← All calculatorsCalculator

Encoder Resolution & Speed Calculator

Work out what an incremental quadrature encoder can resolve: counts per turn and angle per count, how finely a control loop can measure speed by counting edges or by timing them, and the speed at which the encoder or the counter runs out.

Encoder

Controller

The encoder sits on the motor; the gear ratio scales everything to the output shaft. The capture clock is the timer that measures the time between edges for the period method.

Quantity / checkValueNote

Speed-measurement resolution vs speed

Quantisation only, as a fraction of the speed

Counting edges in a fixed window (M method) is coarse at low speed, where few edges arrive per sample. Timing the interval between edges (T method) is fine at low speed and coarse at high speed, where an interval is only a few timer ticks. Most drives switch between them, or combine both (M/T method), around the crossover.

counts per output turn N = PPR · kquad · G  ·  angle per count = 360° / N
M method: Δn = 60 / (N · Ts) rpm (one count per sample)
T method (×1 edges): Δn / n = n · PPR · G / (60 · fclk)  ·  one new reading per line period
speed limits: nmax = min(60 fcnt / N, 60 fenc / (PPR · G))

Notes

×4 decoding quadruples resolution, not accuracy. The four edges in a line period are only evenly spaced if the A and B duty cycles are exactly 50% and the phase is exactly 90°. Typical encoders specify ±20–45° electrical phase error, so ×4 counts are uneven by a fraction of a count. That does not matter for position, but it adds noise to a period measurement, which is why the T method here times a single edge per line.

Speed from counts is a difference of positions. At low speed the M method alternates between 0 and 1 count per sample, and the speed loop sees a pulse train instead of a speed. Filtering helps but adds lag. Lengthening the window, using the T method, or an observer that estimates speed from position and torque command all work around it.

Check the counter width. A 16-bit counter wraps at 65 536 counts. The software must read it at least once per half-range of motion (32 768 counts), or it cannot tell the direction of the wrap.

References

  • R. Petrella, M. Tursini, L. Peretti, M. Zigliotto — Speed measurement algorithms for low-resolution incremental encoder equipped drives: a comparative analysis (IEEE ACEMP, 2007)
  • T. Ohmae et al. — A microprocessor-controlled high-accuracy wide-range speed regulator for motor drives (IEEE Trans. IE, 1982): the M/T method
  • STMicroelectronics RM0440 (STM32G4 reference manual) — timer encoder interface mode