Driving LEDs – things everyone needs to know
LED - what is it
Light Emitting Diodes more frequently known as LEDs are semiconductor devices that converts electricity in to light. It hard to fond a gadget or other device that doesn't use LED diodes. They are cheap they are simple to use and they are small. LEDs can emit different light colour depending on different chemical compound material in a semiconductor.
One and common LED symbol is as standard diodes but with couple arrows indicating that it emits light:
There can be few differences between different standards – some require unfilled diode symbol, other require filled. You can also find LEDs or other semiconductors that has circle around them. Probably simple unfilled and without circle version is best choice as it require less ink and time to waste in drawing it.
Recognizing LED pins
It is easy with standard LEDs – they have special shape that allows detecting pins easily.
As you can see cathode side has a flat cut on fibber glass. Also cathode pin as shorter comparing to anode, but don't rely on it- especially if diode is already used somewhere. But this is with standard through hole diodes. We know that there are other types – so be sure to check pins in a datasheed or simply test before soldering.
Selecting a resistor for LED
First of all – don't drive any LED without resistor. Resistor is needed to limit electrical current that flows through LED. Without it diode will fry – especially in higher voltages. So always keep in mind general rule – don't drive semiconductor without a resistor. So what resistor do you need?
For indicating purposes there is no big deal. Usually 0,5k or 1k resistor in series works just perfect for standard voltages like 5V. But what if you want to sure and drive LED optimally with any voltage... You have to do some math – nothing more than Ohm's law. If you will look at diodes datasheet you will find that LED needs about 10 to 20mA of current and it has a forward voltage drop about 1,8V. To be more specific voltage drop depends on wavelength emitted. Starting from Infrared voltage drop is about 1,5V while Ultra Blue reaches 3,8V drop. And current usually depends on LED power can be hundreds of miliamps or even several amps.
OK lets take a standard 5mm diode (20mA and 2V) and find right resistor for it if supply voltage is 5V. If you look in a any LED datasheet you will find following chart indicating relation between LEDs forward current and forward voltage drop. This is main characteristics in determining LED voltage drop under desired current. And as you may already figured out brightness of LED directly depends on current flowing through it.
So lets find a working point keeping in mind not to exceed maximum allowed current which is 20mA in our case, and find forward voltage drop which is equal to 20. So now lets calculate resistor value.
It's easy. First of all subtract LED drop voltage from supply voltage:
This means that 3V has to drop on resistor. Now by using simple Ohms law we can easily calculate resistor value:
Lets put these calculations in one simple formula:
Here you can see that VS - stands for Supply voltage; VD - Diode forward voltage drop; ID - diode forward current;
This way we can calculate resistor valu at any circumstances. Of course be sure not to drive LED at maximum current for a long time. Large currents shortens its life. Leave some reserve by selecting a bigger resistor value. You can always double resistor value like up to standard 330Ohm. Your eye won't actually see the difference in intensity change, but this will be much healthier to LED. More about LEDs here.