CNC Services Northwest

Centroid CNC control sales, service, training and support


Quadrature Encoder Counts

Newcomers to CNC and automation often wonder why the number of counts that the control sees per revolution of the encoder is four times the resolution ("PPR" or "CPR" or "lines") specified on the encoder.

The reason is clear when you understand how an encoder works.

There is a rotating disc in the encoder, with some number of lines cut, etched, or printed on it. The passage of the lines alternately allows light to pass through and blocks light from passing through.

A light source on one side of the disc shines through to two receivers on the other side of the disc. Call the receivers "A" and "B".

For every line which passes by, each receiver may see dark, then light, then dark again. This is translated to a low or high signal level (voltage level) which can be transmitted to a computer to count the number of lines that have gone by.

The A and B receivers are offset, so that one goes dark (or light) before the other. This allows the computer to tell in which direction the encoder is rotating. It also gives the computer more fine-grained information to work with.

The encoders used on Centroid controls all transmit their signals with differential line drivers, so there are two wires for the A channel, and two wires for the B channel. When A is active (light is shining through), then the A signal is high, and the /A signal is low. When A is inactive (light is blocked), then the A signal is low, and the /A signal is high; and likewise for B and /B.

We speak of the differential wires on a channel as "A" and "A-not", or "B" and "B-not", because the second wire of the pair is always a logical "not" of the first wire: when one is high, the other is low.

Consider the passage of one line past a receiver, with equal amounts of light time and dark time, as one full cycle. Then the offset between the A receiver and the B receiver is 1/4 of a cycle: for example, when A is exactly half way through the "light" half of its cycle, B will change from light to dark, or from dark to light (depending on the direction of rotation).

The computer counts rotation every time it sees an edge: a change from light to dark or dark to light on either channel. By looking at the state of the other channel at that instant, it can tell the direction of rotation.

Note in the above diagram that there are four edges (two rising edges and two falling edges) in a single full cycle -- in the passage of one line on the wheel. Every edge is a countable event, showing that the encoder has rotated one fourth of a cycle. That is why the encoder counts per revolution is four times its number of lines.


CNC Services Northwest Home

Copyright © 2020 Marc Leonard
Last updated 25-May-2020 MBL