Connecting 2-coloured LED

I need to connect a 2-coloured LED to ONE digital output of the Arduino. The LED changes colour when polarity is inverted, i.e. it shines green when its first pin is connected to 5V and its second pin to ground and it shines red when its first pin is connected to ground and its second pin to 5V. Could anybody give me some guidance how to realize such a connection using ONE digital output (for example high output resulting in red, low output resulting in green, or vice versa). Thanks a lot.

Add an external circuit, simple inverter, to drive the 2nd LED.
Can as simple as a transistor and couple of resistors.

Thanks very much for your answer, CrossRoads. Knowing that I'm not really an expert in electronics :blush: :blush: (to say the least :blush:) would it be possible to show or to point me to a connection circuit how this could be done. Thanks again.

You have 2 ways to connect a LED to the arduino, but i dont know what diodes do you have

fig1.pdf (283 KB)

If the forward voltage drop for the two colors are less than 2.5V, I think you can get away with a simple resistor divider. If not, you might want to get fancy with a couple of transistors in a half-bridge connection (any small-signal bipolar transistors should do).

Or like CrossRoad says, use an inverter for the other side of the LED (+ current limiting resistor in series).

dual-color LED output.png

I was thinking along these lines with a common anode 2-color LED.
If common cathode, something similar can be done.

But i said , we dont know what type of diode we are talking about,common cathode common anode,or simple 2 diodes

we dont know what type of diode we are talking about

I assume its just one, a bi-directional LED; just 2 pins. Which is why I connected two LED's in "anti-parallell" in my above schematics, I didn't have a bi-dir LED symbol.

Ok
lets wait for LED data

Thanks a lot for your suggestions so far. Sorry that I took a while to answer, but I was away today.

It is actually an LED with just 2 pins and colour change is made by changing polarity. Regarding the "forward voltage drop" I don't really know. For more details I have attached the data sheet.

Thanks a lot again.

DUO LED.pdf (79.6 KB)

Try this then.

That looks good.

Or go with the simple one above. 150-220-ish ohm resistors for the resistor divider should work. 1k as I put in the schematics is a bit high.

Clever schemes!

If you want to substitute the inverter gate (74x04) with discrete transistors however you’re likely to need a pair (totem pole sink/source output stage). With the single transistor as proposed by crossroads above, D2 will see twice a much series resistance as D1 and so will only be half as bright.

CrossRoads:
Try this then.

It just occurred to me that I could use a varying duty-cycle PWM signal to get a range of colors from such a device. That could be useful for a gross indicator of over/under some condition.

Sounds plausible. I am slighlty red/green color blind (as are many males) so would be interesting to see if the shading between colors would be noticable.
1/2 red, 1/2 green make what color? Amber/yellowish?

Yeah. Red + green = yellow, but the exact shade would depend on the color temperatures of the LED in question. In another week, I'll have money to throw at this, so I'll toss appropriate stuff into a Digikey order.

I'm doing some window shopping for components, and maybe I'm being too fussy about it, but I noticed that the 74LS04 is a DIP-14 package, with 6 inverter circuits, so I was wondering if there's a smaller package, maybe even a single inverter in something resembling a TO-92 (except with 4 leads). Not that board real estate is something that concerns me now -- but if it did ... ?

And then I noticed the output current rating on the Fairchild 74LS04 (PDF) and thinking I can't drive an LED with that, or it'll be pretty dim. Same thing for one single inverter I found, the ON M74VHC1GT04DFT1G.

Looking for something with a higher current rating, I find things like the Toshiba 7SZ04F. Seems like a lot of these things are SMD. :frowning: (Not that I mind SMD per se, but it ain't handy for breadboarding.)

Any advice / suggestions?

Go with a single transistor like 2N2222 or BC547, any package you're comfortable with.

Thanks very much for all your suggestions. Unfortunately my LEDs have not arrived yet. As soon as I get them I will go for your proposals. Thanks again.

CrossRoads:
Go with a single transistor like 2N2222 or BC547, any package you're comfortable with.

Well, I was specifically thinking of using your inverter circuit driving a bi-color.

ETA: ... because it seems a lot cleaner, uses fewer components, etc.