Switch Debouncing

The problem is that when the a switch is closed it isn't "clean" and can actually close and open multiple times before it stays closed. This results in multiple signals being sent out which could cause problems when the driver presses a button. There are a few ways to combat signal bouncing (hardware or software). This document will give an overview of a circuit design that can control the effects of signal bouncing.


Example of what happens without debouncing circuit:

     

                                                  Switch bounce produced on switch press


Below is a debouncing circuit I found online. It makes use of a capacitor to filter out any quick changes in the switch signal. This is referred to as a RC debouncer.

          


Looking at when the switch is open and when it is closed:



Switch open:

  • The capacitor C1 will charge via R1 and D1.
  • In time, C1 will charge and Vb will reach within 0.7V of Vcc.
  • Therefore the output of the inverting Schmitt trigger will be a logic 0.

Switch closed:

  • The capacitor will discharge via R2.
  • In time, C1 will discharge and Vb will reach 0V.
  • Therefore the output of the inverting Schmitt trigger will be a logic 1.


Note:

If bouncing occurs and there are short periods of switch closure or opening, the capacitor will stop the voltage at Vb immediately reaching Vcc or GND. Although, bouncing will cause slight charging and discharging of the capacitor, the lag of the Schmitt trigger input will stop the output from switching.

Resistor (R2) is required as a discharge path for the capacitor, otherwise, C1 would be shorted when the switch is closed. Without the diode (D1) both R1 and R2 would form the capacitor charge path when the switch is open. The combination of R1 and R2 would increase the capacitor charge time, slowing down the circuit. Too small a resistor value for R1 would lead to unwanted wasted current because when the switch is closed R1 is connected across the supply rails.


Information pulled from: