incremental rotary encoder

Thread Starter

FelipeOlivares

Joined Nov 25, 2021
8
Hello, I would like to ask about the incremental rotary encoder and its connection, specifically the AB phases, thank you very much.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
The incremental encoder can take a few forms, basically it is a quadrature encoder, IOW, there are two phase, A&B separated by 90°, hence quadrature.
The two phases are often have complementary pair, the mirror of the other pair.
They can be made for open collector, 24vdc driver or 5vdc RS485.
The technique typically uses a moiré pattern to produce the effect.
The initial effect is two sign waves which are squared up for the quadrature signals.
 

BillB3857

Joined Feb 28, 2009
2,570
What is it you are asking. Most incremental rotary encoders I have encountered have either two or three outputs. Two of the outputs were square waves that were 90 degrees out of phase with each other. That enabled the control they were attached to to be able to detect not only the count, but direction of rotation. The third output, when available, was a ZERO pulse that happened only one time per revolution. That pulse was typically used in conjunction with a limit switch in order to start a counter at a specific position on an old style Numerical Control machine moving from a HOME position.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
That pulse was typically used in conjunction with a limit switch in order to start a counter at a specific position on an old style Numerical Control machine moving from a HOME position.
Not so much older style, many still use this method today where machine zero is not known at power up.
 

Ian0

Joined Aug 7, 2020
9,667
Electrically, it looks like two switches.
Connect the common terminal to 0V, and the A and B outputs to v+ through resistors to give logic level outputs. You might need a debouncing capacitor.
Simplest software interface is to trigger on the rising edge of "A". If "B" is logic 0 at the time of the trigger, it went anticlockwise, and if it is logic 1 it went clockwise.
More complicated techniques will give better resolution.
 

crutschow

Joined Mar 14, 2008
34,280
Do you need to know how to decode the signals?

To perhaps help you understand the encoder operation, below is the LTspice simulation of a quadrature rotary encoder output signals, with a simple decoder using one dual 74HC74 FF IC package:

The circuit outputs Ckup pulses (green trace) when the A signal (red trace) goes high before the B signal (blue trace) for one direction of encoder rotation, and outputs Ckdn pulses (yellow trace) when the B signal goes high before the A signal for the opposite encoder rotation.

If you understand how a D-flip-flop works, then you should be able to determine how the decoder works.

1641429334284.png
 
Last edited:

MaxHeadRoom

Joined Jul 18, 2013
28,617
One issue with quadrature encoders is if the motion controller, PID loop etc, causes very slight dither either side of a direction pulse, it can appear to the system to be a count up, when in fact it is slight oscillation around a fixed point.
 

Ian0

Joined Aug 7, 2020
9,667
Are we all thinking about the same sort of thing? Rotary encoders can be either devices that measure the rotation of a shaft for motor control, or something that replaces a potentiometer on a panel.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
Are we all thinking about the same sort of thing? Rotary encoders can be either devices that measure the rotation of a shaft for motor control, or something that replaces a potentiometer on a panel.
Generally the term Incremental Encoder refers to the quadrature version, at least as far as the world I operate in.
The only other that can also use the term, is the same encoder, but the initial detected quad sign waves uses the co-tangent feature to calculate absolute position.
 

Ian0

Joined Aug 7, 2020
9,667
Generally the term Incremental Encoder refers to the quadrature version, at least as far as the world I operate in.
The only other that can also use the term, is the same encoder, but the initial detected quad sign waves uses the co-tangent feature to calculate absolute position.
They both work the same way. Just the purpose (and quality of construction) that is different. I was just wondering which the TS was thinking about.
 

MisterBill2

Joined Jan 23, 2018
18,167
Really, there are two family types of optical encoders, which are incremental and absolute. Almost all incremental encoders provide at least quadrature outputs, but in various formats, (voltage and impedance). Knob driven panel encoders main differences are mechanical, usually they do not have high speed bearings, and they may have push-switch operation in addition. I have used a panel mounted incremental encoder to replace several pots, with push buttons to chose which function would be adjusted. That encoder saved the cost of an analog input module and several precision pots and a regulated power supply, as it could use the same digital DC inputs as the buttons and limit switches. So it made the machine controls more rugged and less expensive, and it avoided damage from those who will always twist a knob beyond the stops so a to break things.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
I worked with some of the first incremental optical linear scale encoders where a incandescent lamp was used, rather than LED as came later.
When changing the lamp, the phasing had to be re-done using a double beam 'scope and lissajous figure to set the 90° phasing. :oops:
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
How does a encoder with a resolution of 2μm work with an LED to differentiate between lines at that resolution?
It is done with the read head carrying a small piece of grating slightly skewed which results in a Moiré pattern producing a 'shutter' many times larger than the grating resolution, the 'shutter' also appears to move at right angles to the direction of motion ,
Quite interesting to see in person.
 

MisterBill2

Joined Jan 23, 2018
18,167
I worked with some of the first incremental optical linear scale encoders where a incandescent lamp was used, rather than LED as came later.
When changing the lamp, the phasing had to be re-done using a double beam 'scope and lissajous figure to set the 90° phasing. :oops:
I have fought with those linear encoders and lost more times than not. So we replaced them with commercially made and adjusted ones and avoided wasting hours of fighting with them. The machines using them were built in the UK, by the way.
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
I have fought with those linear encoders and lost more times than not. So we replaced them with commercially made and adjusted ones and avoided wasting hours of fighting with them. The machines using them were built in the UK, by the way.
I have cleaned the scales on a few, obtaining cleaning solution and suitable cloth etc from the local Opticians.
I have only ever used Commercially made versions.
 
Top