Atlas Robotics
Practical AMR DesignIntermediate

Choosing encoders: how much resolution is enough for odometry?

Atlasbot · 17/8/2026 · 12 min read

Choosing encoders: how much resolution is enough for odometry?
Encoder resolution affects the smoothness of speed data

The article Encoder explained the principle of quadrature encoder. Continuing lesson Selecting Motor, the question now is: the motor has been selected (RPM is known) — what resolution encoder is needed to make the odometry smooth enough without wasting interrupt processing resources on the MCU?

Key concepts

Choosing encoder resolution is a problem of balancing two opposing dimensions:

  • Too low — speed data calculated from the encoder is "jerky", affecting the quality of the PID loop
  • Too high — the interrupt frequency generated exceeds the MCU's real-time processing ability, causing loss of count pulses

Important starting point: the resolution of interest is effective resolution at wheel, not the nominal parameter of the encoder itself.

How it works

If the encoder is mounted before the gearbox (on the motor shaft, as discussed in the Encoder article), the effective resolution at the wheel is multiplied by the gearbox gear ratio:

effective_resolution = encoder_pulse_per_rev × gearbox_transmission_ratio

For example, the encoder has 12 pulses/revolution (quite low), the gearbox has a ratio of 1:150 — the effective resolution at the wheel is 12 × 150 = 1800 pulses/revolution, smooth enough even though the encoder itself has a low nominal resolution. This is the reason why many cheap gear motors still give good enough odometry even though the integrated encoder seems "weak" on paper.

Each encoder pulse usually triggers an interrupt on the MCU for counting — too high an interrupt frequency can take up all the processing time of the MCU, affecting other real-time tasks (like the PID loop learned in lesson PID in robot control system).

Technical details

Formulas

Maximum interrupt frequency generated when the motor runs at maximum speed:

f_interrupt = (RPM / 60) × effective_resolution × 4

(multiply 4 because the quadrature encoder generates 4 rising/falling edge events per clock cycle —
popular "x4 decoding" technique to increase effective resolution without
encoder disc is finer)

For example, 120 RPM motor, effective resolution 1800 pulses/rev:
f_interrupts = (120/60) × 1800 × 4 = 14,400 interrupts/second

Conversely, too large a time interval between two consecutive pulses at the lowest speed required to operate — will cause a "step" in the measured speed data:

Δt_between_2_pulses = 60 / (lowest_RPM × effective_resolution)

If Δt_between_2_pulses is significantly larger than the PID loop cycle (for example, the PID loop runs at 100Hz = 10ms cycle, but there is only 1 new pulse every 50ms), the instantaneous speed calculation from the encoder will not be updated in time for many consecutive cycles - directly affecting the quality of PID control.

Parameters

Effective resolutionSuitable
< 500 pulses/revJust enough for high-speed robots, no need for precise odometry
500-2000 pulses/revPopular for small-medium sized AMRs, well balanced
> 2000 pulses/revNecessary for applications requiring very precise localization, the MCU is powerful enough to handle it

Practical applications

For most research/DIY AMR projects the size of the showcase projects on this page, around 1000-2000 effective pulses/rev (usually achieved through gear ratios, no need for expensive high-resolution encoders) is a reasonable balance point — smooth enough for odometry and PID, and safely within the interrupt handling capabilities of common MCUs (STM32, ESP32) even when all 2-4 wheels are running at the same frequency interrupt at the same time.

Practical example

Compare 2 encoder options for the same motor 120 RPM (max), 20 RPM (min when running slowly):

Option A: encoder 12 pulses/rev, gear 1:150 → effective resolution 1800 pulses/rev
- f_interrupts (max) = (120/60) × 1800 × 4 = 14,400 interrupts/second → MCU handles well
- Δt_between_2_pulses (min RPM) = 60/(20×1800) ≈ 1.7ms → fast enough compared to 10ms PID cycle

Option B: encoder 512 pulses/rev, gear 1:150 → effective resolution 76,800 pulses/rev
- f_interrupts (max) = (120/60) × 76800 × 4 = 614,400 interrupts/second → EXCEEDS the capacity of most MCUs

Conclusion: Option A is smooth enough (step 1.7ms << PID cycle 10ms) — Option B
"more accurate on paper" but in reality causes interrupt overload, which is counterproductive

Common mistakes

  • Choose as high a resolution encoder as possible without checking the interrupt frequency — like the example of Choice B above, exceeding the MCU's processing capacity causes loss of count pulses, erroneous odometry instead of being more accurate.
  • Only check the interrupt frequency at maximum RPM and ignore smoothness at minimum RPM — slow-moving robots (precise parking, maneuvering near obstacles) need to be checked separately Δt_between_2_pulses at the lowest expected operating speed.
  • Forget to multiply the gear ratio when comparing encoder datasheet parameters — it's easy to mistakenly evaluate a "12 pulse/rev" encoder as too low when the actual effective resolution (after the gearbox) is completely sufficient.
  • Not counting PID loops running on multiple wheels at the same time — with a 4-wheel AMR (Mecanum), the total interrupt frequency from all 4 encoders cumulatively can be much more significant than calculating each wheel individually.

Conclusion

Choosing an encoder is not unconditionally "the more accurate the better" — there needs to be a balance between data smoothness at low speeds and the actual interrupt handling ability of the MCU at high speeds. The effective resolution (after the gearbox) is the number that matters, not the nominal parameter of the encoder alone. The next article Choosing LiDAR applies similar thinking — balancing data granularity and practical processing capabilities — to another sensor.

Get new articles and lessons by email

When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.

Unsubscribe any time with the link in each email. See our Privacy policy.

Choosing encoders: how much resolution is enough for odometry? — Atlas Robotics