Rotary encoders are devices that generate electrical pulses as they rotate. The angle or rate of rotation that the encoder is experiencing is measured by monitoring the number or frequency of the pulses. In robotics, encoders are most commonly attached to the robot's drive motors and used to measure the robot's linear speed, angular speed, and distance traveled. Drive motor encoders can be used to perform closed loop speed control on the wheels. More generally, encoders can be attached to any of the robot's joints to track its speed and/or angle, such as a rotating joint in a robotic arm. This page is an introduction to encoders and how they work. For more information about actually implementing encoders, consult our How to Add Encoders to a Robot page.
Measurement: Motor rotation distance. When attached to the drive motors, used to measure wheel speed and distance.
Ideal operating conditions: Robot operating on smooth/even ground where wheels maintain constant rolling contact with no slip.
- Quite accurate over short time periods/distances
- Works indoors and outdoors, day or night
- Good for mitigating discrete jumps in position and orientation estimates when fused with other sensors
- Great fallback sensor when things go wrong
- Can be used for closed loop speed control of the wheels
- Requires initial calibration between encoder counts and amount of robot movement
- Assumes no slip between robot wheel and ground. An unstable or inconsistent surface beneath the robot can lead to wheel slippage. Skid-steer robots also experience wheel slippage while turning. This causes error in the estimated robot speed and position because the wheel moves but the robot doesn’t.
- Position errors from wheel slippage and imperfect calibration accumulate over time/distance to give a progressively worse position estimate. When used to measure speed instead of position this is less of an issue.
- Additional hardware is often needed to keep track of the encoder counts. However, some motor controllers (such as Roboteq models) have this functionality built-in.
How Encoders Work
An encoder is a device attached to an actuator or motor that enables you to measure precise movements. The advantages of this are precision movements and speed control. There are two main types of encoders, hall-effect and optical. A hall-effect encoder typically uses an iron mass or magnet, the sensor then 'watches' for changes in the magnetic field. An optical encoder uses layered disks. The disks have symmetrical areas of transparent and opaque material that allows a light source, such as an LED to pass through and strike a photo detector.
Both types of encoders are fundamentally solid. Deciding between the two depends on your budget and your desired CPR (Counts Per Revolution). Hall-effect encoders tend to be less expensive but have a significantly lower CPR. This is not necessarily a bad thing. If you just want to know how far your robot has traveled you do not need the 1,000-2,000 counts for an optical encoder a 98 CPR for a hall-effect encoder provides more than enough resolution for you needs. A standard six inch tire has a circumference of approximately 18.8 inches. At a 98 CPR you have a resolution of 0.19 inches (a little over an eight of an inch). Typically an encoder is put on the motor, which is then geared down. So if you have a 1:10 reduction, your encoder now will read 0.019 inches per count.
Encoders typically output what is known as a quadrature signal. A quadrature signal is comprised of two channels (Channel A and Channel B). Channel B is 90 degrees out of phase from channel A. This allows the circuitry watching the output signal to know what direction you are traveling. If B trails A then your motor is moving clockwise, if A trails B then your motor is moving counter clockwise.
Adding Encoders to a Robot
We have written a detailed guide on this topic here.
Quick Links to our Encoders and Accessories
Encoder Buffer and Pull-up Boards
- Dual LS7366R Quadrature Encoder Buffer Breakout Board (TE-183-002)
- IG32, IG42, and IG52 Gear Motor Encoder Pull-up Board (TE-179-000)
Motor Controllers with direct encoder feedback
- RoboClaw 2x15A (TE-331-215)
- RoboClaw 2x30A (TE-331-230)
- RoboClaw Solo 30A Motor Controller (TE-331-130)
- RoboteQ SDC2160 - 2x20A 60V Motor Controller with Encoder Input (TE-144-060)
- RoboteQ MDC2460 - 2x60A 60V Motor Controller with Encoder Input (TE-240-060)
- RoboteQ XDC2460 - 2x150A 60V Motor Controller with Encoder Input (TE-286-150)
Motors with Encoders
- IG42 24VDC 013 RPM Gear Motor with Encoder (TD-044-013)
- IG52-04 24VDC 082 RPM Gear Motor with Encoder (TD-045-082)
- IG32P 24VDC 075 RPM Gear Motor with Encoder (TD-055-075)
- IG32 24VDC 074 RPM Gear Motor with Encoder (TD-054-074)
- IG42 24VDC 078 RPM Gear Motor with Encoder (TD-044-078)
- IG32P 24VDC 265 RPM Gear Motor with Encoder (TD-055-265)
- IG32P 24VDC 190 RPM Gear Motor with Encoder (TD-055-190)
- IG32 24VDC 191 RPM Gear Motor with Encoder (TD-054-191)
- IG52-04 24VDC 010 RPM Gear Motor with Encoder (TD-045-010)
- IG52-04 24VDC 136 RPM Gear Motor with Encoder (TD-045-136)
- IG42 24VDC 122 RPM Gear Motor with Encoder (TD-044-122)
- IG52-04 24VDC 285 RPM Gear Motor with Encoder (TD-045-285)
- IG42 24VDC 240 RPM Gear Motor with Encoder (TD-044-240)