I've noticed that some people are uncertain how to calculate series resistance for a LED or when using a group of LEDs are uncertain about wiring them in series or parallel. This walkthrough will try and explain how and why.
LEDs come in a wide range of colour, brightness and power ratings. Some of the latest highpower LEDs even require heatsinking. No matter what LED you want to use, they all have some basic properties in common that you need to know before using them in a circuit.
First of all, LEDs are a polarised electronic component. This means that power must be connected the right way or else damage will occur. For this reason there is always some indication on the caseing as to which lead is positive and which is negative.
Calculate the resistor value
To calculate the correct resistor value you need to know a few things about your LED.
1. what is it's forward voltage drop?
2. what is it's maximum continuous forward voltage.
This information should be supplied with you LEDs or can be found in the data sheet. I've attached the data sheet for a high intensity IR LED as an example of what to expect. It is worth becoming familiar with data sheets. You don't need to understand everything in them but you should be able to find basic information such as absolute maximum ratings and electrical characteristics. The second attachment covers a wide range of components but in the section on LEDs it gives you details on various LEDs such as forward voltage and max continuous current. It demonstrates that both values can vary widely depending on the LED.
Once you know the forward voltage drop and maximum current you can work out your circuit design and resistor values.
This is a basic power indication LED circuit. The formula for calculating the series resistor is:
R ohms = (Vsupply - VLED) / I where "I" is current in amps. For the circuit on the right, assume the supply voltage is 7.2V, the forward voltage of the diode is 2.1V and it's maximum forward current is 15mA.
R ohms = (7.2V - 2.1V) / 0.015A
R ohms = 5.1V / 0.015A
R ohms = 340 ohms
Since you can't get a 340 ohm resistor I would use a 390 ohm. The current would be less giving you a safety margin.
If you are driving a LED from a processor output as an indicator light then the same formula works except that your supply voltage is that of the processor (usually 5V) and your processor is limited on it maximum current output. Pic processors have a maximum limit of 25mA which is enough for most LEDs. Note that the forward voltage of the LED must be less than the supply voltage or else it wont light up.