How to use Rotary Encoder with Arduino
Vložit
- čas přidán 14. 10. 2022
- My last video was a tutorial on how to use rotary potentiometer with Arduino. In this video I provide tutorial but this time for a different position sensor ... rotary encoder.
It is quite fascinating that this component looking similar to the rotary potentiometer is actually totally different.
Hope you would find this tutorial useful.
Link to the code:
www.hackster.io/mdraber/using...
If you like this content and you want to support me in creating similar videos go to my Patreon webpage
/ mariosideas
Or
www.paypal.com/cgi-bin/webscr... - Věda a technologie
Great Video...Would never have thought of using that kind of logic between the two pins with one interrupt handler.
Very good educational explaination. I finally understand how it works. I'm currently building a router lift and I will continue to try to connect a Stepper Driver and Stepper motor to make the rotations work correctly with absoule values (together with momentary push buttons) and fine tune the router bit with a rotary encoder in millimeters which would be displayed on a LCD or OLED screen. Thanks for an excellent video.
Awesome, nice explanation and great way of displaying the code
exactly what ive been looking for. Thumbs up👍
My pleasure:) like the video and subscribe to my channal. Also consider supporting it.
This was the best explanation about Rotary Encoder I have found!
Great to hear!
The skip in the digital count is probably caused by bouncing. A "debounce" circuit using CMOS 4093 Schmitt trigger ICs is better that having capacitors to ground - of course, this adds a layer of complexity, but it's doable. I am trying to use your Arduino code with a linear encoder (home-built) rather than a rotary switch for my application. Great easy to follow video and super graphics. Thanks.
This is very informative, thank you so much for the video and explanation
The best explanation ever.👍
Thanks:) Please give video a like if you enjoyed it
good explanation bro. ive found it easy than ever
Thanks:) Give this video a like then:) Also If you want to see future content like this subscribe and set the neotification not to miss my upcoming videos. There are also ways you can support my channel if you choose to:)
Thanks for this video and explanation. The « hesitation » you can see from « falling » trigger mode might be induced by some electrical rebound when contacts are opened/closed. Put a small 10nF between GND and CLK and GND and DT it should solve it :)
This worked beautifully thank you very much :D
bro I genuinely love you
Useful help !
I found this on Google. "FALLING triggers an interrupt when the signal changes from HIGH to LOW. LOW fires the interrupt for the ENTIRE time the signal remains LOW. So, if your ISR returns while the signal is LOW, the ISR will immediately be called again, after executing only a single instruction back in the foreground task."
I think what it is saying is with falling, if you have a bounce issue, it may false trigger, but if you force it to "LOW" then the bounce will be ignored. I believe that is what they are saying.
UPDATE: Actually, after reading this and some other stuff a few more times, I think I have it wrong. So I am in the same place as you, not really sure why LOW is working better in this situation.
EXACTLY:) I was digging myself and couldn't find reasonable answer
I think the ISR execution condition of >5ms since last interrupt makes the LOW mode work. This is because when the signal is LOW, the interrupts fires with the clock frequency, which is much faster than 5ms. Therefore, when not turning, ISR is not doing anything despite being fired all the time when the signal pin is low. When the signal pin is high, ISR is not fired anyway, so when rotating and passing from high to low, the >5ms execution time is fulfilled.
Absolutely perfect explanation ❤❤
Glad you liked it
Amazing! This is great help!! :)
Subscribe to the channal if you like this content
great explanation, I will try it
Cheers:) consider supporting my channel
Muito bem explicado!!!Parabéns pelo vídeo!
Grandes mentes hein?! :)
Great video❤loved, awesome 🇧🇷😉👏👏👏👏👏👏
Big thanks. Like the video:)
This has been helpful but in my case I'm trying to use a mouse scroll wheel rotary encoder (which you can get from a computer mouse or buy from amazon). Setting it up in a similar fashion, I can get it to function roughly in the right direction - as I keep scrolling up or down, the counter reliably keeps increasing or decreasing as expected but sometimes it will go in the wrong direction as well. I tried experimenting with different resistors but haven't found a fix. Maybe there's something wrong with my wiring. I'm very new to this.
great video
Thank you
Nice work
Glad you liked it:)
erratic behaviour is coming from contact bouncing. The simplest solution is to add caps to GND.
Thanks!
Thank you for your contribution:) Means a lot
Thanks
Thank you very much.
good
My pleasure:) like the video and subscribe to my channal. Also consider supporting it.
What happend if i connect the DT in the CLk, and The Clk in the DT ?
Then turning it clockwise would decrease the number and couterclocwise would increase it. So you would have opposite behaviour
Where is the code sir
This should be now fixed:)
Once I move the knob on the encoder the output runs so fast I can't read it and keeps running even if I don't turn the knob anymore.
Changed Serial.print to Serial.println and it starts a new line now, but the numbers don't change when I turn the encoder knob
Which exact place in the video you are reffering to
@@marios_ideas I'm referring to the code I got from the link
Cd4026 et ne555 one kilo ehz
A word of explanantion?
:)
Excellent video, very didactic.. thanks..
Glad you enjoyed it!