Using Rotary Encode...
 
Notifications
Clear all

Using Rotary Encoders with Arduino

1 Posts
1 Users
0 Likes
1,199 Views
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1076
Topic starter  

Rotary encoders are versatile devices that can be used both as controls and as instruments to measure the rotation of a DC motor. Today I will show you how to do both of those things using rotary encoders and an Arduino.

Complete article with code - https://dbot.ws/rotenc

We will look at two types of rotary encoders today. The first one is a very common control that looks a bit like a potentiometer but, as you will see, is much more accurate and versatile.

The second rotary encoder we’ll examine is attached to the back of the DC Gearmotor I’m using to build my DB1 robot.

Both encoders work on similar principles.

I’ll show you how rotary encoders can determine both the position and direction of rotation by using and comparing two output pulses. Then we will create and run a few Arduino sketches to put them to use.

In the first sketch, we will see how to read the value from a rotary encoder control. Next, we will add a servo motor and precisely control its position with a rotary encoder.

After that, we will bring out the servo motor encoder. We will look at the output pulses on an oscilloscope, then we will connect it to an Arduino to build a tachometer of sorts, reading the RPM of the motor.

Here is the Table of Contents for today's video.

00:00 - Introduction
02:15 - Rotary Encoder Operation
06:13 - Basic Rotary Encoder Control Sketch
12:09 - Controlling a Servo Motor
18:40 - Rotary Encoder on a DC Gear Motor
21:08 - Reading RPM from a Motor

As usual, you will find all of the code in a detailed article on the DroneBot Workshop website at https://dbot.ws/rotenc.

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
Quote