Incremental Encoder: Quadrature, PPR, x4 Decoding and Wiring

By editor 5 min read
Quadrature A and B square waves with index pulse Z

An incremental encoder is a rotary or linear sensor that outputs two square waves, A and B, 90° apart (quadrature). The pulses show movement, the phase order shows direction, and an optional Z index pulse marks a reference position once per revolution. It does not know absolute position: a counter tracks the pulses after homing. Frequency = PPR × rpm / 60, and x4 decoding gives four counts per pulse. A 1,024 PPR encoder at 1,800 rpm outputs 30.72 kHz and 4,096 counts per revolution.

A, B (+Z)
outputs
90°
quadrature phase
PPR × rpm / 60
channel frequency
x4
counts per cycle

How an Incremental Encoder Works

Incremental encoder quadrature waveformsSquare waves A and B offset by 90 degrees, with an index pulse Z once per revolution. Dashed lines mark every edge of A and B; one full A cycle contains four edges, so x4 decoding counts four times per pulse.Quadrature A/B outputs with index Z: four countable edges per cycleABZ1234← one A cycle = 4 counts (x4 decoding)A leads B by 90° in one direction, lags by 90° in the other; Z marks one reference position per revolutionIndustrialBasicsindustrialbasics.com
Figure 1: Quadrature encoding, direction from the A-B phase and x4 edge counting as described in Wikipedia (Incremental encoder).

Wikipedia describes the quadrature technique. At constant speed, A and B are square waves 90° apart, and the sign of the phase difference gives the direction. Pulse frequency is proportional to speed, and the signals stop changing when the shaft stops. The pattern comes from either an offset pattern read by aligned sensors, or a simple pattern read by offset sensors. Optical, magnetic and mechanical sensing are all used.

Because the encoder only reports changes, an incremental encoder interface, such as a PLC high-speed counter or drive input, counts up or down on each edge using the A-B phase. To know true position, the axis is homed: driven to a home switch (often with the Z pulse) and the counter preset to the known position. For servo feedback loops, see closed loop servo systems.

Encoder Calculator

Encoder Frequency and Resolution Calculator
IndustrialBasics calculator. Channel frequency f = PPR × rpm / 60; counts per revolution = PPR × decoding factor; one cycle has four edges, so x4 resolution is a quarter of a cycle (Wikipedia). Check your counter card’s rating: some specify the A/B input frequency, others the count rate after decoding.

Resolution: PPR, CPR and Counts

Resolution is specified as pulses (or cycles) per revolution, PPR or CPR, for rotary encoders, and pulses per unit length for linear ones. The measurement resolution is finer. Each cycle has four edges (rising A, rising B, falling A, falling B), so with x4 decoding the smallest detectable step is a quarter of a cycle. Wikipedia’s example is a 1,000 pulses/mm linear scale, which has a 1 μm cycle but 250 nm measurement resolution.

DecodingCounts per cycle1,024 PPR gives2,500 PPR gives
x111,024 counts/rev (0.352°)2,500 (0.144°)
x222,048 (0.176°)5,000 (0.072°)
x444,096 (0.088°)10,000 (0.036°)
Counts per revolution and angle per count, calculated by IndustrialBasics from the quadrature edge count described by Wikipedia.

Real encoders have symmetry and phase errors. Pulses are not exactly 180° wide and A-B is not exactly 90°. Specifications such as 180° ±25° symmetry and 90° ±20° phase guarantee minimum edge spacing, which sets the maximum speed a counter can follow reliably.

Output Driver Types

DriverHow it worksBest for
Open collector (NPN / open drain)Sinks current; needs a pull-up resistor (internal or external)Wide voltage range, opto-isolators; lower frequency
Push-pull (TTL / HTL)Actively drives high and lowShort cable to logic on a common supply
Differential RS-422 (A, /A, B, /B)Complementary pair per channel; line receiver at the inputLong cable, high frequency, noisy plants; detects broken wires
Mechanical (contact)Sliding contacts to ground; needs pull-up and debounceHand knobs, low speed, low duty
Driver types from Wikipedia (Incremental encoder).
Wiring tip: Match the encoder output to the input card: an open-collector NPN encoder needs a sourcing (pull-up) input, and 24 V HTL signals must not feed a 5 V TTL-only input. RS-422 differential is the safe default for runs of more than a few meters.

Common Industrial Uses

  • Motor speed and position feedback for servo and VFD drives (see Hz and RPM)
  • Conveyor and web length measurement with a measuring wheel (see RPM to FPM)
  • Cut-to-length, registration and flying-shear control
  • CNC machine axes, robotics and coordinate measuring machines
  • Antenna, reel and turntable angle monitoring

For other sensors on the plant floor, see types of industrial sensors.

Frequently Asked Questions

What is an incremental encoder?

A rotary or linear sensor with two outputs, A and B, that pulse as it moves. Together they show that movement happened and in which direction; many add an index (Z) pulse at a reference position (Wikipedia).

What is the difference between incremental and absolute encoders?

An incremental encoder reports only changes in position, so the controller must count pulses and home the axis after power-up. An absolute encoder reports a unique position value directly.

What is quadrature?

A and B are square waves 90° apart. Which one leads tells the direction: +90° for one direction and −90° for the other, depending on the device.

What does PPR mean?

Pulses per revolution: the number of A (or B) cycles per turn, also called CPR (cycles per revolution). Linear encoders use pulses per unit length.

What is x4 decoding?

Counting every rising and falling edge of both A and B: four counts per cycle, so a 1,024 PPR encoder gives 4,096 counts per revolution. x2 counts A edges and x1 counts A rising edges only.

How do I calculate encoder frequency?

f = PPR × rpm / 60. A 1,024 PPR encoder at 1,800 rpm outputs 30,720 Hz (30.72 kHz) on each channel.

What is the Z or index pulse?

A once-per-revolution pulse at a fixed position, used with a home switch to establish an absolute reference when homing.

Which output type should I choose?

Differential RS-422 (A, /A, B, /B) for long cables, high frequency or noisy plants, such as CNC, robotics and factory automation. Push-pull (TTL) suits short runs. Open collector needs a pull-up resistor and is frequency-limited.

Why is my encoder count drifting?

Usually electrical noise, ground loops, a frequency above the input rating, or a mechanical slip of the coupling. Differential outputs, shielded cable and correct grounding cure most noise problems.

How do I convert encoder counts to distance?

position = counts × (distance per count). For a roller, distance per count = π × diameter ÷ counts per revolution.

Sources and Further Reading

About the author

editor

Leave a Comment