Overview
An LED does not limit its own current. Above its forward voltage, a tiny increase in voltage causes a huge increase in current, so it needs a series resistor to set the current instead.
The formula
R = (Vsupply − Vf) ÷ I
Vf is the LED's forward voltage and I is the current you want. Round up to the next standard value.
| LED colour | Typical Vf | At 5 V, 10 mA |
|---|---|---|
| Red | 1.8–2.2 V | 300 Ω → use 330 Ω |
| Yellow / orange | 2.0–2.2 V | 300 Ω → use 330 Ω |
| Green (modern) | 2.8–3.2 V | 220 Ω |
| Blue / white | 2.9–3.3 V | 200 Ω → use 220 Ω |
Calculator
Seven-segment displays
Each segment is its own LED and needs its own resistor. One resistor on the common pin would share the current between however many segments are lit, so an "8" would be much dimmer than a "1".
When no resistor is needed
Only when the part already contains one: many LED modules, LED "sequins" and the Uno's own L LED include a resistor. If you are not sure, assume it does not.