Encoder Question

My team wants to use an encoder to keep track of their shooter. We are using command based java this year. If we are using a gear tooth counter on a digital input, how would we calculate the DistancePerPulse? We are using a 40 tooth gear. There is no gear reduction. All help appreciated.

Sorry, but I’m not at all sure what you’re trying to ask here. In the first place, why are you using a gear if there’s no gear reduction? (I can think of one reason, but it’s not likely as the question is phrased.) Or do you mean that you are measuring teeth on the bull gear (that is, the output gear of the shooter)?

You are trying to calculate “distance per pulse”. There are no lengths in your question, so whatever you’re asking, there is not enough info. What is the effective moment arm/radius of your shooter?


OK, trying to put together something reasonable: You are counting teeth on the last (output end) gear in your shooter, which is rotating at the same speed as a wheel X inches in diameter. The circumference of that wheel is πX inches. The distance that the edge of the wheel moves per pulse (assuming one pulse per tooth) is πX/40. If there are p pulses per tooth, that becomes πX/40p.

If my assumptions aren’t right, please post the corrections so we can help out.

Sorry for being vague. Yes we are planning on using a 40 tooth bull gear on the output shaft of the shooter. The wheels of the shooter are 4 inch diameter. We need to calculate the rpm. We haven’t used encoders before. We are also wondering what would change if we used a 20 tooth gear vs a 40 tooth gear.

Well, the simplest way to check your distance per pulse is finding out how many pulses you get in one rotation (using the encoder to print how many pulses you’ve passed through in the SmartDashboard or something like that). Then use 1 / theNumberYouGot as the distance per pulse.

What type of Motor Controller are you using? If you’re wiring your encoder into the Talon SRX, you can call YOUR_TALON_OBJECT.getSpeed() to get the RPM of the sensor.

Ok that makes sense but how we figure that into rpm? We would have pulses per rotation.

We are using a talon srx but we are not using an encoder. We are using a gear tooth sensor.

Figure out how many pulses per minute (ppm), and divide by the number of pulses per rotation (ppr) to get rotations per minute (rpm). For example, if you get 160 ppr, and count 40 pulses in 10 ms, then you would have 60 (sec/min) * 100 (10 ms/sec) *40 (pulses/10 ms) =240,000 ppm and 240,000 ppm / 160 ppr = 1500 rpm.

If it’s counting gears as they rotate, it’s an encoder. Encoders can be magnetic, optical, proximity, mechanical, or any other consistent means of detecting a fractional rotation or motion.

Thanks for the info. Would we have to use the talon SRx in cAN mode or in pwm mode if we hook it up that way. Also would we still have to set the distance per pulse.

If you connect the encoder to the Talon SRX inputs, you will need to use CAN. If you connect the encoder to roboRIO inputs, you can use either PWM or CAN.

I have not done any coding using the SRX internals, sorry.

Gear tooth sensors are supported.

See Section 17.1.4. EncRise (a.k.a. Rising Counter) in the Talon SRX Software Reference Manual for reference to gear-tooth sensor.

See Talon SRX User’s Manual for wiring.