Pages: [1] 2   Go Down
Author Topic: Connecting 2-coloured LED  (Read 3790 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27361
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Jr. Member
**
Karma: 0
Posts: 89
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* fig1.pdf (282.97 KB - downloaded 26 times.)
Logged

Norway
Offline Offline
Sr. Member
****
Karma: 4
Posts: 423
microscopic quantum convulsions of space-time
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (4.35 KB, 563x401 - viewed 49 times.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27361
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


* 2_LEDs_one_pin.jpg (48.34 KB, 960x720 - viewed 44 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 89
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Norway
Offline Offline
Sr. Member
****
Karma: 4
Posts: 423
microscopic quantum convulsions of space-time
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 89
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok
lets wait for LED data
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.62 KB - downloaded 18 times.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27361
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try this then.


* 2_LEDs_parallel_one_pin.jpg (49.02 KB, 960x720 - viewed 55 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Norway
Offline Offline
Sr. Member
****
Karma: 4
Posts: 423
microscopic quantum convulsions of space-time
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Offline Offline
Edison Member
*
Karma: 3
Posts: 1001
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

CO, USA
Offline Offline
God Member
*****
Karma: 5
Posts: 711
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27361
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: April 29, 2011, 09:56:49 pm by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1] 2   Go Up
Jump to: