In the simplest terms, an incremental rotary encoder provides information
about the instantaneous position of a rotating shaft. It does this by
producing one square wave cycle per increment of shaft movement. This
increment is referred to as the resolution of the encoder and is built
directly into the internal hardware of the device. A resolution of 360
means that 360 square wave cycles will be produced in one complete rotation
of the shaft. By counting the number of cycles, one can tell the position
of the shaft, relative to its starting position. In our example,
90 cycles means that the shaft is now at a position 90 degrees from where
Velocity and Acceleration
If we add one more measured value, time, to our position information then
velocity (position/time) can now be determined. If a shaft rotates 90
degrees in 1/4 second then it is rotating at 360 degrees per second (1
revolution per second) or 60 RPM. Similarly, if we were to measure the
changes in velocity over time we could determine an acceleration rate
for the shaft as well. Position, velocity and acceleration are all important
factors to control in a complex motion control system.
Direction of Rotation
With incremental encoders, it is a standard convention to output a second
data channel of position information. For simplicity these two channels
are usually called the A and the B channel. These two channels are arranged
with a preset offset of 1/4 of a cycle, or quadrature. This
means that the A channel will go from LO to HI and then, while it is still
HI, the B channel will go from LO to HI. Shortly after the A channel goes
from HI to LO, then the B channel goes from HI to LO. This relationship
is described as A leads B, that is the A channel makes its transition
first, followed by the B channel. If the encoder was to reverse direction,
then the B channel would make its transitions before the A channel. In
this case, then B would lead A. Using this relationship it is possible
to determine the direction of rotation of an encoder.
A Point of Reference
With dual channels in quadrature it is possible to determine relative
position, velocity and acceleration information of a shaft. However it
is not possible to determine the exact rotary position without some sort
of internal position reference. This is provided with an index mark. This
is an additional data track and is usually referred to as the Z track
(other names include ref or 0). The Z data channel
usually changes state from LO to HI only once per revolution and only
for a short duration (from 1/4 cycle up to about 1 cycle being fairly
common). By observing this index track it is possible to create a zero
point from which to begin counting the A and B channels.
Applying Feedback to Control
Encoder square wave outputs can be easily read by machine controllers.
Controllers, as their name suggests interpret the encoder inputs according
to their operating instructions and then provide a signal output to adjust
the machines that they are controlling.
In a basic example, imagine a conveyor belt that is instructed
(via the controller) to move at 100 feet per minute. This conveyor is
powered by an electric motor with an encoder on its shaft. Output from
the encoder goes into the controller, and as long as the square wave pulses
are coming out of the encoder at the right speed, everything is fine.
If this conveyor is carrying dump truck loads of dirt
up to a hopper, and a truck has just dumped a load of dirt on the bottom
end of the conveyor, the extra heavy load will make the motor slow down.
The controller notices that the pulses coming from the encoder have slowed
down and so it commands the motor to speed up. Similarly, as the dirt
reaches the top of the conveyor and is dumped into the hopper, the conveyor
is suddenly lighter and it starts to speed up. The controller, via the
encoder, knows whats going on and commands the motor to slow back
Another Type of Encoder
Lets take a look at another popular type of encoder, an absolute
encoder. Absolute encoders by their very nature have a more complicated
signal structure. Optical encoders use photo-detectors internally to tell
whether an internal light is ON (unblocked) or OFF (blocked). This ON/OFF
character is inherently binary in nature and so it makes sense to produce
an absolute position output where a rotation is successively divided into
2 parts, then 4, 8, 16 and so on. The trade-off with this approach is
that each subsequent two-fold increase in resolution requires another
data channel, and resolutions are only available in factors of two. Whereas
the incremental encoder with 4096 cycles per revolution required one data
channel and an index to precisely define a position, the absolute encoder
requires 12 data lines (2 to the 12th power equals 4096 discrete positions).
This means bigger, more expensive cabling and connections.
Absolutes have some clear advantages, however, in situations
where the position information is only needed periodically (not continuously)
or in instances where a power outage requires a machine to be able to
reorient itself without having to re-zero any of its settings.
In these instances, as soon as power is applied to the encoder and the
data lines are read, then the position is known.