Encoder tutorial: how they work

05 September 2008

“The biggest machine safety issue is unannounced power outages,” says Jim Marshall, of Sick Stegmann. “On startup, you need to know where axes are without physically moving them. For machine tools and tool changers that’s critical, as it is for automated warehouses.”

Manchester encoding
Manchester encoding

Encoders can report both position and velocity. They generally have three main components:

• A source, such an LED or permanent magnet, which mounts on the static part of the machine and provides a steady excitation.

• The encoder mounts on the machine’s moving part and modulates the steady excitation.

• A detector receives the modulated signal and decodes it to produce an electronic output indicating position and velocity.

Figure caption
A structured graduated disk rotates relative to a scanning point while photovoltaic cells convert light into electric signals. The graduated disk determines absolute position.


The simplest example is an optical rotary encoder. In a contained system with a bearing, you have a glass disk aligned to the bearing center, and a stator portion that holds the electronics and scans the disk as it turns.

A light source, typically an LED, provides a narrow light beam aimed at the detector, which might be a photodiode. Both are rigidly mounted to the stator-side of the rotary joint’s bearing. The encoder is an opaque disk with transparent slots or windows in a circular pattern mounted on the bearing’s rotor.

As the bearing rotates, the encoder alternately allows the beam through (when a window is in position), or blocks it. The photodiode output thereby alternately goes high and low to signal position changes. The photodiode’s output then goes to an electronic circuit that decodes it into position and speed readings.

Originally, stator-side electronics were built of separate components. Sales volumes and improvements in manufacturing techniques have allowed some commercial vendors to integrate most or all of the stator-side electronics into a single application-specific integrated circuit (ASIC). The ASIC makes the encoder more reliable.

Generally, a rotary encoder comes as a complete unit enclosed in a stator housing with a rotating shaft. The housing mounts to the bearing stator side, while the shaft couples to the bearing rotor. Commercial units typically have multiple “tracks” of modulating elements on the disk, and multiple detectors for those tracks.

Some encoders have ‘complementary’ outputs: A channel, B channel, and the complements of those. Engineers use the complements to double check each original signal.


There are two ways to classify encoders. They can be absolute or incremental, and they can be rotary or linear.

Absolute encoders provide a unique output for every position within the encoder’s range. Various coding schemes are available, such as Gray code, and pseudorandom codes. The big advantage of absolute encoders is that they can’t get “lost.” Catastrophic power loss, for example, doesn’t hamper the function of absolute encoders. As soon as power returns, they instantly know exactly where they are. Their big disadvantage is complexity.

Incremental encoders tick off pulses every time the position changes by one resolution unit. It is then up to the control electronics to count pulses to keep track of the actual position. Incremental encoders are very simple. Two bands providing regular waveforms that are identical except for a 90 degree phase shift are all that is needed to provide position, speed, and direction information. Incremental encoders’ big disadvantage is that anything that interferes with keeping track of the count—such as signal interruptions during motion, power failures, glitches, noise, or intermittent electronic faults—can destroy the system’s position knowledge.

Rotary encoders include a rotating encoder disk with the modulating elements applied in a circular pattern. The disk then rotates between the excitation source and detector fixed to the encoder housing.

Linear encoders unwrap the circular pattern and lay it out on a long tape. Because linear encoder measurement ranges may be indefinitely long, they may not be enclosed in a housing. Rather, the tape may actually be mounted to the machine’s static part, while the source and detector electronics slide back and forth along it, mounted to the machine’s moving part.


For safety applications, encoders can verify if a machine has stopped or not.

If the machine is an automated multi-spindle drill press, the obvious response to any safety event would be to hold the work fixture steady and retract all spindles to their mechanical stops. At that “home” position, a system using incremental linear encoders to track spindle position can recover its position memory.

If the machine is a multi-axis robot, however, or a conveyor system, making any movement without first knowing its starting point is more critical. In such cases, an absolute encoder on each axis is a safety must.

Another important safety principle is redundancy. Each component of a safe machine system needs a backup—including encoders.

Safety encoders normally have two independent scanning methods so that, even though the same disk is scanned, two positions or two velocities can be read and compared to ensure there are no differences.

In some cases, however, there may be no need for both channels to report absolute position. The system might be able to reach the typically required safety integrity level of SIL-3 with a relative encoder backed up with an absolute encoder.

In general, there is no universal formula for how to use encoders to achieve machine safety. Proper safety system design in general, and proper use of encoders for machine safety in particular, depends on the results of a thorough risk assessment that takes into account the entire machine as well as its operating environment.

Photo caption
Optical rotary encoders incorporate a slotted disk attached to the bearing rotor, which runs within a slot crossed by a light beam. Shuttering by the slots cuts the beam, which registers on a photodiode array. The light source and array fit into a compact package attached to the bearing’s stator. Source: BEI Duncan Electronics

C.G. Masi, Control Engineering


Below is a transcript of an online exchange between Control Engineering senior editor C.G. Masi and Dr. Simon Stein, Manager R&D for Safety and Connectivity at SICK Stegmann GmbH in Donaueschingen, Germany regarding the use of encoders in machine safety systems.


Dr. Stein:

Encoders usually support position or speed-related safety functions of machines. A main field is safety-related motor-feedback, where encoders are used to sense the position and speed of servo drives used in safety applications.

According to the relevant standard IEC 61800-5-2 (e.g. safe operating stop, safely limited speed, safe position), several electric-drive safety functions can be implemented more easily using encoders with safe-position output.

Safe-position output of an encoder can usually be achieved by two means:

• Redundant sensing and processing that allows cross-checking two position values for faults. This approach covers both in-encoder redundancy as well as dual-encoder applications.

• Single-channel measurement of position with high diagnostic coverage.

The latter approach can be more cost effective if supported by the encoders. It is useful for synchronous servo drives where safety functions like safe operating stop can be monitored both by comparing encoder position value with drive commutation information.

Other drives (asynchronous, DC) or general machinery usually must rely on the redundant sensing approach. Here, the second channel of position can not be derived from other sources and the encoder alone has to fulfill redundancy requirements.


Dr. Stein:

Apart from safety technology (number of channels, diagnostic coverage), the basic sensor technology of an encoder can be versatile. As long as the technology allows for necessary diagnostic coverage there is no obstacle from the safety point of view.

At our company, encoders with optical, magnetic, and capacitive sensing technologies are used for safety applications. This requires that all mentioned sensor technologies be able to process analog, independent sine and cosine signals related to the position value of the encoder. These two signals must follow the trigonometric identity that the squares of the sine and cosine of any angle must sum to unity, resulting in a high diagnostic coverage.


Dr. Stein:

As mentioned above the sensing technology has limited impact on overall machine safety strategies. The safety architecture of the encoder however influences the safety strategy.

Where a safety application would need two standard encoders and potentially elaborate diagnostics within the PLC, a single safety encoder can suffice to fulfill the same role. Both cost and ease of implementation are affected by this choice.


Dr. Stein:

Incremental encoders can only support safety functions related to speed (including stop functions). In contrast, absolute encoders can enable position-related safety functions. All other considerations apply for both variants of encoders.

Print this page | E-mail this page