# What is an encoder?

So, I’m new to robotics, and I need to find out what an encoder is.

Simply speaking it allows you to see how far or how fast something has rotated.

inside there is a light or laser that shines on or through a disk that spins with whatever it is that you want to measure. That disk will either have small holes or lines that trigger signals that are then sent back to the controller (most used in FIRST have an A and a B signal). The higher the counts per resolution the more precise the encoder is.

Hope that gives you a basic understanding.

An encoder is a device that counts occurances in a certain way. The most common application is as light and dark segments on a rotating disc, though there are linear encoders.

The way they work is by sending a “high” or “low” signal indicating whenever the light and dark regions pass the detector. You can count them up to find what distance you’ve traveled or count the rate and determine a speed.

The problem with a simple encoder is that it can tell you number of signal switches and/or rate of change, but it cannot tell you direction. To get direction, a 2nd detector is offset (usually 90 degrees out of phase – note: this is not 90 degrees on the wheel, but 1/4 of the way through a cycle of high and low) so you can determine the direction of motion. These are commonly known as the “A” and “B” channels.

An example of how this would work is

``````Forward                    Reverse
A - low ; B - low          A - low ; B - low
A - high; B - low          A - low ; B - high
A - high; B - high         A - high; B - high
A - low ; B - high         A - high; B - low
A - low ; B - low          A - low ; B - low
``````

As you can see, the direction can be determined by looking at which signal is leading (changing first). This is what’s know as a quadrature encoder.

As far as line counts, it’s a balancing act. The more lines you have, the greater precision you can get, which is a good thing. But this can cause problems too. With very small divisions, your encoder is subject to “noise” in its measurement. Any small misalignments or vibrations can be enough to cause the signal to behave in erratic ways. Fewer line counts reduce the probability of this occuring. The other drawback to a high number of line counts is the signal processing rate of your controller. If you’re spinning so fast, you send 100,000 line counts past your detectors, your system may not be able to count that fast, and then your signal will become garbled as the controllers struggles to keep up.

So, more lines = better precision. Less lines = cleaner signal. We typically use 100 line count encoders for direct motor output since we gear down the motors and 360 line count encoders for more precise measurements on devices that don’t move as fast.

An encoder is a feedback device that is primarily used to reference position of a certain object. They can be linear or rotary. An example of a linear encoder would be a linear scale commonly used on different machine axis to reference the position of the axis to correspond with the machine program. Rotary encoders are commonly used on servo and spindle motors. On a servo motor they are used to detect shaft/rotor position in reference to the stator so that the drive running the motor knows which phase to fire next (commutation). On a spindle motor an encoder can also detect velocity and reference back to the controller to keep speed stablilized.

Encoders can communicate using a variety of different languages (so to say). The most common is the incremental encoder. There are also absolute, serial, TTL, 1Vp-p, 11 uAmp, All pretty much do the same thing, they count. Encoders can also come in various different counts from as low as 500 PPR (Pulse Per Revolution) up to in excess of 1,000,000 PPR. So, depending on how accurate you need to be there should be an encoder out there to fit your needs.

If you are interested in an article about some problems with encoders here is a link to an article http://www.repairzone.com/learningcenter/technotes/encoders-the-prime-suspect-in-siemens-servo-motor-repair