Skip to content

SensingSensors

Wheel Encoders

Counts divided by counts per turn give turns; turns times the circumference give distance.

Not started Jump to practice

How far has the robot driven? Its wheels can tell it, if they can count their own turns.

Key idea

A wheel encoder sends a pulse each time the shaft turns a small step. With $C$ counts per turn, $\text{turns} = \text{counts}/C$ and $\text{distance} = \text{turns} \times \pi d$. If the encoder is on the motor before a gearbox, multiply $C$ by the gear ratio.
Turn the wheel and watch the count and the distance.

Why it works

Each count is a tiny, known slice of a turn. Counting slices gives turns; each turn rolls one circumference. Two encoders, one per wheel, also tell the robot how much it has turned, which is the start of odometry.

Worked example: Distance

A 7 cm wheel, 360 counts per turn, 900 counts.
  1. $900/360 = 2.5$ turns.
  2. $2.5 \times \pi \times 7 \approx 55\ \text{cm}$.

Answer: About 55 cm.

Common mistake

Using the radius instead of the circumference, or forgetting the gear ratio between the motor and the wheel.

Hands-on: a bot that knows how far it went

A first mobile robot, three price points (approximate U.S. prices, 2026)
  • \$0: a free browser simulator for microcontroller code, and our Robotics Ladder pictures.
  • About \$35 to \$60: a two-wheel robot chassis kit with gear motors and encoder discs, a dual motor driver, a 4-AA battery holder, and your starter-kit microcontroller.
  • About \$80 to \$150: a chassis with metal gear motors and magnetic encoders, an IMU board and a distance sensor.

Program the robot to drive 1 meter by counting encoder pulses. Mark the start on the floor, run it ten times, and measure where it stops each time. Write the numbers down: they are your first test log.

Safety. Test on the floor, not a table. Pick the robot up by its body, not its wheels, and switch it off before you handle the motors.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • Roland Siegwart, Illah R. Nourbakhsh and Davide Scaramuzza, Introduction to Autonomous Mobile Robots, 2nd ed. (MIT Press, 2011)
  • Arduino Documentation