In this tutorial we will learn how a Rotary Encoder works and how to use it with an Arduino. You can watch the video below or read the written tutorial below.
1 Overview
A rotary encoder is a position sensor used to determine the angular position of a rotating shaft. It generates analog or digital electrical signals based on rotational motion.
There are many different types of rotary encoders classified by output signal or sensing technology. The specific rotary encoder we will be using in this tutorial is an incremental rotary encoder, which is the simplest position sensor for measuring rotation.
This type of rotary encoder is also known as a quadrature encoder or a relative rotary encoder, and its output is a series of square wave pulses.
2. Working principle of rotary encoder
Let's take a closer look at the encoder and see how it works. The square wave pulses are generated as follows: The encoder has a disc with evenly distributed contact areas connected to a common pin C and two other individual contact pins A and B as shown in the diagram below.
When the puck starts to rotate step by step, pins A and B will start to make contact with the common pin and two square wave output signals will be generated accordingly.
If we only count the pulses of the signal&#x