Rotary encoder is an electro-mechanical instrument that that converts rotational motion into analog or digital information. Apparently it seems like potentiometer however it has turning capability in both clockwise as well as counter-clockwise directions upto infinite extent. In this article we will see Arduino rotary encoder wiring.
Rotary encoders are of several types. Two main types include relative (incremental) and absolute encoders. The output of absolute encoder is a value proportional to the current shaft angle while incremental encoder’s output is step of shaft and its direction.
Rotary Encoder Pinout:
Rotary encoder has 5 pins; three of them on encoder side while two on the click button side.
The two (1 & 2) pins are actually push buttons where 1 is grounded and 2 acts like a switch while on encoder side the corner pins (3 & 5) are connected to the Arduino board whereas the middle pin of the encoder is grounded.
However when rotary encoder is mounted on the breakout board, all the five pins are available on the same side. The pictorial comparison is given below.
Arduino Rotary Encoder Wiring :
Arduino rotary encoder wiring is shown below.