by Dale Lukas Peterson — last modified Feb 22, 2011 01:15 PM
A few things to keep in mind when selecting digital optical encoders:
- Single-ended or differential
- 5.0V digital logic
- Current capabilities
Even though single-ended is cheaper and simpler and may seem like it is all you need for your application, it turns out that many single-ended encoders can't source (drive voltage to +5.0V) more than 40 micro-amps. Some single ended encoders modules (EM1 from US Digital, for example) can drive +/-8mA, which is better, but may not be enough if you have a long cable.. Two options exist to remedy this:
- pull up resistors from the A/B/I pins directly to +5.0V. In my experience, this was not sufficient to drive a digital 5.0V logic input to high when using a 4.0 foot cable which had 26 AWG wires for A/B/I.
- a line driver, which essentially increases the current sourcing and sinking capabilities of a single ended encoder to +/-20mA. These are pretty simple and generally just connect to the A/B/I/5V/Gnd pins of your encoder.
- Buy a differential encoder instead of a single-ended encoder. This usually costs about $10-$15 more than the single-ended option, but is simpler since you don't need adapter cables, and offers more flexibility to work with devices that require differential encoder outputs. Also, you can easily spend $10-$30 on the various line driver and adapter cables, so this actually can be cheaper in the long run. And the wiring is certainly simpler.
I strongly recommend the third option, since they can source/sink 20mA, and provide the extra signal lines A~/B~/I~ which are used by some devices that make use of encoders. Most industrial motor controllers make use of differential optical encoders since these signals are much more robust to noise. Even if you aren't making use of the extra lines provided by the differential line drive, they don't hurt.
Interfacing 5.0V logic to 3.3V systems, in the case of a encoder, is a one way conversion since only the encoder signals needs to be converted down to 3.3V. The simplest way to do this, provided your device can source/sink enough current (hint, hint, differential encoder), is to use a simple voltage divider. For relatively low frequencies (< 10kHz), this option should work just fine. Another cleaner and lower power solution is to use a simple octal buffer/line driver such as the SN74LVC244A, which converts up to eight 5.0V signals to 3.3V, with a negligible delay of < 5.7ns. This is enough to handle 4 encoders if all that is needed are the two A and B channels.
In summary, the potential headaches (inadequate current, separate line drivers, more complex wiring with more connectors if separate line drivers are needed) of single-ended encoders do not justify their use, especially when you consider the marginal cost difference between single ended and differential versions of the same encoder.