Why do my optical encoder signals look this way?

I received an email from a customer who was seeing “not symmetrical” data channels on some optical encoders we shipped to them

Hi Jim,

The data channels are not symmetrical and there appears to be something superimposed on the index. Attached are pictures. Can I return these for your evaluation?

Regards,

Al

Below are the screen shots that he sent:

Read more of this post

Finding the Index on an Incremental Encoder with a DMM

Sometimes you don’t have the right tools to do the job.

Lets say you needed to identify where the index pulse was firing on your incremental encoder, but you left your oscilloscope in your other jacket pocket, and now all you have on hand is a DMM.

Well fear not, finding the index with a multimeter is possible although a bit tedious.

The index fires once per revolution and at higher line counts this makes it VERY easy to miss.  Since there is some delay in a multimeter’s display time, you will need to rotate the encoder very slowly to catch a change in voltage level.

The Blue box has a nine-volt battery inside that I regulated down to 5Vdc for the encoder power.  I have pulled out connections to ground (Black wire) and the index channel (Orange wire). When the index fires, the voltage will go from zero to five volts.

Jim is an Applications Engineer with Quantum Devices Inc. A leading manufacturer of Optical Encoders.

Quantum Devices Optical Encoder Black/White Wire

What’s with this black-white wire?

Quantum devices QD145 and QD200 Optical Encoders feature an extra black & white-stripped wire that serves as an alternate grounding connection for the encoder.

This wire is intended to be used in situations where the encoder flex mount is not case grounded.  The Black/white wire is at the same potential as the Optical Encoder’s conductive polymer housing and  flex mount.

Internally the electrical path of the black-white wire is tied to the optical encoder housing and flex mount through the circuit board.  Our optical encoders tend to live on the back of hardware like Brushless DC motors, where the motor housing is at ground potential.  In cases like this it is usually best to leave the black-white wire tied off and floating.

Arrow showing flex mount grounding Optical Encoder to Motor.

Jim is an application engineer for Quantum Devices INC, a leading manufacturer of optical encoders.

Jim reached at jmiller@quantumdev.com.

Inverted Flex Mount for QD145 Optical Encoder

O.

.Another way to mount an Optical Encoder

Instead of using an end bell,  a lot of our motor manufacturer customers recess the QD145 optical encoder into an extended motor housing and then seal the motor with an end plate.

This has the advantage of being a lower cost item to manufacture, as the  motor housing is often extruded  or cast.  Just making the housing longer and providing an end plate usually costs less than casting a separate end bell.

Conventional Motor End Bell

But the downside to a recessed motor housing is that mounting an optical encoder in a recess like this creates a problem when tightening the set screws to the shaft. It often has to be done through an MS connector hole, or blind, by reaching the Allen wrench around and under the encoder.

Cast recess in motor housing

Because of this, we occasionally get asked for a a version of our QD145 optical encoder that allows the assembler to  access the set screws above the body of the encoder.  The inverted flex mount turns the encoder upside down allowing easy access to the set screws that are normally underneath the encoder.

The QD145 inverted flex mounti9ng option is not currently listed on our web site, but can be ordered using the following part numbers under the mounting options:

Use an 06 Mounting option for the inverted 1.157″ Bolt Circle flex mount.

Use an 07 Mounting option for the inverted 1.812″ Bolt circle flex mount.

The wiring is changed internal to the encoder so that the QD145 maintains correct phasing for all channels.

Another option for a drop in recess mounted encoder is the JR12 Jam Nut style encoder which does not use set screws to secure the encoder to the shaft, but a compression nut instead.

Dimensions for the 07 version of the QD145 Inverted flex mount.


Understanding Incremental Encoder signals

Which incremental encoder wires should I use?

Channels A & B (Incremental Channels)

Use only A (or only B) for an RPM or counting applications where the rotation is either unidirectional, or where you don’t need to know direction.

Use A and B together to know direction. After two low pulses the next high pulse indicates direction.  This is due to the phasing offset between A and B of 90 electrical degrees, placing the signals in what is known as quadrature.

These signals can also be used to set up an up/down counter

Index pulse, also known as Z, marker, or I

Index pulse is a pulse that occurs once per rotation. It’s duration is nominally one A (or B) electrical cycle, but can be gated to reduce the pulse width.

The Index (Z) pulse can be used to verify correct pulse count

The Incremental Encoder Index pulse is commonly used for precision homing.  As an example, a lead screw may bring a carriage back to a limit switch.  It is the nature of limit switches to close at relatively imprecise points. This only gives a coarse homing point. The machine can then rotate the lead screw until the Z pulse goes high.

For a 5000 line count encoder this would mean locating position to within 1/5000 of a rotation or a precision of .072 Mechanical Degrees.  This number would then be multiplied against lead screw travel.

Commutation (UVW) signals are used to commutate a brushless DC motor. I always like to compare these signals to that of a distributor in a car. The commutation (sometimes called “Hall”) signals tell the motor windings when to fire

You would need to have encoder commutation signals if the motor you are mounting the encoder to has a pole count and there is no other device doing the work of commutation.  It is important to note that commutation signals need to be aligned or “timed” to the motor.


Single ended VS differential

These terms refer not to the waveforms of signals, but instead to the way the signals are wired.

Single ended wiring uses one signal wire per channel and all signals are referenced to a common ground.

TTL and Open Collector are types of single ended wiring.

Differential wiring uses two wires per channel that are referenced to each other.  The signals on these wires are always 180 electrical degrees out of phase, or exact opposites.  This wiring is useful for higher noise immunity, at the cost of having more electrical connections.

Differential wiring is often employed in longer wire runs as any noise picked up on the wiring is common mode rejected.

RS-422 is an example of differential wiring.

.

Gray Code for Rotary Incremental Encoders

Gray code was named for Frank Gray, a Bell labs researcher, who patented the procession in 1953,  even though a form of it was used by Emile Baudot for telegraphy as early as 1878.

The most important thing to understand about Gray code is that only one bit changes from transition to transition.   In binary it is possible for a number to go from all ones to all zeros, as is the case with 11111111 (255 decimal)  going back around to 00000000 (zero).

Dec           Bin                    Gray
0              0000                0000
1              0001                0001
2              0010                0011
3              0011                0010
4              0100                0110
5              0101                0111
6              0110                0101
7              0111                0100
8              1000                1100
9              1001                1101
10            1010                1111
11            1011                1110
12            1100                1010
13            1101                1011
14            1110                1001
15            1111                1000

Notice how only one of the 0’s or 1’s of the Gray code change as the number increments?  In binary there are times when all of the bits change, (0111  to 1000 (Seven to Eight ) and 1111 back to 0000 (Fifteen to Zero) ).

Error Checking

The advantage to only one bit changing in Gray code is that it gives you error-checking ability.  If you sum the number of bits the bit total will always change by only one.

You could also do some error checking knowing that the bit sum will always alternate between even and odd.

Gray      Bit Sum
0000         0
0001           1
0011           2
0010           1
0110           2
0111            3
0101            2
0100           1

Gray Code in Incremental Encoders

The A & B channels of Incremental Encoders are in quadrature, which makes a two-bit gray code progression.  Depending on direction, the Incremental Encoder bit progression with be a cyclical pattern of either 00 – 01 -11 – 10  or  00 – 10 – 11 – 01 – 00.

Only one bit changes from transition to transition.

The QD787 absolute encoder shown at the top of this post has an option for an eight bit Gray code output.

Links to more information on Gray code:

http://encyclopedia2.thefreedictionary.com/Grey+code

http://www.itl.nist.gov/div897/sqg/dads/HTML/graycode.html

http://mathworld.wolfram.com/GrayCode.html

Sample C code:

http://www.nrbook.com/a/bookcpdf/c20-2.pdf

WIKI:

http://en.wikipedia.org/wiki/Gray_code#Constructing_an_n-bit_gray_code

For more information on encoders, go to http://www.quantumdev.com

Jim can be reached at:  jmiller@quantumdev.com

Interfacing a 5Volt Incremental Encoder to 12 Volts

.

Interfacing to an Incremental Encoder using an optoisolator

When I chose the PLC that I wanted to build incremental encoder applications around, The DL06 seemed like a perfect low cost option, but what I failed to notice was that it had a minimum 12V input requirement to turn on the DC inputs. No problem, I thought, I’ll just get production to build me some of those 5-26V incremental encoders that are so popular with the kids now days.   I realized that plan was flawed once I saw how busy the production schedule was. It appears that word has gotten out that the QDI series of encoders are a great positional feedback option.

So what could I do? I already had 5V incremental encoders mounted on the motors. This carried the added bonus of the commutation tracks already being phased, meaning I didn’t have to worry about timing the Com tracks of the incremental encoder to the BLDC motor.

If only there was some way to turn a 5V signal into a 12V signal…

Well there is. You can use a device called an optoisolator, sometimes called an optocoupler, or photocoupler, although there are technically differences among these devices.

Here are some of them from my component stash. They seem to often come in white packaging.

My guess is that the white color is for better optical properties internal to the device, as white is much more reflective.

Looks like I only have one black sheep left in my flock.

An optoisolator consists of a light source on one side (usually an LED), and a phototransistor on the other.  It should probably be mentioned that the “tail end” of an optoisolator can also contain other devices, like an SCR,  Triac, or varistor. For what I needed, the transistor style output would work just fine.

Each side of the device is electrically isolated from the other so there can be a 5 volt potential on one side and a 12 volt potential on the other, each having a separate a ground.

I also needed to use at least a 100 ohm resistor on the cathode side of the LED.   This was done to limit the current though the optoisolator in order to keep from burning out the internal LED.   The inputs on the PLC already have built in internal resistance, so no resistors were needed there. I just wired it in series between the +12V source and the input. The PLC’s common was wired to ground.

Below is a down and dirty”trial run” at interfacing to the PLC.

There is sometimes a need for a customer to separate out incremental and commutation signals with separate voltage supplies.  Usually this is the case if the signals are running to two different devices, each with separate grounds.  For example, having a drive and a controller that are separated by a great distance.

For these custom designs we have used the optoisolators internal to the encoder.  Here they are in a smaller surface mount package.

While optoisolators can be a good solution to an incremental encoder  voltage-interfacing problem, ordering an encoder like a 5-26 Volt QD145, or QD200 and NOT having to mess with interfacing makes a lot more sense.

You should also keep in mind that there is a real delay using devices like this that can result in positional error. For demonstration purposes, or slow movers, this may not matter, but if you are trying to keep a the reigns tight on a control loop, 20 uS or so of delay may be too much.

To find your multi-voltage encoder answers go to http://www.quantumdev.com

Jim can be reached at:  jmiller@quantumdev.com