When using incremental encoders in your motion control and robotics applications, it is sometimes necessary to use an encoder signal converter device of some type to accomplish a particular function. For example, your encoder may output single-ended A, B, and Index signals, and you may need to convert them to RS-422 differential signals. Or you may have a situation where your encoder outputs signals at higher voltages such as 12 or 24 volts, and you need to convert the signals down to 5-volt TTL compatible levels.
You might need a device that will take the encoder signals in and generate an analog voltage or a 4-to-20 mA current loop signal out that is proportional to the position or the speed of the encoder. Or possibly you need a digital binary up/down counter device that would present the position or speed of the encoder as a 12-bit, 16-bit, or 24-bit parallel output value. How about a device that divides the resolution of the encoder down to some lower value such as converting 720 cycles per revolution down to 60 cycles per revolution?
The devices I have described, and many more are available. This article will focus in on some simple examples of encoder signal converting devices for starters. If you need a specific kind of converter for your application, you can leave your comments at the end of this article or send your inquiry to the email address given at the end of this article.
Differential Drivers – Converting A, B, and Z to A+, A-, B+, B-, Z+, Z-
What if you have an incremental encoder on hand that you wish to use in an application, but it just has single-ended A, B, and possibly third channel index Z outputs. But you find yourself in a situation where it needs to have RS-422 differential A+, A-, B+, B-, Z+, and Z- outputs because the interface for the encoder is located more than 6 feet away, or just because the interface you are sending the encoder signals into has A+, A-, B+, B-, Z+, and Z- inputs.
So do you forget about using that particular encoder, and go out and buy an encoder with differential outputs? That could cost a significant amount more money than simply adding an RS-422 differential line driver device to your existing encoder. A better solution could be to just connect an RS-422 differential driver device to the encoder outputs.
The heart of an RS-422 differential driver circuit is the 26C31 chip. This chip has four differential drivers in it, but only three of the drivers would be needed for an encoder that has A, B, and Z outputs. It would just be a matter of connecting the A, B, and Z signals from the encoder to the A, B, and C inputs of the 26C31 chip. The output from the chip would be three differential signal pairs A+, A-, B+, B-, Z+, and Z-.
The differential signals coming out of the 26C31 chip should be good for passing through up to 1000 feet of cable if the cable is made up of twisted pairs of wires. It would be important to put the A+ and A- signals together in one pair of wires, the B+ and B- signals in another twisted pair, and so on.
Differential Receivers – Converting A+, A-, B+, B-, Z+, Z-, to A, B, Z
Then at the other end of the cable it may be necessary to convert back to single-ended A, B, and Z signals before going into the interface, unless the interface already has inputs for differential signals, A+, A-, B+, B-, Z+, and Z-. A good chip for converting from differential back to single-ended is the 26C32 chip.
The 26C32 is a differential line receiver chip that has four differential receivers in it. It is a good idea to add a 150-ohm resistor in series with a 4.7 nF capacitor across each of the differential pairs near the inputs of the 26C32 chip to help minimize signal reflections.
If you have questions about the differential line driver and differential line receiver circuits that we have discussed here in this article, just leave your questions in the comments section below. I will get back to you.
A company called CNL Devices Inc has differential line driver and receiver circuit boards with screw terminal connectors. They also have them housed in black plastic cases with or without a DIN-rail mounting clip. If you are interested in obtaining some differential drivers and/or receivers for your encoder project, email your inquiry to sales@CNLDevices.com.
Converting Quadrature Into UP/Down Clocks Or Clock & Direction
Sometimes it is useful or necessary to convert 2-channel A/B quadrature incremental encoder signals into up and down clock pulses or clock pulses and a direction logic level. An example of this would be in the case of wanting to use some binary counter chips to act as an encoder position value register.
There are 4-bit binary counter chips available that have up clock and down clock inputs or a clock input and a direction level input. A couple examples of such chips would be the 40193 with up clock and down clock inputs, and the 4516 that has a clock input and a direction level input. Two more examples of counter chips with up/down clock inputs or clock/direction inputs would be the 74193 and 74191 series.
The LS7183N chip enables an incremental encoder to drive the up and down clock inputs of a 40193 counter chip by converting the A/B quadrature into up clocks when the encoder is moving in one direction, and down clocks when the encoder is moving in the opposite direction.
The LS7184N chip takes the encoder A/B quadrature in and generates clocks and a direction logic level out. The direction level output goes high when the encoder moves in one direction, and goes low when the encoder moves in the opposite direction. The LS7184N chip can be used with the 4516 counter chip that accepts clock and direction signals in.
Both the LS7183 and the LS7184 chips have three clocking modes that are selected at pin 6 of the chip by connecting the pin to GROUND, or +V, or leaving the pin floating open. The chips can be put into X1 (times one) clocking mode where they generate a clock out on the rising edge of the encoder’s “A” channel cycles. Or the X2 clocking mode can be selected where a clock is generated on the rising and falling edges of the “A” channel cycles. Then there is the X4 clocking mode where a clock is generated on all the rising and falling edges of both the “A” and “B” encoder channel cycles.
Converting 2-bit Binary Into 2-bit Gray Code
In the discussion above, it was shown how to use LS7183N and LS7184N chips to turn 2-channel A/B quadrature from an incremental encoder into up/down clocks or clock and direction. It is possible to go in the opposite direction and convert a single channel of clocks or square waves into 2-channel A/B quadrature.
One way to do this is to send the clock signal into the clock input of a 74191 4-bit counter chip. Use the two least significant bits of this 4-bit counter. The output from the two least significant bits of the counter will be simply the sequence 00, 01, 10, 11, and back to 00, and so on as the clocks are counted by the 74191 chip.
But the output from a 2-channel incremental encoder is a 2-bit Gray code sequence of 00, 01, 11, 10, and back to 00, and so on, repeating that sequence. So how do we convert a standard 2-bit binary sequence into Gray code?
The answer is to use Exclusive-OR gates to convert the 2-bit binary output from the two least significant bits of the 74191 counter into a 2-bit Gray Code. See the following diagram and logic truth table to understand how this is done:
Many Other Converter Possibilities
In this article, we have looked at some simple encoder signal converter ideas. These included converting single-ended A, B, and Z into RS-422 differential A+, A-, B+, B-, Z+, Z- using the 26C31 chip. Converting RS-422 differential back to single-ended A, B, and Z using the 26C32 chip. Then we looked at using the LS7183N and LS7184 chips to convert single-ended A and B quadrature into UP/DOWN CLOCKS or CLOCK/DIRECTION signals. Then finally we looked at clocking a binary counter chip with a single channel of square wave cycles and using the lower 2-bits of the counter output to get A/B quadrature out. A circuit consisting of Exclusive-OR gates was used to get a 2-bit Gray code out like what an incremental encoder generates.
There are many more converter ideas that we didn’t discuss. Perhaps you have a need in your application for some specialized converter and you are not able to locate an off the shelf solution. In my days as an applications engineer, I had the opportunity to receive many phone calls from customers over the years in which they would ask me if I knew of a device that would take encoders signals in and output an analog voltage, or a 4-to-20 mA current loop signal, or A/B quadrature at a reduced resolution, or a 24-bit parallel output, and I could go on.
Many of these ideas actually turned into off the shelf products that I had a hand in designing. So if you would like more information on any of the converter ideas mentioned in this article, or if you have a new idea for a converter, please feel free to email firstname.lastname@example.org.
If you have any questions or comments regarding this article, please leave them in the comments section below. I would welcome discussing with you anything related to this article, and answering your questions.