We would like to welcome our newest Robohub contributor, David Kohanbash, whose blog – Robots for Roboticists – covers a broad range of technical topics that is sure to interest makers and practitioners. We hope you enjoy!
Incremental encoders are good for speed control and can be used for position control when we have a homing routine to get absolute position, or the system is constrained to less than one rotation. One way an incremental encoder can also be an absolute encoder is if it is single turn. Usually an encoder on the back-shaft of a motor will be multi-turn, however if you have the encoder on the output shaft (or if it is a secondary position encoder) it can be single-turn.
Throughout this post I am focusing on digital/analog optical quadrature encoders. While there are other types of incremental encoders (with all sorts of fancy output options) these are probably the most common. These come as a standard option for many motors as well as in kits that you can snap onto a motor.
Quadrature encoders have at minimum 4 wires:
– Power (often +5V)
A+ and B+ are the signal lines that generate the pulses that we use for determining position. There are several other signal lines that are often seen with encoders:
– I+ (or sometimes Z+)
– I- (or sometimes Z-)
I+ is known as the index pulse. For every full rotation of the encoder shaft there is one index pulse to help give an absolute reference in the rotation. This is often useful when homing a motor you can look for the index pulse.
The A-, B-, and I- are the inverse of the + versions of those signals. This is useful when operating in a high noise environment or where signal integrity is an issue.
If signal integrity is a concern (or an active issue) you can add a line driver to improve the signal.
In design reviews and in practice I often see people purchasing the highest resolution encoder that they can get. Often the cost of the encoder wheel does not change much based on the resolution.
Incremental quadrature encoders typically range from 100-1000 counts/rotation, however you can find encoders with many thousands of counts/rotation. Since they are quadrature and there are 4 state changes per each set of A & B phases, the resolution is 4 times the counts/turn.
In theory if you need 1degree of resolution per rotation, you need an encoder with 360 counts. Using a quadrature encoder this can be reduced to only 90 counts in the encoder wheel! If you have gearing on the motor this can be further improved to limit the number of encoder ticks required.
When you pick an encoder it can be tempting to select the highest resolution available, but you should stop and think first. Some controllers will have a hard time tracking position if the motor is spinning fast and there are too many encoder ticks per unit time. On the flip side if you have a slow-moving motor you might need the high-resolution so that you can see the change in motor position during a given time step in your controller.
Some other things that you need to consider are operating conditions and mounting. Operating conditions is fairly straight forward; can the encoder survive the temperature, vibration, shock, water, etc.. that it will need to endure. Mounting can be a bit more interesting. There are all sorts of options for encoder mounts. Some of the mounting options are hollow shafts, solid shafts, recessed shafts, collars, etc.. Often when ordering a motor if you can get one with a backshaft that will be the easiest way to connect the encoder (assuming you dont have the manufacturer adding it for you). If you are using a brake on the motor, the brake might need to connect to the backshaft, and you will need to be creative or get a pass-through on the brake to add the encoder.
In closing when selecting an encoder you should check the following:
1. Is an incremental (ie non-absolute) encoder good for this application?
2. Does your controller interface to the output format of the encoder?
3. What resolution is needed?
4. What environment will the encoder be operated in?
5. Mechanical fit & mounting.
6. How the electrical noise is (so you can get the differential channels)?
7. How long should the cable be (assuming it is attached and not just a connector)?
A final piece of advice is to use shielded cables for your encoder signals. This is especially important for long cable runs (where you might need a driver) and noisy environments.