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.

——————–
WHERE TO BUY
——————–

1. Arduino Mega: https://educ8s.tv/part/ArduinoMega

2. Nokia 5110 LCD: https://educ8s.tv/part/NOKIA5110

3. Rotary Encoder: https://educ8s.tv/part/RotaryEncoder

4. Wires: https://educ8s.tv/part/Wires

5. Small Breadboard: https://educ8s.tv/part/SmallBreadboard

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!
[adsense]

——————–

LIBRARIES
——————–

Encoder library: https://github.com/0xPIT/encoder/tree/arduino

TimerOne library: https://github.com/PaulStoffregen/TimerOne

——————–

CODE OF THE PROJECT
——————–

 

 

 

——————–

SUBSCRIBE ON YOUTUBE

——————–

Never miss a video: Subscribe to educ8s.tv