Incremental encoders are useful devices that convert rotary or linear motion into electrical signals. The electrical signals can then be utilized by an encoder counter display to give a visual reading of the position of something.
In the case of a rotary encoder, a very common application would involve coupling or mounting the encoder to the shaft of an electric motor to track and measure circular motion.
In the case of a linear encoder, an application could involve using the encoder to track and measure straight-line back and forth motion. Using a linear encoder to measure and control the drill depth on a drill press could be one possible application.
To better understand how to use an incremental encoder with a digital encoder counter display, this article will discuss topics such as:
1. What is encoder resolution and how to choose the appropriate encoder resolution for your application.
2. The encoder to display interface electronics, and how the display converts electrical signals from the encoder into a count value.
3. Scale factors, and how the scale factor is used to convert the count value in the display’s up and down counters into an actual displayed position value in units such as degrees, radians, inches, millimeters, or whatever is desired.
4. Why a reset or preset button is needed on the display to reset the display to zero or to preset an initial starting point value.
Encoder Resolution – How Small Of A Piece Of Pie Can You Cut?
The resolution of an incremental encoder has to do with how small of a change in position that can be detected. The higher the resolution of the encoder, the smaller the change in position that can be detected.
Incremental encoders have two channels of output, commonly referred to as channels A and B, that are in quadrature relationship to each other so that the direction of movement can be determined. The other benefit that comes from having two channels of output is that it quadruples the resolution.
For example, if there are 360 lines on the disk, we know that the lines are spaced one angular degree apart from each other since there are 360 degrees in a circle. Using the 360 lines, the optical encoder module in the encoder will output 360 square wave cycles per revolution out of the “A” channel and 360 square wave cycles out of the “B” channel.
Now because the A and B channel cycles are in a quadrature relationship to each other, meaning that they are shifted 1/4-cycle or 90 electrical degrees out of phase with each other, there are four times as many rising and falling edges of the A and B channel square wave cycles as there are lines on the disk. This means that the resolution is quadrupled from 360 cycles per revolution up to 1,440 square wave edges per revolution. So now movements as small as 360 divided by 1,440 or 0.25 of a degree can be detected.
The same X4 (times four) resolution holds true for incremental linear encoders as well. For example, if the linear strip has 100 lines per inch on it, that would mean that the lines are spaced 0.01 inch apart. But because of the quadrature relationship between the A and B channel square wave cycles, the resolution will actually turn out to be 400 edges or counts per inch. This will result in movements as small as 0.0025 of an inch being detectable.
So when choosing an encoder to use in your application, it is important to choose one that has the resolution you need. If in your application you needed to measure changes in movement down to 1 degree, you would want to choose an incremental rotary encoder that has 90 lines on the disk so that you get 360 counts per revolution from it. For 0.25 of a degree changes in movement, choose an encoder with 360 lines on the disk as in our example above. For 0.1 degree changes in movement, choose an encoder with 900 lines on the disk, and so on.
The Digital Encoder Display – Turning Edges Into Position
So now that you have a better understanding of encoder resolution, let us now take a look at what goes on inside of a digital encoder display unit. It is the job of the digital display unit to take in the 2-channel A/B quadrature signals from an incremental encoder, convert those signals into a count value, and finally a position value that can be displayed.
The specific digital display unit that will be discussed in this article is one manufactured by a company called CNL Devices Inc. If after reading this article you desire to find out more about this display unit, or get your hands on one, you can email firstname.lastname@example.org.
The digital display has a 5-pin male connector on it for connecting the cable from the incremental encoder into the back of the display. Pin 1 of the connector is GROUND, and pin 4 has +5 VDC power on it for powering a 5-volt encoder through the cable. Channel A signal from the encoder come in on pin 3 and channel B signals come in on pin 5. Pin 2 is not used.
The first circuit within the display to receive the signals from the encoder is a chip that converts the 2-channel A and B quadrature into up clock and down clock pulses. Shown below is a diagram of the square wave output from an incremental encoder. You can see that the square waves coming out of channel A are shifted 1/4-cycle or 90 electrical degrees out of phase with those coming out of channel B. If you start on the left side of the diagram and move to the right, you will see that A leads B in phase. We could say that for this particular encoder that rotation in a clockwise direction results in A leading B in phase.
During this A leads B movement of the encoder, any of the following occurrences will result in a pulse being generated out of the up clock channel of the chip:
A going high when B is low.
B going high when A is high.
A going low when B is high.
B going low when A is low.
Conversely, when the encoder rotates in a counter-clockwise direction, B leads A in phase and it would be like starting on the right side of the diagram and moving to the left. During this B leads A movement of the encoder, any of the following occurrences will result in a pulse being generated out of the up clock channel of the chip:
B going high when A is low.
A going high when B is high.
B going low when A is high.
A going low when B is low.
The up and down clocks are then sent to a microcontroller chip in the display. The microcontroller chip has two counters in it that are used to keep track of the total number of up clocks and down clocks that have come in as a result of the position changes being reported by the encoder.
The microcontroller chip is programmed to constantly monitor the count values in the two counters, and does some simple arithmetic to keep track of any changes in position out at the encoder.
Scale Factors – Converting Counts to Units of Measurement
As was described above, the microcontroller within the display keeps track of the current position of the encoder by keeping count of the total number of up clocks and down clocks that have occurred. That difference in the number of up clocks and down clocks that have occurred is directly related to the current position of the encoder. That difference will be referred to as the net count value.
The net count value could be displayed directly on the LED digits of the display, but in most applications it is necessary to multiply the net count value by a scale factor value to convert to the desired units of measurement to be displayed.
For example, let us say that an encoder with 900 lines on the disk is connected to the digital display, and that it is desired that the LED digits on the display show readings in 0.1 of a degree increments This encoder has a resolution of 900 CPR (cycles per revolution) which results in 3,600 edges or counts per revolution because of quadrature. So the scale factor value that would be necessary to convert the net count value into degrees would be 0.1.
So if the current net count value is 1223 for example, the microcontroller would multiply 1223 by 0.1 and display the current encoder position as 122.3 degrees. The display manufactured and sold by CNL Devices Inc will come programmed with a scale factor value set in it of the customer’s choosing.
The Reset or Preset Button – Where Am I?
One characteristic of using incremental encoders with a digital display, is that when the system is first powered on, the current position of the encoder is not known. In most applications it is necessary to home the encoder to a known starting point, and then press the reset button or preset button on the display to set the reading on the display to zero or some starting preset value. Then as long as electrical power is maintained to the system, the position of the encoder will not be lost.
The display unit manufactured and sold by CNL Devices Inc has a button on it that will be factory programmed to function as either a reset to zero button or a preset to some initial starting value button. The function of the button will be specified by the buyer at the time of purchase.
Encoder resolution was explained, and we learned that putting more lines on the disk or linear strip results in higher resolution. The higher the resolution of an encoder, the smaller the changes in position that can be detected and measured.
We also learned that the actual resolution of the encoder is four times higher than the number of lines on the disk or linear strip because of quadrature.
So choosing the right encoder resolution is just a matter of asking yourself what is the smallest change in position that needs to be measured in this application, and then selecting an encoder with enough lines on the disk or linear strip to do the job.
The internal workings of a digital display were discussed. The electronics within the display converts the A and B quadrature signals from the encoder into up clocks and down clocks. A net count value resulting from the up and down clocks is multiplied by a scale factor value so that the value displayed on the LED digits of the display are in the desired units of measurement.
Also, it was explained that when first powering up a system comprised of an incremental encoder and a digital display, the current position of the encoder is not usually known. This makes it necessary to home the encoder to a known starting point, and then press a reset or preset button on the display to enter a starting position value.
And again, if you would like more information about the digital display unit manufactured and sold by CNL Devices Inc, you can contact their sales department at email@example.com.
Your comments and questions regarding this article are very much welcomed, and you can leave them in the comments section below.