Quadrature Encoder Calculator

Counts per revolution, resolution, count frequency and RPM — for x1/x2/x4 decoding.

Counts, decoding and resolution

A quadrature encoder has two channels, A and B, 90° out of phase. The phase tells you direction; the edges give you position. How many counts you get per revolution depends on which edges you decode:

where x1 counts one edge of one channel, x2 both edges of one channel, and x4 every edge of both — most MCU timer encoder modes do x4 for free, quadrupling resolution. The angular resolution per count and the count frequency at a given speed follow:

Two things to size in firmware: the count frequency must stay below the timer's max input rate (and below where switch bounce or noise corrupts edges), and the counts per sample period set your speed-measurement resolution — too few counts per tick and your velocity estimate gets coarse, which is why high-speed loops sometimes measure time between edges instead.