# Quadrature Encoder Basics Part 1: Theory

Mr.Bit

While some motion applications require little precision and no feedback. Others, mostly industrial, require a robust way to keep track of reliable and precise data for speed, position and direction.

Stepper, Brushed or brushless DC motors do not provide any kind of feedback except when they are equipped with an encoder or hall-sensor.

On industrial stepper motors like the one that igus Delta Robot and robolink D joint is powered from, we can see that the stepper motor is equipped with an incremental quadrature encoder (8-pin).

### What is an encoder?

An encoder is an electro-mechanical device that is used to measure displacement.

### Why is it used?

Encoders are used to convert the angular position of a motor or rotating equipment, into an analogue or digital signal.

#### Types of encoders:

When considering the types of encoders, we should distinguish the technologies that are being used for signal generation and the type of output they produce.

### Technologies:

• Resistive (using hall-sensor or magneto-resistive sensor),
• Optical ( using a LED and a photo-sensor),
• Electromechanical (converting the analogue position of a shaft to analogue or digital signal, also known as shaft encoder)

#### Resolution:

• Encoder resolution measured in pules per revolution (PPR), is the number of counts being generated by the encoder in each turn. In the case of igus motors, the quadrature incremental encoders give out 2000 pulses out of 2 channels ( A,B) thus 500 counts/ full steps. (the inverted copies A/,B/, are discussed later).
• On absolute encoders, bits are used to describe the resolution as their output are binary words. For example, an 8bit encoder equal 2^8 counts, thus 256 counts and a 16-bit encoder 2^16= 65536 counts/ revolution.

### Types of output:

• Incremental: A sequence of on and off signals that are generated by an optical disc, indicating movement from one position to another. This position is lost if power is cut.
• Absolute: Each position of the encoder produces a unique code/pattern/word that can be regained even after a power cut.

Image 2: Absolute encoder disc pattern

In our case, this measurement is achieved via optical means. Inside the encoder, there is a disc which has a specific pattern of opaque and transparent parts.

Image 3: Quadrature incremental encoder disc pattern (without index)

The light detector that is used to receive the signals through the disc, receives the light intermittently according to the pattern creating a square wave pulse output.

When having one code track on the encoder, thus one channel, we can measure position and velocity of a stepper motor in a relatively high resolution. This is also known as a tachometer/ speedometer, as this type of encoder is mainly capable of velocity feedback.

On the other hand, a quadrature encoder has a second code track with a 90degree displacement that allows us to determine direction on top of velocity and position. E.g. If channel A pulse output leads channel B then the motor is rotating clockwise and if channel B leads channel A the motor is rotating anti-clockwise. In other words, there is a leading/lagging phase relationship between the channels.

Having a high-resolution industrial-proof encoder means that, there is a double ended signal transmission + an index channel on top of channels A and B.

A/ and B/ are simply inverted copies of A and B, and they are there to provide better noise immunity in industrial environment applications.
In more detail, the differential signalling technology is being used, where each channel has its inverted copy. The receiver, (e.g. closed loop controller) detects the potential difference between the channel and its copy and balances them, to have an equal amplitude, always compared to a common voltage.
The advantages of this procedure are there is very low current flowing to the ground conductor and less supply voltage needed due to increased resistance to electromagnetic interference (EMI).

The N channel output is the reference/ zero /index channel, it is mainly used for homing the system by providing precise feedback of a reference position.
This channel provides one pulse per rotation of the encoder.
The N/ channel is simply the inverted copy used for filtering purposes.

In the next chapter, we will see how we can measure the steps produced by an encoder using an Arduino microcontroller.
Thank you for reading, please comment your thoughts/ questions at the comment section!

A.B.

Electro-mechanical background with interest in motion control and automation, DC, EC, Steppers! Low Cost Automation Engineer at igus, UK.

## Recommended Articles

June 11, 2021 07:04

Very interesting, thank you

December 12, 2018 08:43

Can't wait for part 2, thanks

January 16, 2019 08:39

@Mrbuzz Thank you for the comment. Part 2 is now live https://www.rs-online.com/designspark/detecting-quadrature-encoders-with-arduino-uno

November 15, 2018 16:29

Thank you @throbscottle, I am currently finishing part 2, which I will link here.
If after that you have more questions or ideas, please let me know.

Thanks for your comment!

November 13, 2018 11:06

Really good article, but I has hoping to find a Part 2 and a Part 3 at least! It would be nice to have something about how to read these encoders.

November 1, 2018 09:16

Yes this is also a common method of measuring displacement, again the magnetic encoders offer both incremental and absolute options.
The digital measurement systems we use and offer work in the same principle.
https://www.igus.co.uk/info/linear-guides-digital-measurement-system

Thanks for your comment @Workshopshed

October 17, 2018 13:50

I've also been looking at magnetic encoders, these use a diametrically magnetised magnet and a DSP to determine the absolute rotation of a shaft. Output is typically PWM or digital.