Raspberry Pi Pinout – Interactive GPIO Board
Last updated: November 2026
Our interactive Raspberry Pi GPIO Pinout shows all 40 GPIO pins at a glance – click any pin for its BCM number, function, and code example. The layout is identical across Pi 3, Pi 4, Pi 5, Pi 400, and Zero 2 W. Official reference: raspberrypi.com/documentation/computers/raspberry-pi.html
👉 Click on a pin, USB port, or Ethernet port for details.
Numbering / Naming Schemas of GPIO Pins
GPIO numbering is inconsistent and can be confusing – even I have to check my own posts repeatedly to see which specification is meant. The simplest is the physical numbering, as it is the same across all Raspberry Pi models.
The Three Common Numbering Systems
- Physical Numbering (Board) – Pin 1 is the pin with the square solder pad on the back of the Raspberry Pi. Counted from top left to bottom right.
- BCM Numbering – Refers to the GPIO pins according to the Broadcom SoC pin assignment (e.g., GPIO2, GPIO3). Used by Python libraries like
RPi.GPIOandgpiozero. - WiringPi Numbering – Custom schema of the WiringPi library, hardly relevant today.
Recommendation: Use BCM numbering – it is the standard in current tutorials and libraries.
Important: Raspberry Pi 5
On the Raspberry Pi 5, all GPIO pins are controlled via the new RP1 I/O coprocessor. The physical 40-pin layout is identical, but the original RPi.GPIO library doesn’t run on it. Old scripts with import RPi.GPIO usually keep working through rpi-lgpio, which Raspberry Pi OS has included since October 2024 (on older installs: sudo apt install python3-rpi-lgpio). For new projects, use gpiozero or lgpio. The Pi 5’s GPIO pins still use 3.3V logic and are not 5V tolerant either – use a level shifter for 5V signals.
USB Ports
The number and speed of the USB ports depend on the Raspberry Pi model:
| Model | USB Ports |
|---|---|
| Raspberry Pi 5 | 2× USB 3.0 (5 Gbps) + 2× USB 2.0 |
| Raspberry Pi 4 Model B | 2× USB 3.0 (5 Gbps) + 2× USB 2.0 |
| Raspberry Pi 400 | 2× USB 3.0 + 1× USB 2.0 |
| Raspberry Pi 3 Model B+ | 4× USB 2.0 |
| Raspberry Pi Zero 2 W | 1× Micro-USB OTG (USB 2.0) |
On older models (Pi 1–3), the USB controller and Ethernet port share the same bus, which limits throughput. From Pi 4 onwards, USB 3.0 and Gigabit Ethernet are completely separate.
Per USB port, devices with up to 500 mA (USB 2.0) or 900 mA (USB 3.0) are intended. For hard drives without their own power supply, an active USB hub is recommended.
Ethernet Port
The Ethernet port is model dependent:
| Model | Ethernet |
|---|---|
| Raspberry Pi 5 | Gigabit Ethernet (true Gbit, PoE+ with HAT) |
| Raspberry Pi 4 Model B | True Gigabit Ethernet |
| Raspberry Pi 3 Model B+ | Gigabit Ethernet over USB 2.0 (max. ~300 Mbps) |
| Raspberry Pi 3 Model B | 100 Mbps Fast Ethernet |
| Raspberry Pi Zero 2 W | No Ethernet (WLAN only) |
From the Raspberry Pi 4 onwards, the Ethernet controller is connected directly to the PCIe bus – this achieves true Gigabit speeds. Network Boot (booting without an SD card via the network) is possible from Pi 3 and is activated by default on Pi 4/5.
WLAN Info
| Model | WLAN | Bluetooth |
|---|---|---|
| Raspberry Pi 5 | Dual-Band 802.11ac (2.4 + 5 GHz) | Bluetooth 5.0 / BLE |
| Raspberry Pi 4 Model B | Dual-Band 802.11ac (2.4 + 5 GHz) | Bluetooth 5.0 / BLE |
| Raspberry Pi 3 Model B+ | Dual-Band 802.11ac (2.4 + 5 GHz) | Bluetooth 4.2 / BLE |
| Raspberry Pi 3 Model B | 2.4 GHz 802.11n | Bluetooth 4.1 |
| Raspberry Pi Zero 2 W | 2.4 GHz 802.11 b/g/n | Bluetooth 4.2 / BLE |
| Raspberry Pi Zero W | 2.4 GHz 802.11 b/g/n | Bluetooth 4.1 |
Tip: When using WLAN on older models (Pi 3), deactivate Bluetooth, as both modules use the same chip and can influence each other. From Pi 4 onwards, this is no longer a problem.
Setting up WLAN on the Raspberry Pi is described in this article.
Bluetooth
Every Raspberry Pi since the Pi 3 has Bluetooth built in, including Bluetooth Low Energy (BLE). WLAN and Bluetooth share a single radio chip and antenna.
| Model | Bluetooth |
|---|---|
| Raspberry Pi 5 / Pi 500 | Bluetooth 5.0 / BLE |
| Raspberry Pi 4 Model B / Pi 400 | Bluetooth 5.0 / BLE |
| Raspberry Pi 3 Model B+ | Bluetooth 4.2 / BLE |
| Raspberry Pi 3 Model B | Bluetooth 4.1 |
| Raspberry Pi Zero 2 W | Bluetooth 4.2 / BLE |
| Raspberry Pi Zero W | Bluetooth 4.1 |
Bluetooth and the Serial Port
On the Pi 3 and Pi 4, Bluetooth uses the fast hardware UART (PL011) by default, so the serial port on pins 8/10 has to make do with the slower mini UART. If you need a reliable GPIO UART, for a GPS module for example, you can turn Bluetooth off with dtoverlay=disable-bt in config.txt. The Raspberry Pi 5 doesn’t have this problem, because the RP1 controller provides its own UARTs.
The easiest way to pair devices is the Bluetooth menu on the desktop, or bluetoothctl in the terminal.
Pin 1 – 3.3V Power Supply
Voltage: 3.3VType: SupplyMax. Current: 50mA total
Physical Pin 1 provides a constant voltage of 3.3V, fed from the internal voltage regulator of the Raspberry Pi. The maximum load per pin is 16 mA. If multiple 3.3V pins are used simultaneously, the total load across all 3.3V GPIOs must not exceed 50 mA. Twin pin with the same function: Pin 17. Pin 1 can always be recognized by the square solder pad on the back of the circuit board.
Typical Use
- Powering 3.3V sensors (BME280, DHT22, OLED displays)
- Reference voltage for level shifters (3.3V to 5V)
- Powering microcontrollers (Arduino Pro Mini 3.3V)
Caution: Excessive current consumption can destabilize the 3.3V rail and cause the Pi to crash. No short-circuit protection available.
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 2 – 5V Power Supply
Voltage: 5VType: SupplyCurrent: PSU-dependent
Physical Pin 2 is directly connected to the 5V supply line of the Raspberry Pi. The voltage comes unfiltered from the power supply. Twin pin: Pin 4.
The available current depends on the power supply unit. An official Raspberry Pi 5 power supply (27W USB-C) delivers up to 5A. For connected consumers, a reserve of at least 500 mA should be planned for the Pi itself.
Typical Use
- Powering 5V devices (fans, 5V relays, servo drivers)
- Injecting an external 5V source (instead of USB power)
- Powering level shifters (5V side)
Caution: GPIO pins are only designed for 3.3V. Never apply 5V directly to GPIO pins!
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 3 – BCM 2 (GPIO2) – I2C Bus 1 SDA (Data Line)
Phys. Pin: 3BCM: 2Type: I2C SDABus: 1
Physical Pin 3 (BCM GPIO2) is the data line (SDA) of I2C bus 1. I2C (Inter-Integrated Circuit) is a 2-wire serial bus where data is transmitted synchronously between a master (Raspberry Pi) and several slaves (sensors, displays). Both lines require pull-up resistors (typically 4.7 kOhm – many modules already have these integrated).
Activate I2C: sudo raspi-config → Interfacing Options → I2C → Enable, then restart.
Show connected devices:
i2cdetect -y 1Python Code Example (smbus2)
import smbus2
bus = smbus2.SMBus(1) # I2C bus 1
addr = 0x76 # Example: BME280
# Read register
value = bus.read_byte_data(addr, 0xD0)
print(f"Chip ID: {value:#x}")
bus.close()Typical Use
- Temperature/Air pressure sensors (BME280, BMP180, BMP280)
- OLED displays (SSD1306)
- Real-time clock modules (DS3231)
- A/D converters (ADS1115)
- GPIO expanders (MCP23017)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SDA1 | SA3 | LCD_VSYNC | AVEOUT_VSYNC | AVEIN_VSYNC | – |
| Pi 4, 400 | SDA1 | SA3 | LCD_VSYNC | SPI3_MOSI | CTS2 | SDA3 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 2 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI0_CE3 | DPI_VSYNC | CTS1 | SDA1 | IR_RX0 | SPI2_SIO0 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 4 – 5V Power Supply
Voltage: 5VType: SupplyCurrent: PSU-dependent
Physical Pin 4 is directly connected to the 5V supply line of the Raspberry Pi. The voltage comes unfiltered from the power supply. Twin pin: Pin 2.
The available current depends on the power supply unit. An official Raspberry Pi 5 power supply (27W USB-C) delivers up to 5A. For connected consumers, a reserve of at least 500 mA should be planned for the Pi itself.
Typical Use
- Powering 5V devices (fans, 5V relays, servo drivers)
- Injecting an external 5V source (instead of USB power)
- Powering level shifters (5V side)
Caution: GPIO pins are only designed for 3.3V. Never apply 5V directly to GPIO pins!
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 5 – BCM 3 (GPIO3) – I2C Bus 1 SCL (Clock Line)
Phys. Pin: 5BCM: 3Type: I2C SCLBus: 1
Physical Pin 5 (BCM GPIO3) is the clock line (SCL) of I2C bus 1. I2C (Inter-Integrated Circuit) is a 2-wire serial bus where data is transmitted synchronously between a master (Raspberry Pi) and several slaves (sensors, displays). Both lines require pull-up resistors (typically 4.7 kOhm – many modules already have these integrated).
Activate I2C: sudo raspi-config → Interfacing Options → I2C → Enable, then restart.
Show connected devices:
i2cdetect -y 1Python Code Example (smbus2)
import smbus2
bus = smbus2.SMBus(1) # I2C bus 1
addr = 0x76 # Example: BME280
# Read register
value = bus.read_byte_data(addr, 0xD0)
print(f"Chip ID: {value:#x}")
bus.close()Typical Use
- Temperature/Air pressure sensors (BME280, BMP180, BMP280)
- OLED displays (SSD1306)
- Real-time clock modules (DS3231)
- A/D converters (ADS1115)
- GPIO expanders (MCP23017)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SCL1 | SA2 | LCD_HSYNC | AVEOUT_HSYNC | AVEIN_HSYNC | – |
| Pi 4, 400 | SCL1 | SA2 | LCD_HSYNC | SPI3_SCLK | RTS2 | SCL3 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 3 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI0_CE2 | DPI_HSYNC | RTS1 | SCL1 | IR_TX0 | SPI2_SCLK |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 6 – Ground (GND)
Voltage: 0V / GNDType: Ground
Physical Pin 6 is a ground pin (Ground, GND). It forms the common reference potential for all circuits on the Raspberry Pi. The 40-pin header has a total of 8 ground pins (Pins 6, 9, 14, 20, 25, 30, 34, 39).
Tips
- For multiple sensors, use a separate GND pin for each (avoids voltage drops)
- Place the GND pin and signal pin as close together as possible (short lines = less interference)
- For motor drivers, provide a separate GND for the load side
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 7 – BCM 4 (GPIO4) – GPCLK0 (General Purpose Clock)
Phys. Pin: 7BCM: 4Type: GPIO / GPCLKFrequency (Pi 1–4): up to ~125MHz
Physical Pin 7 (BCM GPIO4) is a free GPIO in default mode. In ALT0 mode, it is available as General Purpose Clock 0 (GPCLK0) and generates a hardware clock signal without CPU load. On the Pi 1 to 3, you can set the frequency from about 4.7 kHz, and from about 13 kHz on the Pi 4. The datasheet gives roughly 125 MHz as the upper limit, less on heavily loaded pins. On the Pi 5, the RP1 chip generates the clock, and GPCLK0 is function a0 there.
A Note on pigpio
Older guides use pigpio to generate the clock signal. That doesn’t work on the Raspberry Pi 5, and current Raspberry Pi OS no longer offers the pigpio daemon as a package.
Typical Use
- Clock signal for external ICs (Ethernet controllers, audio codecs)
- Frequency generator / test signal
- Synchronization of external circuits
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | GPCLK0 | SA1 | DPI_D0 | AVEOUT_VID0 | AVEIN_VID0 | ARM_TDI |
| Pi 4, 400 | GPCLK0 | SA1 | DPI_D0 | SPI4_CE0_N | TXD3 | SDA3 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 4 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | GPCLK0 | DPI_D0 | TXD2 | SDA2 | RI0 | SPI3_CE0 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 8 – BCM 14 (GPIO14) – UART TXD0 (Transmit Line)
Phys. Pin: 8BCM: 14Type: UART TXD0Level: 3.3V
Physical Pin 8 (BCM GPIO14) is the transmit line (TXD0) of the primary UART interface. UART (Universal Asynchronous Receiver Transmitter) transmits data serially without a separate clock signal. Typical baud rate: 115200 baud. The level is 3.3V – for connections with 5V systems (Arduino), a level shifter is necessary.
Activate UART: In /boot/firmware/config.txt (Pi 5) or /boot/config.txt (Pi 4), add at the end: enable_uart=1
In /boot/cmdline.txt, remove the entry console=serial0,115200 so that the Linux console does not block the port. Then restart.
Python Code Example (pyserial)
import serial
ser = serial.Serial("/dev/serial0", baudrate=115200, timeout=1)
ser.write(b"Hello from Raspberry Pi!n")
line = ser.readline()
print(line.decode("utf-8", errors="replace"))
ser.close()Typical Use
- Serial terminal / Debug console (USB-UART adapter)
- Communication with Arduino, ESP32, GPS modules
- Controlling Bluetooth modules (HC-05/06)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | TXD0 | SD6 | DPI_D10 | AVEOUT_VID10 | AVEIN_VID10 | TXD1 |
| Pi 4, 400 | TXD0 | SD6 | DPI_D10 | SPI5_MOSI | CTS5 | TXD1 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 14 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | PWM0_CHAN2 | DPI_D10 | CTS4 | SDA3 | TXD0 | SPI5_SIO0 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 9 – Ground (GND)
Voltage: 0V / GNDType: Ground
Physical Pin 9 is a ground pin (Ground, GND). It forms the common reference potential for all circuits on the Raspberry Pi. The 40-pin header has a total of 8 ground pins (Pins 6, 9, 14, 20, 25, 30, 34, 39).
Tips
- For multiple sensors, use a separate GND pin for each (avoids voltage drops)
- Place the GND pin and signal pin as close together as possible (short lines = less interference)
- For motor drivers, provide a separate GND for the load side
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 10 – BCM 15 (GPIO15) – UART RXD0 (Receive Line)
Phys. Pin: 10BCM: 15Type: UART RXD0Level: 3.3V
Physical Pin 10 (BCM GPIO15) is the receive line (RXD0) of the primary UART interface. UART (Universal Asynchronous Receiver Transmitter) transmits data serially without a separate clock signal. Typical baud rate: 115200 baud. The level is 3.3V – for connections with 5V systems (Arduino), a level shifter is necessary.
Activate UART: In /boot/firmware/config.txt (Pi 5) or /boot/config.txt (Pi 4), add at the end: enable_uart=1
In /boot/cmdline.txt, remove the entry console=serial0,115200 so that the Linux console does not block the port. Then restart.
Python Code Example (pyserial)
import serial
ser = serial.Serial("/dev/serial0", baudrate=115200, timeout=1)
ser.write(b"Hello from Raspberry Pi!n")
line = ser.readline()
print(line.decode("utf-8", errors="replace"))
ser.close()Typical Use
- Serial terminal / Debug console (USB-UART adapter)
- Communication with Arduino, ESP32, GPS modules
- Controlling Bluetooth modules (HC-05/06)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | RXD0 | SD7 | DPI_D11 | AVEOUT_VID11 | AVEIN_VID11 | RXD1 |
| Pi 4, 400 | RXD0 | SD7 | DPI_D11 | SPI5_SCLK | RTS5 | RXD1 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 15 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | PWM0_CHAN3 | DPI_D11 | RTS4 | SCL3 | RXD0 | SPI5_SCLK |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 11 – BCM 17 (GPIO17)
Phys. Pin: 11BCM: 17Type: GPIOLevel: 3.3V
Physical Pin 11 corresponds to BCM GPIO17. It is a freely configurable General Purpose I/O pin and can be operated by software as an Input or Output. The logic level is 3.3V (HIGH) or 0V (LOW). The pin supports internal configurable pull-up and pull-down resistors. In ALT3 mode, it can be used as UART0 RTS0, and in ALT4 mode as SPI1 CE1.
Raspberry Pi 5: On the Pi 5, the RP1 chip takes over GPIO control. The original RPi.GPIO doesn’t run on it. Old code with import RPi.GPIO usually works through rpi-lgpio, included in Raspberry Pi OS since October 2024 (otherwise sudo apt install python3-rpi-lgpio). For new code, use gpiozero or lgpio.
Python Code Example
import lgpio # all models, including the Pi 5
# or: import RPi.GPIO as GPIO # via rpi-lgpio on the Pi 5
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 17) # BCM 17 as output
lgpio.gpio_write(h, 17, 1) # HIGH (3.3V)
lgpio.gpio_write(h, 17, 0) # LOW (0V)
lgpio.gpiochip_close(h)Typical Use
- Switching LED or relay
- Reading a button
- Sending a digital signal
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | FL1 | SD9 | DPI_D13 | RTS0 | SPI1_CE1_N | RTS1 |
| Pi 4, 400 | – | SD9 | DPI_D13 | RTS0 | SPI1_CE1_N | RTS1 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 17 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI1_CE1 | DPI_D13 | DSI1_TE_EXT | – | RTS0 | – |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 12 – BCM 18 (GPIO18) – PWM0
Phys. Pin: 12BCM: 18Type: GPIO / PWMHW PWM: Channel 0 (Pi 5: 2)
Physical Pin 12 (BCM GPIO18) supports Hardware PWM (Channel 0, Channel 2 on the Pi 5) in addition to normal GPIO function. Pulse Width Modulation (PWM) generates a square wave signal with variable duty cycle. Hardware PWM is generated directly by the internal timer block and does not cause any CPU load.
Python Code Example (Software PWM via lgpio)
import lgpio, time
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 18)
# Software PWM: Frequency 50 Hz, Duty Cycle 50%
lgpio.tx_pwm(h, 18, 50, 50)
time.sleep(2)
lgpio.tx_pwm(h, 18, 50, 0) # Stop
lgpio.gpiochip_close(h)Typical Use
- Controlling an RC servo (50 Hz, 1-2 ms pulse width)
- Dimming LED brightness
- Regulating fan speed
- Audio output (low-budget DAC)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | PCM_CLK | SD10 | DPI_D14 | I2CSL_SDA_MOSI | SPI1_CE0_N | PWM0 |
| Pi 4, 400 | PCM_CLK | SD10 | DPI_D14 | SPI6_CE0_N | SPI1_CE0_N | PWM0_0 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 18 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI1_CE0 | DPI_D14 | I2S0_SCLK | PWM0_CHAN2 | I2S1_SCLK | GPCLK1 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 13 – BCM 27 (GPIO27)
Phys. Pin: 13BCM: 27Type: GPIOLevel: 3.3V
Physical Pin 13 corresponds to BCM GPIO27. It is a freely configurable General Purpose I/O pin and can be operated by software as an Input or Output. The logic level is 3.3V (HIGH) or 0V (LOW). The pin supports internal configurable pull-up and pull-down resistors.
Raspberry Pi 5: On the Pi 5, the RP1 chip takes over GPIO control. The original RPi.GPIO doesn’t run on it. Old code with import RPi.GPIO usually works through rpi-lgpio, included in Raspberry Pi OS since October 2024 (otherwise sudo apt install python3-rpi-lgpio). For new code, use gpiozero or lgpio.
Python Code Example
import lgpio # all models, including the Pi 5
# or: import RPi.GPIO as GPIO # via rpi-lgpio on the Pi 5
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 27) # BCM 27 as output
lgpio.gpio_write(h, 27, 1) # HIGH (3.3V)
lgpio.gpio_write(h, 27, 0) # LOW (0V)
lgpio.gpiochip_close(h)Typical Use
- General Purpose GPIO
- Controlling LED / Buzzer
- Reading button / sensor
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SD0_DAT3 | TE1 | DPI_D23 | SD1_DAT3 | ARM_TMS | – |
| Pi 4, 400 | SD0_DAT3 | – | DPI_D23 | SD1_DAT3 | ARM_TMS | SPI6_CE1_N |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 27 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SD0_DAT3 | DPI_D23 | I2S0_SDO3 | MIC_DAT1 | I2S1_SDO3 | SPI1_CE1 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 14 – Ground (GND)
Voltage: 0V / GNDType: Ground
Physical Pin 14 is a ground pin (Ground, GND). It forms the common reference potential for all circuits on the Raspberry Pi. The 40-pin header has a total of 8 ground pins (Pins 6, 9, 14, 20, 25, 30, 34, 39).
Tips
- For multiple sensors, use a separate GND pin for each (avoids voltage drops)
- Place the GND pin and signal pin as close together as possible (short lines = less interference)
- For motor drivers, provide a separate GND for the load side
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 15 – BCM 22 (GPIO22)
Phys. Pin: 15BCM: 22Type: GPIOLevel: 3.3V
Physical Pin 15 corresponds to BCM GPIO22. It is a freely configurable General Purpose I/O pin and can be operated by software as an Input or Output. The logic level is 3.3V (HIGH) or 0V (LOW). The pin supports internal configurable pull-up and pull-down resistors.
Raspberry Pi 5: On the Pi 5, the RP1 chip takes over GPIO control. The original RPi.GPIO doesn’t run on it. Old code with import RPi.GPIO usually works through rpi-lgpio, included in Raspberry Pi OS since October 2024 (otherwise sudo apt install python3-rpi-lgpio). For new code, use gpiozero or lgpio.
Python Code Example
import lgpio # all models, including the Pi 5
# or: import RPi.GPIO as GPIO # via rpi-lgpio on the Pi 5
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 22) # BCM 22 as output
lgpio.gpio_write(h, 22, 1) # HIGH (3.3V)
lgpio.gpio_write(h, 22, 0) # LOW (0V)
lgpio.gpiochip_close(h)Typical Use
- General Purpose GPIO
- Switching output
- Interrupt input
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SD0_CLK | SD14 | DPI_D18 | SD1_CLK | ARM_TRST | – |
| Pi 4, 400 | SD0_CLK | SD14 | DPI_D18 | SD1_CLK | ARM_TRST | SDA6 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 22 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SD0_CLK | DPI_D18 | I2S0_SDI1 | SDA3 | I2S1_SDI1 | – |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 16 – BCM 23 (GPIO23)
Phys. Pin: 16BCM: 23Type: GPIOLevel: 3.3V
Physical Pin 16 corresponds to BCM GPIO23. It is a freely configurable General Purpose I/O pin and can be operated by software as an Input or Output. The logic level is 3.3V (HIGH) or 0V (LOW). The pin supports internal configurable pull-up and pull-down resistors.
Raspberry Pi 5: On the Pi 5, the RP1 chip takes over GPIO control. The original RPi.GPIO doesn’t run on it. Old code with import RPi.GPIO usually works through rpi-lgpio, included in Raspberry Pi OS since October 2024 (otherwise sudo apt install python3-rpi-lgpio). For new code, use gpiozero or lgpio.
Python Code Example
import lgpio # all models, including the Pi 5
# or: import RPi.GPIO as GPIO # via rpi-lgpio on the Pi 5
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 23) # BCM 23 as output
lgpio.gpio_write(h, 23, 1) # HIGH (3.3V)
lgpio.gpio_write(h, 23, 0) # LOW (0V)
lgpio.gpiochip_close(h)Typical Use
- General Purpose GPIO
- LED control
- Reading button signal
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SD0_CMD | SD15 | DPI_D19 | SD1_CMD | ARM_RTCK | – |
| Pi 4, 400 | SD0_CMD | SD15 | DPI_D19 | SD1_CMD | ARM_RTCK | SCL6 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 23 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SD0_CMD | DPI_D19 | I2S0_SDO1 | SCL3 | I2S1_SDO1 | – |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 17 – 3.3V Power Supply
Voltage: 3.3VType: SupplyMax. Current: 50mA total
Physical Pin 17 provides a constant voltage of 3.3V, fed from the internal voltage regulator of the Raspberry Pi. The maximum load per pin is 16 mA. If multiple 3.3V pins are used simultaneously, the total load across all 3.3V GPIOs must not exceed 50 mA. Twin pin with the same function: Pin 1.
Typical Use
- Powering 3.3V sensors (BME280, DHT22, OLED displays)
- Reference voltage for level shifters (3.3V to 5V)
- Powering microcontrollers (Arduino Pro Mini 3.3V)
Caution: Excessive current consumption can destabilize the 3.3V rail and cause the Pi to crash. No short-circuit protection available.
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 18 – BCM 24 (GPIO24)
Phys. Pin: 18BCM: 24Type: GPIOLevel: 3.3V
Physical Pin 18 corresponds to BCM GPIO24. It is a freely configurable General Purpose I/O pin and can be operated by software as an Input or Output. The logic level is 3.3V (HIGH) or 0V (LOW). The pin supports internal configurable pull-up and pull-down resistors.
Raspberry Pi 5: On the Pi 5, the RP1 chip takes over GPIO control. The original RPi.GPIO doesn’t run on it. Old code with import RPi.GPIO usually works through rpi-lgpio, included in Raspberry Pi OS since October 2024 (otherwise sudo apt install python3-rpi-lgpio). For new code, use gpiozero or lgpio.
Python Code Example
import lgpio # all models, including the Pi 5
# or: import RPi.GPIO as GPIO # via rpi-lgpio on the Pi 5
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 24) # BCM 24 as output
lgpio.gpio_write(h, 24, 1) # HIGH (3.3V)
lgpio.gpio_write(h, 24, 0) # LOW (0V)
lgpio.gpiochip_close(h)Typical Use
- General Purpose GPIO
- HC-SR04 Echo pin
- Reading button signal
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SD0_DAT0 | SD16 | DPI_D20 | SD1_DAT0 | ARM_TDO | – |
| Pi 4, 400 | SD0_DAT0 | SD16 | DPI_D20 | SD1_DAT0 | ARM_TDO | SPI3_CE1_N |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 24 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SD0_DAT0 | DPI_D20 | I2S0_SDI2 | – | I2S1_SDI2 | SPI2_CE1 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 19 – BCM 10 (GPIO10) – SPI0 MOSI (Master-Out Slave-In)
Phys. Pin: 19BCM: 10Type: SPI0 MOSIBus: 0
Physical Pin 19 (BCM GPIO10) is the Master-Out Slave-In (MOSI) of SPI bus 0. SPI (Serial Peripheral Interface) is a synchronous 4-wire serial protocol based on the master-slave principle with high data transfer rates (up to several MHz). Unlike I2C, each SPI device requires its own Chip Enable (CE) line.
Activate SPI: sudo raspi-config → Interfacing Options → SPI → Enable, then restart.
SPI Lines at a Glance
- MOSI (Pin 19 / 38) – Master sends, Slave receives
- MISO (Pin 21 / 35) – Slave sends, Master receives
- SCLK (Pin 23 / 40) – Clock signal from the Master
- CE0/CE1/CE2 (Pin 24 / 26 / 36) – Chip Enable (Slave selection)
Python Code Example (spidev)
import spidev
spi = spidev.SpiDev()
spi.open(0, 0) # Bus 0, CE0
spi.max_speed_hz = 1000000
# Send byte and receive simultaneously
response = spi.xfer2([0x01, 0x80, 0x00])
print(f"Response: {response}")
spi.close()Typical Use
- SPI displays (ILI9341, ST7789)
- A/D converters (MCP3008)
- RFID modules (RC522)
- Accelerometers (MPU6000)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SPI0_MOSI | SD2 | DPI_D6 | AVEOUT_VID6 | AVEIN_VID6 | – |
| Pi 4, 400 | SPI0_MOSI | SD2 | DPI_D6 | I2CSL_SDA_MOSI | CTS4 | SDA5 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 10 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI0_MOSI | DPI_D6 | CTS3 | SDA1 | – | SPI4_SIO1 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 20 – Ground (GND)
Voltage: 0V / GNDType: Ground
Physical Pin 20 is a ground pin (Ground, GND). It forms the common reference potential for all circuits on the Raspberry Pi. The 40-pin header has a total of 8 ground pins (Pins 6, 9, 14, 20, 25, 30, 34, 39).
Tips
- For multiple sensors, use a separate GND pin for each (avoids voltage drops)
- Place the GND pin and signal pin as close together as possible (short lines = less interference)
- For motor drivers, provide a separate GND for the load side
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 21 – BCM 9 (GPIO9) – SPI0 MISO (Master-In Slave-Out)
Phys. Pin: 21BCM: 9Type: SPI0 MISOBus: 0
Physical Pin 21 (BCM GPIO9) is the Master-In Slave-Out (MISO) of SPI bus 0. SPI (Serial Peripheral Interface) is a synchronous 4-wire serial protocol based on the master-slave principle with high data transfer rates (up to several MHz). Unlike I2C, each SPI device requires its own Chip Enable (CE) line.
Activate SPI: sudo raspi-config → Interfacing Options → SPI → Enable, then restart.
SPI Lines at a Glance
- MOSI (Pin 19 / 38) – Master sends, Slave receives
- MISO (Pin 21 / 35) – Slave sends, Master receives
- SCLK (Pin 23 / 40) – Clock signal from the Master
- CE0/CE1/CE2 (Pin 24 / 26 / 36) – Chip Enable (Slave selection)
Python Code Example (spidev)
import spidev
spi = spidev.SpiDev()
spi.open(0, 0) # Bus 0, CE0
spi.max_speed_hz = 1000000
# Send byte and receive simultaneously
response = spi.xfer2([0x01, 0x80, 0x00])
print(f"Response: {response}")
spi.close()Typical Use
- SPI displays (ILI9341, ST7789)
- A/D converters (MCP3008)
- RFID modules (RC522)
- Accelerometers (MPU6000)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SPI0_MISO | SD1 | DPI_D5 | AVEOUT_VID5 | AVEIN_VID5 | – |
| Pi 4, 400 | SPI0_MISO | SD1 | DPI_D5 | I2CSL_SDI_MISO | RXD4 | SCL4 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 9 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI0_MISO | DPI_D5 | RXD3 | SCL0 | – | SPI4_SIO0 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 22 – BCM 25 (GPIO25)
Phys. Pin: 22BCM: 25Type: GPIOLevel: 3.3V
Physical Pin 22 corresponds to BCM GPIO25. It is a freely configurable General Purpose I/O pin and can be operated by software as an Input or Output. The logic level is 3.3V (HIGH) or 0V (LOW). The pin supports internal configurable pull-up and pull-down resistors.
Raspberry Pi 5: On the Pi 5, the RP1 chip takes over GPIO control. The original RPi.GPIO doesn’t run on it. Old code with import RPi.GPIO usually works through rpi-lgpio, included in Raspberry Pi OS since October 2024 (otherwise sudo apt install python3-rpi-lgpio). For new code, use gpiozero or lgpio.
Python Code Example
import lgpio # all models, including the Pi 5
# or: import RPi.GPIO as GPIO # via rpi-lgpio on the Pi 5
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 25) # BCM 25 as output
lgpio.gpio_write(h, 25, 1) # HIGH (3.3V)
lgpio.gpio_write(h, 25, 0) # LOW (0V)
lgpio.gpiochip_close(h)Typical Use
- General Purpose GPIO
- Reset signal for external chips
- LED indicator
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SD0_DAT1 | SD17 | DPI_D21 | SD1_DAT1 | ARM_TCK | – |
| Pi 4, 400 | SD0_DAT1 | SD17 | DPI_D21 | SD1_DAT1 | ARM_TCK | SPI4_CE1_N |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 25 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SD0_DAT1 | DPI_D21 | I2S0_SDO2 | MIC_CLK | I2S1_SDO2 | SPI3_CE1 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 23 – BCM 11 (GPIO11) – SPI0 SCLK (Clock Signal)
Phys. Pin: 23BCM: 11Type: SPI0 SCLKBus: 0
Physical Pin 23 (BCM GPIO11) is the clock signal (SCLK) of SPI bus 0. SPI (Serial Peripheral Interface) is a synchronous 4-wire serial protocol based on the master-slave principle with high data transfer rates (up to several MHz). Unlike I2C, each SPI device requires its own Chip Enable (CE) line.
Activate SPI: sudo raspi-config → Interfacing Options → SPI → Enable, then restart.
SPI Lines at a Glance
- MOSI (Pin 19 / 38) – Master sends, Slave receives
- MISO (Pin 21 / 35) – Slave sends, Master receives
- SCLK (Pin 23 / 40) – Clock signal from the Master
- CE0/CE1/CE2 (Pin 24 / 26 / 36) – Chip Enable (Slave selection)
Python Code Example (spidev)
import spidev
spi = spidev.SpiDev()
spi.open(0, 0) # Bus 0, CE0
spi.max_speed_hz = 1000000
# Send byte and receive simultaneously
response = spi.xfer2([0x01, 0x80, 0x00])
print(f"Response: {response}")
spi.close()Typical Use
- SPI displays (ILI9341, ST7789)
- A/D converters (MCP3008)
- RFID modules (RC522)
- Accelerometers (MPU6000)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SPI0_SCLK | SD3 | DPI_D7 | AVEOUT_VID7 | AVEIN_VID7 | – |
| Pi 4, 400 | SPI0_SCLK | SD3 | DPI_D7 | I2CSL_SCL_SCLK | RTS4 | SCL5 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 11 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI0_SCLK | DPI_D7 | RTS3 | SCL1 | – | SPI4_SCLK |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 24 – BCM 8 (GPIO8) – SPI0 CE0 (Chip Enable 0)
Phys. Pin: 24BCM: 8Type: SPI0 CE0Bus: 0
Physical Pin 24 (BCM GPIO8) is the Chip Enable 0 (CE0, also Chip Select) of SPI bus 0. With the CE signal, the master selects the desired slave chip by pulling the line LOW. Another SPI device can be operated on the same bus via CE1.
Further SPI lines: MOSI (Pin 19/38), MISO (Pin 21/35), SCLK (Pin 23/40), CE0 (Pin 24), CE1 (Pin 26), CE2 (Pin 36).
Typical Use
- Operating a second SPI device alongside CE0 (e.g., two RFID modules)
- Display on CE0, memory IC on CE1
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SPI0_CE0_N | SD0 | DPI_D4 | AVEOUT_VID4 | AVEIN_VID4 | – |
| Pi 4, 400 | SPI0_CE0_N | SD0 | DPI_D4 | I2CSL_CE_N | TXD4 | SDA4 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 8 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI0_CE0 | DPI_D4 | TXD3 | SDA0 | – | SPI4_CE0 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 25 – Ground (GND)
Voltage: 0V / GNDType: Ground
Physical Pin 25 is a ground pin (Ground, GND). It forms the common reference potential for all circuits on the Raspberry Pi. The 40-pin header has a total of 8 ground pins (Pins 6, 9, 14, 20, 25, 30, 34, 39).
Tips
- For multiple sensors, use a separate GND pin for each (avoids voltage drops)
- Place the GND pin and signal pin as close together as possible (short lines = less interference)
- For motor drivers, provide a separate GND for the load side
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 26 – BCM 7 (GPIO7) – SPI0 CE1 (Chip Enable 1)
Phys. Pin: 26BCM: 7Type: SPI0 CE1Bus: 0
Physical Pin 26 (BCM GPIO7) is the Chip Enable 1 (CE1, also Chip Select) of SPI bus 0. With the CE signal, the master selects the desired slave chip by pulling the line LOW. Another SPI device can be operated on the same bus via CE1.
Further SPI lines: MOSI (Pin 19/38), MISO (Pin 21/35), SCLK (Pin 23/40), CE0 (Pin 24), CE1 (Pin 26), CE2 (Pin 36).
Typical Use
- Operating a second SPI device alongside CE0 (e.g., two RFID modules)
- Display on CE0, memory IC on CE1
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SPI0_CE1_N | SWE_N_SRW_N | DPI_D3 | AVEOUT_VID3 | AVEIN_VID3 | – |
| Pi 4, 400 | SPI0_CE1_N | SWE_N_SRW_N | DPI_D3 | SPI4_SCLK | RTS3 | SCL4 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 7 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI0_CE1 | DPI_D3 | RTS2 | SCL3 | DSR0 | SPI3_SCLK |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 27 – BCM 0 (GPIO0) – I2C ID EEPROM SDA (Data Line)
Phys. Pin: 27BCM: 0Type: I2C EEPROM SDA
Physical Pin 27 (BCM GPIO0) belongs to the special I2C bus 0, which is reserved exclusively for the automatic recognition of HAT (Hardware Attached on Top) expansion boards. At startup, the Raspberry Pi reads an EEPROM on the HAT via this bus and configures itself automatically.
Important: This bus is not suitable for custom sensors – it is controlled by the GPU firmware. For your own I2C devices, use I2C bus 1 (Pin 3 + Pin 5) instead.
Typical Use
- HAT EEPROM detection (automatic, no user code necessary)
- In exceptional cases: Bus 0 can be released in config.txt:
dtparam=i2c0=on
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SDA0 | SA5 | PCLK | AVEOUT_VCLK | AVEIN_VCLK | – |
| Pi 4, 400 | SDA0 | SA5 | PCLK | SPI3_CE0_N | TXD2 | SDA6 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 0 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI0_SIO3 | DPI_PCLK | TXD1 | SDA0 | – | SPI2_CE0 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 28 – BCM 1 (GPIO1) – I2C ID EEPROM SCL (Clock Line)
Phys. Pin: 28BCM: 1Type: I2C EEPROM SCL
Physical Pin 28 (BCM GPIO1) belongs to the special I2C bus 0, which is reserved exclusively for the automatic recognition of HAT (Hardware Attached on Top) expansion boards. At startup, the Raspberry Pi reads an EEPROM on the HAT via this bus and configures itself automatically.
Important: This bus is not suitable for custom sensors – it is controlled by the GPU firmware. For your own I2C devices, use I2C bus 1 (Pin 3 + Pin 5) instead.
Typical Use
- HAT EEPROM detection (automatic, no user code necessary)
- In exceptional cases: Bus 0 can be released in config.txt:
dtparam=i2c0=on
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SCL0 | SA4 | DE | AVEOUT_DSYNC | AVEIN_DSYNC | – |
| Pi 4, 400 | SCL0 | SA4 | DE | SPI3_MISO | RXD2 | SCL6 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 1 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI0_SIO2 | DPI_DE | RXD1 | SCL0 | – | SPI2_SIO1 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 29 – BCM 5 (GPIO5)
Phys. Pin: 29BCM: 5Type: GPIOLevel: 3.3V
Physical Pin 29 corresponds to BCM GPIO5. It is a freely configurable General Purpose I/O pin and can be operated by software as an Input or Output. The logic level is 3.3V (HIGH) or 0V (LOW). The pin supports internal configurable pull-up and pull-down resistors. In ALT0 mode, it can be used as GPCLK1.
Raspberry Pi 5: On the Pi 5, the RP1 chip takes over GPIO control. The original RPi.GPIO doesn’t run on it. Old code with import RPi.GPIO usually works through rpi-lgpio, included in Raspberry Pi OS since October 2024 (otherwise sudo apt install python3-rpi-lgpio). For new code, use gpiozero or lgpio.
Python Code Example
import lgpio # all models, including the Pi 5
# or: import RPi.GPIO as GPIO # via rpi-lgpio on the Pi 5
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 5) # BCM 5 as output
lgpio.gpio_write(h, 5, 1) # HIGH (3.3V)
lgpio.gpio_write(h, 5, 0) # LOW (0V)
lgpio.gpiochip_close(h)Typical Use
- General Purpose GPIO
- GPCLK1 in ALT0 mode
- Sending a digital signal
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | GPCLK1 | SA0 | DPI_D1 | AVEOUT_VID1 | AVEIN_VID1 | ARM_TDO |
| Pi 4, 400 | GPCLK1 | SA0 | DPI_D1 | SPI4_MISO | RXD3 | SCL3 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 5 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | GPCLK1 | DPI_D1 | RXD2 | SCL2 | DTR0 | SPI3_SIO1 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 30 – Ground (GND)
Voltage: 0V / GNDType: Ground
Physical Pin 30 is a ground pin (Ground, GND). It forms the common reference potential for all circuits on the Raspberry Pi. The 40-pin header has a total of 8 ground pins (Pins 6, 9, 14, 20, 25, 30, 34, 39).
Tips
- For multiple sensors, use a separate GND pin for each (avoids voltage drops)
- Place the GND pin and signal pin as close together as possible (short lines = less interference)
- For motor drivers, provide a separate GND for the load side
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 31 – BCM 6 (GPIO6)
Phys. Pin: 31BCM: 6Type: GPIOLevel: 3.3V
Physical Pin 31 corresponds to BCM GPIO6. It is a freely configurable General Purpose I/O pin and can be operated by software as an Input or Output. The logic level is 3.3V (HIGH) or 0V (LOW). The pin supports internal configurable pull-up and pull-down resistors. In ALT0 mode, it can be used as GPCLK2.
Raspberry Pi 5: On the Pi 5, the RP1 chip takes over GPIO control. The original RPi.GPIO doesn’t run on it. Old code with import RPi.GPIO usually works through rpi-lgpio, included in Raspberry Pi OS since October 2024 (otherwise sudo apt install python3-rpi-lgpio). For new code, use gpiozero or lgpio.
Python Code Example
import lgpio # all models, including the Pi 5
# or: import RPi.GPIO as GPIO # via rpi-lgpio on the Pi 5
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 6) # BCM 6 as output
lgpio.gpio_write(h, 6, 1) # HIGH (3.3V)
lgpio.gpio_write(h, 6, 0) # LOW (0V)
lgpio.gpiochip_close(h)Typical Use
- General Purpose GPIO
- GPCLK2 in ALT0 mode
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | GPCLK2 | SOE_N_SE | DPI_D2 | AVEOUT_VID2 | AVEIN_VID2 | ARM_RTCK |
| Pi 4, 400 | GPCLK2 | SOE_N_SE | DPI_D2 | SPI4_MOSI | CTS3 | SDA4 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 6 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | GPCLK2 | DPI_D2 | CTS2 | SDA3 | DCD0 | SPI3_SIO0 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 32 – BCM 12 (GPIO12) – PWM0
Phys. Pin: 32BCM: 12Type: GPIO / PWMHW PWM: Channel 0
Physical Pin 32 (BCM GPIO12) supports Hardware PWM (Channel 0) in addition to normal GPIO function. Pulse Width Modulation (PWM) generates a square wave signal with variable duty cycle. Hardware PWM is generated directly by the internal timer block and does not cause any CPU load.
Python Code Example (Software PWM via lgpio)
import lgpio, time
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 12)
# Software PWM: Frequency 50 Hz, Duty Cycle 50%
lgpio.tx_pwm(h, 12, 50, 50)
time.sleep(2)
lgpio.tx_pwm(h, 12, 50, 0) # Stop
lgpio.gpiochip_close(h)Typical Use
- Controlling an RC servo (50 Hz, 1-2 ms pulse width)
- Dimming LED brightness
- Regulating fan speed
- Audio output (low-budget DAC)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | PWM0 | SD4 | DPI_D8 | AVEOUT_VID8 | AVEIN_VID8 | ARM_TMS |
| Pi 4, 400 | PWM0_0 | SD4 | DPI_D8 | SPI5_CE0_N | TXD5 | SDA5 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 12 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | PWM0_CHAN0 | DPI_D8 | TXD4 | SDA2 | AAUD_LEFT | SPI5_CE0 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 33 – BCM 13 (GPIO13) – PWM1
Phys. Pin: 33BCM: 13Type: GPIO / PWMHW PWM: Channel 1
Physical Pin 33 (BCM GPIO13) supports Hardware PWM (Channel 1) in addition to normal GPIO function. Pulse Width Modulation (PWM) generates a square wave signal with variable duty cycle. Hardware PWM is generated directly by the internal timer block and does not cause any CPU load.
Python Code Example (Software PWM via lgpio)
import lgpio, time
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 13)
# Software PWM: Frequency 50 Hz, Duty Cycle 50%
lgpio.tx_pwm(h, 13, 50, 50)
time.sleep(2)
lgpio.tx_pwm(h, 13, 50, 0) # Stop
lgpio.gpiochip_close(h)Typical Use
- Controlling an RC servo (50 Hz, 1-2 ms pulse width)
- Dimming LED brightness
- Regulating fan speed
- Audio output (low-budget DAC)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | PWM1 | SD5 | DPI_D9 | AVEOUT_VID9 | AVEIN_VID9 | ARM_TCK |
| Pi 4, 400 | PWM0_1 | SD5 | DPI_D9 | SPI5_MISO | RXD5 | SCL5 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 13 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | PWM0_CHAN1 | DPI_D9 | RXD4 | SCL2 | AAUD_RIGHT | SPI5_SIO1 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 34 – Ground (GND)
Voltage: 0V / GNDType: Ground
Physical Pin 34 is a ground pin (Ground, GND). It forms the common reference potential for all circuits on the Raspberry Pi. The 40-pin header has a total of 8 ground pins (Pins 6, 9, 14, 20, 25, 30, 34, 39).
Tips
- For multiple sensors, use a separate GND pin for each (avoids voltage drops)
- Place the GND pin and signal pin as close together as possible (short lines = less interference)
- For motor drivers, provide a separate GND for the load side
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 35 – BCM 19 (GPIO19) – SPI1 MISO (Master-In Slave-Out)
Phys. Pin: 35BCM: 19Type: SPI1 MISOBus: 1
Physical Pin 35 (BCM GPIO19) is the Master-In Slave-Out (MISO) of SPI bus 1. SPI (Serial Peripheral Interface) is a synchronous 4-wire serial protocol based on the master-slave principle with high data transfer rates (up to several MHz). Unlike I2C, each SPI device requires its own Chip Enable (CE) line.
Activate SPI: sudo raspi-config → Interfacing Options → SPI → Enable, then restart.
SPI Lines at a Glance
- MOSI (Pin 19 / 38) – Master sends, Slave receives
- MISO (Pin 21 / 35) – Slave sends, Master receives
- SCLK (Pin 23 / 40) – Clock signal from the Master
- CE0/CE1/CE2 (Pin 24 / 26 / 36) – Chip Enable (Slave selection)
Python Code Example (spidev)
import spidev
spi = spidev.SpiDev()
spi.open(1, 0) # Bus 1, CE0
spi.max_speed_hz = 1000000
# Send byte and receive simultaneously
response = spi.xfer2([0x01, 0x80, 0x00])
print(f"Response: {response}")
spi.close()Typical Use
- SPI displays (ILI9341, ST7789)
- A/D converters (MCP3008)
- RFID modules (RC522)
- Accelerometers (MPU6000)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | PCM_FS | SD11 | DPI_D15 | I2CSL_SCL_SCLK | SPI1_MISO | PWM1 |
| Pi 4, 400 | PCM_FS | SD11 | DPI_D15 | SPI6_MISO | SPI1_MISO | PWM0_1 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 19 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI1_MISO | DPI_D15 | I2S0_WS | PWM0_CHAN3 | I2S1_WS | – |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 36 – BCM 16 (GPIO16) – SPI1 CE2 (Chip Enable 2)
Phys. Pin: 36BCM: 16Type: SPI1 CE2Bus: 1
Physical Pin 36 (BCM GPIO16) is the Chip Enable 2 (CE2, also Chip Select) of SPI bus 1. With the CE signal, the master selects the desired slave chip by pulling the line LOW. Another SPI device can be operated on the same bus via CE2.
Further SPI lines: MOSI (Pin 19/38), MISO (Pin 21/35), SCLK (Pin 23/40), CE0 (Pin 24), CE1 (Pin 26), CE2 (Pin 36).
Typical Use
- Operating a second SPI device alongside CE0 (e.g., two RFID modules)
- Display on CE0, memory IC on CE1
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | FL0 | SD8 | DPI_D12 | CTS0 | SPI1_CE2_N | CTS1 |
| Pi 4, 400 | – | SD8 | DPI_D12 | CTS0 | SPI1_CE2_N | CTS1 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 16 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI1_CE2 | DPI_D12 | DSI0_TE_EXT | – | CTS0 | – |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 37 – BCM 26 (GPIO26)
Phys. Pin: 37BCM: 26Type: GPIOLevel: 3.3V
Physical Pin 37 corresponds to BCM GPIO26. It is a freely configurable General Purpose I/O pin and can be operated by software as an Input or Output. The logic level is 3.3V (HIGH) or 0V (LOW). The pin supports internal configurable pull-up and pull-down resistors.
Raspberry Pi 5: On the Pi 5, the RP1 chip takes over GPIO control. The original RPi.GPIO doesn’t run on it. Old code with import RPi.GPIO usually works through rpi-lgpio, included in Raspberry Pi OS since October 2024 (otherwise sudo apt install python3-rpi-lgpio). For new code, use gpiozero or lgpio.
Python Code Example
import lgpio # all models, including the Pi 5
# or: import RPi.GPIO as GPIO # via rpi-lgpio on the Pi 5
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, 26) # BCM 26 as output
lgpio.gpio_write(h, 26, 1) # HIGH (3.3V)
lgpio.gpio_write(h, 26, 0) # LOW (0V)
lgpio.gpiochip_close(h)Typical Use
- General Purpose GPIO
- Switching output
- Sensor input
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | SD0_DAT2 | TE0 | DPI_D22 | SD1_DAT2 | ARM_TDI | – |
| Pi 4, 400 | SD0_DAT2 | – | DPI_D22 | SD1_DAT2 | ARM_TDI | SPI5_CE1_N |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 26 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SD0_DAT2 | DPI_D22 | I2S0_SDI3 | MIC_DAT0 | I2S1_SDI3 | SPI5_CE1 |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 38 – BCM 20 (GPIO20) – SPI1 MOSI (Master-Out Slave-In)
Phys. Pin: 38BCM: 20Type: SPI1 MOSIBus: 1
Physical Pin 38 (BCM GPIO20) is the Master-Out Slave-In (MOSI) of SPI bus 1. SPI (Serial Peripheral Interface) is a synchronous 4-wire serial protocol based on the master-slave principle with high data transfer rates (up to several MHz). Unlike I2C, each SPI device requires its own Chip Enable (CE) line.
Activate SPI: sudo raspi-config → Interfacing Options → SPI → Enable, then restart.
SPI Lines at a Glance
- MOSI (Pin 19 / 38) – Master sends, Slave receives
- MISO (Pin 21 / 35) – Slave sends, Master receives
- SCLK (Pin 23 / 40) – Clock signal from the Master
- CE0/CE1/CE2 (Pin 24 / 26 / 36) – Chip Enable (Slave selection)
Python Code Example (spidev)
import spidev
spi = spidev.SpiDev()
spi.open(1, 0) # Bus 1, CE0
spi.max_speed_hz = 1000000
# Send byte and receive simultaneously
response = spi.xfer2([0x01, 0x80, 0x00])
print(f"Response: {response}")
spi.close()Typical Use
- SPI displays (ILI9341, ST7789)
- A/D converters (MCP3008)
- RFID modules (RC522)
- Accelerometers (MPU6000)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | PCM_DIN | SD12 | DPI_D16 | I2CSL_MISO | SPI1_MOSI | GPCLK0 |
| Pi 4, 400 | PCM_DIN | SD12 | DPI_D16 | SPI6_MOSI | SPI1_MOSI | GPCLK0 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 20 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI1_MOSI | DPI_D16 | I2S0_SDI0 | GPCLK0 | I2S1_SDI0 | – |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 39 – Ground (GND)
Voltage: 0V / GNDType: Ground
Physical Pin 39 is a ground pin (Ground, GND). It forms the common reference potential for all circuits on the Raspberry Pi. The 40-pin header has a total of 8 ground pins (Pins 6, 9, 14, 20, 25, 30, 34, 39).
Tips
- For multiple sensors, use a separate GND pin for each (avoids voltage drops)
- Place the GND pin and signal pin as close together as possible (short lines = less interference)
- For motor drivers, provide a separate GND for the load side
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Pin 40 – BCM 21 (GPIO21) – SPI1 SCLK (Clock Signal)
Phys. Pin: 40BCM: 21Type: SPI1 SCLKBus: 1
Physical Pin 40 (BCM GPIO21) is the clock signal (SCLK) of SPI bus 1. SPI (Serial Peripheral Interface) is a synchronous 4-wire serial protocol based on the master-slave principle with high data transfer rates (up to several MHz). Unlike I2C, each SPI device requires its own Chip Enable (CE) line.
Activate SPI: sudo raspi-config → Interfacing Options → SPI → Enable, then restart.
SPI Lines at a Glance
- MOSI (Pin 19 / 38) – Master sends, Slave receives
- MISO (Pin 21 / 35) – Slave sends, Master receives
- SCLK (Pin 23 / 40) – Clock signal from the Master
- CE0/CE1/CE2 (Pin 24 / 26 / 36) – Chip Enable (Slave selection)
Python Code Example (spidev)
import spidev
spi = spidev.SpiDev()
spi.open(1, 0) # Bus 1, CE0
spi.max_speed_hz = 1000000
# Send byte and receive simultaneously
response = spi.xfer2([0x01, 0x80, 0x00])
print(f"Response: {response}")
spi.close()Typical Use
- SPI displays (ILI9341, ST7789)
- A/D converters (MCP3008)
- RFID modules (RC522)
- Accelerometers (MPU6000)
Alternative Functions
| Model | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 |
|---|---|---|---|---|---|---|
| Pi 1–3, Zero | PCM_DOUT | SD13 | DPI_D17 | I2CSL_CE_N | SPI1_SCLK | GPCLK1 |
| Pi 4, 400 | PCM_DOUT | SD13 | DPI_D17 | SPI6_SCLK | SPI1_SCLK | GPCLK1 |
Raspberry Pi 5: The RP1 chip numbers its functions a0 to a8, which you set with pinctrl set 21 a3, for example. a5 is the plain GPIO, and every pin has a6 and a7 (PROC_RIO, PIO).
| Model | a0 | a1 | a2 | a3 | a4 | a8 |
|---|---|---|---|---|---|---|
| Pi 5 | SPI1_SCLK | DPI_D17 | I2S0_SDO0 | GPCLK1 | I2S1_SDO0 | – |
Available on the following boards
| Model | Available |
|---|---|
| Raspberry Pi 5 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 4 Model B / 400 | ✓ J8 Header (40-Pin) |
| Raspberry Pi 3 Model B / B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 2 Model B | ✓ J8 Header (40-Pin) |
| Raspberry Pi Zero 2 W / Zero W | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Models A+ and B+ | ✓ J8 Header (40-Pin) |
| Raspberry Pi 1 Model A and B | ✓ P1 Header (26-Pin) |
Raspberry Pi 5 Pinout in Detail
Our interactive Raspberry Pi 5 Pinout tool shows you all 40 GPIO pins of the new flagship (and its predecessors) at a glance. Click on a pin to get details about its function, BCM number, and alternative functions.
The 40-pin GPIO layout is identical on all current models – Raspberry Pi 3, Pi 4, Pi 5, Pi 400, and Pi Zero 2 W use the same physical pinout. The Raspberry Pi Pico microcontroller has its own layout, covered in our Pico pinout. On the Raspberry Pi 5, the RP1 chip takes over GPIO control. The original RPi.GPIO doesn’t run there, but old scripts usually keep working through rpi-lgpio, which Raspberry Pi OS has included since October 2024. To see which pins a HAT uses and whether two HATs clash, try our HAT check.
Most Important GPIO Pins at a Glance
| Physical | BCM No. | Function |
|---|---|---|
| Pin 3 | GPIO 2 (SDA) | I²C Data |
| Pin 5 | GPIO 3 (SCL) | I²C Clock |
| Pin 8 | GPIO 14 (TXD) | UART Transmit |
| Pin 10 | GPIO 15 (RXD) | UART Receive |
| Pin 19 | GPIO 10 (MOSI) | SPI Data Out |
| Pin 21 | GPIO 9 (MISO) | SPI Data In |
| Pin 23 | GPIO 11 (SCLK) | SPI Clock |
| Pin 1 | 3.3V | Power supply |
| Pin 2 | 5V | Power supply |
| Pin 6 | GND | Ground |
- Raspberry Pi 5: The original
RPi.GPIOdoesn’t run. Don’t install it with apt either, because that replacesrpi-lgpio. If an older install doesn’t have rpi-lgpio yet, add it withsudo apt install python3-rpi-lgpio. For new code, usegpiozeroorlgpio. - 3.3V logic: GPIO pins output max. 3.3V – never connect 5V components directly (use a voltage divider).
- Current limit: Max. 16 mA per pin, 50 mA total – always use a series resistor for LEDs.
- Pins 2/3 have pull-ups: GPIO 2 and GPIO 3 have fixed internal pull-up resistors (1.8 kΩ) – no external pull-up needed for I²C.
About the Author
This page is maintained by the raspberry.tips team. We have been working hands-on with the Raspberry Pi since 2013 – from early GPIO experiments to current Pi 5 projects. All pin data is based on practical experience and the official Raspberry Pi Foundation datasheets.
Download the pinout as a graphic and use it freely
You may use this pinout graphic free of charge, modified or unmodified, including commercially: in class, in blog posts, in documentation or on the wall of your makerspace. It is licensed under CC BY 4.0. The only condition is attribution with a link to this page.
You can copy this credit line as it is:
Graphic: <a href="https://raspberry.tips/en/raspberry-pi-gpio-pinout">Raspberry Pi GPIO pinout by raspberry.tips</a>, licensed under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>
For printed material without links, “Graphic: raspberry.tips, CC BY 4.0” is enough.
All Raspberry Pi models (Pi 3, Pi 4, Pi 5, and Zero 2 W) have a 40-pin header. 26 of those pins are usable as GPIO, plus two 5V and two 3.3V power pins and 8 ground pins.
BCM (Broadcom) uses the SoC’s internal chip numbers, e.g. GPIO 17. BOARD uses the physical pin position on the header, e.g. pin 11. The interactive pinout shows BCM numbers.
No. All GPIO pins use 3.3V logic and are not 5V-tolerant. To connect 5V devices you must use a level shifter, otherwise you risk permanently damaging your Pi.
On the Raspberry Pi 4 and Pi 5, GPIO 12, 13, 18, and 19 support hardware PWM. On the Pi 4, GPIO 12 and 18 share a PWM channel, as do GPIO 13 and 19. The Pi 5 has a separate channel for each of the four pins. Software PWM works on all GPIO pins but is less precise.
Yes, the 40-pin header of the Raspberry Pi 5 is pin-compatible with the Pi 4. The BCM numbers and functions (I2C, SPI, UART, PWM) are identical. However, the Pi 5 uses the new RP1 I/O controller, which may require adjustments with some low-level libraries.
🛒 Buy Raspberry Pi

