So I have an RGB LED and I believe it is a common cathode, but it may be anode. Anyway, would there be any functional difference between having a single 270 ohm resistor from the common cathode to ground and having a separate one for each color?
Oh yes, quite a significant one.
Just try what happens and you'll never forget about it. And I'm not talking about the famous blue smoke here (if R is chosen reasonably of course).
With a single resistor the brightness of one LED will change when you turn on another one (they will both be dimmer than if just one was on by itself).
-- The Aussie Shield: breakout all 28 pins to quick-connect terminals
Hah, 'getting dimmer' is one way of putting it XD
ok thanks everyone. I was thinking the same thing, but I'm much stronger with the programming than the actual electrical setup process. So would a resistor with a 3R on the common cathode do the same job as a single res. of value R on each of the 3 color leads? And wouldn't any configuration lead to a dimming when more than one color lights up? unless the fact that they are coming from the same LED would make the brightness sum the same at all times. (sorry bout the long post)
The simple answer is: You always need an individual resistor for each color.
As soon as you put a single resistor in the "common path" you create a bottleneck and you lose true individual control of the leds. Or some won't turn on at all. Think of it as 3 lines of people trying to get through a narrow door. There's no way they won't disturb each other's progress.
If you dive into the basics (Kirchhoff Laws) you'll eventually find out that parallel components (in this case 3 leds with one common connection) always see the same voltage. And the smallest one is dominant here, which will be the "forward voltage" of the red led. It turns on first and the blue and green will be very dim or won't light up at all.
With a single resistor you will observe something like this:
- turn on green or blue alone: OK
- turn on blue + green: might work
- turn on either blue or green first and then red: only red will stay on
So would a resistor with a 3R on the common cathode do the same job as a single res. of value R on each of the 3 color leads?
No. Once again, when two LED's are turned on they will have less brightness than a single one on by itself (and with 3R, they will all be less bright to begin with). With a single R in each lead the brightness will be the same regardless of how many are on. In theory...it depends on the rest of your circuit and what it's current-sourcing/sinking capacity is.
And wouldn't any configuration lead to a dimming when more than one color lights up?
No. Look at the circuit for our Gadget Shield (second page, on the right side):
This circuit keeps the same brightness in all LED's regardless of how many are on.
-- The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected
Got it. Thanks again for the help everyone.
Just to clarify: If each colour is driven from its own separate constant-current source (some LED driver chips do this), then no resistors are needed and everything is simple. If you drive from fixed voltage via resistors then the different forward voltages for each colour mean separate resistors are required. This has the advantage in that you can select the resistor ratios to provide colour-balance for 'white'. Remember to respect the maximum forward current ratings for each colour and the total power dissipation for the package.
If you are only wanting one colour at a time to light up you can get away with just a cathode resistor, but this isn't the usual arrangement.