Thank you for the compliment! But rest assured I am not giving up :) I moved internationally and I only now have all my electronics stuff in one place again. I am working on the next tutorial on LCDs :)
Thank you so much for this. I was trying to troubleshoot a toaster and I got to this dial part. The PCB marked it as "VR1" so I interpreted that as a variable resistor or potentiometer. When testing it as such obviously I thought the part was broken, but now I know it's just one of these encoders. I tested it with that LED circuit you showed in the video and it works fine. So glad I learned about a new part today!
Wow that's awesome, I am glad you did not get intimidated and learned something new. Be sure to be careful with anything attached to line voltage, though. Thanks for your comment, and I hope it inspired you to learn more about electronics. Have a great day!
@@orides5976 I see! Any particular reason you like these chips? I quite like the PIC16F1455/59 because of their nice peripherals (as well as the internal 48MHz clock).
Thank you, glad you like it! It's a bit of a puzzle for me for every video to try and make it look neat, and I do enjoy the challenge, but ultimately I hope that it can make the videos more fun and easy to follow :) Have a great weekend!
4:06 Thank You!!! A friend of mine has had this trick up their sleeve for a while… When I asked about it originally, they said it’s not worth putting the time and effort into. I completely forgot about it until now… though It all makes sense, they probably removed that copper spring. Once it’s gone though, the clicky steps can still be desired. THe realization at that point just replacing with a new one is probably the best option because the spring is long gone in the trash 😂
Haha yeah that spring wears out quickly on the cheaper encoders, and there is indeed some residual "bumpiness" that you can feel with the spring removed.
This video is fantastic, very clear and efficient presentation with enough technical depth to get a strong understanding of why it works. I love the diy mega encoder!
Thanks Jens. That was interesting. I really liked your supersized implementation of the encoder, I think that demonstrated the behaviour better than any I've seen. Take care.
@@FriendlyWire Thank you so much for your hard work! thanks to your videos, I wrote my own library for displaying messages on the LED matrix running MAX7219 and it was your video that helped me in this, it was the most detailed and informative, thanks from Russia
It can be dust inside the rotary encoder. Get some compressed air and try to get rid of it. I had a similar case a few years back, and after the compressed air it worked fine again. Good luck, and let us know what you find :)
@@FriendlyWire The rotary encoder in my keyboard has clips located underneath, so I couldn't open it without desoldering. I went ahead and desoldered it from the module, then carefully cleaned the inside with a Q-tip. After reassembly, it's now working perfectly. I'm not entirely sure what caused the issue, as I didn’t find any visible dust or debris. It’s possible something very small got lodged in the contacts. There was a decent amount of lube inside as well, which seemed fine. I soldered the encoder back in place, but since I don’t have proper desoldering tools, I only used a minimal amount of solder just enough to hold it in. This way, if the problem returns, it’ll be easier to remove again. It’s been a week now, and everything’s still functioning well. Thanks for the vid I have a good guide what is in the inside and how it works.
@@jervx829 Wow, that sounds like quite the operation! Congratulations, and yes, it's quite possible that there was a small piece of debris that affected the inside contacts. Thanks for sharing, and congratulations again, nicely done! :)
Grandioses Video! Hab endlich effektiv und präzise den Background dazu erlernt. Vielen Dank. PS: Ich schaue seit 15 Jahren solche Videos und hab noch nie diese "flimmernden" Leitungen gesehen (als Hervorhebung). Dafür müsstest Du eine Medallie bekommen ! Ich werde dieses Video als "Mahnung" verlinken, sobald ich von jemand anderem ein Video sehe wo z.B. aus einer schwarzen eine dunkelblaue Leitung wird (gleiche dicke, ohne Animation)......
Vielen Dank fuer Deine netten Worte, es freut mich sehr, dass Dir der Stil meiner Videos gefaellt. Es dauert relativ lange, diese Animationen zu zeichnen und dann zu animieren, aber ich glaube, dass es den Inhalt verstaendlicher machen kann. Viele Gruesse aus den USA!
I talk a little bit about it in the video, but the short answer is: no, because it uses Gray code, so the worst that can ever happen during a bounce is that you are "off by 1" but never more than that.
Hi Jens(?). I have a question. I’m wondering if you might consider breadboarding some sound projects? But with discreet components; no coding. I’d enjoy seeing other discrete component circuit projects. You’re doing a great job. So friendly and professional. You’re quite educated!
Thank you, Sarah, this is a great suggestion. I enjoy projects with discrete components (like the code lock) but they can get rather complex quickly. Do you have a good suggestion for a sound project? I don't know that much about it! (And thank you for your kind words!)
It all depends on how often you call the ISR. In this case, it's called with approximately 3906 Hz, which is not very often, only every 0.25ms. The controller runs at 4MHz which for PICs means an instruction cycle is around 1us, so the ISR is called approximately every 256 instructions. The ISR contains much less than 256 instructions, so it's not a big deal. If you are worried, you could try to reduce the ISR frequency and see when it starts to affect the performance of the rotary encoder. Hope this helps :-)
Hi. I'd like to use a rotary encoder with an esp32. Is it okay to use it "raw" or do I have to use it on a module board (with 4 pins) ? If I use it raw, do I have to add resistors, or does the esp have internal pull up resistors like the chip you use in the video? I'm sorry I don't know anything about resistors...
Thank you for the question! This all depends on the inputs of your ESP32. I am not an expert on these chips, but in general it does not hurt to add pullup resistors. If the circuit works between 3-5V, then 4.7 kilo Ohm resistors are a good choice. I am not really sure, however, what you mean by the module board. Do you have a link? These module boards are not usually needed if you program the microcontroller yourself, like in this video, because we do all the decoding ourselves in software :)
So the hardware timer hits it's maximum count value 3906 times a second? (I had to look up what an overflowing timer was haha) That must be counting extremely fast! Thanks for the response!@@FriendlyWire
@@delta-a17 Yes, you got it! I can break it down for you in some more detail. The code runs at 4 MHz, but due to the PIC architecture it means it can only process 1 million instructions per second. The timer is 8 bit wide, which means it can count from 0 to 255. If you divide 1,000,000 by 256 you get 3906. This means that an 8 bit timer, when driven at 1MHz, "flows over" around 3906 times per second :)
@@FriendlyWire #russiaisaterroriststate BTW, thank them again. They just blew up a big hydroelectric power plant in Ukraine, causing a huge disaster - tens of thousands (!) of people will loose everything, some of them will drown or become MIA.
pelase do the same with the "dual" endless pots found on akai apc40 mk1 mk2 or native instruments machine mk1 mk2 mk3 etc. those have no detend and are way better. i would love to understand them, they have 4 pins.
Ohh, interesting, do you have a link to one of these potentiometers? I am always interested in new topics to cover in upcoming tutorials, so I would really appreciate it! Thank you!
neat explaination !!! instantly SUBSCRIBEEED .... nowadays more and more companies are switching to ARM based controllers so can u make some vids on stm32 with various sensors
Thank you so much, glad you liked the video! I may stick with PIC microcontrollers for a bit more, but I am curious about others, too, so: you never know, I may cover them at some point :)
10:55 part about decoding direction deserves slower and more repetitions ...because it is the most important part of not understanding principle. But overall great video
Thank you for your feedback! :) Yes, it could use more time, I agree with you. Sometimes it's hard to decide for me how much detail to put in the video. For this reason I always write a companion article to each video, which usually has more details. You can check it out here: www.friendlywire.com/tutorials/rotary-encoder/#ch7 Let me know if it makes sense or if you have questions, I am happy to help!
@@FriendlyWire Yup i did the same, I used (for testing) 3x CD4094 in daisy chain mode but I'm havng problems with timings on grids, can't fgure it out. If i manually set output bytes they apear proper but when i add the part with analog inputs, everything is flickering and shows garbage. Both parts work separate, when i use ports directly, analog part works perfect, and when the part with shift registers is alone. The problem comes when i have to send AN0 and AN1 variables through shift registers along with GRID positions. I am sure that many people would like to build a device like this. ;)
@@technixbulI am not sure why anything would flicker in this way, it shouldn't. Can you send me your code? My email is at the bottom of www.friendlywire.com :)
That is strange! So the outputs are either 00 or 11? That is definitely not Gray code. Do you have a link to that encoder? I would suspect that it may be broken.
My advice is not to use MCLR pin as the input for rotary encoder SW. Instead use other free pin. The reason is because when programming the PIC, a high voltage (because you must have disabled LVP to allow MCLR as input) is delivered to MCLR and if you accidentally pressed the SW, it will be shorted to GND and might damage the PICKit3 MCLR output driver.
Good point! The MCLR pin is the only one left with an internal pullup resistor, which is why I used it. Since it's connected to the pushbutton, chances that it's pressed while being programmed are almost zero. But if you want to add external pullups you can use other pins too, of course.
@@FriendlyWire In that case I suggest putting a 600 Ohms resistor in between the PICKit3's MCLR connection and the rotary encoder's SW. This value is big enough to limit the current (~15mA max) if it is accidentally shorted when programming and is small enough for PIC to detect a low (
Thanks for the suggestion! I am not sure if shorts are the way to go, to be honest, because I like to explain things properly, and shorts may bring in people with a different expectation :)
@@digital_madness-pp8cw Saw the message, it was from 2 days ago. To answer your question: yes, you can change the code so that an input value of 0-5V can be sent to the computer via RS232. But writing such a program from scratch takes time. What kind of timing/resolution requirements do you have?
@@digital_madness-pp8cw I am sorry, but I still don't understand exactly what you need. Can you explain it in more detail? And what kind of resolution do you need, both in voltage and in time? Some numbers would be good! :)
How do you know how many stops a rotary encoder has? Is this information on the part's data sheet somewhere? Do they come with different numbers of stops?
Yeah they go by different names, and for cheap ones that don't have datasheets it's a bit of a guess, unfortunately. But commonly the situation with the detents/stops is similar to what is shown in the video.
This channel deserves wayyyy more subscribers
Thank you for your kind words, I am so glad you like the videos! :)
Yes this channel really deserves so more subscribers ❤🎉
@@kalvo-no7oq Thank you, too :)
I love your demonstrations, they are very helpful for understanding!
Thank you so much, Sebastien, much appreciated :)
it’s just so sad to see quality content creators not getting enough recognition and giving up
Thank you for the compliment! But rest assured I am not giving up :) I moved internationally and I only now have all my electronics stuff in one place again. I am working on the next tutorial on LCDs :)
Thank you so much for this.
I was trying to troubleshoot a toaster and I got to this dial part. The PCB marked it as "VR1" so I interpreted that as a variable resistor or potentiometer.
When testing it as such obviously I thought the part was broken, but now I know it's just one of these encoders.
I tested it with that LED circuit you showed in the video and it works fine. So glad I learned about a new part today!
Wow that's awesome, I am glad you did not get intimidated and learned something new. Be sure to be careful with anything attached to line voltage, though. Thanks for your comment, and I hope it inspired you to learn more about electronics. Have a great day!
Thank you for using PICs! I´m not feeling so alone anymore! 🙂
Ha, I'm glad you like them, too :) Which ones do you use?
@@FriendlyWire Currently i have been using the 16F1829 and 16F1824.
@@orides5976 I see! Any particular reason you like these chips? I quite like the PIC16F1455/59 because of their nice peripherals (as well as the internal 48MHz clock).
Beautiful wiring on those breadboards, man!
Thank you, glad you like it! It's a bit of a puzzle for me for every video to try and make it look neat, and I do enjoy the challenge, but ultimately I hope that it can make the videos more fun and easy to follow :) Have a great weekend!
4:06 Thank You!!!
A friend of mine has had this trick up their sleeve for a while…
When I asked about it originally, they said it’s not worth putting the time and effort into.
I completely forgot about it until now… though It all makes sense, they probably removed that copper spring. Once it’s gone though, the clicky steps can still be desired. THe realization at that point just replacing with a new one is probably the best option because the spring is long gone in the trash 😂
Haha yeah that spring wears out quickly on the cheaper encoders, and there is indeed some residual "bumpiness" that you can feel with the spring removed.
This video is fantastic, very clear and efficient presentation with enough technical depth to get a strong understanding of why it works. I love the diy mega encoder!
Thank you for your kind words, I am glad you liked the video! And building the mega encoder was fun, too :)
Great information. Your animations and style is also very fun and entertaining. Keep up the good work!
Thank you, glad you liked it! And your user name even has "digital encoders" in it, so it means a lot :)
Outstanding explanation ! Thanks
I am glad you like it, and thank you for your kind words!
Thanks Jens. That was interesting. I really liked your supersized implementation of the encoder, I think that demonstrated the behaviour better than any I've seen. Take care.
Thank you, Jerry, glad you like it! :)
@@FriendlyWire Thank you so much for your hard work! thanks to your videos, I wrote my own library for displaying messages on the LED matrix running MAX7219 and it was your video that helped me in this, it was the most detailed and informative, thanks from Russia
@@farted-in-secret Fantastic, I am glad you find the video helpful! :)
Thanks my F75 keybord volume knob literally jumps value, this vid will help a lot. Should I just clean it or replace the EC11?
It can be dust inside the rotary encoder. Get some compressed air and try to get rid of it. I had a similar case a few years back, and after the compressed air it worked fine again. Good luck, and let us know what you find :)
@@FriendlyWire The rotary encoder in my keyboard has clips located underneath, so I couldn't open it without desoldering. I went ahead and desoldered it from the module, then carefully cleaned the inside with a Q-tip. After reassembly, it's now working perfectly. I'm not entirely sure what caused the issue, as I didn’t find any visible dust or debris. It’s possible something very small got lodged in the contacts. There was a decent amount of lube inside as well, which seemed fine.
I soldered the encoder back in place, but since I don’t have proper desoldering tools, I only used a minimal amount of solder just enough to hold it in. This way, if the problem returns, it’ll be easier to remove again. It’s been a week now, and everything’s still functioning well. Thanks for the vid I have a good guide what is in the inside and how it works.
@@jervx829 Wow, that sounds like quite the operation! Congratulations, and yes, it's quite possible that there was a small piece of debris that affected the inside contacts. Thanks for sharing, and congratulations again, nicely done! :)
Your explanation is very nice
Thank you for your kind words! :)
Just found your channel. Subbed
Wow, thanks so much! :)
@FriendlyWire I hope you get plenty of subs! Your channel is fantastic
Clever management of unexpected A&B status. As always, smart filters are the success key. Thanks
I would love to claim that I came up with the algorithm, but I did some research and found the one I presented in the video online :)
Grandioses Video! Hab endlich effektiv und präzise den Background dazu erlernt. Vielen Dank.
PS: Ich schaue seit 15 Jahren solche Videos und hab noch nie diese "flimmernden" Leitungen gesehen (als Hervorhebung). Dafür müsstest Du eine Medallie bekommen !
Ich werde dieses Video als "Mahnung" verlinken, sobald ich von jemand anderem ein Video sehe wo z.B. aus einer schwarzen eine dunkelblaue Leitung wird (gleiche dicke, ohne Animation)......
Vielen Dank fuer Deine netten Worte, es freut mich sehr, dass Dir der Stil meiner Videos gefaellt. Es dauert relativ lange, diese Animationen zu zeichnen und dann zu animieren, aber ich glaube, dass es den Inhalt verstaendlicher machen kann. Viele Gruesse aus den USA!
This is nice explanation. Thank you for this video
Thank you for your nice comment, I am glad you found the video helpful! :)
Well you did it! I am now using a rotary encoder in my Project. Super Video ❤
Ha, that's awesome, Mohammed! Thank you for your kind words, and congratulations! :)
Brilliant video, extremely useful information for my projects❤
Thank you, Adhithya, glad you find the video useful! :)
This was very helpful and I’ve learned a lot. Thank you!
Thank you so much, I am glad you liked the video!
That's a nice video Boss👍👍👍, I've just subscribed to your channel and liked your video..........Hello from Ghana, Africa✌✌✌
Thanks so much, I am so glad you like it! Best wishes from Germany! :)
Nice work
Thank you, Mark!
Does a rotary encoder need to be concerned about switch bounce?
I talk a little bit about it in the video, but the short answer is: no, because it uses Gray code, so the worst that can ever happen during a bounce is that you are "off by 1" but never more than that.
Well explained.
Thank you, glad you like the video! Have a great day :)
Hi Jens(?). I have a question. I’m wondering if you might consider breadboarding some sound projects? But with discreet components; no coding. I’d enjoy seeing other discrete component circuit projects.
You’re doing a great job. So friendly and professional. You’re quite educated!
Thank you, Sarah, this is a great suggestion. I enjoy projects with discrete components (like the code lock) but they can get rather complex quickly. Do you have a good suggestion for a sound project? I don't know that much about it! (And thank you for your kind words!)
Superb bro,explanation very well.❤
Thank you, glad you like it! :)
Thanx for this informative video ...
Please can you make a video on hx710b pressure sensor 😅
Thank you for your feedback, I will look into the sensor you mentioned. :)
Is this consider "much" code for a ISR? thank you in advance.
It all depends on how often you call the ISR. In this case, it's called with approximately 3906 Hz, which is not very often, only every 0.25ms. The controller runs at 4MHz which for PICs means an instruction cycle is around 1us, so the ISR is called approximately every 256 instructions. The ISR contains much less than 256 instructions, so it's not a big deal. If you are worried, you could try to reduce the ISR frequency and see when it starts to affect the performance of the rotary encoder. Hope this helps :-)
What Program are you using to create the schematics?
I use Eagle for the schematics, it's free to use, but perhaps not the most user-friendly. I just kind of like the aesthetics :)
Hi. I'd like to use a rotary encoder with an esp32. Is it okay to use it "raw" or do I have to use it on a module board (with 4 pins) ? If I use it raw, do I have to add resistors, or does the esp have internal pull up resistors like the chip you use in the video? I'm sorry I don't know anything about resistors...
Thank you for the question! This all depends on the inputs of your ESP32. I am not an expert on these chips, but in general it does not hurt to add pullup resistors. If the circuit works between 3-5V, then 4.7 kilo Ohm resistors are a good choice. I am not really sure, however, what you mean by the module board. Do you have a link? These module boards are not usually needed if you program the microcontroller yourself, like in this video, because we do all the decoding ourselves in software :)
Wow this is really good. Subscribing!
Thank you, I am glad you liked it! What kind of video would you like to see next on here?
Sehr gutes Video
Vielen Dank! :)
Merci à vous excellent...
Merci beaucoup! :)
I don't know what the ISR is used for if this implementation is polling the rotary encoder at rest. Isn't an ISR usually called in response to input?
Good question! Lots of things can trigger the interrupt, in this case it's the overflowing timer. This makes sure it's polled at a consistent rate.
So the hardware timer hits it's maximum count value 3906 times a second? (I had to look up what an overflowing timer was haha) That must be counting extremely fast! Thanks for the response!@@FriendlyWire
@@delta-a17 Yes, you got it! I can break it down for you in some more detail. The code runs at 4 MHz, but due to the PIC architecture it means it can only process 1 million instructions per second. The timer is 8 bit wide, which means it can count from 0 to 255. If you divide 1,000,000 by 256 you get 3906. This means that an 8 bit timer, when driven at 1MHz, "flows over" around 3906 times per second :)
That makes perfect sense, thanks!@@FriendlyWire
@@delta-a17Glad I could help! :)
Super cool video! Thanks! :)
Thank you, glad you like it! :)
Thank you for your videos and work from Russia!
Thank you for your kind words, Konstantin :)
@@FriendlyWire #russiaisaterroriststate BTW, thank them again. They just blew up a big hydroelectric power plant in Ukraine, causing a huge disaster - tens of thousands (!) of people will loose everything, some of them will drown or become MIA.
pelase do the same with the "dual" endless pots found on akai apc40 mk1 mk2 or native instruments machine mk1 mk2 mk3 etc.
those have no detend and are way better. i would love to understand them, they have 4 pins.
Ohh, interesting, do you have a link to one of these potentiometers? I am always interested in new topics to cover in upcoming tutorials, so I would really appreciate it! Thank you!
neat explaination !!! instantly SUBSCRIBEEED ....
nowadays more and more companies are switching to ARM based controllers so can u make some vids on stm32 with various sensors
Thank you so much, glad you liked the video! I may stick with PIC microcontrollers for a bit more, but I am curious about others, too, so: you never know, I may cover them at some point :)
@@FriendlyWire 👍
10:55 part about decoding direction deserves slower and more repetitions ...because it is the most important part of not understanding principle. But overall great video
Thank you for your feedback! :) Yes, it could use more time, I agree with you. Sometimes it's hard to decide for me how much detail to put in the video. For this reason I always write a companion article to each video, which usually has more details. You can check it out here: www.friendlywire.com/tutorials/rotary-encoder/#ch7 Let me know if it makes sense or if you have questions, I am happy to help!
Würde sowas auch ohne MCU funktionieren?
Mittels Decoder IC der so
Ja, das sollte auch funktionieren, ein paar Flip Flops sollten reichen :)
Great videos! Are you planning any new content? Your explanations are very user friendly! Hope for some new projects soon!
Actually, yes, there is a new video coming net weekend! :) And thank you so much!
I want to see 24bit shift register contolling 2x22 leds with 2 grids for stereo VU meter, where each grid correspond ti its analog input.
I have not used 24bit shift registers, but you could also use 3x8bit registers, like the TLC5916, for which I do have a tutorial on this channel :)
@@FriendlyWire Yup i did the same, I used (for testing) 3x CD4094 in daisy chain mode but I'm havng problems with timings on grids, can't fgure it out. If i manually set output bytes they apear proper but when i add the part with analog inputs, everything is flickering and shows garbage. Both parts work separate, when i use ports directly, analog part works perfect, and when the part with shift registers is alone. The problem comes when i have to send AN0 and AN1 variables through shift registers along with GRID positions. I am sure that many people would like to build a device like this. ;)
@@technixbulI am not sure why anything would flicker in this way, it shouldn't. Can you send me your code? My email is at the bottom of www.friendlywire.com :)
@@FriendlyWire I will, but firstly i need to gather all in one place, the functionality was expanded a lot and need to add comments.
@@technixbul Sounds like a plan! :)
Bro my rotary encoder give at both pin high at once cut time than for next cut time it's low why this please give
That is strange! So the outputs are either 00 or 11? That is definitely not Gray code. Do you have a link to that encoder? I would suspect that it may be broken.
My advice is not to use MCLR pin as the input for rotary encoder SW. Instead use other free pin. The reason is because when programming the PIC, a high voltage (because you must have disabled LVP to allow MCLR as input) is delivered to MCLR and if you accidentally pressed the SW, it will be shorted to GND and might damage the PICKit3 MCLR output driver.
Good point! The MCLR pin is the only one left with an internal pullup resistor, which is why I used it. Since it's connected to the pushbutton, chances that it's pressed while being programmed are almost zero. But if you want to add external pullups you can use other pins too, of course.
@@FriendlyWire In that case I suggest putting a 600 Ohms resistor in between the PICKit3's MCLR connection and the rotary encoder's SW. This value is big enough to limit the current (~15mA max) if it is accidentally shorted when programming and is small enough for PIC to detect a low (
I think you could benefit from posting a bunch of shorts, increasing your exposure
Thanks for the suggestion! I am not sure if shorts are the way to go, to be honest, because I like to explain things properly, and shorts may bring in people with a different expectation :)
15k subscribers channel
5M subscribers quality
Thanks so much! :)
I send you an email, no reply
I am sorry about that, I must have missed it. When did you send it? Unfortunately I get a lot of spam mail, and your message may have gone unnoticed.
@@FriendlyWire The title of the message was: "Help /627A"
@@digital_madness-pp8cw Saw the message, it was from 2 days ago. To answer your question: yes, you can change the code so that an input value of 0-5V can be sent to the computer via RS232. But writing such a program from scratch takes time. What kind of timing/resolution requirements do you have?
@@FriendlyWire The higher the resolution, the better. Please send if you have time, i already gave you my email.
@@digital_madness-pp8cw I am sorry, but I still don't understand exactly what you need. Can you explain it in more detail? And what kind of resolution do you need, both in voltage and in time? Some numbers would be good! :)
Nothing have to say❤️🔥 thanks🥲❣️
Sir you cleared all confusion
Thank you so much, I am glad you liked the video! :)
How do you know how many stops a rotary encoder has? Is this information on the part's data sheet somewhere? Do they come with different numbers of stops?
Never mind its called detents
Yeah they go by different names, and for cheap ones that don't have datasheets it's a bit of a guess, unfortunately. But commonly the situation with the detents/stops is similar to what is shown in the video.