# RGB LED brightness levels

Do RGB LEDs have very different brightness levels?

I'm running an RGB LED (common cathode) via some TIP120 transistors, controlled from a raspberry Pi.

There is a 5v feed from the rPi.

Initially I had ~2k resistors in series with the output pins and the base of the trans. but they were failing to trigger so I've removed them.

I also then had what I thought were the correct resistor values in series with the LED (82R and 150R for red and blue / green respectively) but they were so dim as to be useless.

So those have gone as well.

So against everything I know to be "right" I've got no resistors on the LED or the output pins. The red is nice and bright but green and blue are still both pretty dim. I'm controlling with software PWM from the pi and have had to limit the red channel to 25% of the green and blue just to level things out a bit.

Any idea what's going on?

• Measure the actual voltage across the LED; I suspect it's dipping to ~4V causing something of a brownout. What is the nominal forward current of each of the LEDs? – pjc50 Nov 8 '13 at 10:51
• Why using a bipolar transistor here? – Blup1980 Nov 8 '13 at 11:49
• Red LEDs normally have a lower forward voltage than green/blue and so the current limit resistor should have been higher for red compared to blue/green. – Andy aka Nov 8 '13 at 12:05
• RGB LED datasheet? rPi I/O current capability? Call me crazy, but how about a schematic? – apalopohapa Nov 8 '13 at 12:27
• @Blup1980 because either OP already had them, or because bipolar transistors are cheaper and easier to find then mosfets, at retail stores like radioshack. Also, they work, when wired correctly. – Passerby Nov 8 '13 at 16:26

Without a schematic, based on your question, you have Common Cathode Led with TIP120 transistors? I assume you have them connected backwards from normal.

simulate this circuit – Schematic created using CircuitLab

The TIP120 is a NPN darlington pair transistor. It normally expects to be on the low side of the load. You are using them for High Side Switching, which won't work. If your led was common anode, you could swap them around, and it would work (WITH THE RESISTORS).

But in this case, you have 1) A different signal level from the led power level (3.3v vs 5v) so Direct PNP transistor won't work, and 2) The Raspberry PI GPIO cannot source a lot of current. 16mA at max. So You need both NPN and PNP transistors. Some 2n3904 and 2n3906 Common npn and pnp transistors, but any similar would work

simulate this circuit

I only show the blueled (5v source voltage - 3.2v forward voltage - 0.2v VCE drop / 20mA = 80Ω), do the same for the green led, and use a 140Ω or higher resistor for the red led.

• DOH! So using NPN on the high side isn't going to work? Never knew that! I'll eventually be using an LED strip as per this: mitchtech.net/raspberry-pi-pwm-rgb-led-strip which I guess is common +ve, so I'll be OK in that case? I've been poking around with a multimeter and noticed that when "open" the Vce is dropping from the source voltage (~4.5v) down to ~2v. – user1133150 Nov 10 '13 at 13:12
• cont... I guess if I'm using the wrong kit for the job at the moment then it's a bit irrelevant :-) I've got a 12v power source, DC - DC converter and LED strip ordered so I'll just wait until that lot turns up and have a play. Thanks all! – user1133150 Nov 10 '13 at 13:23
• @user1133150 yep, a tip120 would work great on a led strip with a common anode setup. – Passerby Nov 10 '13 at 21:30

The red, green and blue of RGB LEDs do have different perceived luminous intensities, for several reasons. Some of them are listed below, not in the order of importance:

1. Eye color sensitivity

• The human eye is sensitive to different colors to different levels - and this relationship also varies by light intensity: Both ambient light intensity (bright room versus dark room) and emission intensity (bright LED versus dim LED).
• Under photopic vision conditions i.e. well lit conditions where the cones of the eye are the primary mediators, we are typically most sensitive to green light, approximately 555 nanometer wavelength
(source)
Under scotopic (dimly lit) conditions, this drops down to around 507 nm aqua color as the most sensitive.
• These sensitivity patterns change with age, differ by gender, and vary from person to person. Also, traumas, including even purely psychological traumas, can change the vision profile.
2. LED power emission

• This one is easy: Let us take this RGB LED datasheet as an example.
Before factoring in the efficiency differences in conversion of electrical energy to light in different LED junction chemistries, the power expressed across a 2.0 Volt junction (typical Vf for red in the example LED) at 20 mA = 40 mW is clearly different from the power across a 3.2 Volt junction (for blue and green) at 20 mA = 64 mW.
• Hence, the amount of light emitted by each junction at the same current should be different: Not proportionally so, since efficiencies are vastly different, but different nevertheless.
3. Color matching between LED junctions:

• This is actually a farily complex task in itself, even if all else is ideal. Some useful links to give you an insight into exactly how complex it is to match R, G and B in LEDs:
• This article computes a ratio of estimated R:G:B current values of 2.77:5.79:1 or around 3:6:1, to achieve an evenly matched white, using one specific RGB LED combination. Your results will of course be very different due to using a different LED.
• This write-up touches upon some of the hoops one has to jump through, to achieve an even RGB output (again, to get a white light) and to then sustain the matching as the LEDs age and lose luminosity at different rates.

## One could go on listing other factors...

4. Specific to the question: Current through each LED

• The VCE(sat) of the TIP120 at 20 mA is approximately 0.75 Volts (Figure 2 in datasheet). Thus available voltage for the LEDs and any current limiting resistors should be 5.0 - 0.75 = 4.25 Volts
• Assuming that the supply rail is a solid 5 Volts with unlimited current capacity and does not droop under load, the LEDs should all have blown out when operated without current limiting resistors, under these conditions. That didn't happen, which means some other current limiting is at play.
• Either the 5 Volt rail from the RPi cannot sustain the current requirement of say 60 mA for rated operation of all 3 LED junctions (unlikely, but possible), or there is some other resistance coming into play: Long thin wires? Long USB cable supplying the RPi? RPi drawing close to the maximum available current already? Too low a base current on the TIP120? Only you can tell, by some judicious poling around with a multimeter.
• Any which way, if the supply, at the LED anodes, is unable to sustain the current needed for the 3 LEDs, and is therefore dropping in voltage, this drop will fall below 3.2 Volts before it drops below 2.0 Volts. At something around 3.0 Volts, still working on the example LED datasheet, the green and blue LEDs will see reduced conduction, tailing off to non-conducting - so the demanded current will reduce. Somewhere in that vicinity, the supply rail will reach an equilibrium with barely illuminated green and blue, and yet there will be plenty of voltage headroom for the red LED to light up.
• This matches with our observed behavior.

• Either that, or the supply voltage from the RPi is not 5 Volts as supposed, but actually 3.3 Volts, which will again give exactly the observed behavior: A multimeter would be able to confirm this.

Now, about resistance calculation for the LEDs:

Taking the typical voltages from the datasheet, for 20 mA current each, and supply voltage of 4.25 Volts calculated previously:

• Rred = 112.5 Ohms, ~ 120 Ohms
• Rgreen = 52.5 Ohms, ~ 56 Ohms
• Rblue = 52.5 Ohms, ~ 56 Ohms

Those 3 values should give approximately 20 mA current through each color junction, if the supply is truly 5 Volts.

• Reread Op's question. Common Cathode leds, with NPN darlington pairs, see the issue? – Passerby Nov 8 '13 at 16:24