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.


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:


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.

  • \$\begingroup\$ Is this likely though? I set this idea to the side because the behavior could be observed when I slowly opened the switch, which is weird because the flip flop operates on a up clock. Also because I didn't have a schmitt trigger handy... might have to grab a couple to figure this out. \$\endgroup\$ – kumowoon1025 Jan 24 '14 at 3:40
  • \$\begingroup\$ @user3052786 If it flips back and forth you can get high and low transitions on every opening or closing of the switch. Even sub-microsecond transitions will be detected by the flip-flop clock. Closing tends to be more noisy, but both can have bounce. \$\endgroup\$ – Spehro Pefhany Jan 24 '14 at 3:47
  • \$\begingroup\$ It's actually a momentary push button that doesn't even click. I don't understand how a low transition would trigger the flip flop which only responds to high transitions, am I missing something? Does opening the switch cause a high transition sometimes? \$\endgroup\$ – kumowoon1025 Jan 24 '14 at 4:44
  • \$\begingroup\$ Yes, each time it closes or opens it can bang back and forth a few times between open and closed. So if it opens you don't get a clock, but then it closes again (clock) and then opens (no clock), so you get one false clock. \$\endgroup\$ – Spehro Pefhany Jan 24 '14 at 5:05
  • \$\begingroup\$ I had an extra flip flop and used that to debounce a spdt switch I had, and it worked flawlessly. You were right, after all :) \$\endgroup\$ – kumowoon1025 Jan 24 '14 at 9:18

Any mechanical switch can bounce, and the symptoms you describe are consistent with that. Debounce the switch. There are many ways to do that, I'll let you do the search.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.