Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Switching between two LEDs

Status
Not open for further replies.

Netguru5

New Member
Hopefully, this should be simple for you gurus! I need help designing a curcuit on a breadboard that switches between two different colored LED's operated with a momentary switch. I also need a 1 second delay between the transition. I would appreciate any help.

Thanks :)
 

Karkas

Member
I'm not a guru, an one of them here may give you a better solution but if you explained yourself well this can help you.

With a JK FF, you can achieve that. You would need a 1Hz (your 1 second delay) "clock" and the two inputs to a HIGH level, and then your FF will toggle, you will have one LED in each output, and then it will toggleand switch your LEDs, I think that's what you're asking for.
 

Netguru5

New Member
Karkas,

Thanks for the reply, this may be exactly what I need. I had one more question on the flip-flop since I've never actually played with one. If I set the Hold state, will it hold that state when the power is removed? And does it hold the state until the reset command?
 

Karkas

Member
The power removed? you mean turning off the supply?
For that application you won't be able to use the reset command, because it is with J=0 and K=1, and for toggling, you need the two inputs to be high,
If mean by that clearing the FF, they have the input CLR.

this is a link for the datasheet to a positive edge triggered JK FF.
https://pdf1.alldatasheet.com/datasheet-pdf/view/50928/FAIRCHILD/DM74ALS109A.html
 
Last edited:

Netguru5

New Member
The power removed? you mean turning off the supply?
For that application you won't be able to use the reset command, because it is with J=0 and K=1, and for toggling, you need the two inputs to be high,
If mean by that clearing the FF, they have the input CLR.

this is a link for the datasheet to a positive edge triggered JK FF.
DM74ALS109A pdf, DM74ALS109A description, DM74ALS109A datasheets, DM74ALS109A view ::: ALLDATASHEET :::

Yes I mean turning off the supply, I should have been more clear. To be more clear, here is the desired function.

* Power supply comes on and LED1 is Lit.
* Momentary switched is engaged
* LED1 goes OFF
* 1 second delay
* LED2 is lit
* Momentary switched is engaged
* LED2 goes OFF
* 1 second delay
* LED1 is lit

I woud also like to retain which LED was last lit when the PS is turned off, then back on.
 

Karkas

Member
Well now that you put it that way then is not that easy, at least for me.
FF doesn't do that exactly, the JK FF toggle between the two states but they don't have an indefined state, I mean a OFF state, unless you pull LOW the CLR input, maybe you this will work. I haven't tested It but it's an idea:
Look up, 555 astable configuration, and design it for the TL to be 1 sec. and the TH to be the time you want it to be, and do that I said but besides connecting it to the clock input, connect it to the CLR input, so when it goes LOW for 1 sec. it will CLR the FF, and it will give you a 0 in the two LEDs, and when the other rising edge comes, maybe it will toggle, by maybe I mean that I think that once you clear it, it will start over a Q High, and will never toggle.

About that of turning off the PS, I don't think any device will keep working without the power supply.
About retain that last LED, taht where gurus come in.

I'm sorry if that doesn't work, it turned harder than it looked in your first post.
 

dougy83

Well-Known Member
Netguru5,

I've attached a circuit that should do the job. The left part is a toggle flip-flop, the right part is the 1second (approx.) delay-on (no delay off).

LEDs are driven from the input supply voltage, the schmitt trigger inverters are supplied power from a capacitor (I said 1F, but smaller values will work depending on how long the main supply will be removed for) which will allow the state to be remembered when the power is switched off. The inverters must be CMOS type or they will draw too much power when the supply is removed and won't remember the state on power up. Also, no guarantees which LED will light on the first power up; although I've my bets on LED1.
 

Attachments

  • TOGGLE.PDF
    33.9 KB · Views: 138

Karkas

Member
Hi Netguru5, the solution by Dougy83 looks simpler, if you want you can try this, here you can design the time you want the LEDs to be on, and the 1 sec. delay is exactly designed with those components, it will give 0.99 sec, the transistor in the CLOCK will invert that signal, so when the time delay goes high, it will be a LOW in the CLOCK and when it goes LOW after that 0.99 sec. the transistor will send the rising edge that will turn on the other LED.
That should do what you need, the first two images are the explanation of how is that going to work, and the last is what you need, it will also remember the last LED on turn on, but by turnin' the opposite when you turn on again, you won't exactly remove the power supply but by moving on and off that switch, and by the way, when you turn it off the on LED won't turn off instantly, it will be on for the time you programmed it, and then the other LED won't light.

It is not complicated, and not as big as it looks, by doing 1.1*C*R you will have the time ON of the monostable multivibrator, that will light the LEDs.
 

Attachments

  • 555monostable.gif
    555monostable.gif
    7.7 KB · Views: 134
  • wavforms triggering 555.gif
    wavforms triggering 555.gif
    3.4 KB · Views: 124
  • para Netguru5.GIF
    para Netguru5.GIF
    18.6 KB · Views: 130

dougy83

Well-Known Member
Sorry Karkas, I can't see how your circuit will work. You've tied the 2 outputs of the 555s together. If that wasn't the case, the LEDs would only light for a second after the change of state and then stay off. The clocking to the FF (and the feedback from the rightmost 555) also looks a bit sus...sorry I don't mean to be negative; just have another look at your circuit.
 

Karkas

Member
I haven't tested it yet but see, When the switch is closed, there is a positive edge at the clock, and that sets the FF, setting it means that Q* is low and because of the rrangement of those two resistors and the cap, thar 555 can be triggered, and it will last as long as Netguru design it, when it falls LOW, the right-most 555 is triggered, and it will last aproximately 0.99 sec. and that will inhibit the CLOCK, once that 0.99. sec are over, there's another rising edge at the CLOCK, and that will RESET the FF, doing the same thing in the opposite LED, did you see it?
 

dougy83

Well-Known Member
I think Netguru is after a 1 second delay between the transitions of one LED going off to the other coming on; the LED then stays on indefinitely until the switch is pushed again.

The FF clk pin is not held at a defined voltage - perhaps a pull-down resistor is warranted? Also, check the two 555s on the left - are the outputs supposed to be connected together?
 

Karkas

Member
No, That's a mnostable multivibrator it won't be on undefinitely, none of them, and yes the two outputs are supposed to be connected together, because the third 555 needs the two falling edges to be triggered, that transition is between the two LEDs,
I'm maybe it won't work, but if it doesn't I don't think it will be for the cuases you're saying, no offense.
I'm sorry but tell me something, isn't that 10K resistor a pull down when the transistor is cut-off?
I'm not sure about that.

If you don't mind, I wouldlike to see how yours work, not because I don't see it will, but because I'm not that experienced.

Thanks.
 
Last edited:

dougy83

Well-Known Member
No, That's a mnostable multivibrator it won't be on undefinitely, none of them, and yes the two outputs are supposed to be connected together, because the third 555 needs the two falling edges to be triggered, that transition is between the two LEDs,
Having the 2 outputs connected together will mean that both LEDs will always be displaying the same state. To get the 3rd 555 to detect a falling edge from either of the 1st or 2nd 555s you could use a diode from pin 2 of the 3rd 555 to the output of each of the 1st & 2nd 555s (note 2 diode in total) - this will isolate the outputs of the 555s from each other and the 3rd 555 will then get the falling edge of either output.

I'm sorry but tell me something, isn't that 10K resistor a pull down when the transistor is cut-off?
The 10k is connected inline with the switch and won't be in-circuit until the switch is pressed. Perhaps the leakage through the transistor will pull the clock down when the switch is open, I don't know.

If you don't mind, I wouldlike to see how yours work, not because I don't see it will, but because I'm not that experienced.
I can't find a good description of how the inverter FF works, but the circuit and a description are available here:
Simple Toggle Touch Switch Using Two Inverter Gates | Free Circuit Diagram

The LED drive circuits are the same, but driven from opposite-state signals; the resistor and capacitor delay the turn on of the gate, while the turn off time is much less due to the capacitor being discharged through the diode.
 

Karkas

Member
Yes you're right, the two diodes are necessary, well, I don't think it is necessary to put them on the picture, unless Netguru doesn't understand how to put them.

But tell me, a pull down resistor isn't the opposite of a pull up? I mean the pull ups are put in the outputs to make sure the desired output is given and that output is not in a floating state, what's the differenec between them and the pull down?

I though you had designed it. I'll check your link, thanks.

Sorry for the lot of "outputs"
 
Last edited:

dougy83

Well-Known Member
Yes you're right, the two diodes are necessary, well, I don't think it is necessary to put them on the picture, unless Netguru doesn't understand how to put them.
He is more clever than me for assuming that; I didn't mean to state the obvious.

But tell me, a pull down resistor isn't the opposite of a pull up? I mean the pull ups are put in the outputs to make sure the desired output is given and that output is not in a floating state, what's the differenec between them and the pull down?
a pull-up usually pulls an input high; a pull-down usually pulls an input low. It keeps the input in a defined state when it's not being driven by another source. The 10k resistor inline with the switch in your circuit does nothing until the switch is turned on.
 
Last edited:

Karkas

Member
He is more clever than me for assuming that; I didn't mean to state the obvious.

Maybe I didn't understand that, but who is more clever than you?
I didn't assume that Netguru was going to put the diodes there, I didn't realized what you did about the HIGH in one output was going to turn ON the two LEDs.

a pull-up usually pulls an input high; a pull-down usually pulls an input low. It keeps the input in a defined state when it's not being driven by another source. The 10k resistor inline with the switch in your circuit does nothing until the switch is turned on.

Yes itdoes not do nothing, but the CLOCK will be low anyway, because closing the switch will give a HIGH level, coming from Vcc 'cause the transistor is cut-off, by the way, when you have an open collector in a gate, for example, you need a pull up resistor, not to pull the output high but to complete the arrangement of the internal transistor, that thing over there with the BJT is a NOT gate, if the 10K resistor wasn't there would be happening the same that if you had a NOT with open collector and you don't use the pull up resistor, so as I see it that's a pull up, I agree with you that's not a pull down, but do you think it needs it?
 

Netguru5

New Member
I just got back home and I wanted to say Thanks to Karkas and dougy83 for taking time out to help me. This is exactly what I need to start and I sincerely appreciate this information. Thanks again :)
 

dougy83

Well-Known Member
I hope it works out how you wanted. All the best.
 

Karkas

Member
Hi Netguru,
Tell me if you can put the diodes, or if you need me to post the image with them.
 
Status
Not open for further replies.

Latest threads

Top