Raspberry Pi GPIO — LED Reference
40-pin header (Pi 1 B+ / 2 / 3 / 4 / 5 / Zero). All GPIO pins are 3.3 V logic. Per-pin source/sink limit ≈ 16 mA, total across the header ≈ 50 mA. Target 5–10 mA per LED to stay well inside those budgets.
Pinout map
3V3 (1) (2) 5V
GPIO2 SDA (3) (4) 5V
GPIO3 SCL (5) (6) GND
GPIO4 (7) (8) GPIO14 TXD
GND (9)(10) GPIO15 RXD
GPIO17 (11)(12) GPIO18 PWM0
GPIO27 (13)(14) GND
GPIO22 (15)(16) GPIO23
3V3 (17)(18) GPIO24
GPIO10 MOSI(19)(20) GND
GPIO9 MISO(21)(22) GPIO25
GPIO11 SCLK(23)(24) GPIO8 CE0
GND (25)(26) GPIO7 CE1
ID_SD (27)(28) ID_SC <- reserved (HAT EEPROM)
GPIO5 (29)(30) GND
GPIO6 (31)(32) GPIO12 PWM0
GPIO13 PWM1(33)(34) GND
GPIO19 PWM1(35)(36) GPIO16
GPIO26 (37)(38) GPIO20
GND (39)(40) GPIO21
Pins safe for LEDs
Free to use without conflicting with default peripherals:
| GPIO | Header pin | Notes | Led Use |
|---|---|---|---|
| 4 | 7 | Power LED | |
| 5 | 29 | Ethernet Activity LED | |
| 6 | 31 | Led 01 - Disk Space | |
| 12 | 32 | hardware PWM0 | Led XX - |
| 13 | 33 | hardware PWM1 | Led XX - |
| 16 | 36 | Led 02 - Disk Space | |
| 17 | 11 | Led 03 - Disk Space | |
| 18 | 12 | hardware PWM0 | Led XX - |
| 19 | 35 | hardware PWM1 | Led XX - |
| 20 | 38 | Led 04 - Disk Space | |
| 21 | 40 | Led 05 - Disk Space | |
| 22 | 15 | Led 06 - Disk Space | |
| 23 | 16 | Led 07 - Disk Space | |
| 24 | 18 | Led 08 - Disk Space | |
| 25 | 22 | Led 09 - Disk Space | |
| 26 | 37 | Led 10 - Disk Space | |
| 27 | 13 |
GPIO 12 / 13 / 18 / 19 are the hardware PWM channels — use these if you want smooth brightness/fade.
Pins to avoid (or use with care)
| GPIO | Pin(s) | Why |
|---|---|---|
| 0, 1 | 27, 28 | Reserved for HAT ID EEPROM — do not use |
| 2, 3 | 3, 5 | I²C, has 1.8 kΩ pull-ups to 3V3 — pulled high |
| 7, 8 | 26, 24 | SPI0 CE1/CE0 |
| 9, 10, 11 | 21, 19, 23 | SPI0 MISO / MOSI / SCLK |
| 14, 15 | 8, 10 | UART TXD/RXD — serial console by default |
If the corresponding interface is disabled in raspi-config these pins become regular GPIO and are fine for LEDs.
Wiring
GPIOxx ──┬── [ R ] ──▶|── GND
│ LED
Resistor on either side of the LED is fine. Anode (long leg, flat side of bulb is cathode) toward GPIO, cathode toward GND.
Resistor values (3.3 V supply)
R = (3.3 − Vf) / I. Picking the next-larger standard E12 value.
| LED colour | Vf (typ.) | 10 mA → calc | Use | 5 mA → calc | Use |
|---|---|---|---|---|---|
| Red | 2.0 V | 130 Ω | 150 Ω | 260 Ω | 330 Ω |
| Yellow | 2.1 V | 120 Ω | 150 Ω | 240 Ω | 270 Ω |
| Orange | 2.0 V | 130 Ω | 150 Ω | 260 Ω | 330 Ω |
| Green (std) | 2.1 V | 120 Ω | 150 Ω | 240 Ω | 270 Ω |
| Green (hi-b) | 3.0 V | 30 Ω | 47 Ω | 60 Ω | 100 Ω |
| Blue | 3.0 V | 30 Ω | 47 Ω | 60 Ω | 100 Ω |
| White | 3.0 V | 30 Ω | 47 Ω | 60 Ω | 100 Ω |
A 220 Ω resistor is a safe universal default for any colour from a 3.3 V GPIO — gives roughly 6 mA on a red, ~1.5 mA on a blue (dim but visible). Use 330 Ω if you only need an indicator.
Quick test (Python, gpiozero)
from gpiozero import LED
from time import sleep
led = LED(17) # BCM numbering — header pin 11
while True:
led.on(); sleep(0.5)
led.off(); sleep(0.5)
For PWM brightness use PWMLED(12) etc. on one of the hardware-PWM-capable pins.