Nearly every consumer device makes use of the Light Emitting Diode (LED). This highly versatile device offers an easy way to add an indicator to any project while drawing a relatively small amount of current. Once their operation is understood, adding them to any project is a simple task. This tutorial is a simplified explanation of how a LED works and how to select a current limiting resistor. The LED tutorial here is enough to use LEDs in a project but is not intended to be a thorough explanation.
A Diode is an electronic component that only conducts electricity in one direction. The “Forward Voltage” rating of a diode will determine the minimum voltage difference between the anode and cathode to allow current to flow. For example, let’s consider a diode with a forward voltage of 0.7 volts. If you apply +1 votls to the anode and 0 volts to the cathode, then current will flow. However, reversing the voltages to apply 0 volts to the anode and +1V to the cathode, prevents current from flowing!
A “Light Emitting Diode” (LED) is a variant of the standard diode with the same characteristics. The obvious difference is that when current flows through an LED it generates visible (non-visible) light.
When looking at the specifications for a LED, there are two key ratings to note: the “Forward Voltage” and the “Forward Current.”
The forward voltage defines the amount of voltage required for the current to flow through the diode junction. Any voltages below this level cause the LED to remain “open” or non-conductive. This open state also means any components in series with the LED will not have current flowing through them either!
Current is allowed to flow through the LED once the voltage drop across it reaches the forward voltage. Not only that, but the LED only drop its forward voltage at any given time. This point is what makes a diode or LED different from a resistor.
A resistor is called a linear device because the current that runs through it is directly propertional to the voltage applied and its resistance. (You might know this as Ohm’s Law.) A diode or LED is different. Voltage and current has a non-linear relationship.
Now let’s look at a pratical example. Consider a LED with a forward voltage rated at 3.0 volts. What happens if you attach the anode to the positive (+) terminal of a AA (LR-6) battery and the cathode to the negative (-) terminal? Will the LED do anything? No! The AA (LR-6) battery only has a nominal voltage of 1.5 volts. Until you add a second battery, the LED will not light up.
So if you use two nominal AA (LR-6) batteries in series and connect them to this diode, it will light up, and all is good, right? Well, No. Inside the LED, that the diode junction turns into a (near) short-circuit when the a forward voltage is applied. This behavior means the LED could draw ALL the current it can from the battery. This situation is not good because you are short-circuiting the battery! Not only will this damage the battery, but will overheat or destroy the LED!
Forward Current (If)
As mentioned before, applying the forward voltage turns an LED into a short cirucit. As a short, the LED will draw all the current the supply allows AND will damage itself. So you must limit the amount of forward current allowed to flow through the LED. There is where the name “current limiting resistor” comes in. A resistor placed in series with the LED limits the current that flows through it.
Diodes, and LEDs, drop a constant voltage regardless of the current that runs through them. So the Resistor and LED work together. The resistor holds the amount of current constant and the LED holds the voltage dropped across each constant. The next question to address is, what value resistor is needed?
Yellow LED Example
To calculate the required current limiting resistor, two properties of the LED must be known: Its Forward Current (If) and Forward Voltage (Vf). Mentioned in the last section is that a LED will hold the voltage dropped across it constant. Regardless of the voltage applied, it will only drop the Forward Voltage (Vf) across itself. Using the datasheet for a Yellow LED (available at Sparkfun), we see these two values:
The goal is to set the Forward Current for the LED at 20mA which means the LED will drop 1.8-2.2V. In this case, make the assumption THIS LED is going to drop 2V.
Ohm’s law determines the value of R_LIMIT. The R_LIMIT and LED are in series. This connection means their voltages add-up and the amount of current going through them is the same. The LED drops 2 volts across itself, leaving 3 volts for the drop across R_LIMIT. Since these two components are in series, 20mA of current will flow through both.
Ohm’s Law says that Resistance = Voltage / Current. This means R_LIMIT = 3.0V / 20mA = 150Ω.
The resistor value used depends on which LED is picked. Generally it will be in the range 150-470 Ω. When in doubt, select a slightly large resistance value.
Diodes are simple, yet versatile components. LEDs extend these properties to include lights. LEDs have plenty of cool Matrix-based projects as well as more practical uses like status indicators. The information shown here shows how to find the Forward Voltage and Forward Current of an LED from its datasheet. Then Ohm’s Law is shown to calculate the correct limiting resistor.