Can someone please make me a circuit using a 4013b d flipflop to do the followin - Page 1
Forum section: electronics / beginners

author: Astaldoath
author_rank: Contributor
timestamp: October 28, 2018, 11:57:38 pm
content: All i need is for it to turn a momentary push button in to a latching switch. No matter what I try I cant get it to work. Ive tried a ton of tutorials ive found online, none work. Im using a 9v as my power supply also, its all I have.I just want 1 single button, press once, turns the led on, press again it turns it off. If possible with switch debounce.Im trying to do this in hardware, in arduino ive done it already but I need to make it very compact, as compact as possible.The only chip I have right now is the 4013b from my radio shack kit which is a d flip flop and I have read it can be set up just like the 555 push button circuit but withoutmuch parasitic draw (which is a problem for me because of batteries) I may end up using LI PO or Li Ion later on but I dont have any nor the battery holder with the leads and I have no money at the moment. I have various resistors, leds, some Capacitors, mostly electrolitic, some ceramic. A few diodes (not sure what specs) I do have 1 relay left also one I tore apart to see how it worked lol.Please guys this problem is making me feel worthless that I cant figure out this simple problem in hardware. Im about to sell my meter, my soldering iron and all my arduino kits because I feel like an utter failure. If anyone could help Id appreciate it. Im not great at reading schematics, i mean I think I can do it correctly. If you could take a picture of it built that would help out also. If anyone does this I thank you so much and I will be so greatful.

author: Tom45
author_rank: Frequent Contributor
timestamp: October 29, 2018, 02:10:09 am
content: What are you using for the input to the D flipflop CLK input? Do you have Q' connected to the D input? Have you put a meter on the Q output?

author: alsetalokin4017
author_rank: Super Contributor
timestamp: October 29, 2018, 03:06:38 am
content: This works, built and tested just now.(I googled "4013 latching switch circuit" and looked at the Images and found one that I understood, used 9V and used components I had to hand.)

author: alsetalokin4017
author_rank: Super Contributor
timestamp: October 29, 2018, 03:53:56 am
content: As we can see there are many ways to skin a cat, and they are all the same, in principle.In the schematic I posted, Q1 can be just about any NPN, and D1 can be just about any small signal diode like 1n914 or whatever. Using the Q1 transistor allows higher current LEDs or other downstream devices.And of course it's good practice to tie the unused CLK to ground, as well as putting in a decoupling cap across the chip's power pins. I did neither of these on my breadboard and the circuit worked fine nevertheless.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: October 29, 2018, 04:16:36 am
content: The circuit I posted starts with the LED on when power is first applied. Bson's circuit starts with the LED off, but I think it needs more debouncing, at least on my breadboard I get occasional false triggering. Also with Bson's circuit the LED changes state when the button is released after being pressed, not when pressed.

author: basinstreetdesign
author_rank: Frequent Contributor
timestamp: October 29, 2018, 04:53:31 am
content: So the problem is that the switch supplies very dirty edges. After trying several schemes involving both FFs in the package I settled on the following. It's the same basic strategy as you guys have offered but with a mod. That is that the FF is prevented from changing state more than once, once it has been clocked - regardless of whether the Q output went high or low. The RC networks on the Clear and Set inputs provide a 50 mS pulse on to those inputs to hold the FF in the selected state when a transition occurs. On negative edges of the outputs I will rely on the internal clamp diodes to hold the Set and Clear to ground. It should work but I cant breadboard it now.If you need to make sure that the LED is off at power up then an additional RC from VDD to the R input will take care of that. But that R should be >> 100K.EDIT: OOPS, I just realized that this circuit doesn't protect from fuzzy voltage at the clock pin as the clock signal falls when you take your finger off the switch. Oh well.