Français

Lessons · Lesson E3 · Electricity basics · 15 min

LEDs and the right resistor

Which way round an LED goes, and how to pick the resistor that keeps it safe, with one formula and a calculator. About 15 minutes.

An LED has a direction

LED stands for light-emitting diode, and a diode is a one-way gate for current [1][2]. That gives the two legs different names: the anode (+), where current enters, and the cathode (−), where it leaves [1].

How to tell them apart [2][3]:

  • The longer leg is the anode (“+”).
  • Look at the rim of the casing: one side is flattened. The leg on that side is the cathode (“−”). Useful when the legs have been cut to the same length.

Wired the wrong way round, an LED simply does nothing, and it takes real abuse to hurt it like that [1]. Dark LED? Turn it 180° and try again.

Which leg is which on an LED A 5 millimetre LED seen from the side, from above, and as a symbol. Side view: the longer leg is the anode, the plus side; the shorter leg is the cathode, the minus side; the rim at the bottom of the casing has a flat edge on the cathode side. Top view: the round rim with its flat edge, cathode next to the flat. Symbol: a triangle pointing in the direction of the current, from the anode to the cathode, with a bar on the cathode side and two arrows for the light. Current goes in by the anode and out by the cathode. Put in backwards, the LED simply stays dark. FIG. 1 — LED: LONG LEG, FLAT EDGESide viewFlat edge= cathode side (−)Short legcathode (−)Long leganode (+)Seen from above+−flatThe flat is on the − side.Handy when legs are trimmed.SymbolanodecathodeICurrent goes in by the anode (+) and out by the cathode (−).Backwards? It stays dark, no harm done. Flip it around.
Tap the diagram to open it full screen.

Forward voltage: what the LED keeps for itself

When an LED is on, it uses up a roughly fixed amount of voltage. This is its forward voltage (written Vf) [4][5]. The resistor gets whatever the supply has left [4][3].

How much is it? It depends on the LED, and the colour is part of that:

  • Red, yellow, orange and light-green LEDs fall around 1.85 V to 2.5 V. 2.2 V is a decent average [4].
  • Across all colours, the range runs from about 1.6 V up to over 3 V [3], or 1.7 V to 3.4 V by another source [5].
  • A red LED is often taken at around 1.8 V to 2.2 V [4][5].

Always look at the packaging or datasheet of your own LED. That number is the one to use. If you do not have it, start from the red LED value of about 2 V, and measure the real voltage with your multimeter once the LED is lit (lesson 2).

The LED also has a current limit. Basic LEDs are usually rated for about 20 mA continuous, and you should stay at or below that [5][3]. This lesson aims for 10 mA: clearly lit, with room to spare.

The LED keeps Vf, the resistor takes the rest Voltage drawn as a water level that steps down along the loop. After the 5 volt supply the level is at 5 volts. The resistor is the first step down, from 5 to 2 volts: it takes the rest, 5 minus 2, so 3 volts. The LED is the second step, from 2 volts to 0: its forward voltage, about 2 volts for a red LED. The two steps add up to the supply voltage. Current flows along the loop from plus, through the resistor, then the LED, back to minus. FIG. 2 — WHERE THE VOLTAGE GOES0 V1 V2 V3 V4 V5 Vvoltage (level)after the supply: 5 VResistor: the rest5 V − 2 V = 3 VLED keeps Vf≈ 2 V (red)I3 V + 2 V = 5 V: the steps add up to the supply.Vf depends on the LED: read your packaging or datasheet.Picture only: current flows from + through the resistor, then the LED, to −.
Tap the diagram to open it full screen.

The formula: Ohm’s law on the resistor

In the loop (supply, resistor, LED in a row) the voltages must balance: what the supply provides equals what the parts use up [4]. The LED uses Vf, so the resistor must absorb the rest:

VR = VS − VF

Now apply Ohm’s law (lesson 1, “Voltage, current, resistance”) to the resistor only. The same current flows through every part of a single loop [9], so the resistor carries the current you want in the LED:

R = (VS − VF) ÷ I

Careful: Ohm’s law is for the resistor. The LED itself does not follow it: like any diode, its current is not proportional to its voltage [10].

Worked example. Supply 5 V, red LED at 2 V, target 10 mA (0.010 A):

  1. Voltage left for the resistor: 5 − 2 = 3 V
  2. R = 3 ÷ 0.010 = 300 Ω

Same method as the SparkFun example: 9 V supply, 1.8 V LED, 10 mA gives about 720 Ω [5].

What if the value is a bit off? It does not have to be exact. A slightly smaller resistor gives a brighter light and a slightly shorter LED life. A larger one gives a dimmer light [3].

Three steps to the resistor value A loop with a 5 volt supply, a resistor of unknown value and a red LED. Step 1: the voltage left for the resistor is the supply voltage minus the LED's forward voltage, 5 minus 2, so 3 volts. Step 2: choose the current, 10 milliamps, which is 0.010 amps, the same everywhere in the loop. Step 3: divide, R equals 3 volts divided by 0.010 amps, 300 ohms. The general formula is R equals supply voltage minus forward voltage, divided by the current. FIG. 3 — THE RECIPE: R = (Vs − Vf) ÷ I?Vs = 5 VVf ≈ 2 Vred LEDI1231Voltage left for the resistorVs − Vf = 5 V − 2 V = 3 V2Choose the current (same all round the loop)I = 10 mA = 0.010 A3DivideR = 3 V ÷ 0.010 A = 300 ΩR = (Vs − Vf) ÷ I
Tap the diagram to open it full screen.

Standard values, then 3.3 V and 5 V

You will not find a 300 Ω resistor in a shop. Resistors are sold in preferred values so that manufacturers and shops can share the same few. The E12 series has 12 values per power of ten, with 10% tolerance [7]:

10 · 12 · 15 · 18 · 22 · 27 · 33 · 39 · 47 · 56 · 68 · 82 (then × 10, × 100, × 1,000: 100, 120, … 820, 1,000, 1,200, …)

Our rule: round up to the next E12 value. More resistance means less current [3], so rounding up keeps the LED on the safe side. This is our own rule of thumb, not a standard.

Three examples at 10 mA. Both 5 V and 3.3 V are common supply voltages.

Supply LED (Vf) Calculation Standard pick Real current
5 V red, 2 V (5 − 2) ÷ 0.010 = 300 Ω 330 Ω 3 ÷ 330 ≈ 9.1 mA
3.3 V red, 2 V (3.3 − 2) ÷ 0.010 = 130 Ω 150 Ω 1.3 ÷ 150 ≈ 8.7 mA
5 V an LED rated 3.2 V (5 − 3.2) ÷ 0.010 = 180 Ω 180 Ω (E12) 1.8 ÷ 180 = 10 mA

When the supply is close to Vf, be careful. With 3.3 V and an LED of 3.2 V, only 0.1 V is left for the resistor, so a tiny difference in the LED’s real voltage changes the current a lot. With an LED of 3.4 V on 3.3 V, the supply is below the forward voltage, which is what an LED needs to light up [5]: it will be dim or may not light, and the current cannot be set reliably, whatever the resistor. If the maths gives you a tiny or negative resistor value, choose a different LED or a higher supply.

The E12 series on a log scale A scale from 100 to 1000 ohms drawn on a logarithmic axis. The twelve E12 values, 100, 120, 150, 180, 220, 270, 330, 390, 470, 560, 680 and 820 ohms, are evenly spaced: each is about 1.2 times the one before. The same twelve numbers repeat in every power of ten. Two examples round up to the next value: a calculated 130 ohms becomes 150 ohms, and a calculated 300 ohms becomes 330 ohms. FIG. 4 — E12: 12 VALUES PER DECADE1001201501802202703303904705606808201 kΩeach step ≈ × 1.2Same gap between neighbours: evenly spaced on a log scale.3.3 V: 130 Ω → round up → 150 Ω5 V: 300 Ω → round up → 330 ΩThe same 12 numbers in every decade: 10–82 Ω, 100–820 Ω, 1 k–8.2 kΩ…
Tap the diagram to open it full screen.
The same red LED at 5 V and at 3.3 V Two LED circuits with a red LED of about 2 volts forward voltage and a target of 10 milliamps. Left, a 5 volt supply: 3 volts are left for the resistor, the calculation gives 300 ohms, the E12 pick is 330 ohms and about 9.1 milliamps flow. Right, a 3.3 volt supply: only 1.3 volts are left, the calculation gives 130 ohms, the E12 pick is 150 ohms and about 8.7 milliamps flow. A lower supply needs a smaller resistor for about the same current. FIG. 5 — SAME LED, 5 V AND 3.3 VA · 5 V supply5 V330 Ωresistor gets 3 V2 VI ≈ 9.1 mA(5 − 2) ÷ 0.010 = 300 ΩE12 pick: 330 ΩB · 3.3 V supply3.3 V150 Ωresistor gets 1.3 V2 VI ≈ 8.7 mA(3.3 − 2) ÷ 0.010 = 130 ΩE12 pick: 150 ΩLower supply → less voltage left → smaller resistor for about the same current.Red LED, Vf ≈ 2 V, target 10 mA. Always round up to the next E12 value.Arrows: conventional current (I), from + round the loop to −.
Tap the diagram to open it full screen.

Try it, and why never without a resistor

Set a supply, a Vf and a target current. The calculator shows the exact value, the E12 pick and the real current.

Resistor calculator
Three steps to the resistor value A loop with a 5 volt supply, a resistor of unknown value and a red LED. Step 1: the voltage left for the resistor is the supply voltage minus the LED's forward voltage, 5 minus 2, so 3 volts. Step 2: choose the current, 10 milliamps, which is 0.010 amps, the same everywhere in the loop. Step 3: divide, R equals 3 volts divided by 0.010 amps, 300 ohms. The general formula is R equals supply voltage minus forward voltage, divided by the current. FIG. 3 — THE RECIPE: R = (Vs − Vf) ÷ I?Vs = 5 VVf ≈ 2 Vred LEDI1231Voltage left for the resistorVs − Vf = 5 V − 2 V = 3 V2Choose the current (same all round the loop)I = 10 mA = 0.010 A3DivideR = 3 V ÷ 0.010 A = 300 ΩR = (Vs − Vf) ÷ I
Tap the diagram to open it full screen.

Why a resistor every time. An LED cannot hold its own current down. Wire it directly across a supply and it pulls all the current the supply will give, until it burns out [6]. The resistor is the part that caps the current [6][3].

Quick checks if something looks wrong:

  • LED dark: flipped around? Supply below Vf? Gap in the loop (lesson 2)?
  • Resistor or LED getting hot: switch off, look for a short or a resistor that is far too small [3][8].
  • Never use a resistor “just because it was in the box”: do the calculation, even a quick one.

Check yourself

Three short questions. Nothing is saved, take your time.

  1. You are holding an LED with both legs intact. Which leg goes toward the positive side of the supply?

    • The shorter leg
    • The longer leg
    • Either one, they are the same
    Show the answer

    The longer leg. The longer leg is the anode, the positive side. The flat edge of the casing is next to the negative side [1][2][3].

  2. Supply 5 V, red LED with a forward voltage of about 2 V, target current 10 mA. Which standard E12 resistor do you pick?

    • 220 Ω
    • 330 Ω
    • 1 kΩ
    Show the answer

    330 Ω. R = (5 − 2) ÷ 0.010 = 300 Ω. 300 Ω is not a standard E12 value, so we go up to the next one, 330 Ω. That gives about 9 mA [5][7].

  3. Why should an LED never be connected straight to a battery or supply with no resistor?

    • It will only light dimly
    • Nothing limits the current, so it draws far too much and burns out
    • The LED will work backwards
    Show the answer

    Nothing limits the current, so it draws far too much and burns out. An LED has no built-in way to limit its own current. Without a resistor it takes all the current the supply allows and burns out [6].


Sources

Show the 10 sources
  1. Adafruit, “All About LEDs”, page “What is an LED?” (anode and cathode; longer lead to the more positive voltage; a reversed LED does not light and is hard to damage) — https://learn.adafruit.com/all-about-leds/what-is-an-led
  2. SparkFun, “Polarity” (LED longer leg is the anode; the pin nearest the flat edge is the cathode) — https://learn.sparkfun.com/tutorials/polarity
  3. All About Circuits, Semiconductors, “Special-Purpose Diodes” (flat side and short lead are the cathode; forward drop from about 1.6 V to over 3 V depending on colour; typical 20 mA; series dropping resistor; R = E/I worked example; values need not be precise; smaller resistor means brighter light and shorter life) — https://www.allaboutcircuits.com/textbook/semiconductors/chpt-3/special-purpose-diodes/
  4. Adafruit, “All About LEDs”, page “Forward Voltage and KVL” (loop voltages balance; red, yellow, orange and light-green LEDs 1.85–2.5 V, average 2.2 V; the resistor absorbs the rest) — https://learn.adafruit.com/all-about-leds/forward-voltage-and-kvl
  5. SparkFun, “Resistors” (forward voltage usually between 1.7 V and 3.4 V depending on colour; about 20 mA maximum for basic LEDs; the series-resistor equation; 9 V, 1.8 V, 10 mA example giving about 720 Ω; red LED around 1.8 V) — https://learn.sparkfun.com/tutorials/resistors
  6. SparkFun, “Light-Emitting Diodes (LEDs)” (an LED connected straight to a supply destroys itself; resistors limit the current) — https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds
  7. All About Circuits, Reference, “Resistor Color Codes” (E-series preferred values; E12 list; 10% tolerance) — https://www.allaboutcircuits.com/textbook/reference/chpt-2/resistor-color-codes/
  8. SparkFun, “What is a Circuit?” (hot parts or sudden burn-out: switch off and look for short circuits; a wrong resistor value can overload an LED) — https://learn.sparkfun.com/tutorials/what-is-a-circuit
  9. All About Circuits, Volume I (DC), “Voltage and Current” (the amount of current is the same at any point of a single loop) — https://www.allaboutcircuits.com/textbook/direct-current/chpt-1/voltage-current/
  10. OpenStax, University Physics Volume 2, section 9.4 “Ohm’s Law” (ohmic and nonohmic parts; a diode is nonohmic) — https://openstax.org/books/university-physics-volume-2/pages/9-4-ohms-law

Pinch or double-tap to zoom, swipe to change diagram.Scroll with Ctrl or double-click to zoom. Arrow keys change diagram.