LEDs, or Light Emitting Diodes, can seem deceptively simple when reading many online tutorials: wire one up to a power source, add a resistor, and you should be good; if not, reverse the pins on the LED and voila.

A simple LED schematic

The above leaves a lot of unanswered questions though. What kind of resistor should be used? How much power is needed, and of course how much is too much? What if you’re trying to power more than one LED? As with most things in electronics, Ohm’s Law provides the answer to these questions, but to use Ohm’s Law effectively some basic of knowledge of the LED is needed.

First let’s learn how to identify the positive and negative legs on an LED. Figure 2: shows the side view of a typical round LED. If you look to the base of the LED, you will see a small rim that is flattened on one side. Now look at the leg on this side of the LED; notice how it is shorter than the other. On most LEDs this is all you need to identify the positive and negative legs. The negative leg is shorter, and the rim is flat on that side of the component.LED Side View

It’s important to keep track of part numbers when ordering LEDs as the manufacturer’s data-sheet defines the operating specifications of the component, and with this, it’s easy to calculate the value of resistor that should be paired with the LED. If you don’t have a data-sheet or part numbers to hand, typical values for LEDs can be found by searching the web. As a rule of thumb, red LEDs tolerate lower current and use less voltage than green LEDs. Green LEDs in turn use less power than blue, which use less power than white. Typical values for a 5mm red LED are a forward voltage of 1.9V and an ideal upper current of 20mA. So how do we use these numbers?

The forward voltage, sometimes listed as voltage drop, of an LED is the amount of voltage that must be supplied for proper illumination. An LED that has a forward voltage rating of 2V, if connected to a 5V power source, will leave 3V of potential between its cathode and the negative terminal of the power source. If this potential is not dropped across a resistor, too much current will flow, and the LED will quickly fail.

The operating current is the maximum current that the LED will sustain before damage occurs. With care it is possible to safely drive LEDs beyond their rated operating current, but generally speaking, you will want to set up your circuit such that the LED receives a current that is about 20% lower than the rated maximum. Ohm’s Law tells us that Volts = Amps * Resistance (V = I * R). If our source voltage is 5V, and our LED drops 2V, then our choice of resistor must drop the remaining 3V with a current draw of close to, but less than, 20mA. If we thus rearrange V = I * R to give us a value for R, we get:

R = V / I

Plugging in our values for voltage and current gives:

R = 3 / 0.02

R = 150 Ohms

Any resistor larger than 150 ohms will therefore protect our LED. Ideally we want to undershoot a little though, so using the 80% rule of thumb expressed above, we can simply switch out the 20mA for 16mA and redo the math:

R = 3 / 0.016

R = 187.5 Ohms

This tells us that a resistor somewhere around 180 ohms would be a good choice for our hypothetical LED. In tutorials you will often see 220Ω resistors used with 5mm red LEDs. This is a conservative choice that has the added benefit of being a commonly found resistor value.

Because each LED has a fixed voltage drop, two or more LEDs wired in series will drop the combined forward voltage of the LEDs.  In this case the resistor value must be changed:

V = 5 V
I = 0.016 Ohms
LED voltage drop: 2 + 2 = 4 V

R = V / I
R = 5 – 4 / 0.016
R = 1 / 0.016
R = 62.5 Ohms

The voltage drop of the LEDs obviously sets an upper limit of LEDs that can be wired in series for a given supply voltage.