These metal contacts make and break the circuit has spring attached for the actuation of the switch. When a switch at normally open condition is actuated to close due to the spring action and mass the contact will be bouncy. The contact will come together and bounce off each other several times before finally coming to rest in a closed position. This effect is called “contact bounce”.
The same can happen in reverse action while the switch is in normally closed and actuating to open, this effect is called contact debouncing.
To understand the bouncing, consider if an incandescent lamp controlled by a contact switch. When the lamp is turned ON, the switch starts bouncing which results toggling the lamp which means for a small time the lamp continues to be ON and OFF frequently.
Oscillator output for contact bouncing is shown below:
Problem with Contact bouncing:
Bouncing is not at all a problem if you are using a contact switch to turn on a fan or lamp. But, if you are using a switch or relay as input to a digital counter, a personal computer, or a microprocessor-based piece of equipment, then you must consider contact bounce. The reason for concern is that the time it takes for contacts to stop bouncing is measured in milliseconds.
Solution for contact bouncing:
There are several methods to reduce the bouncing which includes hardware and software methods:
it uses an RC time constant to swamp out the bounce, shown below:
If you multiply the value of the resistance by the value of the capacitance, you get the RC time constant. Select R and C so that RC is longer than the expected bounce time. An RC value of approximately 0.1 seconds is typical.
If you are the one who develops the digital “box”, then you can bounce off the software. In general, the switch or relay connected to the computer will generate an interrupt when the contacts are activated. The interruption will cause a subroutine to be called (interrupt service routine).
The idea is that as soon as the change is activated, the Debounce routine (DR) is called. The DR calls another subroutine called DELAY that kills long enough to allow the contacts to stop bouncing. At that time, the DR checks if the contacts are still activated (maybe the user kept a finger on the switch). If so, the DR waits for the contacts to be deleted. If the contacts are free, the DR calls DELAY once more to allow the bounce in the contact release before finishing.