Rotary Encoders: A Comprehensive Guide to Understanding and Using Them

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
look at this plate when I rotate this plate you have no doubt that I am rotating the plate clockwise and if I reverse its Direction Still You have no doubt about direction right you are humans and it's very easy for you to detect the direction of movement and estimate the speed of rotation but this is very complicated task in electronics you have to use rotary encoders in this video I'm going to talk about rotary encoders and I will explain how a rotary encoder can help us to detect the direction of movement and estimate the speed of rotation The Best Is Yet To Come so keep watching till the end this is very basic model of a rotary encoder rotary encoders are used in many modern devices as a user interface mainly to select something from selecting the desired washing program in a washing machine to seeking a song on a car stereo let's look closer at a real rotary encoder module there are five pins on the module CLK DTW plus and ground pins by applying source and ground voltages to plus and ground pins the module will be powered up and ready to be used then by rotating the handle two signals with shifted phases will appear at CLK and DT pins these two signals will appear at CLK and DT pins these two signals are the same with a little shift in their phase I know the phrases like shifted phase is not much understandable to most of viewers so I'm going to explain it in simple words this is simplified model of a rotarian coder look there are two points here a red point and a blue one when I rotate the plate clockwise like this the blue point is covered first then the red point is covered and if I continue to rotate the plate clockwise the blue point is uncovered first then the red point is uncovered moreover if I rotate the plate counterclockwise like this the red point is covered first then the blue one and the red point is uncovered first then the blue one the order of covering or uncovering the points will indicate the direction of rotation now we have the main idea behind rotary encoders and many other direction indicator systems suppose that these two points are electrodes and the plate is ground and I pulled up the electrodes to 5 volt using these pull-up resistors now when the plate is not covering the points like this the voltage at these two points has to be 5 volts but when the plate is covering the points the voltage at these two points will be equal to 0 volt so when you turn the plate clockwise the voltage at Blue electrode will be pulled down before the red electrode and when you turn the plate counterclockwise the voltage at red electrode will be pulled down before the blue electrode actually you can watch the voltages at red and blue electrodes if the voltage at Blue electrode changes before red electrode it means that the plate is rotating clockwise and if the voltage at Blue electrode changes after red electrode it means that the plate is rotating counterclockwise this is the phase shift in simple words the silver colored thing on the module is the main rotary encoder component look this is the main rotary en their component these two pins here are the push button pins inside the module you can hear the click sound when I press the button and these three pins here are the main rotary encoder pins this is the plate inside the component and these two are the electrodes actually this plate is doing the same job as the red plate here look the handle is connected to the plate inside the component when I rotate the handle the plate inside the component rotates the pin in the Middle look here the pin in the middle is connected to the plate and side pins are electrodes let me connect the plate to ground and connect side pins to LEDs in this way as you can see when I rotate the handle both LEDs are blinking yes that's right both seems to have the same state at any moment but what if I rotate the handle very slowly as you can see when I turn the handle clockwise it's the red LED that turns on First and it turns off first either way in contrast when I turn the handle counter clockwise it's the second LED I mean the blue LED that toggles first look when both of LEDs are turned on the first led that turns off indicates the Direction look when I turn the handle clockwise it's the red LED and when I turn the handle counterclockwise it's the blue LED also when both of LEDs are turned off the first led that turns on indicates the Direction look when I turn the handle clockwise it's the red LED that turns on First and when I turn the handle counter clockwise it's the blue LED that turns on first in a more precise terms the CLK and DT pins will pass binary patterns in a certain order if the handle turns clockwise they will pass binary pattern in this order and if the handle turns counterclockwise they will pass the patterns in a reverse order like this this is enough for detecting the direction of rotation now let's do another experiment I'm going to connect the rotating coder to a microcontroller and use the rotation information for increasing or decreasing the speed of a DC motor this is the rotary encoder component here when the handle is rotated the microcontroller detects the rotation direction and it will change the duty cycle of the output signal the output signal is used to fit the base terminal of the DC motor driver transistor here look also there is a buzzer here to beep at any speed change and beep longer when this speed is zero or is maximum look as you can see I'm able to change the speed of this DC motor using this rotary encoder and then this speed tries to get out of the defined range the buzzer makes a specific alert look the same mechanism can be implemented to detect if a person or a car is coming into a place or going out of it maybe it's a good idea to make a video about it if it is please let me know in comment section below anyway we have reached the final moments of this video I hope you enjoyed watching this video if so please help my channel grow by hitting the like button and subscribing for more videos
Info
Channel: Electronic Wizard
Views: 5,536
Rating: undefined out of 5
Keywords: Technology, DIY, Electronics, Rotary Encoders, Rotation Direction Detector, Rotation Speed
Id: S2BfGMqe3kQ
Channel Id: undefined
Length: 7min 44sec (464 seconds)
Published: Mon Apr 15 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.