Why Capacitors Don’t Fix It. It’s an debate as old as the desert sands – hardware or software debouncing? We are fans of software debouncing but old-schoolers like hardware. Here are some of the pitfalls of hardware debouncing. Ed writes –
As part of our discussion around those Hall effect switches, I cautioned our Larval Engineer that she can’t use capacitors to “smooth out” mechanical switch bounce, even though all of her cronies and (most likely) her profs will advocate doing exactly that. The subject also came up at the local hackerspace when she showed off her project, so I should explain why capacitors don’t solve the problem.
Make a robot friend with Adafruit’s CRICKIT – A Creative Robotics & Interactive Construction Kit. It’s an add-on to our popular Circuit Playground Express, FEATHER and other platforms to make and program robots with CircuitPython, MakeCode, and Arduino. Start controlling motors, servos, solenoids. You also get signal pins, capacitive touch sensors, a NeoPixel driver and amplified speaker output. It complements & extends your boards so you can still use all the goodies on the microcontroller, now you have a robotics playground as well.
Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !
You can actually solve this in hardware if you need to. One way to do so is with a monostable multi-vibrator.
It is more flexible to solve the problem in software, but sometimes hardware solutions are the best way to go.
Hardware debouching IC…. easy as pie
smigit trigger also could work….
Hardware debouncing ICs are expensive — in many cases costing more than the microcontroller itself.
A schmitt trigger isn’t going to help — switch bounce has a full swing, so you’ll just end up buffering (and delaying) the bounce signal, not eliminating it.
The monostable strobe Nick mentioned has worked well for me in the past for discrete logic (7400) circuits. These days it’s easier to debounce in software when working with a micro, though the strobe idea is still good when you need robust debouncing with low latency and execution time, or if you can’t spare the cycles to debounce in software.