Calculating an LED resistor value
An LED must have a resistor connected in series to limit the current through the LED, otherwise it will burn out almost instantly.
The resistor value, R is given by:
R = (VS – VL) / I
VS = supply voltage
VL = LED voltage (usually 2V, but 4V for blue and white LEDs)
I = LED current (e.g. 10mA = 0.01A, or 20mA = 0.02A)
Make sure the LED current you choose is less than the maximum permitted and convert the current to amps (A) so the calculation will give the resistor value in ohms ().
To convert mA to A divide the current in mA by 1000 because 1mA = 0.001A.
If the calculated value is not available choose the nearest standard resistor value which is greater, so that the current will be a little less than you chose. In fact you may wish to choose a greater resistor value to reduce the current (to increase battery life for example) but this will make the LED less bright.
I want to switch on the current through the LED when the Arduino's output pin is high, so I'm going to use an NPN transistor in common-emitter mode. If I wanted to switch it on when the output from the Arduino is low, I'd use a PNP transistor.
To use the Wizard it might help to have the following data in lieu of the actual specifications of your LED's:
here's a table to help you make decent guesses:
For forward current you can use 20mA in most cases.
Color Voltage (Volts)
true green 3.3
blue (430 nm) 4.6
links for 2010-08-20
August 21, 2010 by Philologus