Rotary encoder
A rotary encoder, also called a shaft encoder, is an electro-mechanical device that converts the angular
In geometry, an angle is the figure formed by two rays sharing a common endpoint, called the vertex of the angle.Angles are usually presumed to be in a Euclidean plane with the circle taken for standard with regard to direction. In fact, an angle is frequently viewed as a measure of an circular arc...

 position or motion of a shaft or axle to an analog or digital code. The output of incremental encoders provides information about the motion of the shaft which is typically further processed elsewhere into information such as speed, distance, RPM and position. The output of absolute encoders indicates the current position of the shaft, making them angle transducers
A transducer is a device that converts one type of energy to another. Energy types include electrical, mechanical, electromagnetic , chemical, acoustic or thermal energy. While the term transducer commonly implies the use of a sensor/detector, any device which converts energy can be considered a...

. Rotary encoders are used in many applications that require precise shaft unlimited rotation—including industrial controls, robotics
Robotics is the branch of technology that deals with the design, construction, operation, structural disposition, manufacture and application of robots...

, special purpose photographic lens
Photographic lens
A camera lens is an optical lens or assembly of lenses used in conjunction with a camera body and mechanism to make images of objects either on photographic film or on other media capable of storing an image chemically or electronically.While in principle a simple convex lens will suffice, in...

es, computer input devices (such as optomechanical mice and trackball
A trackball is a pointing device consisting of a ball held by a socket containing sensors to detect a rotation of the ball about two axes—like an upside-down mouse with an exposed protruding ball. The user rolls the ball with the thumb, fingers, or the palm of the hand to move a cursor...

s), and rotating radar
Radar is an object-detection system which uses radio waves to determine the range, altitude, direction, or speed of objects. It can be used to detect aircraft, ships, spacecraft, guided missiles, motor vehicles, weather formations, and terrain. The radar dish or antenna transmits pulses of radio...

There are two main types: absolute and incremental (relative).

Absolute rotary encoder


Digital absolute encoders produce a unique digital code for each distinct angle of the shaft. They come in two basic types: optical and mechanical.

Mechanical absolute encoders

A metal disc containing a set of concentric rings of openings is fixed to an insulating disc, which is rigidly fixed to the shaft. A row of sliding contacts is fixed to a stationary object so that each contact wipes against the metal disc at a different distance from the shaft. As the disc rotates with the shaft, some of the contacts touch metal, while others fall in the gaps where the metal has been cut out. The metal sheet is connected to a source of electric current
Electric current
Electric current is a flow of electric charge through a medium.This charge is typically carried by moving electrons in a conductor such as wire...

, and each contact is connected to a separate electrical sensor. The metal pattern is designed so that each possible position of the axle creates a unique binary code
Binary code
A binary code is a way of representing text or computer processor instructions by the use of the binary number system's two-binary digits 0 and 1. This is accomplished by assigning a bit string to each particular symbol or instruction...

 in which some of the contacts are connected to the current source (i.e. switched on) and others are not (i.e. switched off).

Optical absolute encoders

The optical encoder's disc is made of glass or plastic with transparent and opaque areas. A light source and photo detector array reads the optical pattern that results from the disc's position at any one time.

This code can be read by a controlling device, such as a microprocessor
A microprocessor incorporates the functions of a computer's central processing unit on a single integrated circuit, or at most a few integrated circuits. It is a multipurpose, programmable device that accepts digital data as input, processes it according to instructions stored in its memory, and...

 or microcontroller to determine the angle of the shaft.

The absolute analog type produces a unique dual analog code that can be translated into an absolute angle of the shaft (by using a special algorithm).

Standard binary encoding

An example of a binary code, in an extremely simplified encoder with only three contacts, is shown below.
Standard Binary Encoding
SectorContact 1Contact 2Contact 3Angle
1 off off off 0° to 45°
2 off off ON 45° to 90°
3 off ON off 90° to 135°
4 off ON ON 135° to 180°
5 ON off off 180° to 225°
6 ON off ON 225° to 270°
7 ON ON off 270° to 315°
8 ON ON ON 315° to 360°

In general, where there are n contacts, the number of distinct positions of the shaft is 2n. In this example, n is 3, so there are 2³ or 8 positions.

In the above example, the contacts produce a standard binary count as the disc rotates. However, this has the drawback that if the disc stops between two adjacent sectors, or the contacts are not perfectly aligned, it can be impossible to determine the angle of the shaft. To illustrate this problem, consider what happens when the shaft angle changes from 179.9° to 180.1° (from sector 4 to sector 5). At some instant, according to the above table, the contact pattern changes from off-on-on to on-off-off. However, this is not what happens in reality. In a practical device, the contacts are never perfectly aligned, so each switches at a different moment. If contact 1 switches first, followed by contact 3 and then contact 2, for example, the actual sequence of codes is:
off-on-on (starting position)
on-on-on (first, contact 1 switches on)
on-on-off (next, contact 3 switches off)
on-off-off (finally, contact 2 switches off)

Now look at the sectors corresponding to these codes in the table. In order, they are 4, 8, 7 and then 5. So, from the sequence of codes produced, the shaft appears to have jumped from sector 4 to sector 8, then gone backwards to sector 7, then backwards again to sector 5, which is where we expected to find it. In many situations, this behaviour is undesirable and could cause the system to fail. For example, if the encoder were used in a robot arm, the controller would think that the arm was in the wrong position, and try to correct the error by turning it through 180°, perhaps causing damage to the arm.

Gray encoding

To avoid the above problem, Gray encoding
Gray code
The reflected binary code, also known as Gray code after Frank Gray, is a binary numeral system where two successive values differ in only one bit. It is a non-weighted code....

 is used. This is a system of binary counting in which adjacent codes differ in only one position. For the three-contact example given above, the Gray-coded version would be as follows.
Gray Coding
SectorContact 1Contact 2Contact 3Angle
1 off off off 0° to 45°
2 off off ON 45° to 90°
3 off ON ON 90° to 135°
4 off ON off 135° to 180°
5 ON ON off 180° to 225°
6 ON ON ON 225° to 270°
7 ON off ON 270° to 315°
8 ON off off 315° to 360°

In this example, the transition from sector 4 to sector 5, like all other transitions, involves only one of the contacts changing its state from on to off or vice versa. This means that the sequence of incorrect codes shown in the previous illustration cannot happen.

Single-track Gray encoding

If the designer moves a contact to a different angular position (but at the same distance from the center shaft), then the corresponding "ring pattern" needs to be rotated the same angle to give the same output. If the most significant bit (the inner ring in Figure 1) is rotated enough, it exactly matches the next ring out. Since both rings are then identical, the inner ring can be omitted, and the sensor for that ring moved to the remaining, identical ring (but offset at that angle from the other sensor on that ring). Those two sensors on a single ring make a quadrature encoder.

For many years, Torsten Sillke and other mathematicians believed that it was impossible to encode position on a single track so that consecutive positions differed at only a single sensor, except for the two-sensor, one-track quadrature encoder. However, in 1994 N. B. Spedding registered a patent (NZ Patent 264738) showing it was possible with several examples. See Single-track Gray code for details.

Absolute encoder output formats

In commercial absolute encoders there are several formats for transmission of absolute encoder data, including parallel binary, SSI
Synchronous Serial Interface
Synchronous Serial Interface is a widely used serial interface standard for industrial applications between a master and a slave . SSI is based on RS422 standards and has a high protocol efficiency in addition to its implementation over various hardware platforms, making it very popular among...

, "BiSS", ISI
ISI or Isi may refer to:* İsi, a village and municipality in the Masally Rayon of Azerbaijan-Organizations:* Bureau of Indian Standards, previously the Indian Standards Institute, the national Standards Body of India...

, Profibus
PROFIBUS is a standard for field bus communication in automation technology and was first promoted in 1989 by BMBF...

, DeviceNet
DeviceNet is a network system used in the automation industry to interconnect control devices for data exchange. It uses Controller Area Network as the backbone technology and defines an application layer to cover a range of device profiles...

, CANopen
CANopen is a communication protocol and device profile specification for embedded systems used in automation. In terms of the OSI model, CANopen implements the layers above and including the network layer. The CANopen standard consists of an addressing scheme, several small communication protocols...

, Endat and Hiperface, depending on the manufacturer of the device.

Incremental rotary encoder

An incremental rotary encoder provides cyclical outputs (only) when the encoder is rotated. They can be either mechanical or optical. The mechanical type requires debouncing and is typically used as digital potentiometers on equipment including consumer devices. Most modern home and car stereos use mechanical rotary encoders for volume control. Due to the fact the mechanical switches require debouncing, the mechanical type are limited in the rotational speeds they can handle. The incremental rotary encoder is the most widely used of all rotary encoders due to its low cost and ability to provide signals that can be easily interpreted to provide motion related information such as velocity and RPM.

The fact that incremental encoders use only two sensors does not compromise their accuracy. One can find in the market incremental encoders with up to 10,000 counts per revolution, or more.

There can be an optional third output: reference, which happens once every turn. This is used when there is the need of an absolute reference, such as positioning systems.

The optical type is used when higher RPMs are encountered or a higher degree of precision is required.

Incremental encoders are used to track motion and can be used to determine position and velocity. This can be either linear or rotary motion.
Because the direction can be determined, very accurate measurements can be made.

They employ two outputs called A & B, which are called quadrature outputs, as they are 90 degrees out of phase.

The state diagram:
{> class="wikitable" width="180"
|+Coding for
clockwise rotation
!Phase !!A !!B
0 >-
0 >-
1 >-
{> class="wikitable" width="180"
|+ Coding for
counter-clockwise rotation
!Phase !!A !!B
|1 1 >-
|2 1 >-
|3 0 >-
|4 0
The two output wave forms are 90 degrees out of phase, which is all that the quadrature term means. These signals are decoded to produce a count up pulse or a count down pulse. For decoding in software, the A & B outputs are read by software, either via an interrupt on any edge or polling, and the above table is used to decode the direction. For example, if the last value was 00 and the current value is 01, the device has moved one half step in the clockwise direction. The mechanical types would be debounced first by requiring that the same (valid) value be read a certain number of times before recognizing a state change.

If the encoder is turning too fast, an invalid transition may occur, such as 00->11. There is no way to know which way the encoder turned; if it was 00->01->11, or 00->10->11.

If the encoder is turning even faster, a backward count may occur. Example: consider the 00->01->11->10 transition (3 steps forward). If the encoder is turning too fast, the system might read only the 00 and then the 10, which yields a 00->10 transition (1 step backward).

This same principle is used in ball mice to track whether the mouse is moving to the right/left or forward/backward.

Rotary encoders with a single output cannot be used to sense direction of motion. They are well suited for systems that measure rate-of-movement variables such as velocity and RPM. In certain applications they may be used to measure distance of motion (e.g. feet of movement).

Incremental versus absolute encoder terminology

There seem to be some grey areas as to what constitutes an incremental encoder as opposed to an absolute encoder.

Traditional absolute encoders

Traditional absolute encoders have multiple code rings with various binary weightings which provide a data word representing the absolute position of the encoder within one revolution. This type of encoder is often referred to as a parallel absolute encoder. The distinguishing feature of the absolute encoder is that it reports the absolute position of the encoder to the electronics immediately upon power-up with no need for indexing.

Traditional incremental encoders

A traditional incremental encoder works differently by providing an A and a B pulse output that provide no usable count information in their own right. Rather, the counting is done in the external electronics. The point where the counting begins depends on the counter in the external electronics and not on the position of the encoder. To provide useful position information, the encoder position must be referenced to the device to which it is attached, generally using an index pulse. The distinguishing feature of the incremental encoder is that it reports an incremental change in position of the encoder to the counting electronics.

Battery backed incremental encoders

Some encoder manufacturers, such as Fanuc, have taken a different approach to this terminology. These manufacturers use absolute as their terminology for incremental encoders with a battery backed up memory to store count information and provide an absolute count immediately upon power up.

Sine wave encoder

A variation on the Incremental encoder is the Sinewave Encoder. Instead of producing two quadrature square waves, the outputs are quadrature sine waves (a Sine and a Cosine). By performing the arctangent function, arbitrary levels of resolution can be achieved.

Encoders used on servomotors

Rotary encoders are often used to track the position of the motor shaft on permanent magnet brushless motors, which are commonly used on CNC machines, robot
A robot is a mechanical or virtual intelligent agent that can perform tasks automatically or with guidance, typically by remote control. In practice a robot is usually an electro-mechanical machine that is guided by computer and electronic programming. Robots can be autonomous, semi-autonomous or...

s, and other industrial equipment. Incremental (Quadrature) encoders are used on Induction Motor type servomotors, but absolute encoders are used in Permanent Magnet Brushless Motors, where applicable. In these applications, the feedback device (encoder) plays a vital role in ensuring that the equipment operates properly. The encoder synchronizes the relative rotor magnet and stator winding positions to the current provided by the drive. Maximum torque results if the current is applied to the windings when the rotor magnets are in a particular position range relative to the stator windings. The motor will perform poorly or not at all if this timing is not adjusted correctly. Improper encoder alignment on the motor can actually cause it to run backwards sometimes resulting in a hazardous run away condition. Correct alignment is essential to proper operation of these motors.

Encoder technologies

Encoders may be implemented using a variety of technologies:
  • Conductive tracks. A series of copper pads etched onto a PCB is used to encode the information. Contact brushes sense the conductive areas. This form of encoder is now rarely seen.
  • Optical. This uses a light shining onto a photodiode
    A photodiode is a type of photodetector capable of converting light into either current or voltage, depending upon the mode of operation.The common, traditional solar cell used to generateelectric solar power is a large area photodiode....

     through slits in a metal or glass disc. Reflective versions also exist. This is one of the most common technologies.
  • Magnetic. Strips of magnetised material are placed on the rotating disc and are sensed by a Hall-effect
    Hall effect
    The Hall effect is the production of a voltage difference across an electrical conductor, transverse to an electric current in the conductor and a magnetic field perpendicular to the current...

     sensor or magnetoresistive
    Magnetoresistance is the property of a material to change the value of its electrical resistance when an external magnetic field is applied to it. The effect was first discovered by William Thomson in 1856, but he was unable to lower the electrical resistance of anything by more than 5%. This...

     sensor. Hall effect sensors are also used to sense gear
    A gear is a rotating machine part having cut teeth, or cogs, which mesh with another toothed part in order to transmit torque. Two or more gears working in tandem are called a transmission and can produce a mechanical advantage through a gear ratio and thus may be considered a simple machine....

     teeth directly, without the need for a separate encoder disc.

See also

Analogue devices that perform a similar function include the synchro
A synchro is a type of rotary electrical transformer that is used for measuring the angle of a rotating machine such as an antenna platform. In its general physical construction, it is much like an electric motor...

, the resolver
Resolver (electrical)
A resolver is a type of rotary electrical transformer used for measuring degrees of rotation. It is considered an analog device, and has a digital counterpart, the rotary encoder.-Description:...

, the rotary variable differential transformer (RVDT) and the rotary potentiometer
A potentiometer , informally, a pot, is a three-terminal resistor with a sliding contact that forms an adjustable voltage divider. If only two terminals are used , it acts as a variable resistor or rheostat. Potentiometers are commonly used to control electrical devices such as volume controls on...


A Linear encoder
Linear encoder
A linear encoder is a sensor, transducer or readhead paired with a scale that encodes position. The sensor reads the scale in order to convert the encoded position into an analog or digital signal, which can then be decoded into position by a digital readout or motion controller.The encoder can be...

is similar to a rotary encoder, but measures position in a straight line, rather than rotation. Linear encoders often use incremental encoding and are used in many machine tools.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.