Encoder PPR/CPR and quadrature-count calculator

Pulses on one channel per shaft turn. Some data sheets call this lines or cycles per revolution (CPR).

A signed count, for example -600. The slider covers one turn.

Shaft speed at the encoder, not after a gearbox.

Enter the PPR from the encoder data sheet, choose the decoding mode your counter uses, then choose what to calculate.

No valid result to draw.

Show the steps

Interactive calculation is unavailable until JavaScript loads. The formulas, worked examples and references below remain available.

Convert encoder pulses per revolution into quadrature counts per revolution, counts into shaft revolutions and angle, and shaft speed into count rate.

How to use

Enter the pulses per revolution on one channel (PPR) from the encoder data sheet.

Choose the decoding mode: x1 counts rising edges of A, x2 both edges of A, x4 every edge of A and B.

Choose what to calculate: counts to revolutions, revolutions to counts, or shaft speed to count rate.

Enter the count, revolutions or speed, or drag the slider. Results update as you type.

Use Copy result for labeled values. Reset restores the starting example.

Science

An incremental quadrature encoder has two outputs, A and B, each a square wave with PPR cycles per shaft turn. B is shifted 90 electrical degrees from A, so the pair passes through four states per cycle and the order of the states gives the direction.

A decoder can count one edge per cycle (x1), both edges of A (x2) or every edge of both channels (x4). Counts per revolution is the PPR times 1, 2 or 4. x4 gives four times as many counts from the same encoder.

Data sheets are not consistent: "CPR" means cycles per revolution in some and counts per revolution in others. Check whether a stated figure already includes x4 decoding before multiplying. Which direction counts up depends on the wiring and the decoder setup, so the tool takes the sign of a count as given.

Limitations: the speed results assume an ideal 90 degree phase and 50% duty. Real encoders have phase and duty errors that make some edge spacings shorter than the ideal time between counts; check the counter's minimum pulse width with margin. The tool does not model gearboxes, index pulses, absolute encoders, position resolution or accuracy.

Formulas

Counts per revolution: CPR = k × PPR. k is 1, 2 or 4 for x1, x2 or x4 decoding.

Revolutions: r = n / CPR. n is the signed count.

Shaft angle: θ = 360 × n / CPR degrees.

Counts: n = r × CPR. A fractional result lies between two counts.

Count rate: f_c = CPR × N / 60 counts per second. N is shaft speed in rpm.

Channel frequency: f_A = PPR × N / 60 Hz. Time between counts = 1 / f_c.

Examples

500 PPR, x4 decoding, count 1000: 2000 counts per revolution; 0.5 revolutions, 180 degrees. 4 × 500 = 2000, and 1000 / 2000 = 0.5 of a turn.

1024 PPR, x4, count 10240: 2.5 revolutions, 900 degrees. 10240 / 4096 = 2.5 and 360 × 2.5 = 900.

600 PPR, x4, count -600: -0.25 revolutions, 270 degrees within one turn. -600 / 2400 = -0.25; -90 degrees is 270 degrees within one turn.

2048 PPR, x4, 3000 rpm: 409600 counts/s, 2.44140625 μs between counts. 8192 × 3000 / 60 = 409600; channel A runs at 102.4 kHz.

100 PPR, x4, 0.333 revolutions: 133.2 counts (nearest whole count 133). Common mistake: a non-whole count means the shaft is between counts.

References

Texas Instruments: eQEP module reference guide (SPRUG05)

Broadcom: HEDS-55xx/56xx encoder data sheet