Powering an LED is not as easy as simply hooking it up to a battery. An LED has almost no internal resistance. Therefore, if you hook it up directly to a battery, it will burn out quickly as the current flows unimpeded through the LED. You must add a resistor to the LED circuit. This tutorial explains how to calculate the resistance needed.
In order to calculate the resistance needed, Ohm's Law is used. Ohm's Law can be stated as V = I x R, where V is voltage, I is current and R is resistance. Since we are calculating resistance, we can rearrange the formula to read R = V ÷ I.
Plug the values you have into the formula. Performing the calculation will give you the value of the necessary resistor.
For example, suppose you have a 12 V supply, a white LED with a forward voltage of 3.4 V, and a current of 20 milliamps (0.020 amps.) First calculate the voltage by subtracting 3.4 from 12, giving 8.6.
Now calculate the following: R = 8.6 ÷ 0.020, or 430 Ω (ohms.)
If you are connecting LEDs in series, simply add the forward voltages together before subtracting from the supply voltage.