মূল বিষয়বস্তুতে যান
Learn/Electronics basics/Ohm's law and LEDs
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 colourForward voltageResistor at 5 VResistor at 3.3 V
Red≈ 2.0 V220 Ω100 Ω
Green / yellow≈ 2.1–2.2 V220 Ω68–100 Ω
Blue / white≈ 3.0 V150 Ω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
Open in Lab
UNOATmega328P: The 8-bit AVR microcontroller that runs your sketch (16 MHz, 32 KB flash, 2 KB RAM).ATmega328PUSB-B: USB connection for uploading sketches and for the Serial Monitor. Also powers the board (5 V).DC jack: Barrel jack for 7–12 V from a battery pack or adapter (centre positive).ATmega16U2: Converts USB to serial for uploads and Serial.print().RESET: Restarts your sketch from the beginning (setup() runs again).L (D13): Built-in LED connected to pin 13 (LED_BUILTIN).ON: Power indicator.5 V regulator: Turns 7–12 V from VIN/jack into a steady 5 V.16 MHz: Clock source: the microcontroller runs 16 million cycles per second.ICSP: In-circuit programming header (SPI). Used to burn a bootloader; not needed for normal uploads.220 Ω+
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

1A 3 V drop across a 150 Ω resistor gives what current?

2Which leg of an LED connects towards GND?

3What does the resistor in series with an LED do?