Alternating green and red LEDs discrete circuit

sghioto

Joined Dec 31, 2017
5,392
Why would I do that? I simply replied that I knew what you meant by 100mHz. It was not clearly evident to me why the 100mHz signal was being applied until you explained in your words "It is just an easy way to simulate a 5v signal being applied and 0V applied". I would have drawn it differently.
Other then that your circuit works fine. I like the current limiting aspect.
 

Ian0

Joined Aug 7, 2020
9,846
When you're pedantic about "m" for "milli" and "M" for "Mega", don't you find SPICE irritating with its interchangeable "M" or "m" for "milli" and "MEG" for "Mega"? Yes, I know it's from Fortran which didn't differentiate between upper and lower case, but it's still annoying.
 

tindel

Joined Sep 16, 2012
936
How about this?

I like neat simple circuits - this is one of them, so I built the circuit. It should work in theory, but what about reality? First iteration was with 1x 1N4148, I added a second 1N4148 after the red wasn't turning all of the way off with the green LED on. Makes sense that the green wouldn't turn off the red. I was driving the LED's hard with a 100ohm resistor.

Then I got to thinking... Shouldn't this also work with the following circuit, without the 4148? It's the same principle (~2Vred voltage will turn off the ~3Vgreen when the input is high). In theory, it would only take two parts. Indeed, it did work well, but I needed a bit more fine tuning, I did end up adding a 1n4148 on the green leg to get it to turn off all of the way, and I also found that my voltage on my generator wasn't quite 5V due to the 30mA load (50ohm*30mA = 1.5V). Once I took the function generator up to a high enough voltage that it was 5V at the 'input', it worked well. I didn't take a video - I'll leave that exercise to the reader.

1608703851649.png

In practice, this topology doesn't make a lot of sense to me. Why would you want a green LED and red LED to alternate back and fourth? Couldn't green mean 'go' and off mean 'stop' instead of red? Perhaps for some visual effects - maybe a child's toy or christmas project... If it was mission critical and the green and red absolutely needed to be alternating (manufacturing plant, enclosed space, etc) I wouldn't use this circuit... I'd want more control and deterministic response without the analog subtleties that could possibly creep in during corner cases.

Anywho... kinda fun and simple circuit to play with for 30 minutes or so.
 
Last edited:

Ian0

Joined Aug 7, 2020
9,846
Another "feature" is that the changeover is not abrupt, so, with an integrated red/green LED there is a yellow phase when the two voltages are about equal.
It gets more accurate when the supply voltage is higher and a zener sets the threshold.
 

Ian0

Joined Aug 7, 2020
9,846
Aren't there three cases for "m" : M, m, and µ? Damn, I wish the Romans had been more enlightened.
I think that the Greeks (micro, deca, hecto, kilo, mega and giga) are more to blame than the Romans (deci, centi, milli), or the Spanish (pico) or even the Vikings (femto)
 

tindel

Joined Sep 16, 2012
936
Another "feature" is that the changeover is not abrupt, so, with an integrated red/green LED there is a yellow phase when the two voltages are about equal.
It gets more accurate when the supply voltage is higher and a zener sets the threshold.
The change over is pretty abrupt with a signal diode added. With the diode, I'm not seeing any amber color - the eye/brain is a great integrator. Without the diode, both LEDs are on when the signal is driven high, and there's a definite amber content. I did think that it's possible to choose your diodes carefully to be more on the order of 4V and Red is closer to 2. Green forward voltages can vary a lot depending on the technology used, red's less so.

I was curious and looked into the dual LED packages and found that most common cathode/anode LED's have similar forward voltages (banner spec). I suspect this is because you can get three colors out of a two LED device (red/green/amber). I'm guessing the forward voltage of my common cathode LED are similar based on it's operation, requiring an additional signal diode be added. However, in this case, we don't want that. Here is a link showing all of the digikey dual LED packages where the green/red forward voltage differ by at least 1V. I suspect that these could potentially reduce the part count to 2 (just the LED package and a resistor) and have short enough amber transitions that the eye wouldn't perceive them. All of these packages are pretty expensive compared to a $0.01 discrete LED. I'm too cheap to put in an order to test it though - especially since I don't see a great use case.

Anyway - certainly an interesting circuit if you need to do this and part count is the most important thing to consider. Probably not the cheapest though.

ETA: With that, I think my circuit is the simplest ;), but I built it on your bright idea. :D :cool:
 
Last edited:

tindel

Joined Sep 16, 2012
936
A discrete solution was requested. I suspect some sort of oscillator is needed. If one searches on "common cathode LED wig wag circuit," the TS should get lots of examples -- unless he is using Google and searched on some naughty things a little earlier.

Here's a single transistor solution from that search:

View attachment 225566
Link: https://www.google.com/url?sa=i&url=http://lednique.com/gpio-tricks/1-gpio-dual-led-common-cathode/&psig=AOvVaw3_AQMIEDUw6TILKj4b3Jkn&ust=1608671170866000&source=images&cd=vfe&ved=0CAIQjRxqFwoTCOjc1Z793-0CFQAAAAAdAAAAABAI


From a high-rel / more deterministic standpoint, I think this would be a good starting point, Although I'd probably put R2 on the emitter of the transistor instead for a bit more headroom and a harder turn-off of the transistor - or perhaps use a logic level pmosfet.
 

sghioto

Joined Dec 31, 2017
5,392
I think this would be a good starting point,
That circuit works as long as the 5 volt supply is appx. equal to the GPIO voltage and if that can handle the current. That is the one piece of data missing, the exact source of the 5 volt "trigger". However the TS wanted the circuit to work on a supply between 15 and 35 volts. At best would require two additional transistors and a variable resistor to control the current on the red LED.
While your circuit in post #68 may be the simplest for a given supply voltage I believe the most practical is MrSalts post #57.
 

djsfantasi

Joined Apr 11, 2010
9,163
Interesting idea, any component recommendations. I've used the 2N7000 but never a P-channel.
Every time so far that I’ve used a P channel MOSFET, it’s been driven by a logic level N channel MOSFET. So, you don’t need a logic level P channel MOSFET. The drain of the N channel is connected to the gate of the P channel with a 10k pull-up resistor.
 
Top