Electronic – Is it possible to use just a capacitor to debounce a button

buttoncapacitordebounceswitches

I have been wondering: why cannot you just hook up a capacitor to a button to debounce it? I have been figuring out how to reduce the work my microprocessor has to do, but I have very limited space on a PCB I am designing, so I don't want to do a full-blown debounce circuit which would complicate the design.


schematic

simulate this circuit – Schematic created using CircuitLab


That's a example circuit; sorry for any errors (I am not good at designing circuits with capacitors). Would this even work? For the tack switch, I couldn't find one that matches what it is in real life, but it works for this situation. The button is like the one found here. D10 stands for Digital Pin 10, but it doesn't matter; it just means the Arduino input. I also don't know how big of capacitor I would need, so if this circuit works, what size do I need?


Again, I am just trying to simplify this to make it easier to build while not having to do software debouncing. From looking at how capacitors work, this seems like it would work, but also it might make the button press longer/delay it if the capacitance is too big. They are commonly used for "smoothing" out noise in power supplies, so isn't this a similar thing where it "smooths" out the bouncing? Any circuit modifications to make it work (if needed) would also be appreciated.

Best Answer

It depends on what the default state of the switch is. A capacitor will only charge when you give it a positive voltage. Usually, in an embedded environment, we use a pull-up to give a pin a default high state, and link the switch to ground. Adding a capacitor won't help here, because it won't "store" the ground state.

However, you can also use a pull-down. This would mean the pin is by default low. Making it high by pressing the switch, will charge the capacitor. After releasing, the capacitor will keep the pin high for a little while, so yes, this would work. I'm not sure if 1uF is enough, too little or too much, I'd recommend you to look with a scope and try it out a bit.