Mechanical devices such as switches, relay-contacts etc. allways generate a ”bouncing” phenomen because of their nature, (mechanical).
A microcontroller is fast enough to read 100’s of ”ON-OFF” states in a fraction of a second.
There are ”many” ways to eliminate this with them called ”debounce-solutions”, RC-net, Time-line based, Scmith-trigger, feed-back.. etc. In allmost ewery other but time-based, (which is a programmable thing that would be the best solution IF you run a prosessor based thing), you need some kind of external componenets allmost to any solution.
Here you need 1 chip NAND with 4 ports, 2 ports/ switch + 2 resistors/ switch.
A down side here is that you have to use a change ower switch.
You could allso use 2 "separate" normally closing switches.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: A Flip-Flop With a Switch
A FOOL-PROOF switch debounce eliminator at the output’s Q1 & Q2.
This is a Flip-Flop generated with a change-ower switch.
This is kind of a ”brainteaser” for you to think it out. The two NAND ports interlock each-other by the ways of when the switch ”makes” the first contact, (pos A), to the input ”A”, the output Q1 goes ”1” , thus resulting the input ”C” to be ”1”.
Now them both ”C” & ””D” are ”1” and the output Q2 goes to ”0”.
Now it doesn’t matter how much ewer the input ”A” bounces… 1,0,1,0,1,0, the output Q1 wan't change because the input ”B” is ”0”, co.....ol isn't it.
When switching ower to ”pos B”, the switch leaves input "A" still not resuting any changes in outputs, YET. When touching the input ”D” there will be the same actions like in the ”pos A”, but the other way around
There are 4-port’s in the 74HC00-package so you can use one package for two switches.
There is a C-MOS NAND allso… e.g. MC4011xx
I hope this helped someone with the debounce problem :)