How to use Rotary Encoder with Arduino

  Рет қаралды 40,126

Mario's Ideas

Mario's Ideas

Жыл бұрын

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...

Пікірлер: 53
@Majk369
@Majk369 Жыл бұрын
exactly what ive been looking for. Thumbs up👍
@marios_ideas
@marios_ideas Жыл бұрын
My pleasure:) like the video and subscribe to my channal. Also consider supporting it.
@garylarson3751
@garylarson3751 5 ай бұрын
Great Video...Would never have thought of using that kind of logic between the two pins with one interrupt handler.
@youssefmostafa5788
@youssefmostafa5788 2 ай бұрын
Awesome, nice explanation and great way of displaying the code
@Vandebilt
@Vandebilt 2 ай бұрын
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.
@mans4104
@mans4104 Жыл бұрын
The best explanation ever.👍
@marios_ideas
@marios_ideas Жыл бұрын
Thanks:) Please give video a like if you enjoyed it
@bahaajobs
@bahaajobs 7 ай бұрын
This is very informative, thank you so much for the video and explanation
@kasia2240
@kasia2240 Ай бұрын
This was the best explanation about Rotary Encoder I have found!
@marios_ideas
@marios_ideas Ай бұрын
Great to hear!
@o.z.hamzah1707
@o.z.hamzah1707 4 ай бұрын
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.
@josephgitau280
@josephgitau280 Жыл бұрын
good explanation bro. ive found it easy than ever
@marios_ideas
@marios_ideas Жыл бұрын
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:)
@kvnl1037
@kvnl1037 11 ай бұрын
Useful help !
@TheUnofficialMaker
@TheUnofficialMaker 11 ай бұрын
great explanation, I will try it
@marios_ideas
@marios_ideas 10 ай бұрын
Cheers:) consider supporting my channel
@Anton-wc7lb
@Anton-wc7lb Жыл бұрын
Amazing! This is great help!! :)
@marios_ideas
@marios_ideas Жыл бұрын
Subscribe to the channal if you like this content
@souley_garage
@souley_garage 11 ай бұрын
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 :)
@tinyjudoka6024
@tinyjudoka6024 6 ай бұрын
This worked beautifully thank you very much :D
@zeepichashbrown4676
@zeepichashbrown4676 3 ай бұрын
bro I genuinely love you
@francoisdastardly4405
@francoisdastardly4405 5 ай бұрын
Absolutely perfect explanation ❤❤
@marios_ideas
@marios_ideas 5 ай бұрын
Glad you liked it
@ernandofranco8448
@ernandofranco8448 Жыл бұрын
Muito bem explicado!!!Parabéns pelo vídeo!
@panoramix3192
@panoramix3192 5 ай бұрын
Grandes mentes hein?! :)
@arduinomaquinas
@arduinomaquinas 10 ай бұрын
Great video❤loved, awesome 🇧🇷😉👏👏👏👏👏👏
@marios_ideas
@marios_ideas 10 ай бұрын
Big thanks. Like the video:)
@jumbo999614
@jumbo999614 Жыл бұрын
great video
@marios_ideas
@marios_ideas Жыл бұрын
Thank you
@markgreco1962
@markgreco1962 Жыл бұрын
Nice work
@marios_ideas
@marios_ideas Жыл бұрын
Glad you liked it:)
@duanebeyer950
@duanebeyer950 Жыл бұрын
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.
@marios_ideas
@marios_ideas Жыл бұрын
EXACTLY:) I was digging myself and couldn't find reasonable answer
@gs051233
@gs051233 8 ай бұрын
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.
@sampetri4887
@sampetri4887 10 ай бұрын
Thanks!
@marios_ideas
@marios_ideas 10 ай бұрын
Thank you for your contribution:) Means a lot
@plamenpetkov7132
@plamenpetkov7132 9 ай бұрын
erratic behaviour is coming from contact bouncing. The simplest solution is to add caps to GND.
@johancoetzee6540
@johancoetzee6540 Ай бұрын
Thanks
@marios_ideas
@marios_ideas Ай бұрын
Thank you very much.
@PostalPete
@PostalPete 3 ай бұрын
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.
@lgswitch4813
@lgswitch4813 Жыл бұрын
good
@marios_ideas
@marios_ideas Жыл бұрын
My pleasure:) like the video and subscribe to my channal. Also consider supporting it.
@salim.studio
@salim.studio 4 ай бұрын
What happend if i connect the DT in the CLk, and The Clk in the DT ?
@marios_ideas
@marios_ideas 4 ай бұрын
Then turning it clockwise would decrease the number and couterclocwise would increase it. So you would have opposite behaviour
@liverecon769
@liverecon769 Жыл бұрын
Where is the code sir
@marios_ideas
@marios_ideas Жыл бұрын
This should be now fixed:)
@Scott.Farkus
@Scott.Farkus 6 ай бұрын
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
@marios_ideas
@marios_ideas 6 ай бұрын
Which exact place in the video you are reffering to
@Scott.Farkus
@Scott.Farkus 6 ай бұрын
@@marios_ideas I'm referring to the code I got from the link
@driss25
@driss25 Жыл бұрын
Cd4026 et ne555 one kilo ehz
@marios_ideas
@marios_ideas Жыл бұрын
A word of explanantion? :)
@egyrmexiq1
@egyrmexiq1 7 ай бұрын
Excellent video, very didactic.. thanks..
@marios_ideas
@marios_ideas 7 ай бұрын
Glad you enjoyed it!
How to use rotary encoders
14:12
FriendlyWire
Рет қаралды 28 М.
How to use interrupts in Arduino projects
12:38
Mario's Ideas
Рет қаралды 7 М.
MEU IRMÃO FICOU FAMOSO
00:52
Matheus Kriwat
Рет қаралды 40 МЛН
Каха ограбил банк
01:00
К-Media
Рет қаралды 11 МЛН
버블티로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 96 МЛН
Уроки Arduino. Работа с энкодером
10:55
Заметки Ардуинщика
Рет қаралды 179 М.
Turn any DC Motor into a Servo Motor
25:24
How To Mechatronics
Рет қаралды 278 М.
Rotary Encoder Craziness
3:17
Grateful Frog
Рет қаралды 3,6 М.
How to use a Rotary Encoder with an Arduino - CODE EXPLAINED!
21:11
#226 ROTARY ENCODER with no switch bounce 🤓 - you MUST use this
25:49
HACKED!: Using an HDD Motor as a Rotary Encoder?!
8:21
GreatScott!
Рет қаралды 1,5 МЛН
Adventures in Science: How to Use Rotary Encoders
12:05
SparkFun Electronics
Рет қаралды 222 М.
Rotary Encoders: A Comprehensive Guide to Understanding and Using Them
7:44
Rotary Encoder (KY-040) Debounce Circuit Tutorial
15:03
ForceTronics
Рет қаралды 17 М.
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 4,7 МЛН
Игровой Комп с Авито за 4500р
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,7 МЛН
Ультрабюджетная игровая мышь? 💀
1:00
GamePad İle Bisiklet Yönetmek #shorts
0:26
Osman Kabadayı
Рет қаралды 149 М.
Hisense Official Flagship Store Hisense is the champion What is going on?
0:11
Special Effects Funny 44
Рет қаралды 2,5 МЛН