Author Topic: Switch Bounce Deep Dive  (Read 1891 times)

0 Members and 1 Guest are viewing this topic.

Offline Adam Fraser-KruckTopic starter

  • Newbie
  • Posts: 3
  • Country: ca
Switch Bounce Deep Dive
« on: April 09, 2024, 03:22:32 am »
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 be :)

If you are still interested, more details & open source software at the repo: https://github.com/adamfk/bouncy-button

The also an introductory video with more analysis of these two buttons.
« Last Edit: April 09, 2024, 03:26:12 am by Adam Fraser-Kruck »
 
The following users thanked this post: Haenk, 5U4GB

Online Haenk

  • Super Contributor
  • ***
  • Posts: 1715
  • Country: de
Re: Switch Bounce Deep Dive
« Reply #1 on: April 09, 2024, 06:50:21 am »
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.)
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 4671
  • Country: nl
Re: Switch Bounce Deep Dive
« Reply #2 on: April 09, 2024, 02:04:11 pm »
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.
 

Offline Adam Fraser-KruckTopic starter

  • Newbie
  • Posts: 3
  • Country: ca
Re: Switch Bounce Deep Dive
« Reply #3 on: April 09, 2024, 02:20:58 pm »
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/7


330nF capacitor across the switch
Adding 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/16

I 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.





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.

Jack Ganssle's debouncing page is what got me really interested in exploring switch bounce more. He's awesome :)



 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2852
  • Country: au
Re: Switch Bounce Deep Dive
« Reply #4 on: April 09, 2024, 08:03:10 pm »
... I damaged one with a 330nF capacitor across it thinking that it might help with wetting current.
330nF capacitor across the switch
Adding 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.
A cap directly across 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.
 

Offline Adam Fraser-KruckTopic starter

  • Newbie
  • Posts: 3
  • Country: ca
Re: Switch Bounce Deep Dive
« Reply #5 on: April 09, 2024, 11:44:27 pm »
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/15



The 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).
« Last Edit: April 09, 2024, 11:48:20 pm by Adam Fraser-Kruck »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf