Encoder resolution for Pololu motors

I’m eyeing the 172:1 gearmotor with 48 CPR encoder (#2288, pololu.com/product/2288). One thing I’m interested in in comparing this and motors from other sources (mainly robotshop) is the way the encoder resolution is cited. They give pulses-per-rotation at the motor shaft, and the gearbox output shaft, which differ by the gear ratio. That’s fine and makes sense. I’m wondering, however, if what’s cited is the number of windows in the encoder disk (or, equivalently, poles in the magnet for hall-effect encoders), or the maximum achievable resolution, which is four times this (counting both rising and falling edges of both encoder channels).

Separately, what’s a good duration for an encoder interrupt service routine? 100us? 400us? At the speeds these motors turn, and the stated resolutions, it makes a difference whether theyr’e citing the x4 maximum resolution, or x1 minimum one. I don’t want to get stuck with two $40 motors whose encoder output is faster than my mega can handle, nor do I want such low resolution that I don’t have the option of implementing smooth PID speed control.

[quote] what’s a good duration for an encoder interrupt service routine? 100us? 400us?[/quote]As short as possible. 3-5 lines of C (a couple of microseconds) is all that is needed to handle a quadrature encoder.


The counts per revolution (CPR) listed on our gearmotor product pages refers to the maximum number of counts (rising and falling) you can get from the encoder per revolution of the motor shaft (before the gearbox). For example, using the 172:1 25D gearmotor with 48 CPR encoder that you linked to, you can get up to 8245.92 counts per revolution of the gearbox’s output shaft (as stated on the product page).

Like Jim mentioned, you should try to keep your interrupts as short as possible. It sounds like you are using an Arduino Mega; if that is the case, it should be able to handle the quadrature encoders. If you have not seen it already, you might take a look at the Reading Rotary Encoders page on Arduino’s website. It has several helpful examples and some libraries.


Thanks, Brandom & Jim. That’s just the information I needed to proceed.