← Wiki · Component

LED

A light-emitting diode glows when current flows from anode to cathode. It always needs something that limits the current, usually a resistor.

What it does#

An LED is a diode that emits light. Current flows only one way, from the anode (A, the long leg) to the cathode (K, the flat side of the body, marked with a line or a dot on SMD parts). Across a lit LED sits an almost fixed forward voltage (Vf); the brightness follows the current, not the voltage. Connected straight to a supply, an LED takes as much current as it can and burns out, so it always gets a series resistor.

Choosing the resistor#

R = (V_supply − Vf) / I

LED colour Typical Vf Typical current for an indicator
Red, yellow, orange 1.8–2.2 V 1–5 mA
Green (modern InGaN), blue, white 2.8–3.2 V 1–5 mA

Worked example: a red LED on a 3.3 V pin, aiming for 2 mA: (3.3 V − 2.0 V) / 0.002 A = 650 Ω. Use the next common value up: 680 Ω, or simply 1 kΩ (1.3 mA), which is plenty bright for a status light. The datasheet maximum (often 20 mA) is not the target; modern LEDs are bright at a few milliamps.

A white or blue LED on 3.3 V has only ~0.3 V left for the resistor, so its current depends a lot on the exact Vf. Run it from 5 V, or accept a dim and uneven glow.

Example#

Example circuit: Left: a power indicator on 3V3. Right: a GPIO (net LED, from the header) drives its own LED. Both take about 1.3 mA through 1 kΩ.
Left: a power indicator on 3V3. Right: a GPIO (net LED, from the header) drives its own LED. Both take about 1.3 mA through 1 kΩ. Open the led_gpio example from this page in PCB Canvas: “Insert into my schematic”.

The GPIO version lights when the pin is high. Swap it around (3V3 → resistor → LED → GPIO) and it lights when the pin is low; some boards do that.

Pitfalls#

  • Polarity. A reversed LED stays dark. In the footprint the cathode is pad 1 on most KiCad LED footprints; check the silkscreen mark against the part’s datasheet before ordering.
  • One resistor per LED. LEDs in parallel on one resistor share current badly; the one with the lowest Vf hogs it.
  • Pin current. A microcontroller pin is not a power supply. Keep LEDs on GPIOs to a few mA, and use a transistor or MOSFET for anything bigger.

Footprint#

  • Hand soldering: 0805 or 3 mm through-hole are easy. 0603 is doable with tweezers.
  • JLCPCB assembly: 0603 is the default. The red 0603 (C2286) and green 0805 (C2297) in the catalog are basic parts (no feeder fee).