Man great content as always. What I love about this simple design is if you have switches with pull-downs, all you gotta do is to invert the diode. Super nice!
Great tutorial. I wish these circuits were for sale, or even better: integrated in the KY-040. For just a dollar extra the factory can do it. What is stopping them?
Analog electronics are realtime, and don't waste precious clock cicles on the microcontroller. So software debouce is the inferior solution by default.
Great video, i wish i had seen it earlier...lost a day dealing with the stupid bounce on a KY-040. Do you have a PCBWAY or JLCPCB board model? or you sell those boards? Thanks again for the good work, definetively won my sub and like.
Glad you found the video useful, you can access the Eagle CAD PCB design files on my Patreon page. If you don't have Eagle, I also posted the gerber files for the design which you can send to any PCB manufacturer, such as JLCPCB or PCBway. Here is the link (it is $3 to join for a month): www.patreon.com/posts/ky-040-encoder-93026341
Thanks for a interesting and well-done video. A simple RC filter seems to work for me. I'm surprised nobody has produced a small, cheap eight-channel debounce board using the MAX6818 debounce IC. I've done some searching and haven't found anything.
Or just more cheap, high quality, pre-debounced rotary encoders so we're not reinventing the wheel for everything. Who really wants to use one without debouncing?
Great video Great and interesting solution for a not so often addressed problem Ralph S Bacon have shown a software solution to this problem, that I newer have seen before. It's his #226 video, great stuff Thanks for sharing your experience with all of us 👍😀
Thanks for the video and great info. Could you share your gerber files? Or, perhaps, are you selling the circuit boards you show in the video? Lastly, would it be problematic if the encoder being used did not have built in resistors like the KY-040? I am using a 100PPR encoder for a CNC jogging pendant, that has some pretty terrible bounce, and I want to use this type of hardware approach to improve the output signal, but my encoder does not have any built-in resistors. Can I simply ignore this fact, or would I need to add the resistors, so my encoder was setup like the KY-040 is before adding the circuit you designed? Thanks for your input.
Actually the resistors make the debounce tougher because they provide less flexibility when trying to get the ideal RC time constant. No resistors is better.
@@datawolk It puzzled me why it was across the diode and not across the capacitor as a discharge path as you point out Arnold. I can see it will discharge either way, but across the diode kind of negates the function of the diode to some extent.
Yes it will work without the Schmitt trigger as long as the pulse has a large enough amplitude to register as a high logic level. The only downside is is you get a rising or falling edge that's unpredictable because of tolerances and capacitor values and aging of the capacitor. This is only an issue if you have tight timing in your application and you need interrupts to be in a certain order, etc.
@@ForceTronics for breadboard project i use SN74HC14N and for diode i use 1n4148, for PCB project i use 74HC14D and for diode i use 1N4148W SOD-123 instead of BAS16-HE3-18 because GPT chat says the function is the same
@@dystopian-me The 74HC14D is a Schmitt trigger that inverts the input so if you have a positive or high pulse on the input, it will output the opposite on the output (low pulse). When the input is low the output will be high. That maybe your issue unless you are compensating for that in software. You can purchase a low cost logic analyzer which could be a good tool to help you debug a circuit like this
Hey, thx for pointing out this important topic 👍 But I'm wondering if this complexity is really needed. Isn't a simple RC filter in front of the schmitt trigger enough? With a time constant of few ms it should dampen all bounces enough and can also be pretty high impedance, so you don't have to worry much about the pull-up/down values.
Great question. Without the diode the capacitor would just be shorted to ground when the switch is closed so there would be no RC time constant. I guess you could put a resistor in series before the capacitor to prevent a short to ground. I think it would work but the value of the schmitt trigger is the clean high / low transition. If you are making a commercial product cap values have a 10 or 20% tolerance so you could get a situation where the timing of switches varies a bit across products, but the timing changes may be so small they are not noticeable.
You would need to calculate a resistor divider network that divides the 28V down to an acceptable voltage level that can be measured by whatever device you are using to monitor the encoder.
This will work for other voltage values. You just need to check / do the resistor voltage divider math to ensure you get enough voltage to be read as a logic high
I think you have over complicated it a bit. You have added 5 points of failure. In reality, placing a 0.1uF cap across the switch will reduce the bounce and not hinder the response of the encoder.
Your not wrong and someone already made a similar comment. Just using a cap doesn't work well when working on applications with critical timing and complex interrupts. Using just a cap creates slow unpredictable rise and fall times that are not predictable from one unit to another. This is because caps have wide tolerances (typically 20%), they age, and vary with temperature. This approach creates fast rise and fall times that are predictable in manufacturing. The best approach is probably application dependent.
The Best Video on the Internet. That Helped me Understand the Bounce and Debounce in Rotary Encoder. Thank You Sir.
Thanks for the great feedback and glad it was helpful
My man! This is almost certainly the most useful hardware debounce video currently on UA-cam.
Man great content as always. What I love about this simple design is if you have switches with pull-downs, all you gotta do is to invert the diode. Super nice!
Great tutorial. I wish these circuits were for sale, or even better: integrated in the KY-040. For just a dollar extra the factory can do it. What is stopping them?
WOW, great example showing the bounce output on the scope. It would be nice to a comparison of the hardware and software denounce effectiveness.
Analog electronics are realtime, and don't waste precious clock cicles on the microcontroller. So software debouce is the inferior solution by default.
Great video, i wish i had seen it earlier...lost a day dealing with the stupid bounce on a KY-040. Do you have a PCBWAY or JLCPCB board model? or you sell those boards? Thanks again for the good work, definetively won my sub and like.
Glad you found the video useful, you can access the Eagle CAD PCB design files on my Patreon page. If you don't have Eagle, I also posted the gerber files for the design which you can send to any PCB manufacturer, such as JLCPCB or PCBway. Here is the link (it is $3 to join for a month): www.patreon.com/posts/ky-040-encoder-93026341
Thanks for a interesting and well-done video. A simple RC filter seems to work for me. I'm surprised nobody has produced a small, cheap eight-channel debounce board using the MAX6818 debounce IC. I've done some searching and haven't found anything.
Or just more cheap, high quality, pre-debounced rotary encoders so we're not reinventing the wheel for everything. Who really wants to use one without debouncing?
Great video
Great and interesting solution for a not so often addressed problem
Ralph S Bacon have shown a software solution to this problem, that I newer have seen before. It's his #226 video, great stuff
Thanks for sharing your experience with all of us 👍😀
Thanks for the video and great info. Could you share your gerber files? Or, perhaps, are you selling the circuit boards you show in the video? Lastly, would it be problematic if the encoder being used did not have built in resistors like the KY-040? I am using a 100PPR encoder for a CNC jogging pendant, that has some pretty terrible bounce, and I want to use this type of hardware approach to improve the output signal, but my encoder does not have any built-in resistors. Can I simply ignore this fact, or would I need to add the resistors, so my encoder was setup like the KY-040 is before adding the circuit you designed? Thanks for your input.
Actually the resistors make the debounce tougher because they provide less flexibility when trying to get the ideal RC time constant. No resistors is better.
Hei, thank you for the video. Would it be possible to realise that circuit with through hole components. I would like to try it on a breadboard.
Yes, I would assume so. You just need to do the parts research to find versions in through hole.
Great content, keep it up, is this Schmitt triger ic and this circuit can be used for esp32.
Yeah it will work with any uController as long as you have the right voltage logic level
fantastic
Very cool. What would be needed to adapt it to a 5V circuit?
I can see the BAS16-HE3-18 only as SMD part. What through hole can I use instead ?
If you don't have a schmitt trigger, having the remaining of the circuit would help a bit no?
Yes! Schmitt just gives you a nice sharp pulse
Use a zener bypass diode too, lower forward voltage drop.
Do you mean Schottky?
Thanks for doing that for us! One thing I didn't understand is why the 300R across the diode?
The capacitor has to be discharged when there is no button press. And because this ic has a high impedance input, it has to take another route.
@@datawolk It puzzled me why it was across the diode and not across the capacitor as a discharge path as you point out Arnold. I can see it will discharge either way, but across the diode kind of negates the function of the diode to some extent.
What happens if we'll just remove the triggers' ICs from the circuit? Is it a problem for MCU to read those smooth values using digital or analog IO?
Yes it will work without the Schmitt trigger as long as the pulse has a large enough amplitude to register as a high logic level. The only downside is is you get a rising or falling edge that's unpredictable because of tolerances and capacitor values and aging of the capacitor. This is only an issue if you have tight timing in your application and you need interrupts to be in a certain order, etc.
Super-great
Nice!
I tried to make a pcb according to the schematic, but it didn't work, can I ask about this?
Feel free to ask any questions you have from the video in the UA-cam comments section. I do not share my personal contact information
@@ForceTronics for breadboard project i use SN74HC14N and for diode i use 1n4148, for PCB project i use 74HC14D and for diode i use 1N4148W SOD-123 instead of BAS16-HE3-18 because GPT chat says the function is the same
@@ForceTronics i cant comment with link, then how can i show the error
@@ForceTronics can i send the circuit file via ForceTronics facebook page ? or twitter ?
@@dystopian-me The 74HC14D is a Schmitt trigger that inverts the input so if you have a positive or high pulse on the input, it will output the opposite on the output (low pulse). When the input is low the output will be high. That maybe your issue unless you are compensating for that in software. You can purchase a low cost logic analyzer which could be a good tool to help you debug a circuit like this
Hey, thx for pointing out this important topic 👍 But I'm wondering if this complexity is really needed. Isn't a simple RC filter in front of the schmitt trigger enough? With a time constant of few ms it should dampen all bounces enough and can also be pretty high impedance, so you don't have to worry much about the pull-up/down values.
Great question. Without the diode the capacitor would just be shorted to ground when the switch is closed so there would be no RC time constant. I guess you could put a resistor in series before the capacitor to prevent a short to ground. I think it would work but the value of the schmitt trigger is the clean high / low transition. If you are making a commercial product cap values have a 10 or 20% tolerance so you could get a situation where the timing of switches varies a bit across products, but the timing changes may be so small they are not noticeable.
interesting. I never noticed it
How can i make a debouncing ckt for 28V instead of 5 or 3.3V
You would need to calculate a resistor divider network that divides the 28V down to an acceptable voltage level that can be measured by whatever device you are using to monitor the encoder.
6:30 dafuq, where did that so-called "sgmid trigger" suddenly come from? Not to mention another important question, what is a sgmid trigger?
Schmitt trigger is a pretty well known type of circuit. Googling it would probably make a lot more sense than if I tried to explain it.
Are you selling the debounce board?
I think I'll stick to using a MAX. It's a lot easier than making these pcb's if you don't have an engraving machine.
Will it work with 5 volts?🤔
This will work for other voltage values. You just need to check / do the resistor voltage divider math to ensure you get enough voltage to be read as a logic high
I think you have over complicated it a bit. You have added 5 points of failure. In reality, placing a 0.1uF cap across the switch will reduce the bounce and not hinder the response of the encoder.
Your not wrong and someone already made a similar comment. Just using a cap doesn't work well when working on applications with critical timing and complex interrupts. Using just a cap creates slow unpredictable rise and fall times that are not predictable from one unit to another. This is because caps have wide tolerances (typically 20%), they age, and vary with temperature. This approach creates fast rise and fall times that are predictable in manufacturing. The best approach is probably application dependent.