Electronics basics · Lesson
12 min read
Ohm's law and LEDs
Calculate the resistor that keeps an LED (and your board) safe.
What You Will Learn
- Use V = I × R
- Calculate an LED resistor
- Wire an LED the right way round
Ohm's law connects the three quantities: V = I × R. Rearranged: I = V / R and R = V / I.
Why an LED needs a resistor
An LED drops a roughly fixed voltage (its forward voltage, about 2 V for red) and lets almost unlimited current through above that. Without something to limit the current it overheats in seconds — and can damage the pin driving it.
Example: a red LED on a 5 V pin. The resistor must take the rest: 5 V − 2 V = 3 V. For a safe 15 mA: R = 3 V / 0.015 A = 200 Ω. The nearest common value is 220 Ω.
| LED colour | Forward voltage | Resistor at 5 V | Resistor at 3.3 V |
|---|---|---|---|
| Red | ≈ 2.0 V | 220 Ω | 100 Ω |
| Green / yellow | ≈ 2.1–2.2 V | 220 Ω | 68–100 Ω |
| Blue / white | ≈ 3.0 V | 150 Ω | 22–47 Ω (dim) |
LEDs have a direction: the long leg (anode, +) goes towards the positive side, the short leg (cathode, −, flat edge on the rim) towards GND.
Blink an LEDarduino-uno
Note: Try it: change the resistor to 1 Ω in the inspector and watch the warning. Then try 1 kΩ — the LED gets dimmer.
The resistor can go on either side of the LED. What matters is that it's in the same loop.
Check Your Understanding
Test what you learned in this lesson