Skip to content

Guide

Raspberry Pi 5 Pinout: GPIO Table, RP1 and What Changed from the Pi 4

A complete Raspberry Pi 5 GPIO reference — the unchanged 40-pin header, plus the RP1 companion chip, the gpiochip4 change, and exactly which GPIO libraries still work.

  • 6 min read
  • Updated November 21, 2026
Raspberry Pi 5 Pinout: GPIO Table, RP1 and What Changed from the Pi 4

The Raspberry Pi 5's 40-pin header looks exactly like every Pi since the Pi 2: same pins, same BCM numbers, same HAT footprint. What changed is underneath. GPIO is now driven by RP1, a Raspberry Pi-designed I/O chip connected to the main processor over PCIe, and that's why some old GPIO code stops working on a Pi 5 even though the wiring is identical.

Quick answer: the pinout is unchanged: GPIO 2/3 I2C, GPIO 7–11 SPI0, GPIO 14/15 UART, hardware PWM on GPIO 12, 13, 18, 19, all 3.3 V logic. Use gpiozero or lgpio in Python. RPi.GPIO and pigpio don't work on a Pi 5; for old RPi.GPIO scripts, install the rpi-lgpio drop-in. Power it from a 5 V / 5 A USB-C supply.

Below: the full pin table, what RP1 changes for your code, the library situation, UART and PWM details that differ from the Pi 4, the new connectors, power limits and fixes for the common migration errors.

Raspberry Pi 5 40-pin GPIO header pinout
3V3GPIO2GPIO3GPIO4GNDGPIO17GPIO27GPIO223V3GPIO10GPIO9GPIO11GNDGPIO0GPIO5GPIO6GPIO13GPIO19GPIO26GND5V5VGNDGPIO14GPIO15GPIO18GNDGPIO23GPIO24GNDGPIO25GPIO8GPIO7GPIO1GNDGPIO12GNDGPIO16GPIO20GPIO21

Highlighted on the SolderHub Simulator Raspberry Pi 5. Explore every pin on the Raspberry Pi 5 board page.

All 40 header pins on the SolderHub Simulator Pi 5, pin 1 at the top: odd pins on the left (inner row), even pins on the right (board edge). Green is free GPIO, amber has a fixed pull-up, orange is reserved for HATs, red is power, grey is ground.
Interactive Raspberry Pi 5 header: tap any pin

40 of 40 pins match

3V3GPIO2GPIO3GPIO4GNDGPIO17GPIO27GPIO223V3GPIO10GPIO9GPIO11GNDGPIO0GPIO5GPIO6GPIO13GPIO19GPIO26GND5V5VGNDGPIO14GPIO15GPIO18GNDGPIO23GPIO24GNDGPIO25GPIO8GPIO7GPIO1GNDGPIO12GNDGPIO16GPIO20GPIO21

Hover or tap any pin on the board

ODD header · pin 7

GPIO4

GPIO4

Safe to use

General-purpose clock output GPCLK0.

Nothing else on the board depends on this pin. A good first choice for sensors, LEDs and buttons.

Can be used as

  • Clock out

Signals on this pad

  • GPIO4
  • GPCLK0
Tap or hover any pin for its functions and warnings.

Raspberry Pi 5 GPIO Pinout Table

Pin 1 is the square pad, at the end of the header nearest the board's corner mounting hole. Odd pins run along the inside row, even pins along the board edge.

FunctionBCMPinPinBCMFunction
3.3 V—12—5 V
I2C1 SDA234—5 V
I2C1 SCL356—GND
GPCLK047814UART TX
GND—91015UART RX
GPIO17111218PWM / PCM CLK
GPIO271314—GND
GPIO22151623GPIO
3.3 V—171824GPIO
SPI0 MOSI101920—GND
SPI0 MISO9212225GPIO
SPI0 SCLK1123248SPI0 CE0
GND—25267SPI0 CE1
HAT ID EEPROM SDA027281HAT ID EEPROM SCL
GPIO52930—GND
GPIO6313212PWM
PWM133334—GND
PWM / PCM FS19353616GPIO
GPIO26373820PCM DIN
GND—394021PCM DOUT

That's 26 general-purpose GPIOs (BCM 2–27). BCM 0 and 1 are reserved for the HAT identification EEPROM; leave them alone unless you know you need them.

Everything is 3.3 V. No pin is 5 V tolerant. A 5 V sensor output, an HC-SR04 echo pin or a 5 V Arduino TX line needs a divider or level shifter before it reaches the header.

BCM vs physical numbering. Python libraries use BCM numbers: LED(17) means GPIO17, which is physical pin 11. Mixing the two up is still the most common wiring mistake on every Pi.

main.py
from gpiozero import LED
from time import sleep

led = LED(17)        # BCM 17 = physical pin 11
while True:
    led.toggle()
    sleep(0.5)

What RP1 Changes

On a Pi 4 and earlier, GPIO registers sat inside the Broadcom processor, and libraries such as RPi.GPIO and pigpio poked them directly through /dev/mem. On a Pi 5 those registers are inside RP1, at different addresses and with a different design. RP1 also handles USB, Gigabit Ethernet, and the camera and display connectors.

So anything that uses the Linux GPIO character-device interface (/dev/gpiochip*) works, and anything that accessed the old Broadcom registers directly doesn't. That's the whole compatibility story.

About gpiochip4: at launch, RP1's GPIO appeared as gpiochip4, and many tutorials hard-code that number. Since the Raspberry Pi OS kernel update in 2024 (6.6.y), it's gpiochip0 again, so old code that opens chip 4 now fails. Check your own board with gpiodetect and look for the line labelled pinctrl-rp1.

GPIO Library Compatibility on the Pi 5

LibraryWorks on Pi 5?Use it for
gpiozeroYesThe default. LEDs, buttons, sensors, motors; preinstalled on Raspberry Pi OS
lgpioYesLow-level control, and the backend gpiozero uses on a Pi 5
rpi-lgpioYesDrop-in replacement that runs old RPi.GPIO code unchanged
libgpiod / gpiodYesC and Python bindings for the kernel GPIO interface
RPi.GPIONoFails with RuntimeError: Cannot determine SOC peripheral base address
pigpioNoIts daemon relies on the old Broadcom hardware

Fixing an old RPi.GPIO project usually takes one command. rpi-lgpio provides the same import RPi.GPIO as GPIO API on top of lgpio:

terminal
sudo apt remove python3-rpi.gpio
sudo apt install python3-rpi-lgpio

Inside a virtual environment, use pip uninstall RPi.GPIO and pip install rpi-lgpio instead. Most scripts then run unchanged; edge-detection callbacks and software PWM behave slightly differently, so test those parts.

Using lgpio directly, open chip 0 on a current OS:

main.py
import lgpio

h = lgpio.gpiochip_open(0)      # RP1 is gpiochip0 on kernels since 2024
lgpio.gpio_claim_output(h, 17)
lgpio.gpio_write(h, 17, 1)
lgpio.gpiochip_close(h)

From the shell, the pinctrl tool that ships with Raspberry Pi OS reads and sets pins without any Python. It's the quickest way to check wiring:

terminal
pinctrl get 17          # show GPIO17's mode and level
pinctrl set 17 op dh    # make it an output, drive high
pinctrl set 17 dl       # drive low

I2C, SPI, UART and PWM

Enable the buses in sudo raspi-config → Interface Options, or add lines to /boot/firmware/config.txt (note the new path; it was /boot/config.txt before Bookworm).

I2C is on GPIO 2 (SDA) and 3 (SCL), with 1.8 kΩ pull-ups already on the board. After enabling it, i2cdetect -y 1 lists connected devices.

I2C: SDA on GPIO2 (pin 3), SCL on GPIO3 (pin 5)
3V3GPIO2GPIO3GPIO4GNDGPIO17GPIO27GPIO223V3GPIO10GPIO9GPIO11GNDGPIO0GPIO5GPIO6GPIO13GPIO19GPIO26GND5V5VGNDGPIO14GPIO15GPIO18GNDGPIO23GPIO24GNDGPIO25GPIO8GPIO7GPIO1GNDGPIO12GNDGPIO16GPIO20GPIO21

Highlighted on the SolderHub Simulator Raspberry Pi 5. Explore every pin on the Raspberry Pi 5 board page.

An I2C OLED on the Pi 5: VCC to 3V3 (pin 17), GND to pin 9, SDA to GPIO2, SCL to GPIO3. Power I2C modules from 3V3: many pull SDA/SCL up to their VCC, so a 5V supply would put 5 V on pins that aren't 5 V tolerant (SolderHub Simulator parts).

SPI0 is on GPIO 10 (MOSI), 9 (MISO), 11 (SCLK), 8 (CE0) and 7 (CE1). Devices appear as /dev/spidev0.0 and /dev/spidev0.1.

SPI0: MOSI 10, MISO 9, SCLK 11, CE0 8, CE1 7
3V3GPIO2GPIO3GPIO4GNDGPIO17GPIO27GPIO223V3GPIO10GPIO9GPIO11GNDGPIO0GPIO5GPIO6GPIO13GPIO19GPIO26GND5V5VGNDGPIO14GPIO15GPIO18GNDGPIO23GPIO24GNDGPIO25GPIO8GPIO7GPIO1GNDGPIO12GNDGPIO16GPIO20GPIO21

Highlighted on the SolderHub Simulator Raspberry Pi 5. Explore every pin on the Raspberry Pi 5 board page.

UART is the one that catches Pi 4 users out. On a Pi 5 the Linux console goes to the new 3-pin debug UART connector between the HDMI ports (/dev/ttyAMA10), not to GPIO 14/15. After enabling the serial port in raspi-config, GPIO 14/15 is /dev/ttyAMA0. RP1 has more UARTs that can be routed to other header pins with overlays such as dtoverlay=uart2-pi5.

UART: TXD GPIO14 (pin 8), RXD GPIO15 (pin 10)
3V3GPIO2GPIO3GPIO4GNDGPIO17GPIO27GPIO223V3GPIO10GPIO9GPIO11GNDGPIO0GPIO5GPIO6GPIO13GPIO19GPIO26GND5V5VGNDGPIO14GPIO15GPIO18GNDGPIO23GPIO24GNDGPIO25GPIO8GPIO7GPIO1GNDGPIO12GNDGPIO16GPIO20GPIO21

Highlighted on the SolderHub Simulator Raspberry Pi 5. Explore every pin on the Raspberry Pi 5 board page.

Hardware PWM is available on GPIO 12, 13, 18 and 19. Enable two channels with dtoverlay=pwm-2chan (GPIO 18 and 19 by default). gpiozero's PWMLED uses software PWM on any pin, which is fine for LEDs but too jittery for servos.

Hardware PWM: GPIO12, 13, 18 and 19
3V3GPIO2GPIO3GPIO4GNDGPIO17GPIO27GPIO223V3GPIO10GPIO9GPIO11GNDGPIO0GPIO5GPIO6GPIO13GPIO19GPIO26GND5V5VGNDGPIO14GPIO15GPIO18GNDGPIO23GPIO24GNDGPIO25GPIO8GPIO7GPIO1GNDGPIO12GNDGPIO16GPIO20GPIO21

Highlighted on the SolderHub Simulator Raspberry Pi 5. Explore every pin on the Raspberry Pi 5 board page.

Power: The 5 A Supply and the 5 V Pins

The Pi 5 is designed for the official 27 W (5.1 V, 5 A) USB-C supply. A good 5 V / 3 A supply still boots it, but the firmware then limits the total current to the USB ports to 600 mA, instead of 1.6 A, and shows a warning. A USB SSD or several peripherals can then disconnect or misbehave, which looks like a software fault.

On the header:

  • 5 V pins (2, 4) connect to the supply input. They can power small 5 V loads. You can also power the Pi through them from a regulated 5 V supply, but it then can't negotiate 5 A and limits USB current unless you add usb_max_current_enable=1 to config.txt. Get the polarity right: that path has no reverse protection.
  • 3.3 V pins (1, 17) come from the Pi's regulator. Keep the total load to a few sensors and modules, not motors, LED strips or a power-hungry display.
  • GPIO pins are for signals. Drive LEDs through a resistor (330 Ω is typical) and switch relays, motors and buzzers through a transistor or driver board.
USB current available to peripherals
5 V / 3 A supply
600 mA

Boots, but SSDs may disconnect

5 V / 5 A USB-PD supply
1600 mA
From Raspberry Pi's documentation: the firmware limits USB current unless it detects a 5 A supply (or usb_max_current_enable=1 is set).
Power pins: 5V on 2 and 4, 3V3 on 1 and 17, and eight GND
3V3GPIO2GPIO3GPIO4GNDGPIO17GPIO27GPIO223V3GPIO10GPIO9GPIO11GNDGPIO0GPIO5GPIO6GPIO13GPIO19GPIO26GND5V5VGNDGPIO14GPIO15GPIO18GNDGPIO23GPIO24GNDGPIO25GPIO8GPIO7GPIO1GNDGPIO12GNDGPIO16GPIO20GPIO21

Highlighted on the SolderHub Simulator Raspberry Pi 5. Explore every pin on the Raspberry Pi 5 board page.

What's Actually on the Board

The BCM2712 is the main processor, but it doesn't drive the header itself: RP1, Raspberry Pi's own I/O controller, does. Along the edges are the 40-pin header (pin 1 at the end away from the USB ports), the fan connector, two USB stacks and Ethernet on the right, USB-C power and two HDMI outputs along the bottom, the power button, and the PCIe connector on the left side.

What's on a Raspberry Pi 5: 40-pin GPIO header, fan connector, BCM2712, RP1, USB ports, Ethernet, HDMI, USB-C, power button and PCIe connector, labelled on the SolderHub Simulator Pi 5

New Connectors on the Pi 5

None of these change the 40-pin header, but they're worth knowing before you plan a build:

ConnectorWhat it's for
PCIe 2.0 x1 FFCNVMe SSDs and AI accelerators through an M.2 HAT
Two 4-lane MIPI connectorsTwo cameras, two DSI displays, or one of each (smaller 22-pin connectors; Pi 4 camera cables need an adapter cable)
3-pin debug UARTSerial console without using GPIO 14/15
4-pin fan headerThe official Active Cooler, with PWM speed control
RTC battery connectorKeeps the built-in real-time clock running when unplugged
Power buttonOn the board edge; press to start, and to shut down cleanly

HAT Compatibility

Physically and electrically, almost every HAT fits and works. Where a HAT fails on a Pi 5, it's nearly always its software: a driver or Python library built on RPi.GPIO, pigpio or direct register access. Check for an updated driver or a Pi 5 note from the maker first, and try rpi-lgpio for Python-based HATs. Tall HATs also need a stacking header to clear the Active Cooler.

GPIO0 and GPIO1 (pins 27, 28): reserved for the HAT ID EEPROM
3V3GPIO2GPIO3GPIO4GNDGPIO17GPIO27GPIO223V3GPIO10GPIO9GPIO11GNDGPIO0GPIO5GPIO6GPIO13GPIO19GPIO26GND5V5VGNDGPIO14GPIO15GPIO18GNDGPIO23GPIO24GNDGPIO25GPIO8GPIO7GPIO1GNDGPIO12GNDGPIO16GPIO20GPIO21

Highlighted on the SolderHub Simulator Raspberry Pi 5. Explore every pin on the Raspberry Pi 5 board page.

Raspberry Pi 5 vs Pi 4 for GPIO Projects

Raspberry Pi 4Raspberry Pi 5
ProcessorBCM2711, 4 × Cortex-A72, 1.8 GHzBCM2712, 4 × Cortex-A76, 2.4 GHz
GPIO controllerInside the BCM2711RP1 over PCIe
40-pin header layoutSameSame
RPi.GPIO / pigpioWorkDon't work
Console UARTGPIO 14/15Separate debug connector
Recommended supply5 V / 3 A5 V / 5 A
PCIe / NVMeNoYes
Real-time clock, power buttonNoYes

Troubleshooting Old Projects on a Pi 5

Error or symptomCauseFix
RuntimeError: Cannot determine SOC peripheral base addressRPi.GPIOInstall python3-rpi-lgpio or port to gpiozero
Can't connect to pigpiopigpio doesn't support RP1Use gpiozero or lgpio
lgpio.error: 'can not open gpiochip'Code opens chip 4 on a newer kernelOpen chip 0; check with gpiodetect
No data on GPIO 14/15 serialSerial port not enabled, or using /dev/ttyAMA10Enable it in raspi-config and use /dev/ttyAMA0
I2C device not foundI2C disabled, or wiringEnable I2C, run i2cdetect -y 1, check SDA/SCL aren't swapped
Edits to /boot/config.txt do nothingWrong file on BookwormEdit /boot/firmware/config.txt
USB drive disconnects, power warningSupply under 5 AUse the 27 W supply or a powered USB hub
GPIO pin reads wrong after wiring a 5 V moduleOvervoltage on a 3.3 V pinAdd a level shifter; test the pin with pinctrl get

Work through those in order and almost every "it worked on my Pi 4" problem is solved before you touch the wiring.

Old GPIO project failing on a Pi 5?
Run your Pi 4 script on the Pi 5
Q1 Does it stop with "Cannot determine SOC peripheral base address"?
yes → That's RPi.GPIO. Install python3-rpi-lgpio (same API) or port the script to gpiozero.
no
Q2 Does it say it can't connect to pigpio?
yes → pigpio doesn't support RP1. Use gpiozero or lgpio.
no
Q3 Does lgpio report "can not open gpiochip"?
yes → The code opens chip 4. Open chip 0 on a current kernel; check with gpiodetect.
no
Q4 Is there no data on the GPIO 14/15 serial port?
yes → Enable the serial port in raspi-config and use /dev/ttyAMA0. The console is on the debug UART (/dev/ttyAMA10).
no
The software side is fine. Check wiring, 3.3 V levels and config.txt (/boot/firmware/config.txt).
From the troubleshooting table in this guide.

Pin Planning Tips

  • Keep I2C on GPIO 2/3 and put several sensors on it; it saves pins and the pull-ups are already there.
  • Reserve GPIO 18 and 19 if you might need hardware PWM for servos or a fan.
  • Use GPIO 5, 6, 16, 17, 22–27 for buttons, LEDs and relays; they have no bus duties.
  • Give buttons an internal pull-up (gpiozero's Button does this by default) and wire them to GND.
GPIO 5, 6, 16, 17 and 22–27: good for buttons, LEDs and relays
3V3GPIO2GPIO3GPIO4GNDGPIO17GPIO27GPIO223V3GPIO10GPIO9GPIO11GNDGPIO0GPIO5GPIO6GPIO13GPIO19GPIO26GND5V5VGNDGPIO14GPIO15GPIO18GNDGPIO23GPIO24GNDGPIO25GPIO8GPIO7GPIO1GNDGPIO12GNDGPIO16GPIO20GPIO21

Highlighted on the SolderHub Simulator Raspberry Pi 5. Explore every pin on the Raspberry Pi 5 board page.

When a Pi 5 Is the Right Board

Choose a Pi 5 for camera and vision projects, local AI with an accelerator HAT, home servers such as Mosquitto and Node-RED, and anything that benefits from NVMe instead of a microSD card.

Choose something smaller for a simple always-on sensor or relay controller. A Raspberry Pi Zero uses the same header at a fraction of the power, and a microcontroller such as an ESP32 or a Pico 2 W gives precise timing that Linux can't, at well under a watt.

Plan your header wiring first. The SolderHub Simulator has the same Raspberry Pi 5 you see in these figures, so you can check which pins your sensors and modules need before you wire the real board.

FAQ

Is the Raspberry Pi 5 pinout the same as the Pi 4? Yes. Same 40 pins, same BCM numbers, same bus pins. Only the chip driving them changed.

Does RPi.GPIO work on the Raspberry Pi 5? No. Install rpi-lgpio, which runs RPi.GPIO code on the Pi 5, or switch to gpiozero.

Is it gpiochip0 or gpiochip4? On an up-to-date Raspberry Pi OS it's gpiochip0. Early Pi 5 kernels used gpiochip4. Run gpiodetect to be sure.

Which pins have hardware PWM? GPIO 12, 13, 18 and 19.

Are the GPIO pins 5 V tolerant? No. Every GPIO pin is 3.3 V only.

Can I use a 3 A power supply? It boots, but USB current is limited to 600 mA. Use 5 A for SSDs and power-hungry peripherals.

Do Pi 4 HATs work on the Pi 5? Almost all of them, electrically. Check that the HAT's software doesn't depend on RPi.GPIO or pigpio.


Related guides: Raspberry Pi GPIO pinout reference (all 40-pin models, boot pull states, libraries) · Install Mosquitto on the Pi 5 · Install Node-RED on the Pi 5 · Raspberry Pi Zero pinout

Continue learning

Related articles

All articles

Signal In

Built from what makers search for

The lookups piling up in SolderHub's search bar every day shape what we publish next — new component pages, board guides, and firmware notes, sent out as they go live.

By subscribing you agree to our Privacy Policy. Unsubscribe anytime.