I have an arduino kit (5v) and instead of just following their simple instructions I want to know why they are using certain resistors for their RGB LEDs.
The RGB LED that comes with this is identical to this one:LED Indication HLMP-EG24-PS000 . And I'm assuming the forward voltage and current is the same.
The directions call for three 220-ohm resistors, but is that necessary? My math tells me that Red needs a 100-ohm and the Green & Blue need 160-ohm's. Won't using more resistance decrease the luminosity of the LED?
Or maybe the resistors have something to do with the affect they are trying to achieve with the LED? Here's what the book states, which I don't really understand:
"By creating a voltage difference between the cathode and voltage coming out of the Arduino's PWM pins (which are connected to the anodes through 220-ohm resistors), you'll cause the LED to fade between its three colors."
Do the resistors have anything to do with this fading, or isn't it just the PWM controlling that?
The resistors have nothing to do with the fading which is as you say, down to the PWM.
Yes the larger resistors will reduce the current and thus the brightness, but by an amount you won't notice. I regularly use resistors up in the many 100s or even a k since modern LEDs are so bright.
I did an experiment just yesterday where I had current down in the single digits of mA, 2-3 iirc, and an LED was still quite bright, certainly bright enough as an indicator.
Cotonna:
Won't using more resistance decrease the luminosity of the LED?
Yes, but do you really need all the brightness? Certainly for an indication LED I would say 220Ohm is still waaayyyyyyyyyy to bright. And otherwise, it's better to use more or higher rated leds than to push a single led to (/over) it's max ratings.
And you calculated the resistance for the max current. That's a bit living on the edge. You're led will last longer (no, leds don't life for eternally) if you don't push them to the max.
And if you use the resistor you calculated for the absolute maximum current, how is going to guarantee the supply voltage is always a perfect 5V? And that the resistor isn't 95Ohm instead of 100Ohm? And that the forward voltage of the led is what you used and not lower? All results in a higher current and then you drive the led out of spec. You might damage the led right away but more probably the led just doesn't life that long.
Cotonna:
Do the resistors have anything to do with this fading, or isn't it just the PWM controlling that?
That's just the PWM, resistors are just there to not damage the leds.
The RGB LED that comes with this is identical to this one:LED Indication HLMP-EG24-PS000 . And I'm assuming the forward voltage and current is the same.
Just because it looks the same is no indication that it is the same. In fact you can put money on it not being the same. Those look expensive and the person getting the kit together will have wanted a cheaper one to keep the price down.
Just as an fyi, I bought a 10-segment led bargraph the other day: I kid you not when I say that the leds are so bright, even with a 4k7 resistor (5V supply) they are still perfectly visible in daylight.