Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

A quadrature encoder is a sensor system that lets a robot measure how far and how fast a wheel or shaft has turned. It is essential for accurate motion control in drivetrains, robotic arms, conveyor systems, and motor feedback loops. By converting rotation into digital pulses, the controller can track position instead of guessing from motor voltage or time.

This makes robot movement more repeatable and precise.

Understanding Robotics: Quadrature Encoder

Inside an incremental encoder, a patterned disk or ring moves past optical, magnetic, or mechanical sensors. The pattern creates a sequence of on and off signals as the shaft rotates. The controller does not merely count pulses.

It watches the order of signal changes. A common sequence has four valid states, written as zero zero, zero one, one one, and one zero. In normal motion, each new state differs from the previous state by only one bit.

This arrangement helps the controller identify a real step of motion. It can reject many impossible jumps, such as a change from zero zero directly to one one, which may come from electrical noise or a bad connection.

The encoder produces relative position, not an absolute starting location. If power is removed, a basic incremental encoder forgets where the shaft was. A robot can solve this with homing.

At startup, it moves slowly until it reaches a limit switch, a hard stop, or a separate index mark. That known point becomes zero for the software. This matters in a robot arm, where a joint must know its safe range before moving.

It matters in a wheeled robot too. Wheel counts can show travel from the starting point, but they cannot prove the robot is still at a particular place after wheel slip.

Encoder feedback becomes useful when it is part of a control loop. The program chooses a target position or speed, reads the measured motion, then adjusts motor power based on the difference. If a wheel meets carpet, climbs a ramp, or carries a heavier load, it may slow down.

The encoder reveals that slowdown quickly. The controller can increase power within safe limits. For position control, the motor slows as it nears the target.

This reduces overshoot. A well tuned system still needs limits on power and acceleration. Fast corrections can make a motor shake back and forth, especially when gears have backlash or the mechanism is flexible.

Students should pay close attention to resolution, sampling, and mechanical placement. More counts per turn allow finer measurements, but they create more signal changes for the controller to process. At high speed, a slow microcontroller can miss changes and report too little motion.

Interrupt routines, hardware counters, or dedicated encoder interfaces help prevent this. Mount the encoder firmly on the shaft being measured. Measuring the motor shaft can hide slipping gears, loose belts, or a wheel turning on its axle.

Long wires can pick up noise from motors, so twisted wires, good grounding, and suitable pullup resistors are important. Test by turning the shaft slowly in each direction, checking that one turn gives the expected count and that reversing returns close to the starting count.

Key Facts

  • Quadrature encoders use two digital signals, A and B, shifted by 90 electrical degrees.
  • If A leads B, the shaft is turning one direction; if B leads A, it is turning the opposite direction.
  • Position change in counts is ΔN = Nforward - Nreverse.
  • With 4x decoding, counts per revolution = 4 × lines per revolution.
  • Angular resolution is θ per count = 360 degrees / counts per revolution.
  • Rotational speed can be estimated by rpm = counts per second × 60 / counts per revolution.

Vocabulary

Quadrature encoder
A rotary sensor that uses two phase-shifted pulse signals to measure both rotation amount and direction.
Channel A
One of the two digital output signals from a quadrature encoder, used with Channel B to decode motion.
Channel B
The second digital output signal, shifted about 90 electrical degrees from Channel A.
4x decoding
A counting method that records every rising and falling edge of both A and B to quadruple the basic line count.
Counts per revolution
The number of digital position counts produced during one full turn of the encoder shaft.

Common Mistakes to Avoid

  • Counting only one channel and ignoring the other, because this loses direction information and may reduce usable resolution.
  • Assuming pulses always mean forward motion, because the phase order of A and B must be checked to determine direction.
  • Confusing lines per revolution with counts per revolution, because 4x decoding makes the count value four times the number of disk lines.
  • Reading encoder signals without handling noisy edges, because switch bounce, vibration, or electrical noise can create false counts.

Practice Questions

  1. 1 An encoder disk has 500 lines per revolution. With 4x decoding, how many counts per revolution does the controller measure?
  2. 2 A robot wheel uses a 1024-count-per-revolution quadrature encoder. If the controller reads 256 counts, through what angle has the shaft turned in degrees?
  3. 3 A robot is moving forward when Channel A leads Channel B. Later, Channel B leads Channel A while the wheel is still spinning. What has changed about the wheel motion, and how should the controller interpret the counts?