Recently I was asked by one of my customers about using resistors with LEDs. The question came down to “What is the purpose of the resistor?”
For many people starting out in electronics today, LEDs (Light Emitting Diodes) are a popular starting point. They are a fundamental circuit (or, more often, sub-circuit). LEDs have traditionally been used for indicators of all sorts (looking around my desk, there are 5 of them telling me things are turned on and one telling me if I have voicemail). But now, since the advent of white LEDs, they now serve as a very energy-efficient lighting source. So driving a LED is a good starting project, and learning why we need the resistor is a great way to learn some basic electronics concepts. So let me try to explain.
First let’s start with the LED. A light emitting diode is, fundamentally, a diode. Diodes conduct electricity in one direction only. When current flows though a LED in the correct direction (from the anode to the cathode), two things happen: light is emitted of course, and there is a well defined drop in voltage across the LED.
All LEDs vary the amount of light they produce in direct relation to the current going through them: more current = brighter light. But with everything, there is a limit. (This same relationship applies to tungsten light bulbs, but if you take a light bulb made for the U.S. and take it over to Europe, it will burn much brighter, but only for a fraction of a second before burning out.) In LED datasheets this limit is referred to as forward current (IF), and a typical safe operating limit is 20mA. For lighting uses, we will normally want to run this much current through the LED. Note this is sometimes referred to as the test current (as the manufacturer’s tests use this current as a standard) and is almost always lower than the forward current in the Absolute Maximum Ratings section. For indicators, full brightness may be too bright and might want as little as 1-2mA through the LED.
So what does this have to do with resistors?
Well, everything, really. The resistor is what makes everything work right. Remember the LED has a defined voltage drop? Most likely your power source isn’t exactly equal to that drop (if it is, you might be able to get away without a resistor). Let’s say you have a 5V power supply and are driving a Cree bright white LED which has a voltage drop of 3.2V at 20mA. A simplification of Kirchoff’s Voltage Law (KVL) tells us that the total voltage drops (in this case the LED) have to equal the total voltage gains (the 5V power supply). Here we have a difference of 1.8V to account for. The wire offers minimal resistance of its own, essentially 0Ω. The most fundamental relationship in electronics, Ohm’s Law, says that the current through an element is equal to the voltage across it divided by its resistance (I = V/R). Here we have 1.8V/0Ω, or infinite current, which equals your LED going poof (and maybe a fire if you’re unlucky). This is where the resistor come in.
We have a 1.8V drop to deal with before the LED will work properly on a 5V supply. We also know we want to get the most brightness we can safely get from these little critters, so we’d like 20mA going through them. Using simple algebra, Ohm’s Law can be shuffled around to find any of the three values if we know the other two. In the case, we shuffle it so that R = V/I, since we know V (1.8V) and I (20mA). So R = 1.8V/20mA = 1.8V/0.02A = 90Ω. We would then round to the next highest standard value (or the next highest we have at hand). In this case, a 91Ω or 100Ω resistor would be a good choice.
In driving a LED, we need to choose a resistor to keep the current down to a safe level for the LED so it doesn’t burn out.
A note on power
When choosing the resistor, it’s also good practice to make sure the resistor can handle the power it will dissipate. Usually a 1/4W resistor is sufficient, but not always. To find the power the resistor will need to handle, we use the formula P = VI. In the above example we had 1.8V across the resistor and 20mA through it, therefore P = 1.8V(0.02A) = 36mW, well within the capability of a standard 1/4W resistor. Even within the capability of an 1/8W resistor, but there really isn’t much benefit money-wise to using 1/8W resistors unless you’re mass manufacturing.
Hope this explains the purpose and usefulness of resistors in driving LEDs. Feel free to post your comments and questions. I’ll do my best to answer them for you.