INTRO GUIDE: Basic light emitting diodes (LED)

Posted on Wednesday, October 10th, 2012 in tutorials by DP

Image by kaktuslampan: CC BY-SA

Probably the most used device in out projects is the humble LED. They’re 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 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 resistor 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, follow the link below.

What is a Light Emitting Diode

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

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

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.

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)

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

Forward Current rating

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 20 mili-Amps

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

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.


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 LEDsParallel 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 Ohm 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

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

Lets 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 Ohm 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

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.


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.


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
This entry was posted on Wednesday, October 10th, 2012 at 5:00 pm and is filed under tutorials. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • KH: So Romanians use old ICs too, a bit reminiscent of Dilshan's projects. I'm vaguely disappointed by the liberal use of float data and float calculations....
  • Max: This is of course no "0-30V" supply - the single-supply standard LM723 schematic can't go all the way down to zero, which is why I...
  • KH: A power-off current draw of 4mA for the Sony A6000 is a defect, product recall territory. It hits the camera battery with unacceptable wear and...
  • Olav Storstrøm: Please add 9-pin D-sub RJ45 and RJ12 connectors! Thanks!
  • KH: Hydroponics is like home automation. Every year you have folks who start projects like these and think it will take off and become a big...