As an incremental encoder turns (or travels linearly, in the case of a linear encoder), it generates a precise number of equally spaced, square wave pulses. The number of pulses generated for each rotation (or unit of linear distance) determines the encoder’s resolution. For rotary encoders, resolution is expressed in terms of pulses per revolution (PPR), and for linear encoders, it is referred to as either pulses per inch (PPI) or pulses per millimeter (PPM). (Note that linear encoder resolution can also be specified in terms of microns, which refers to the distance between pulses.)
Tip: For a tutorial on how to determine what resolution is needed for a specific application, check out this article.
By counting the pulses generated, the encoder can determine the amount of travel, but not the direction of travel. In order to determine direction, the encoder needs more information—specifically, a second channel, 90 degrees out of phase with the first channel. By reading which channel is leading and which is following, the encoder can determine the direction of rotation or linear movement. With this encoding method—using two channels, 90 degrees out of phase—higher resolution can also be achieved, depending on how the encoder counts the pulses from the two channels.
This type of encoding is referred to as quadrature encoding, because there are four output states: channel A rising, channel A falling, channel B rising, and channel B falling.
Q: What is CPR (cycles per revolution)?
A: In quadrature encoding, each completion of all four output states (channels A and B, rising or falling) is known as one cycle. CPR is the number of these cycles that the encoder completes in each revolution. The term CPR is often used when discussing the decoding of encoder signals.
Types of quadrature encoding
As its name implies, X1 encoding counts only one edge from one channel. If channel A leads channel B, then the encoder counts the rising edge of channel A. If channel B is leading, the encoder counts the falling edge of channel A. Even though neither edge of channel B is counted, both channels are needed in order to determine the direction of rotation. Typically, if channel A is leading, the movement is considered to be forward, or clockwise. If channel B is leading, the movement is considered to be backward, or counter-clockwise.
Like X1 encoding, X2 encoding only counts one channel, but it counts both the rising and falling edges. This doubles the resolution of the encoder, since twice as many pulses are counted per revolution or unit of distance.
With X4 encoding, channel B is used for more than just determining direction of rotation or travel. In this encoding method, both the rising and falling edges of both channels—A and B—are counted. Now there are four times the pulses per revolution or unit of distance, and resolution is quadrupled.
In addition to channels A and B, it’s also common for an incremental encoder to have a third channel, often referred to as “Z.” This channel produces a single pulse at a precise location, and is used as a reference position for homing.