Encoder

On this page 8

An encoder is a position sensor that converts mechanical motion into a digital signal, reporting how far a shaft has rotated or a carriage has traveled. In robotics, encoders are the most common proprioceptive sensors: they tell a robot where its own joints, wheels and actuators are, which makes them the foundation of closed-loop motion control, odometry and safe manipulation.

Unlike exteroceptive sensors such as LiDAR or a depth camera, which observe the environment, an encoder measures only the machine itself. Its output feeds the position and velocity loops of servo drives, the kinematic models of robot arms and the dead-reckoning estimates of mobile platforms, often hundreds or thousands of times per second.

How an encoder turns motion into counts

Every encoder combines a patterned scale with a read head that detects how the pattern moves past it. On a rotary encoder the scale is a disk or ring attached to the shaft; on a linear encoder it is a strip mounted along the axis of travel. The read head converts each pattern transition into an electrical edge, and the electronics turn those edges into counts per revolution or counts per millimeter.

Most incremental encoders output two square-wave channels, A and B, offset by 90 electrical degrees. This quadrature signal lets the receiver determine direction from which channel leads, and counting both edges of both channels yields four counts per line, so a 1,000-line disk delivers 4,000 counts per revolution. An optional index pulse (Z channel) appears once per turn and serves as a reference mark during homing.

The sensing principle determines accuracy, robustness and cost. The following table compares the main technologies used in robots.

TechnologyWorking principleTypical strengthsTypical weaknesses
OpticalLED light through or off a slotted or etched disk onto photodetectorsVery high resolution and accuracySensitive to dust, oil and condensation
MagneticHall or magnetoresistive sensors read a magnetized ring or a diametric magnetRobust, compact, tolerant of contaminationLower accuracy, affected by stray fields
CapacitiveElectrode patterns change capacitance as the rotor turnsLow power, good resolution, small sizeNeeds careful shielding from electrical noise
InductiveCoils on a circuit board detect a conductive targetVery robust to dirt, shock and temperatureLarger sensor area, moderate resolution
Encoder sensing technologies in robotics

Incremental and absolute encoders

The most important design choice is whether the encoder reports relative movement or absolute position. An incremental encoder only counts changes, so the controller must establish a reference after power-up by homing against a limit switch or the index pulse. An absolute encoder assigns a unique code to every position, usually in Gray code or a serial data word, so the robot knows its pose the moment it is switched on.

Absolute encoders come as single-turn devices, which resolve one revolution, and multi-turn devices, which also count complete revolutions using gear stages, a battery-backed counter or an energy-harvesting Wiegand wire. Multi-turn capability matters on the motor side of a geared joint, where the motor turns many times for one output revolution.

TypePosition after power-upTypical interfaceTypical use in robots
IncrementalUnknown until homingA/B/Z quadrature, TTL or RS-422Wheel odometry, low-cost axes, conveyors
Absolute single-turnKnown within one revolutionSSI, BiSS-C, SPIOutput-side joint sensing, steering angles
Absolute multi-turnKnown across many revolutionsBiSS-C, EnDat, proprietary serialMotor-side sensing in industrial and collaborative arms
Sin/cos analogUnknown without extra track1 Vpp sine and cosine signalsHigh-resolution interpolation in precision stages
Comparison of encoder output types

Serial protocols such as BiSS-C, EnDat and SSI carry position words together with error flags and, in newer variants, diagnostic and safety data. Many collaborative robots use a dual-encoder joint, with one encoder on the motor and one on the gearbox output, to detect gear deflection and to satisfy functional safety requirements.

Key encoder parameters

Specifying an encoder means separating several properties that datasheets often blur. Resolution is not accuracy: a sensor can report 2^20 steps per turn while its true angular error remains far larger because of disk eccentricity, mounting runout or magnetic nonlinearity.

ParameterTypical rangeWhat it affects
Resolution100 to 10,000 lines incremental; 12 to 26 bits absoluteSmallest detectable change in position
AccuracyAbout ±1 arcminute to ±1 degreeAgreement between reported and true position
RepeatabilityUsually much better than accuracyAbility to return to the same reading
Maximum speedThousands to tens of thousands of rpmHighest usable shaft speed before signal loss
Update rate and latencyMicroseconds for serial absolute devicesStability and bandwidth of the control loop
Operating temperatureCommonly -20 to +85 °CDrift, sealing and component life
Parameters that define encoder performance

Velocity is usually derived from encoder data rather than measured directly. At low speeds the finite-difference method becomes noisy because few counts arrive per sample, so drives switch to period measurement between edges or apply an observer or tracking filter. This is one reason why higher resolution improves low-speed smoothness even when positioning accuracy requirements are modest.

Encoders among other robot sensors

An encoder answers a narrow question very well: where is this axis right now. It complements rather than replaces other sensors in the Sensors topic. An IMU measures acceleration and angular rate of a body in space, a force sensor measures interaction loads, and a tactile sensor detects contact at the surface. Fusing wheel encoders with an IMU is a standard way to reduce odometry drift on mobile robots.

Encoders also differ from resolvers, the rotary transformers used in harsh automotive and aerospace drives. A resolver is extremely robust to heat and vibration but needs an excitation signal and a resolver-to-digital converter, whereas a modern encoder delivers digital data directly with higher resolution in a smaller package.

Choosing and integrating an encoder

Selection starts from the control task, not from the catalog. The decision table below summarizes common situations in robot design.

SituationRecommended choiceReason
Differential-drive mobile baseIncremental magnetic encoder on each motorLow cost, robust, homing not needed for odometry
Industrial arm jointAbsolute multi-turn encoder on the motorNo homing run after power loss or emergency stop
Collaborative arm jointDual absolute encoders on motor and outputDetects gear deflection and supports safety functions
Precision linear stageOptical linear encoder on the axisMeasures the load directly, bypassing screw errors
Dusty or oily environmentMagnetic or inductive encoderTolerates contamination better than optical disks
Encoder choices for typical robot designs

Integration details decide whether the specified performance appears in practice. Shaft alignment and runout must stay within the tolerance of the read head, cables carrying quadrature signals should use differential RS-422 drivers and shielding, and the controller must sample fast enough to avoid missed counts at peak speed.

Common encoder problems and their causes

Most encoder faults show up as position drift, jitter or sudden jumps rather than as complete failure. Recognizing the pattern speeds up diagnosis.

  • Gradual position drift on an incremental axis usually means lost counts from electrical noise, a too-slow counter or signal edges exceeding the input frequency limit.
  • Jitter at standstill often comes from a reading that sits exactly on a transition or from excessive control gain amplifying quantization noise.
  • Periodic error once per turn points to eccentric mounting or a bent shaft rather than to the encoder electronics.
  • Wheel odometry errors frequently arise from wheel slip, which the encoder cannot detect because it measures the wheel rather than the ground.

Explained without jargon

An encoder is like a very precise tally counter attached to a turning wheel. Each time the wheel moves a tiny step, the counter clicks, so the robot always knows exactly how far each joint or wheel has turned.

Some encoders only count steps from wherever they started, so the robot must find a known starting point first. Others remember the exact position at all times, even after the power goes off. Either way, the encoder lets a robot move accurately instead of guessing where its own parts are.

A typical use case

A warehouse operator runs a fleet of small mobile robots that carry totes between shelves. Each robot has two drive wheels, and each drive motor carries a magnetic incremental encoder with 4,096 counts per motor revolution behind a 20:1 gearbox, which gives more than 80,000 counts per wheel revolution.

The motor controllers close their velocity loops at 1 kHz using the encoder counts, and the navigation software combines wheel odometry with an IMU and LiDAR localization. When the team noticed that robots drifted on freshly cleaned floors, the logs showed encoder counts that no longer matched LiDAR position. The cause was wheel slip, not sensor failure, and the fix was to lower acceleration limits and weight the odometry less in the sensor fusion filter, which restored docking accuracy to within a few millimeters.