What is switch bounce?

6 replies · 26K views · last reply
Furion
Messages
3
Reaction score
0
Ive been working on a new project for my studies but can't seem to get any info on 'switch bounce'
 
It's the electrical noise made by metal coming together to form a circuit. It lasts maybe 40ms depending on the switch.

Google "switch debouncing circuit" and you'll get lots of examples.
 
If you are interested in cleaning up switch bounce (switch debounce), you can do it with a couple of nand gates.

Diagram of a switch debounce circuit: a single-pole switch with +5V pull-up and a NAND gate SR latch, with a waveform inset showing contact bounce spikes before a clean +5V transition.


http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/setreset.html"
 
Last edited by a moderator:
Is switch bouncing and de bouncing the same?because I am not sure
 
Switch debounce and switch bounce are two different things.

Switch Bounce happens when you close a mechanical switch. When you close a switch it tends to literally bounce upon the metal contact which connects the circuit.

It's almost like dropping a basketball. The basketball will hit then ground (analogous to a closed switch) then bounce back up (analogous to a open switch) then bounce back down, then up, then down, etc... until it permanently stays on the ground (permanently closed).

Usually switches take a few microseconds to a few milliseconds to completely close. What this means in terms of digital logic is that as the switch physically bounces your logic can switch back and forth low-to-high-to-low-etc... until your switch settles down.

Switch Debounce is the process of getting rid of switch bounce. One solution to get rid of switch bounce is given above by dlgoff
 
If you are doing microprocessor/controller work (e.g. with an externally-triggered interrupt), it's quite common practice to pause for a period of time (~20 ms or so) upon receiving an input in order to debounce a button / switch / relay.

A friend of mine nearly tore his hair out trying to fix an interrupt service routine where he'd forgotten to do this.