Distance per count is the wheel circumference divided by the counts per wheel revolution. Enter the encoder, gearbox and wheel to get the numbers your odometry code needs.
Measure the real counts by turning the wheel by hand ten times. Gear backlash and tyre squash change the result.
How it is calculated
Counts per wheel revolution = encoder pulses per motor revolution × decoding factor × gear ratio. Distance per count = π × wheel diameter ÷ counts per wheel revolution. Decoding is 4 when your code counts both edges on both channels of a quadrature encoder.
A worked example
A motor encoder with 11 pulses per revolution, read at 4× decoding through a 30:1 gearbox gives 11 × 4 × 30 = 1,320 counts per wheel revolution. A 65 mm wheel travels π × 65 = 204.2 mm per turn, so each count is 204.2 ÷ 1,320 = 0.1547 mm, or about 6,464 counts per metre.
Common mistakes
- Counting only one channel and forgetting the decoding factor.
- Putting the encoder after the gearbox and still multiplying by the gear ratio.
- Using the wheel diameter without allowing for the tyre squashing under load.
Related
wheel speed calculator, gear train calculator, ROS 2 for beginners.
Last reviewed: November 2026. The calculator runs in your browser and sends nothing anywhere. Results are ideal-case figures; add margin before you order parts.
Another worked example
An encoder gives 16 pulses per motor revolution on each channel, read at 2× decoding, through a 50:1 gearbox, on an 80 mm wheel.
- Counts per wheel revolution = 16 × 2 × 50 = 1,600.
- Wheel circumference = π × 80 = 251.33 mm.
- Distance per count = 251.33 ÷ 1,600 = 0.1571 mm.
- Counts per metre = 1,600 ÷ 0.25133 = 6,366.
- If the code reads 3,200 counts, the wheel moved 3,200 × 0.1571 = 502.7 mm.
From counts to heading
For a two-wheel robot with track width b, the change in heading is (right distance − left distance) ÷ b radians. If the right wheel travels 100 counts more than the left, that is 100 × 0.1571 = 15.71 mm. With a 200 mm track, the turn is 15.71 ÷ 200 = 0.0785 rad, or about 4.5 degrees. Forward distance is the average of the two wheel distances.
Assumptions and limits
- Pulses per revolution is quoted differently by different sellers: per channel, or already as counts. Check the datasheet or rotate the shaft one turn and count in code.
- Odometry drifts. Wheel slip, uneven floors and a wrong wheel diameter add error that grows with distance, so correct it with other sensors when you can.
- If the encoder is on the wheel shaft rather than the motor shaft, leave out the gear ratio.
Common mistakes
- Reading with interrupts on one channel and assuming 4× decoding.
- Using a counter variable that is too small and overflows on a long run.