LED (Light-Emitting Diode)
A diode that emits light when current flows the right way through it.
How it works
An LED is a semiconductor diode that gives off light when current passes through it in the forward direction (from anode to cathode). Like any diode it only conducts one way — wire it backwards and it simply stays dark.
An LED has very little internal resistance, so you must add a current-limiting resistor in series. Connect it straight to 5V and it will draw too much current and burn out almost instantly.
The color is set by the semiconductor material, which also sets the forward voltage — red LEDs drop the least, blue and white the most.
Pins
- Anode (+)
- Longer leg. Connects toward the positive supply / MCU pin, through a resistor.
- Cathode (−)
- Shorter leg, flat spot on the rim. Connects to ground (GND).
Ratings
- Forward voltage (Vf)
- ~1.8 V (red) to ~3.2 V (blue/white)
- Typical current
- 5–20 mA (20 mA max for most 5 mm LEDs)
- Resistor formula
- R = (Vsupply − Vf) / I → e.g. (5 − 2) / 0.02 ≈ 150–220 Ω
Tips
- Always use a series resistor (220–330 Ω is a safe default at 5 V).
- Longer leg = positive. If it doesn't light, try flipping it.
- An Arduino pin can drive one small LED directly; for many or brighter LEDs, use a transistor or driver.