Flip Flop toggle only works momentarily?

Status
Not open for further replies.

Skiye30

New Member
I am designing a circuit for a task lamp I am building, and I want to use a momentary switch to toggle the LED I have on/off. I have studied other posts on here about how to do it, and have built a circuit using one side of a 74ls74 d type flip flop. When I connect the power source the light starts as on. When I push the button it turns off, but once I release the button it comes back on after half a second or so in stead of toggling.


Does the light coming back on have to do with not de-bouncing it, or is there some other problem with my design? I appreciate any help!

specifications:
12VDC power source
12V 50 ma tactile switch
12v 240 ma chip-on-board LED
74ls74 IC
(I don't know if this is more information than is needed or not, but I figured I play it safe
 
Last edited:
Hi there

I'm having trouble seing your picture larger when I click on it, it comes up as not displaying so can't see exactly what is happening in your circuit but it indeed can be done with d type flip flop. From what I can see it looks good as you got the pull down resistor to ground the input when the button is not pressed, it may indeed be the bounce.

I might add I probably would have used the 4000 series equivelent ic (4013) as it is cmos and more tolerable. I thought LS would only work on a supply voltage of 5v with maybe a v above or below and you may find that the problem may be the 12v supply voltage, the 4000 series can take up to 15v.

If ~Q is going to D and Q is to your led then I would have thought it would work, I've attached what I think your circuit is (top one is LS and bottom using cmos 4013, and I should have tied R and S to ground like you have and it does not display v+ and ground either).

All the best
 
Last edited:
That very well could be the case with the flip flop I used, I'm honestly quite new to this, so I just found the first d type I could at my local electronics store.

the diagram you sent is what I have. So if it is the bounce, how would I de-bounce it? I've seen diagrams with resistors and a capacitor, but how would I choose the right ones?

You also mentioned about a pull down resistor on the input to ground the switch? I just grounded it with wire, should I have used a resistor?

Thanks again for your help!
 
Hi again

You should use I would say about a 1k resistor or so yes because otherwise your creating a short circuit when your switch is pressed.
I can recommend a debouncing circuit although I have not actually simulated it in real life, only on the computer.

You may have problems here as you will need a schmitt trigger inverter IC which I don't think you can get in LS and mixing families is not a good idea.
The values of components I have givern are from recomendations of websites so you may have alter these if they don't work at first. Increasing the capacitor will make the circuit react slower but work better and so will R2, R1 is a bit of an improvement (so i've heard) for the contact conditioning as many contact debouncer circuits don't have these.

I have attached the circuit, hope it works ok for you (you may want to get it checked by another member)
 
You want to configure similar to the attached rough sketch. Also, the 74LS74 has the following:

IOH HIGH Level Output Current -0.4 mA
IOL LOW Level Output Current 8 mA

Even configured per the attached you won't drive much of a LED. The 7474 (old as dirt) does have higher Low Level Out Current and that is about 16 mA which will drive a LED. Most LEDs anyway.

Also, if you use a 7474 dual D FF you want to tie the unused inputs to high or low.

Yes, I would include some debounce also. That is my guess as to your problems.

Ron
 
You could use a relay toggle circuit.

You will need either a relay of a TRIAC to switch the lamp anyway.

Either relay can be used to switch the lamp. Use a DPDT relay so the second contact is used for the lamp.

However, note that the relay operate & release times must be less that the contact bounce time.

See attachment.
 

Attachments

  • Relay Flip Flop.gif
    21.5 KB · Views: 381
Last edited:
I ordered some 4013s, they will be here early next week, then I guess I'll see if that fixes it. If not then I guess I'll try a debounce circuit.

Thanks for your replies!
 
Read this thread. What part of current are you not understanding? Did you even read what I posted? The CD4013 has less drive current available. Wider voltage range and less current. Read and understand the data sheets on these chips.

Ron
 
You will not be able to drive a 12V 240mA LED directly with either a 7474 or a 4013. An intervening transistor will be needed.
Applying 12V to a 74LS74 (rated for 5V) probably fried the IC.
As Ron says, read and understand the IC datasheets.
 
Ron: I did read it, you only mentioned the 7474 and ls, so I didn't catch that the 4013 wouldnt work either.

Like I said, I'm relatively new to anything beyond straight up circuits, which is why I came here for help. Ics and what not are a little above my head right now.

Are there any flip flops that can handle the current/ voltage I need? Or is a transistor the only way for something like this?
 
Do you have to use an led with a forward current of 240ma, could you not by another led with smaller current. I use 12v leds (5mm or 3mm) and these have a forward current of 8.5ma with a very max forward volts of 14 so would be ok with your power supply, they always have worked for me even if powering one from the direct output of the ic without any switching of a bigger power source (only if lighting up 1 that is).

I buy mine from maplins, data sheet for them is attached (12v 5mm). Best of luck.
 
The way you do what you want to do is to drive a transistor using the D Flip Flop. This is why data sheets are your best friend. For example if you Google 7474 circuits or 4013 circuits you will get some good results. I have several circuits using 7474 chips directly driving LEDs. Configured as I posted earlier. However, it took planning with low current LEDs. Got to know the limitations.

Ron
 
This is how the transistor would be used.
R1 and C1 de-bounce the switch.
 
This is how the transistor would be used.
R1 and C1 de-bounce the switch.

Your debounce circuit needs a low value resistor (100 Ohm would suffice) in series with C1 in order to limit the discharge current.

The LED needs a resistor in series with it (unless it is a 12 Volt LED).

What is the LED current? This determines the base resistor R2.

You need a decoupling cap across the supply in the range 10 nF ~ 100 nF to avoiud the possibility of odd results.

And you should connect the unused inputs of the other half of the 4013 to Gnd.

I Just read the data sheet for the 4013.

The maximum clock rise & fall time is 5 us.

The time constant of R1 C1 is 10 ms. So I doubt if it will work.

You need a proper debounce circuit.
 
Last edited:
Thank you alec_t! That circuit does work! It's a little finicky, but that may just be the connections to my switch. I'll find a decoupling cap to try, but I'm just happy it works right now!

ljcox: The Led is 12v, 240 ma
 
Thank you alec_t! That circuit does work! It's a little finicky, but that may just be the connections to my switch. I'll find a decoupling cap to try, but I'm just happy it works right now!

ljcox: The Led is 12v, 240 ma

240 mA.
Then I suggest you use a MOSFET such as the 2N7000 in lieu of the BJT.

To ensure saturation, the BJT needs a base current of at least one tenth of the collector current, ie 24 mA.

The 4013 can't source 24 mA.
 
@ljcox
Your debounce circuit needs a low value resistor (100 Ohm would suffice) in series with C1 in order to limit the discharge current.
I don't think so. The 100n cap holds too little charge to damage the switch IMHO. A 100 Ohm resistor would undesirably slow the switching pulse rise time, perhaps enough to prevent switching.
You need a decoupling cap across the supply in the range 10 nF ~ 100 nF to avoiud the possibility of odd results.
Agreed.
And you should connect the unused inputs of the other half of the 4013 to Gnd.
Again, agreed.
The maximum clock rise & fall time is 5 us. The time constant of R1 C1 is 10 ms. So I doubt if it will work.
The 4013 is positive-edge triggered. The pulse rise time constant is not R1 x C1; it's the switch resistance (a few mΩ) x C1, so is < 1uS.
Then I suggest you use a MOSFET such as the 2N7000 in lieu of the BJT
That would be ok.
To ensure saturation, the BJT needs a base current of at least one tenth of the collector current
Not, as in this case, if the transistor has a high beta value. But in general that's a useful rule of thumb.
 
Last edited:
In order to ensure saturation, you need excess charge in the base emitter region.

If you look at the BJT data sheets they usually state that Ib must be at least Ic/10 for saturation.

In my opinion, he needs a better debounce circuit
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…