Imagine you have made a logic circuit that counts up to ten. You press a button and the output increments
not by one but maybe five. On the next press, it steps round seven. What's going on ? The answer lies in
the inferior mechanical contacts of a switch. What you need is a switch debouncer circuit.
There are two types of press button switch normally open (NO) and normally closed (NC). The description
refers to the state of the contacts when the switch button is not pressed. You press the button and the contacts
will open and close many times before finally staying in position. This is known as contact bounce. Depending
on the switch construction, this mechanical contact bounce can last up to 20 milliseconds. This isn't a problem
for lamps, doorbells and audio circuits, but it will play havoc to a fast switching logic circuit or computer.
The contacts open and close before finally staying closed. A digital circuit will respond to each of the
on off transitions. All that a switch debouncer circuit has to do is filter out these transitions. There are
several ways in which this can be achieved.
The simplest method is to use a filter circuit containing a resistor and capacitor. The time constant must
be at least 20ms to avoid contact bounce. The general idea is shown below :
When SW1 is pressed and released the capacitor will be charged and then discharged via the 10k resistor.
This may be OK for driving CMOS logic IC's but TTL chips require a cleaner pulse. With the aid of a simple
monostable circuit a clean output pulse can be achieved as shown below :
Another method is to use a Schmitt trigger such as the CMOS 4093. The schmitt trigger ensures that a
clean output pulse will be produced.
Dedicated switch debouncer IC's now exist and some are capable of debouncing up to four switch inputs. This is hardware options, if working with programmable logic controllers or digital devices with timers incorporated there are other ways to take care of this problem.