Bi-Color LED Red/Green and Yellow/Green

Hello,

I have several bi-color LEDS I would like to wire just using 2 pins off of the Arduino UNO. It seems I am successful in doing so however the more I wire together the dimmer the light output is. I am just running everything off of the USB to the laptop. Should I use a separate wall wart instead? Thanks for the advice.

How many is "several". Are they two-pin or three-pin LEDs. How did you connect them, and what are the resistor values. A picture (hand drawn diagram) is better than 1000 words. Leo..

Hello,

I have 3 bi color R/G leds wired onto a breadboard and 2 wires coming from the Uno from pins 7 and 8. I have 1 100 ohm resistor connected to each wire coming from pins 7 and 8 and then each R/G bi color led is placed one behind the other. My simple sketch is this:

int bi1 = 7;
int bi2 = 8;

void setup() {

pinMode(bi1, OUTPUT);
pinMode(bi2, OUTPUT);

}

void loop() {

digitalWrite(bi1,  HIGH);
digitalWrite(bi2,  LOW);
delay (2000);
digitalWrite(bi1,  LOW);
digitalWrite(bi2,  HIGH);
delay (2000);
}

This is just an example and the green is dim and the red is brighter. Thanks in advance for suggestions.

So I guess it's a two pin bi-color?

Now you are paralleling the LED which is not so great. First of all, the resistor will set the current. And it will not change with the number of leds. So if you connect multiple they now have to share the current. And there lies a problem with leds, they might not share evenly because of small differences.

So it's better to have a resistor per led. But you don't need two per led like you have now, just one of the right value will do.

But you have to watch how many you can connect. A Arduino Uno pin can deliver a absolute maximum of 40mA per output. But it's more save to stay close to 20mA. So for example driving 2 leds at 10mA is fine. So is 4 at 5mA etc. Do you need more brightness you need to use multiple groups connected to multiple pins. Or use a H-bridge (mostly used to drive motors) to amplify it.

Your notes says "Uno from pins 7 and 8" but your sketch says int bi1 = 13; int bi2 = 12;

Which pins are you really using?

Yes...I am using pins 7 & 8 and yes these are 2 lead bi-color LEDS green and red....the green is very dim...and the red is very bright....and there was a typo as I am using 330 ohm resistor on both the red and green pins....on each LED...standard practice....however should I just use one 330 ohm resistor per lead or just on the RED lead as that is the brighter of the 2 colors? Thanks in advance.

Different colors have different forward voltages, red will just be brighter in a 2 lead design. You might be able to dim one color with a diode for more even lighting.
Doesn’t make a difference where you put the resistor with a 2 lead design (if that is in fact what you have). And you wouldn’t use two, it’d just be a waste of space.

PilotinControl: and there was a typo as I am using 330 ohm resistor on both the red and green pins

No you have not ;) A 2 lead bi-color led has no "red lead" or "green lead". Both are connected to both leds inside. One is connected to the anode of the red and the cathode of the green. The other is connected to the cathode of the red and the anode of the green ;) And because only one of the two leds is on at the same time and it doesn't matter if the resistor is on the cathode or anode side you only need one resistor per led

PilotinControl: ....on each LED...standard practice....

First you talked about just paralleling each led. But a resistor per led is preferred. But how many do you connect? When you have 2 330ohm resistors per led the red will draw roughly 5mA. connecting 4 should not give a problem. But keep in mind that if you connect each led with a single 330Ohm (which is fine) you double the current.

The green might be dimmer because of the different voltage drop across it. Green leds come in two types. The classic (low-ish brightness) has a drop similar to the red. So when connecting it to the same resistor (as you do here, no matter if you use one or two resistors) it will draw about the same current. But modern high brightness green leds have a voltage drop like blue or white leds of around 3V. But that leaves 1V aka 33% less voltage for the resistor(s) then with a red led resulting in 33% less current for the green.

But I don't know which type of green you have (no led specs in this tread) so I'm not sure. It also just might be the green is just less bright.

A possible solution would be to increase the resistor for the red. But you can't simply attache a resistor only to red because of the bi-color 2-lead thing. But to do it, simply add a resistor in series with the one for green (doesn't matter on which side because it's a series connection). But you bypass that resistor with a diode in the current direction for the green. That way when you light the green the led sees only the non-by-passed resistor in series and for the red it sees both resistors (so the sum).

Only problem is, a diode has a voltage drop as well. So to make it work better you should use a Schottky diode.

septillion: A possible solution would be to increase the resistor for the red. But you can't simply attache a resistor only to red because of the bi-color 2-lead thing. But to do it, simply add a resistor in series with the one for green (doesn't matter on which side because it's a series connection). But you bypass that resistor with a diode in the current direction for the green. That way when you light the green the led sees only the non-by-passed resistor in series and for the red it sees both resistors (so the sum).

Only problem is, a diode has a voltage drop as well. So to make it work better you should use a Schottky diode.

No need for double resistors or diodes. If you connect at least one LED pin to a PWM pin, then you can vary the brightness of the LEDs individually. So the digital pin selects the colour, and the PWM pin sets the brightness.

Did you run out of pins? You can also use the analogue pins as digital pins if you run out of pins. Use one 330ohm resistor and one LED per two pins. And a maximum of three of those strings per two pins. Leo..

Using PWM is indeed also a possibility :)