Switch Bounce Deep Dive - Page 1
Forum section: electronics / projects

author: Adam Fraser-Kruck
author_rank: Newbie
timestamp: April 09, 2024, 03:22:32 am
content: How long do switches bounce? I used to think 20ms max. Then an unused push button switch bounced way more! I got curious and spent many hours writing a high performance program that provides deep insights into bounce behavior.Hmm... gif animation showing zooming in doesn't seem to work here. Maybe check project repo if you want to see it in action?I initially started exploring switch bounce with an oscilloscope, but it was just too burdensome to collect enough data for experiments and there was no easy way to analyze and share the data. After a few days of using my oscilloscope, I decided to try and see what a humble Arduino could do because they are already so prevalent, easy to use and low cost. Great for students and hobbyists.The end result doesn't compromise much on capability (62 nanosecond pulse detection).It's working better than I had hoped! We can now:-> Collect and analyze lots of switch bounce data easily.-> Interactively inspect bounce waveforms and statistics.-> Share high fidelity bounce data with others.-> Run experiments efficiently without spending too much time.Special thanks to Jack Ganssle (no affiliation) for showing how interesting switches can beIf you are still interested, more details & open source software at the repo:https://github.com/adamfk/bouncy-buttonThe also an introductory video with more analysis of these two buttons.

author: Haenk
author_rank: Super Contributor
timestamp: April 09, 2024, 06:50:21 am
content: Guess that's why you need to electronically debounce buttons.133ms on the other hand is just crazy - did you do a teardown? (I assume there are just two metal plates, slighty springish, pushed together. I.e. as crappy as a construction could be executed.)

author: Doctorandus_P
author_rank: Super Contributor
timestamp: April 09, 2024, 02:04:11 pm
content: Jack Ganssle has made a comparison of bounce properties of a bunch of different buttons, including those squishy rubber things on remote controls. Bounce properties vary a lot. He even had one that acted as an analog signal generator, where the output was some measure of the pushing force.

author: Adam Fraser-Kruck
author_rank: Newbie
timestamp: April 09, 2024, 02:20:58 pm
content: A teardown is a good idea!I have two of the bouncy switches (they both behaved poorly) and I damaged one with a 330nF capacitor across it thinking that it might help with wetting current.I've been slowly building up a collection of switch experiments in this repo:https://github.com/adamfk/bouncy-button-data/The current record there is 660ms for a really old push button, followed closely by 646ms for a barely used (but very cheap) e-stop from ebay.The experiment page for the 133ms button is here:https://github.com/adamfk/bouncy-button-data/issues/7330nF capacitor across the switchAdding the capacitor directly across the switch was pretty interesting. Compare the normal columns (before and after capacitor). normal2 is after the cap was removed. The press max bounce went massively down, but the release max bounce almost doubled! Without a current limiting resistor in series with the capacitor, the current spike might be damaging the switch contacts.Here's the experiment for adding a 330nF capacitor across the switch:https://github.com/adamfk/bouncy-button-data/issues/16I then continued testing with an oscilloscope and the 330nF cap attached (experiment page here). It performed perfectly for about 20 tests and then it started to get bad. After another 40 tests, it got much worse and starting glitching when held pressed.It had a max bounce of 434ms on release.Quote from: Doctorandus_P on April 09, 2024, 02:04:11 pmJack Ganssle's debouncing page is what got me really interested in exploring switch bounce more. He's awesome

author: PCB.Wiz
author_rank: Super Contributor
timestamp: April 09, 2024, 08:03:10 pm
content: Quote from: Adam Fraser-Kruck on April 09, 2024, 02:20:58 pmA capdirectlyacross a switch is a known brutal impactor. The peak currents cause welding/sputtering and eventually switches get much worse.With your setup, you could explore a more controlled wetting current effect ?Does a bad switch benefit from a higher clean current, or is there a practical current that can 'clean and keep clean' ?Your numbers confirm some current does clean the contacts, but too much contaminates and damages the contacts.Wetting current is the minimum amount of electric current necessary for a switch contact to carry in order for it to be self-cleaning. Normally this value is far below the switch’s maximum current rating.

author: Adam Fraser-Kruck
author_rank: Newbie
timestamp: April 09, 2024, 11:44:27 pm
content: Before I damaged the switch with the cap directly across it, I did use an external 1k pullup (5 mA) instead of the internal 35.7k ohm (0.14 mA).Raw data and more photos here:https://github.com/adamfk/bouncy-button-data/issues/15The findings were kinda mixed. Performed better with the external 1k pull up, but not by a massive amount.In the below graphs, the 1k external pullup is shown in yellow. Teal for internal pullup.Of the top 10 worst bounces, each section has half (5/10).Comparing box plots for bounce durations. Statistically the 1k pull up tests bounced less on "average". But... they also had a larger percentage of tests bounce longer than 20ms.Interesting comparing box plots for Transitions Per Activation (press/release). The 1k pullup is better in the average case and much better in the max cases (17 vs 89).