loading

You've heard about LEDs. Chances are you've already tinkered with them. But there are so much details you probably don't know about. Sadly the resources available are often incomplete or just unpractical. This guide takes you all the way from a beginner level to adept skills!

This is chapter 2 of a short series. Use the table of contents below to browse the content I've already published.

In this chapter we'll discover the most common ways of connecting LEDs and figure out which is best suited for your project. Just like most LED circuits these contain a resistor, we'll learn about its purpose and how to choose the right value.


Chapters:

  1. Pick your LED!
  2. Essential Circuits
    1. Electricity 101
    2. Forward Voltage
    3. Single LED (& LED Throwies!)
    4. LEDs in Series
    5. LEDs in Parallel
    6. Constant Current
    7. Comparison Chart
  3. Switching & Dimming
  4. Matrix & Multiplexing (new!)
  5. High Power & Lighting

Step 1: Electricity 101

To understand how the circuits work you'll need to know some fundamental concepts about electronics. In this guide we'll use exclusively DC voltages, the kind you get from batteries or most power supplies.

Electricity can be very well compared to water:

The voltage from a battery can be compared to the pressure of the water, generated by a pump. The amount of water flowing represents the electric current. A pipe symbolizes a wire. If you'd place an obstacle into the stream the amount of water flowing will be reduced depending on the pressure of the water. This obstacle is the equivalent of a resistor. The current through a resistor increases with the voltage applied. This is expressed by Ohms' Law:

I (current) = U (voltage) / R (resistance)

If you put a second obstacle behind the first the same amount of water has to flow through both. The water pressure will be split across both obstacles. This is called a series connection:

I = IR1 = IR2

U = UR1 + UR2

If you connect a second pipe with a second obstacle the water pressure would be identical for both ways. Since the water has a second path the total amount of water flowing will increase. This is called a parallel connection:

U = UR1 = UR2

I = IR1 + IR2

Throughout this guide indices such as R1 and R2 will specify which voltage or current is meant. This is a very common technique for many electronic projects to avoid confusion.

Step 2: Forward Voltage

I've briefly touched this topic in the previous chapter before, yet I haven't told you the meaning of it.

We are used to think that devices need a voltage to operate. A cellphone needs 5V, a remote takes two AA batteries, a total of 3V, a watch may work on a 1.5V button cell. You don't need to worry about the current, they draw as much as they need.

LEDs work the other way around: They need a fixed current (the forward current) and the voltage will adjust accordingly. To me this was one of the hardest things to grasp; it always felt so unnatural.



But why is it like this?

'Normal' devices can be approximated as a simple resistor, if the voltage increases slightly, the current increases slightly in propotion. The brown color in the diagram above shows this phenomenon for a 100Ω resistor.

The other colors illustrate the voltage/current relation of LEDs with various colors. You notice the curves get steeper with increasing voltage. This means a slightly higher voltage will cause much more current to flow, risking damage to the LED.


While it is possible to generate very stable voltages, the forward voltage of LEDs varys between parts and across temperature, making it impossible to set "just the right" voltage. Instead it is much simpler to change a voltage source into a simple current source - with nothing but a cheap resistor!

Step 3: Single LED (& LED Throwies!)

Understanding why things work as they do is incredible powerful, it allows you to find solutions for a variety of projects. This guide is meant to help you archive this.

The explanations below require basic math, namingly equations and variables. If you are not familiar with these concepts, you can use the bold printed formulas and just fill in the given values. Should you need any help, just ask your question in the comments.


While a single LED is not super bright, it is very useful indicate if a circuit has power or not. Other applications may include miniature torches, futuristic art or in our case, a nightlight.



The example project:
A simple USB LED nightlight

The operating conditions:

  • The USB output voltage is USYS = 5V typical.
  • I choose this white 5mm THT LED as it is most commonly available. Important parameters of this LED are:
    • UF = 2.8-3.6V (forward voltage)
    • IF = 30mA (forward current)


The circuit:
The basic design is simple, just connect the LED and the resistor in series as shown in the schematic above. It does not matter whether the resistor is placed between the positive or the negative input and the LED. Just make sure the polarity of the LED is correct.


The resistor value:
To calculate the resistance we need to transform Ohms' Law (The index R indicates that these values belong to the resistor):

I = U / R ⇔ R = U / I

Since the LED and the resistor are connected in series, the same current must flow through both parts:

I = IR = IF

The applied voltage across both components is split between them:

USYS = UR + UF

Since UUSB and UF are known the equation can be transformed to:

⇔ UR = USYS - UF

Putting all this together we get:

R = (USYS - UF) / IF


About the forward voltage:
The forward can vary a lot between parts, thus the manufactures specify a voltage range. In most cases it is sufficient to design the circuit for the average forward voltage, 3.2V in this case. If a high reliability is desired, it is wise choice to select the lowest possible forward voltage which keeps the current guaranteed within it's rating.


The result:

All that's left to do is to apply the formula above to our values:

R = (5V - 3.2V) / 30mA = 1.8V / 0.03A = 60Ω

Resistors are only manufactured in a few standard values, so pick one slightly higher then calculated. This will slightly reduce the current and be within the LED's current rating. In this case a 68Ω resistor is a good choice.


Resistor power rating:
Every resistor dissipates some power in relation to the voltage across and the current trough it:

P = U * I

Since the resistance is given as

R = U / I ⇔ U = R * I

The power can be calculated by

P = ( R * I ) * I = R * I²

In our example this results in:

P = 68Ω * (0.03A)² = 61.2mW

The maximum power dissipation is limited by the size of the resistor and can be looked up in charts like this ↗ http://www.resistorguide.com/resistor-sizes-and-packages/.


Going further:

This building block (LED + resistor) is suitable for a constant voltage operation. This allows you to put as many of these blocks in parallel as you wish; each one will have the same supply voltage.

It's worth mentionig that the current though the LED is most stable when the voltage across the resistor is fairly large. Try to avoid circuits where the voltage across the resistor is UR < 1V. If that is not possible you should consider selecting a lower current throught the LED than rated.


LED Throwies!:
"LED Throwies" are the most simple LED project I could think of.

Haven't heard of them?
Each "Throwie" consists of a LED and a CR2032 battery taped together without a resistor. This does only work so well because the battery voltage is low and the internal resistance (which is usually unwanted) limits the current. It is pure luck that the CR2032 happens to have just the right amount of resistance, smaller cells will result in a dim LED and larger cells might destroy the LED.

Step 4: LEDs in Series

While a resistor per LED works just fine, you may wish to reduce component count and increase the efficiency for larger projects. This method is suitable for higher operating voltages and recommended for most lighting applications.



The example project:
A LED Lamp powered by a 12V DC power supply

The operating conditions:

  • The power supply voltage is USYS = 12V typical.
  • I choose same white 5mm THT LED as in the previous step. Important parameters of this LED are:
    • UF = 3.2V typical
    • IF = 30mA


The circuit:
We know LEDs are driven by a current, and the current in a series connection is the same through each component. Thus we can add a few additional LEDs to this string. The total voltage across all LEDs is the sum of all individual forward voltages:

ULEDs = UF1 + UF2 + ... UFN = N * UF
(N is the total amount of LEDs used)

Note that the combined voltage must be always smaller than the supply/system voltage;

ULEDs < USYS

This limits the amount of LEDs per string to:

N * UF < USYS N < USYS / UF
⇒ N < 12V / 3.2V ⇔ N < 3.75

⇒ N = 3


The resistor value:
The calculation is identical to the one for a single LED, exempt now we need to use the combined voltage ULEDs:

R = (USYS - ULEDs) / IF = (USYS - UF*N) / IF
R = (12V - 3.2V*3) / 30mA = 2.4V / 0.03A = 80Ω

Again, there is no 80Ω resistor, so we pick the 82Ω resistor instead.


Efficiency:

The voltage across the resistor is proportional to the loss of power in both circuits.

With only one LED much power is wasted:

UR = USYS - UF = 12V - 3.2V = 8.8V
UR / USYS ≈ 73% loss!

With three LED it is much better:

UR = USYS - 3*UF = 12V - 9.6V = 2.4V
UR / USYS = only 20% loss


Mixing LEDs:
With a series configuration you can mix different colors (and thus forward voltages) as you like. The only requirement is that they run are rated at the same current.

Step 5: LEDs in Parallel

In many small and portable projects the benefits of a series connection is desired, but the voltage is not sufficient. Commonly you'll see LEDs just wired in parallel to reduce the amount of resistors needed. However this is neither an ideal nor recommended method to drive LEDs.

The main issue: The forward voltages of the LEDs vary a lot. If you'd put a LED with UF = 2.8V and one with UF = 3.6V in parallel the first would draw most of the current, very likely more than it is rated at. With increasing temperature due to self heating this issue gets worse. This is problematic as the first tests might be ok, but it'll be unreliable in daily use. As soon as one LED fails the current will split up across the remaining LEDs driving all of them at higher currents than rated.

Preferred fix? Use one resister per LED.

Are you ok with dimmer LEDs and feeling adventurous? Read on.



The example project:
Miniature LED fairylights

The operating conditions:

  • The power supply voltage is USYS = 5V typical.
  • The LEDs used are generic white 0603 SMD LEDs. Important parameters of this LED are:
    • UF = 2.8-3.6V
    • IF = 20mA


The idea:
The idea is to solder the tiny SMD LEDs directly on two wires. The wires will also be the mechanical support. Any resistors between would ruin the overall look.


Checklist for connecting LEDs in parallel:

☑ resistors must be avoided at all cost
☑ bright light is not required
☑ identical LED color
☑ LEDs are from the same batch


The circuit:
The circuit itself is simple, just add more LEDs in parallel. Since all LEDs are run in parallel their number is not even limited.


The resistor (safe & easy solution):
What if we'd calculate the resistance as if there is only a single LED? Splitting the current across multiple LEDs in parallel can only reduce the current further.

R = (USYS - UF) / IF

The downside is obvious, by adding more LEDs the brightness of each decreases.


The resistor (brighter and complex solution):
Since we are using the same LEDs from the same batch it can be assumed that the forward voltage difference is fairly small. I couldn't find any statistical data on the forward voltage of any LED.

To have same rough values I tested a tiny sample of 10 white 0603 LEDs at IF = 15mA. The results were quite surprising: The mean value is 3.02V, and the forward voltage only varied by ±0.05V! I don't believe this is the usual case, so for all following calculations it is assumed the variation is as much as ±0.1V or 0.2VPP.

The diagram 'Forward Current vs. Forward Voltage' from the datasheet allows us to estimate the small signal current gain by linear aproximation.

IF / UF ≈ 35.7mA/V

A change of 0.2V will result in:

35.7mA/V * 0.2V = 7.14mA

To be entirely sure the LEDs are operated within specification we need to use this as a safety margin. The total current is therefore:

Itot = N * (IF-7.14mA) = N * 12.86mA

All that left to do is to calculate the resistor with the new resistance:

R = (USYS - UF) / Itot

With 10 LEDs this results in:

R = (5V - 3.2V) / (10 * 12.86mA) ≈ 14Ω


Rule of thumb:
The calculated de-rating in the example above is by no means universal, it will vary a lot between different types of LEDs. As a rule of thumb it should be a sufficient approximation to reduce the total current to half of the rated:

R = (USYS - UF) / Itot = (USYS - UF) / (IF * N * 0.50)

Step 6: Constant Current

All the calculations in before had only one purpose, to set the current flowing through LED(s). This was necessary as voltage sources would likely destroy LEDs. Wouldn't it be nice if the resistor is adjusted while running to keep the same current at all time, independent of the supply voltage?

Actually, such a thing exists and is called constant current source. There are a few integrated circuits for this job, but most are intended for high precision applications and therefore quite costly. For normal applications there are plenty of discrete constant current source designs, this is my favorite for driving LEDs.



The example project:
LED tester

The operating conditions:

  • The battery voltage is USYS = 6V-9V (empty/full)
  • This time any standard LED should work, so the requirements are broad
    • UF = 1.2-4.0V
    • IF = 20mA


The circuit:
The design consists of two transistors and two resistors. A transistor can be simplified as a voltage controlled switch: As soon as the voltage from base (B) to emitter (E) exceeds around 0.6V current flows from the collector (C) to the emitter.

All of the LEDs' current will also flow through the resitor R2 and cause some voltage drop. If this voltage exceeds about 0.6V the transistor T2 will turn on. This causes the voltage at the base of transistor T1 to decrease, turning it off and thus reducing the current through the LEDs. Unlike normal switches transistors can also be "half switched" which stabilizes the circuit at a certain current. This current is set by R2:

ILED = 0.6V / R2

For an LED tester it is useful to set the current to 20mA:

R2 = 0.6V / ILED = 0.6V / 20mA = 30Ω

Fortunately 30Ω is a standardized value, thus you can archive precise 20mA!

The circuit does not care about the load you connect, so you can also a series of LEDs! In fact, this is the most common way in the industry to drive a large amount of LEDs reliably.


Details on the circuit design:

The resistor R1 acts like a fine-tune setting for the 'turn-on voltage'. The value 18k sets the 'turn-on voltage' for the selected transistor at 0.6V ±3% for a supply voltage of 4V < USYS < 12V. According to some simulation this circuit works just as well with most other common small transistors.

It should be noted that this is not the best design for a high power LED driver. When T2 is above 25°C the 'turn-on voltage' will decrease by about 2mV per °C. This results in a current increase of about 0.33% per °C compared to the set current.


Other designs:

The obvious issue with all circuits presented in this chapter is the power loss within the resistor or the transistor. Even with the right supply voltage it's hard to archive an efficiency better that 80%.

The industry's solution are so called "switching regulators" which archive efficiencies of 85-98%. On the flipside they are far more complicated and can involve some serious engineering. I'm currently working on different designs which will be explained in detail in upcoming instructables.

Step 7: Comparison Chart

SingleSeriesParallelConstant CurrentSwitching Regulator
typical
application
status LEDlightingminiature artLED testinghigh power LEDs
supply
voltage
low to mid mid to highlowlow to highlow to high
stability vs.
voltage
oo--++++
stability vs.
temperature
oo--~++
simplicity+++-+--
board space+++++---
efficiency-+--++
total power-+--+++
cost vs. light++++---


Legend:

++outstanding
+good
oreasonable
-drawback
--poor
~depends on the design
<p> very useful , Thank you</p>
The comparison chart didn't turn out readable.
<p>Huh? I checked formatting of this page with firefox, chrome and edge, and I can't see any issues. Which browser do you use? Could you please PM me a screenshot of what is displayed to you? I'll try to fix it as soon as possible. Thanks!</p>
Its in the Android instructable app. The grid/cell/bordered part doesnt show. Its shows correct in the Android Chrome browser.
<p>I am a student of electrical and i am happy to see such nice post here. Keep it up. It helped me a lot.</p>
<p>I think you have a typo on Step 4: LEDs in Series. See attached picture. Very good info though. Thank you.</p>
<p>You're right, I fixed it. Thank you!</p>
Thats the first explanation of constant current that has actually clicked for me. I cant wait for the rest. Thank you
<p>Your are in the process of creating a very valuable resource.</p><p>Writing style; careful explanations; examples - they excellent and all work for me.</p><p>Thank you, congratulations, and don't stop any time soon :-)</p>
<p>Words like this mean very much to me, thank you :)</p>
<p>Thank you very much for a great read.</p><p>I second all the previous comments.</p>
<p>This is great. A simple resource to really help me understand the basics before I dive in and start making LED light painting tools.</p>
<p>I'm so glad I found this, the exact knowledge I'm after right now, bloody fantastic!</p><p>Also, there's no such thing as ...&quot;too much math&quot;.. so don't be worrying about that.</p><p>I need to know more about dimming for current LED project so Looking forward to your next chapter.</p><p>Thankyou, Thankyou, Thankyou.</p>
<p>This morning I had planned to delay the next chapter by a week - until I figure out the math stuff. Now I'm sitting at my desk working through the night to be done by tomorrow. Thank you for pushing me forward, that was just what I needed.</p><p>I hope you like what I'll come up with! See you there :) </p>
<p>Thank you for these articles, I am interested in the sequel.</p>
<p>You don't have to wait for long, the next is due tomorrow!</p>
<p>Nice explanation and comparison of LED technics. Thanks.</p>
<p>I'm glad to hear this is useful to you!</p>

About This Instructable

18,566views

322favorites

License:

More by nqtronix:TicTac Fairy Lights LED Cube Pendant - Worlds Smallest LED Cube Practical Guide to LEDs 4 - Matrix & Multiplexing 
Add instructable to: