Sporadic Clock Signals from Momentary Switch

clockdebounceflipflopnoiseswitches

I'm having trouble using a NO momentary switch to send clock edges to a J-Kbar flip flop, specifically the TI CD74AC109E(datasheet).

I have a switch between +5V and the clock pin, and also added a 10k\$\Omega\$ pulldown to the clock pin, so it stays at 0V while the switch is open.

However, when I close the switch, the output responds sporadically; I have the flip flop hooked up so it toggles the Q and Qbar outputs on every high edge on the clock pin, but it doesn't always do that.

I realize that this might be caused by the lack of debouncing for the switch, but as the switch isn't a tactile switch (doesn't go click click when pressed), and the sporadic behavior occurs even when I depress the switch (open it), which makes me think it might be a different problem.

Does anyone have any suggestions as to why this might be happening?

P.S. YouTube video demonstrating the issue I have. I've hooked up an LED to the Q pin to show the output.

Best Answer

All mechanical switches have the potential to bounce, and most do at least some of the time.

That's exactly what is happening. You need to add a debounce circuit. The easiest way is something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

The RC slows the switch transition down, and the Schmitt trigger gate cleans it up so there is only one transition each way, thanks to the hysteresis.