

+V – The VCC or positive supply voltage, usually 3.3 or 5-volts.The pinouts of the control encoder are as follows: It also has its own push button momentary contact switch that can be activated by pressing down upon the shaft. The encoder can be mounted exactly like a potentiometer, and it has a D-shaft to accept a knob. It’s also included in the infamous “37 in one” sensor kit that is available at many electronic stores and online.


The control encoder we are going to use is a very common device, and it’s available from several sources. By checking to see which pulse comes first we can determine the direction of rotation. In both cases the pulses can be counted to determine how much the shaft has rotated. If the encoder shaft is rotated counterclockwise then the bottom set of pulses will be delivered before the top set. The sensor on the top is triggered before the bottom one, so the top set of pulses precedes the bottom set. In the above example the encoder shaft is spinning clockwise. Which sensor goes first is determined by the direction of rotation. The sensors, which can be magnetic (hall effect) or light (LED or Laser), produce pulses when the encoder shaft is rotated.Īs there are two sensors in two different positions they will both produce the same pulses, however, they will be out of phase as one sensor will pulse before the other one. These encoders have two sensors and output two sets of pulses. These are sometimes called quadrature or relative rotary encoders. I’m restricting this discussion to the simpler “incremental” encoders. There are several different types of rotary encoders. Rotary encoders are used in many different applications including industrial controls, robotics, optomechanical mice and trackballs, CNC machines and printers. The difference is the absolute encoder gives the precise position of the shaft in degrees, whereas the incremental encoder reports how many increments the shaft has moved, but not its actual position. There are two main types of rotary encoder: absolute and incremental. We will be focusing on digital devices today.
#Jivelite rotary encoder how to#
I will show you how to hook them up to an Arduino and I’ll give you some demonstration sketches that you can run yourself.Ī rotary encoder, which can also be referred to as a shaft encoder, is an electro-mechanical device that can convert the angular position (rotation) of a shaft to either an analog or digital output signals. Today we will look at both types of rotary encoders.

One of them is to measure the rotation of a DC gearmotor. They can be used when you need a very precision control, and they are not subject to drift due to temperature.Īs a device to measure mechanical rotation rotary encoders have several uses. If the value of DT and CLK (pin interrupt of Arduino Uno) is the same, then the "encoder0Pos" variable will be incremented / added, in addition to that condition, the "encoder0Pos" variable is decremented.When used as a control, rotary encoders can be much more versatile than a potentiometer. In the "doEncoder" function is calculated from the rotary encoder. In line 10 of the sketch above is used to enable the interrupt of pin 2 Arduino Uno. If (digitalRead(encoder0PinA) = digitalRead(encoder0PinB)) #define encoder0PinA 2 #define encoder0PinB 3 In the following tutorial, which will be used as an interrupt is PIN 2 of Arduino Uno, while PIN 3 is only used as a regular input.
