Basic Light Emitting Diode guide

From DP

Jump to: navigation , search

LED topPage1.jpg Image by kaktuslampan: CC BY-SA

Contents

Overview

Probably the most used device in our projects is the humble LED. They’re used in almost every piece of equipment around us. While LEDs are simple to use, we get a surprising number of requests for a LED tutorial. This guide is an introduction to LEDs. Not just how to light them, but how to mine a datasheet for the key values and plug them into an equation! Also check out the evolving version on the tutorials wiki.

If you’re too lazy to calculate the proper resistance value for every LED – like we are – here’s what we use for one-off prototypes:

  • For a 3.3 volt supply use a 2K resistor
  • For a 5.0 volt supply use a 10K resistor

There, no need to read further. If you insist on doing it the proper way, looking stuff up in datasheets, read on.

What is a Light Emitting Diode?

PN junction.png

Image by S-kei: CC BY-SA

A light emitting diode consists of two pieces of semiconductor. One P-type with positively charged “holes”, and one N-type with negatively charged electrons.

When the P side is connected to power, and N to ground, (forward biased P->N direction) current flows through the diode. The electrons and holes combine, neutralizing each other. This releases energy in the form of light, pretty blue (or whatever) LEDness.

The energy is released at a constant wave-length which dictates the color of an LED.

Anode and cathode ends

LED ANCT.jpg

The anode is the P-type semiconductor end of a diode. Current flows into it and exits through the Cathode. It is always the base of the triangle in the diode symbol. LEDs will light up only when connected the right way around, otherwise they pretty much act as an open circuit (like nothing is connected at all).

Voltage drop or forward voltage

LED FWV.jpg

Voltage drop across an LED, also known as forward voltage, tells you how many volts are needed to light it up. Some typical values are listed here, but the best thing to do is get a datasheet and search for the exact Vf value of your part.

LED VF.jpg

As an exercise grab this Kingbright 0805 chip red LED datasheet, and jump to page 2 where the forward voltage Vf is located. In this example the RED chip LED has a Vf of 2 volts. You could power it from a 3.3 volt supply. You could gang together two, cathode to anode, and run them from a 5 volt supply. ( as shown below)

The Vf value is key to calculating the correct current limiting resistor in a future step. Stay tuned!

Forward Current rating

ForwadCurrentRating.jpg

Most LEDs are designed to work best, and have a long happy life, at a specific current. Typically 20mA for common LEDs, but there’s endless other LEDs out there too. Best to check for If in the datasheet. In the datasheet we provided above, the If is 20mA.

As long as you set your current around or below this number your LED should be safe. This rule can be violated if you pulse the LED, giving the die time to cool. For example a 20mA LED blinking on 50% of the time could be run at 40mA.

Basic LED Circuit

LED basic setp.jpg

Here we have a power source V, a current limiting resistor R, and an LED with a voltage drop Vd. The resistor is required to limit the current through the LED at, or below, the datasheet specified forward current If.

Calculating the current limiting resistor in a single LED circuit.

R=(V-Vd)/Id

To calculate the resistance for your circuit subtract the voltage drop from the supply voltage and divide by the desired current.

Probably the absolute easiest way to calculate the resistance is to use a online calculator like the LED calculator for single LEDs, Parallel LED Resistor Calculator, LED Series Resistance Calculator. For the nitty gritty continue below.

Id is the current you want to use on your LED, usually the forward current. Keep in mind that resistors come in specific values, so select the one closest (higher than) to the value given by the formula.

R=(3.3V-2V)/20mA=1.3V/20mA=65 Ohm

Our example uses values extracted from Kingbright’s 0805 chip red LED datasheet. It states the LED’s typical forward voltage is 2V. From the same datasheet the optimal forward current If is 20mA. Using the formula above for calculating the resistor value we find that we need a resistor of 65 Ohms.

Now 65 Ohms is not a standard resistor value. The next closest value is 68 Ohm, and this will give you 19.1mA. .

R=(5V-2V)/20mS = 3V/20mA=150 Ohm

Now lets do the same for a 5 volt supply. In this case 150 Ohms is a standard resistor value, so there is no need to look further.

You might have noticed that these values are much smaller then the rule of thumb values we gave earlier. This is because we don’t want the LEDs to be at full brightness. It’s often distracting to users.

Calculating the current limiting resistor for multiple LEDs connected in parallel


LED Paralel.jpg

Connecting multiple LEDs in parallel is usually a bad idea. Even LEDs of the same production series have slightly different forward voltage to forward current ratios. Some LEDs will draw more current, and some less. This leads to differences in brightness between the LEDs that could reduce the useful life.

R = (V-Vd)/(n*Id)

Where n is the number of LEDs connected this way, and Id is the forward current of a single LED.

R=(3.3V-2V)/(4*20mA)=1.3V/80mA=16.25 Ohm

Let's use the same LED as before in this example where 4 LEDs are connected in parallel. The resistance calculated is 16.25 Ohms, which is not standard. The next standard resistor value is 18 Ohms. This gives you 18.1mA across each LED. As mentioned above this will vary from LED to LED.

R=(5V-2V)/(4*20mA)=3V/80mA=37.5 Ohm

Here is the same setup, but with a 5V supply. This time requiring a non-standard 37.5 Ohms resistor. The next standard value is 39 Ohms. This gives you 19.2mA across each LED.

Worth noting is that in case a single LED burns out, the total current will remain the same. It will be distributed between the LEDs, thus putting more stress on them.

Calculating the current limiting resistor for multiple LEDs connected in series


LED series.jpg

LEDs can also be connected in series, the cathode of one LED connected to the anode of the next. This is done when you have access to a higher voltage power supply, and is more commonly used than the parallel arrangement above. The same current flows through the entire strand of LEDs, thus ensuring they are all the same brightness.

R=(V-(n*Vd))/Id

Use the following formula to calculate the resistance for the current needed. Since the LEDs are connected in series, the entire voltage drop is equal to all the voltage drops added together (n*Vd).

R=(12V-(4*2V))/20mA=(12V-8V)/20mA=4V/20mA= 200 Ohms

Lets use 4 LEDs connected in series with the same specs as before in our example. Obviously the supply voltage will have to be higher then 3.3V, or even 5V, so we chose 12V for this example.

The calculated resistor value is 200 Ohms, which oddly enough is not standard. The next standard resistor value is 220 Ohms, and this will give us 18.2mA going through all the LEDs.

Keep in mind that your power supply needs to be larger then the combined voltage drop of all the LEDs.

In case an LED fails in this setup, the circuit is broken, and all LEDs stop shining.

Conclusion

LEDs are simple, and a fairly universal first electronics project. To calculate the correct current limiting resistor find the forward current and voltage in the datasheet and follow the guide. If you can’t be bothered, just use our rule of thumb for prototype board LEDs:

  • For a 3.3 volt supply use a 2K resistor
  • For a 5.0 volt supply use a 10K resistor