Arduino Rotary Encoder Tutorial

Home/Arduino Projects/Arduino Rotary Encoder Tutorial

Arduino Rotary Encoder Tutorial

Dear friends, welcome back! Today, we take a look at rotary encoders using Arduino.

Intro to Arduino Rotary Encoder Tutorial

A rotary encoder, this device here, is an electromechanical device, that converts angular position or rotation of a shaft into analog or digital code. In simple words, when i turn the shaft to the right it increases its valueand when i turn it to the left, it decreases its value.

The main advantage of the rotary encoders is that we can turn them unlimited times. So, this rotary encoder has 20 positions.

Let’s look.

We are now at position 10, so the value is 10.

Let’s go back to position 0 by turning it to the right. You can see that the value is 20 I can still turn it to the right and the value increases.

When I turn it to the left, the value decreases and the position decreases as well.

Rotary encoders are used in many applications that require precise and unlimited rotation, like industrial control, robotics or computers and microcontrollers, like the projects that we are building.

Another very useful feature of this rotary encoder is that it has a button embedded. As you can see, I can click the rotary encoder and Arduino recognizes the click and shows clicked message here.


1. Arduino Mega:

2. Nokia 5110 LCD:

3. Rotary Encoder:

4. Wires:

5. Small Breadboard:

Full disclosure: All of the links above are affiliate links. I get a small percentage of each sale they generate. Thank you for your support!



Encoder library:

TimerOne library:










Never miss a video: Subscribe to


Leave A Comment