Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Counting Pulses on Magnetic Encoder to measure Distance


I am building a project where I plan on using:

The wheel will be used to reel a tape measure in and out of it’s housing. The goal is to use the encoder to know how far (within ~1cm) the measuring tape has been reeled out.

As I read about the encoder, it looks like it spins at the RPM of the motor not the output RPM after the gearbox. That leads me to believe this encoder spins at 30k RPM, which seems way too fast to reliably count individual pulses in order to achieve the above goal. Would I be able to measure distance (not just speed) using the setup described?

If not, are there alternative encoders that spin at the lower output frequency? It looks like all Pololu wheel encoders have been discontinued?


Not at all. 30,000 RPM is only 500 rotations per second, or 6,000 encoder pulses per second. An interrupt routine can easily count at this rate.

Even in that case, are you required to run the motor at its maximum RPM?


Thanks @Jim_Remington - This is good to hear. All the example code I’ve seen related to the magnetic encoder seems focused on reading speed rather than counting every pulse in order to read distance.

RE: running the motor at max RPM - I chose the 50:1 gear ratio because that results in 625RPM or 10.4 per second x 100mm wheel diameter = ~1m/second speed. I’d like to keep this speed so I think the only way to run motor slower is to get another gear ratio.



The jrk can control speed with a single channel of encoder output. Also, it will work at input frequencies up to 2 MHz, so it can handle the 30k RPM encoder speed. However, it does not have an input for the second channel of a quadrature encoder and cannot perform position control using quadrature encoders. You might consider our RoboClaw motor controllers, instead.

By the way, 12 CPR is for both channels of the encoder and the “counts” include both rising and falling transitions. If you use a single channel of the encoder as a tachometer feedback for the jrk, it will only register 3 pulses per rotation.



Thanks @nathanb - I am new to quadrature encoders, sorry if this is a dumb question: What prevents me from using the JRK + Magnetic Encoder to actually count the 3 pulses per-rotation and use it to perform position control?


The jrk cannot do position control with quadrature encoders because the jrk only has a single input for its feedback and you need both outputs from a quadrature encoder to determine the direction of rotation (and knowing the direction of rotation is essential to knowing the position). You can learn more about how both outputs encode direction in the “Incremental Rotary Encoder” section of the Wikipedia “Rotary Encoder” page.