Simple D Flip Flop circuit not working.

Thread Starter

brododragon

Joined Apr 4, 2023
1
I've made a very simple circuit that should just toggle on the rising edge of the switch, using a d flip flop.

Right now, it decides to toggle seemingly at random. I can't find any pattern in what it's doing.

I've designed the same thing in multisim and it works. I've switched out most the posts and ensured the wires are secure.

Here's a quick video of it. It was actually working better than usual (which also doesn't make sense):
https://youtube.com/shorts/cPN0O16yooA
 

sarahMCML

Joined May 11, 2019
372
I've made a very simple circuit that should just toggle on the rising edge of the switch, using a d flip flop.

Right now, it decides to toggle seemingly at random. I can't find any pattern in what it's doing.

I've designed the same thing in multisim and it works. I've switched out most the posts and ensured the wires are secure.

Here's a quick video of it. It was actually working better than usual (which also doesn't make sense):
https://youtube.com/shorts/cPN0O16yooA
You're getting classic switch bounce problems. You need a de-bouncing circuit. Search on the net.
 

MrChips

Joined Oct 2, 2009
30,823
If you have a double throw pushbutton, this circuit will work.



1680632217195.png

The IC is 74LS00 and the pullup resistors are 1kΩ.
You can also create the same function with the PRESET and CLEAR functions on the other half of the 74LS74.
 

crutschow

Joined Mar 14, 2008
34,464
Yes, a mechanical switch contacts will bounce for a few ms, giving multiple clock pulses to the FF.
The number of pulses detected is somewhat random each time, so the state the FF ends is also random.

Below is the sim of a circuit that should avoid that problem:
It adds an RC delay to the D feedback, so the FF can change state only once while the switch is bouncing, as show by the first PB pulses (yellow trace).

1680633133852.png
 
Last edited:

crutschow

Joined Mar 14, 2008
34,464
Here is perhaps a better debounce circuit since it also protects against any bounce when the switch is released, which does happen, and which my previous circuit doesn't suppress.
The configuration maintains a clock rise-time of <5µs as required by the CD4013 flip-flop specification, while the diode holds the signal high with an R2C1 time-constant, eliminating multiple triggering from switch bounce for either the switch going on or off.
Edit: The part count is actually the same as the previous circuit, using a diode in place of one resistor, and a much smaller capacitor.

1680670354616.png
 
Last edited:
Top