Using Rotary Encoders with Arduino

702,677
0
2019-03-23に共有
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 - dronebotworkshop.com/rotary-encoders-arduino/
More articles and tutorials: dronebotworkshop.com/
Join the conversation on the forum: forum.dronebotworkshop.com/
Subscribe to the newsletter and stay in touch:dronebotworkshop.com/subscribe/

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.

And if you haven't subscribed to the YouTube channel then now is the time! Just hit the Subscribe button and you’re in the club!

Hope you enjoy the video, thanks for watching!

コメント (21)
  • As an avionics electronics technician I have to say that I really enjoy watching all of your very clear and to the point explanations. Keep up the good work Bill, it's really appreciated 👍👍👍
  • @RDarrylR
    I have to say you have some of the most detailed and well produced videos for arduino and electronics on youtube. I really hope your channel catches on even more and your subscriber count grows immensely. The majority of stuff you show i have learned from others before or on my own but you go in much more detail and i always pick up a few new things in each.
  • It's a bit ridiculous how much useful information is packed into your videos. I just watched the one on stepper motors, then this one, and already I feel I have a good enough understanding to get started with my own basic project. I like that you go through the theory as well as the application/code, both at a good pace. Every part of the video has a purpose, and I learn a lot from them throughout. Thanks so much for the lessons.
  • @dougb1542
    Hands down the best channel on youtube for electronic tinkerers! Your videos are very well done. Clear and concise explanations are so helpful to a person wanting to get back into electronics after several years. Thankyou Sir!
  • What a wonderfully perfect video. Clear, thorough, concise with no extra baggage. I really love your format. Keep up the great work!
  • my 62 years have enabled real pleasure watching AND learning from your production - very many thanks; I'll be back
  • Well done Bill. You are my go-to YouTube channel for arduino and motion control stuff. Your explanations and visual coverage of the topics are excellent and so helpful. Many thanks for this one, just needed to get get my head around rotary encoders for a CNC mill that I have been rebuilding.
  • I agree 100% with many of the comments here. Your videos are always straight to the point, little to no fluff, and easy to follow. Well done.
  • Man I love your videos. Thank you for your time, keep up the good work sir!
  • I always enjoy watching your videos. They are well presented, explainations are given, without too much waffle. Easy to understand for newbies and those wanting to learn, but equally enjoyable for more experienced people as there is no waffle to detract from the content. I hope to see many more videos from you as all that I have seen so far have been of very high quality.
  • Always i wonder how you teach like a 100yrs experienced in every project. Wonderful and crystal clear explanation. Thanks for all videos.
  • Sir, your channel is increasingly becoming my go-to resource for all things Arduino and ESP32! Your excellent content and outstanding production value brings me back for more. You're top 3 trending towards #1.
  • I'm far from being a beginner but I enjoy so much your videos ! It's a clean job ! The filming is excellent, the audio is crisp and your explanation is alway accurate and simple ! A real paradise for robotics enthousiasts ! Keep on the good job !
  • as usual, a great explanation that makes electronics and programming easy. Thank you very much for helping me to evolve, to become well educated. No price will be enough.
  • @dryan8377
    Thanks for this. I've been out of arduino for about 10 years now. Did some huge projects (17 code pages+) back then. This was very helpful!
  • Nice job. Just what I was looking for. I am a newby Arduino project guy, but have been in manufacturing control for 35+ years. Concepts easy, hardware/firmware constraints require learning. Fun! I am building a wooden boat with Arduino control of throttle and steering. Not a model...it is 16 foot. I want everything super light weight. Your videos will all help.
  • My grandpa has a difficult time figuring out if he has held his smartphone straight or upside down.. And then there is you who almost has technical knowledge to build a smartphone.. Hats-off to your explanations, better than most stuff seen on youtube..
  • Great job with the production quality! Your videos show you put effort into your work!
  • Another great video. I love how clear your wiring diagrams are. Thank you.
  • This is just what I needed to see for my Mechatronics project. Thank you so much for the brilliant video.