Skip to content
Guide
15 min read
October 17, 2026

Raspberry Pi 5 Pinout: GPIO, RP1, and What Actually 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.

The Raspberry Pi 5's GPIO header looks identical to every 40-pin Pi since the Pi 2 -- same pin count, same BCM numbering, same physical layout, same HAT compatibility. Wire up an existing HAT or follow an old GPIO tutorial and it'll almost certainly work without any changes at all. What actually changed is invisible from the header: the Pi 5 moved GPIO handling off the main SoC and onto a dedicated companion chip called RP1, and that swap is the one thing worth understanding before assuming every old script and library behaves identically.

On every previous Pi, the GPIO pins were controlled directly by the main Broadcom SoC. On the Pi 5, they're controlled by RP1 -- a custom Raspberry Pi-designed chip connected over a fast internal PCIe link -- which handles GPIO, the camera and display interfaces, USB, and Ethernet. The pins themselves and what they do haven't changed; it's the underlying Linux driver path that has, and that's exactly where a handful of older GPIO libraries trip up.

This guide covers the full 40-pin header, what RP1 actually changes under the hood, which GPIO libraries still work correctly, and the practical power and HAT-compatibility details worth knowing before migrating an existing Pi project to a Pi 5.

Full Raspberry Pi 5 40-pin GPIO header pinout

The 40-Pin Header

Unchanged from every Pi since the Pi 2 B: 40 pins, 26 usable GPIOs, power, and ground, in the same physical positions.

from gpiozero import LED
led = LED(17)
led.on()

Pin numbering follows the same two systems every Pi has used -- BCM (Broadcom's own GPIO numbers, what most libraries and tutorials reference) and BOARD (simple physical pin-position counting, 1 through 40). Mixing the two up remains one of the most common wiring mistakes across every Pi generation, the 5 included.

The RP1 Chip: What Actually Changed

RP1 is the real story of the Pi 5's I/O. Instead of the main Broadcom SoC talking to GPIO pins directly, it talks to RP1 over a PCIe link, and RP1 handles the actual pin-level work -- GPIO, the camera/display MIPI interfaces, USB 3.0, and Gigabit Ethernet all route through this one chip.

In practice, this shows up as a new Linux GPIO chip identifier: gpiochip4 instead of the gpiochip0 older Pi models used. Older GPIO libraries written assuming a fixed gpiochip0 path can fail silently or throw an error on a Pi 5 until updated -- this is the single biggest "my old Pi code doesn't work anymore" report specific to this board. Raspberry Pi's own reasoning for the change was to offload I/O handling from the main SoC entirely, freeing it to focus purely on compute -- a deliberate architectural choice, not an accidental side effect of some other redesign.

Library Compatibility

LibraryPi 5 SupportNotes
gpiozeroYes, fullyRecommended default -- abstracts the RP1 change away entirely
lgpioYes, fullyRecommended for Pi 5, built with RP1 in mind
pigpioPartial / in fluxWorks for many use cases but has had ongoing compatibility patches for RP1 -- check current status before relying on it for anything timing-critical
RPi.GPIOOften broken on Pi 5The classic library many older tutorials use -- frequently doesn't work correctly against gpiochip4 without patches

If a project or tutorial specifically imports RPi.GPIO and targets a Pi 5, that's the first thing to check when something doesn't work -- switching to gpiozero or lgpio resolves the overwhelming majority of these reports.

# lgpio — the RP1-aware low-level option
import lgpio
h = lgpio.gpiochip_open(4)
lgpio.gpio_claim_output(h, 17)
lgpio.gpio_write(h, 17, 1)

PWM, I2C, SPI, and UART

All unchanged in pin position and behavior from previous Pi models. Hardware PWM remains available on a subset of GPIO pins, I2C and SPI sit on their traditional pins (GPIO2/3 for I2C1, GPIO7-11 for the primary SPI bus), and UART remains on GPIO14/15. Enable any of these through raspi-config, exactly as on every previous Pi.

sudo raspi-config
# Interface Options → I2C / SPI / Serial Port

Power Pins and the New PCIe/Power Button Header

The 40-pin GPIO header's power pins are unchanged -- 5V, 3.3V, and ground in their usual positions. What's new on the Pi 5 sits away from the GPIO header entirely: a dedicated PCIe FFC connector for NVMe expansion boards, and a small header for an optional power button. Neither of these affects the 40-pin GPIO layout or numbering.

The Pi 5 also needs meaningfully more power than earlier models -- Raspberry Pi's official guidance points to a 5V/5A USB-C supply for full performance, versus the 5V/3A that sufficed for a Pi 4. An under-powered supply on a Pi 5 tends to show up as throttling or USB/peripheral instability rather than an outright refusal to boot, which can look confusingly like a GPIO or software problem at first glance.

HAT and Add-on Board Compatibility

Because the physical pin layout is unchanged, the overwhelming majority of existing HATs and GPIO add-on boards work on the Pi 5 without modification. The exceptions are boards whose driver software makes low-level assumptions about gpiochip0 or direct memory-mapped GPIO access -- the same class of software issue as the RPi.GPIO problem above, not a hardware incompatibility. A HAT that physically fits and electrically matches the 3.3V logic level will almost always work once its driver software (if any) is updated for RP1.

How the Pi 5 Compares

ModelSoCGPIO handlingUSBBest for
Pi 4Broadcom BCM2711Direct, gpiochip0USB 3.0 (2 ports)Existing projects with no reason to upgrade
Pi 5Broadcom BCM2712 + RP1Via RP1, gpiochip4USB 3.0 (2 ports, faster)New builds wanting more compute and NVMe support

The pin layout and most peripheral pin assignments carry over identically between the two -- the meaningful difference for GPIO work specifically is the library compatibility question above, not anything about the pins themselves.

Practical Pin Usage Tips

Default to gpiozero for new projects. It's the officially recommended library, it abstracts the RP1/gpiochip4 change away entirely, and it works identically across every recent Pi model -- there's rarely a reason to reach for a lower-level library unless a project has a specific timing or performance need.

If an old script breaks, check the GPIO library first before assuming a wiring problem. The Pi 5's RP1 change is a software-path issue far more often than it's a hardware fault -- confirm the wiring against the same BCM pin numbers that worked before, then look at whether the library itself supports gpiochip4.

Budget for a proper 5V/5A supply, especially with USB peripherals attached. Marginal power delivery on a Pi 5 tends to manifest as odd, hard-to-diagnose instability rather than a clean failure to boot.

Don't assume every third-party HAT driver has been updated for RP1 yet. Check the manufacturer's current documentation or changelog before assuming compatibility, particularly for older/discontinued HATs that may not receive updates at all.

Check raspi-config's interface settings before troubleshooting I2C/SPI/UART code. The buses being physically wired correctly and the interface simply not being enabled in software is a far more common cause of "my sensor isn't detected" than a genuine GPIO problem, on the Pi 5 as on every Pi before it.

Summary: Pi 5 GPIO Reference at a Glance

Raspberry Pi 5 · 40-pin GPIO header · 26 usable GPIO · I2C · SPI · UART · Hardware PWM · GPIO handled by the onboard RP1 chip over PCIe · Linux GPIO device: gpiochip4 · Recommended libraries: gpiozero, lgpio

Which Projects the Pi 5 Actually Fits

A strong fit: anything CPU- or GPU-bound that outgrew a Pi 4 -- local AI inference, more demanding computer-vision pipelines, multi-camera setups leaning on the improved MIPI bandwidth through RP1, or a general-purpose Linux GPIO project that also wants NVMe storage for reliability over a microSD card.

A weaker fit: ultra-low-power, always-on GPIO projects where a Pi Zero or a microcontroller board draws a fraction of the current for the same simple task -- the Pi 5's extra compute comes with meaningfully higher idle power draw than the Pi family's smaller boards.

Troubleshooting: When GPIO Suddenly "Stops Working"

The most common support pattern specific to the Pi 5 looks like this: a working project gets migrated from an older Pi, and GPIO calls either throw an error immediately or silently do nothing. Before assuming a hardware fault or a wiring mistake, check three things in order. First, confirm the script's GPIO library -- RPi.GPIO is the most likely culprit, and swapping to gpiozero or lgpio resolves the overwhelming majority of these reports on its own. Second, confirm the relevant interface (I2C, SPI, serial) is actually enabled in raspi-config, since a fresh Pi 5 image doesn't carry over settings from an old SD card automatically. Third, check the power supply -- a marginal 5V/3A supply that worked fine on a Pi 4 can produce erratic, GPIO-adjacent symptoms on a Pi 5's higher power draw that look like a software problem at first glance but resolve the moment a proper 5V/5A supply replaces it.

Quick Answers to Common Pi 5 Pin Questions

Are the Pi 5's GPIO pins physically different from a Pi 4's? No -- same 40-pin header, same BCM numbering, same physical layout. Only the underlying chip handling those pins changed.

Why does my old RPi.GPIO script fail on a Pi 5? That library frequently doesn't work correctly against the Pi 5's gpiochip4 without patches. Switch to gpiozero or lgpio for reliable support.

Will my existing HATs work? Almost certainly, electrically and physically. The only real risk is a HAT's driver software making low-level assumptions RP1 breaks -- check for an updated driver if something doesn't behave as expected.

Do I need a special power supply? Raspberry Pi recommends a 5V/5A USB-C supply for full performance -- meaningfully more than the 5V/3A a Pi 4 needed.

What is RP1, exactly? A Raspberry Pi-designed companion chip that now handles GPIO, camera/display interfaces, USB, and Ethernet, connected to the main SoC over PCIe -- it's why the GPIO device shows up as gpiochip4 instead of gpiochip0.

Does enabling I2C or SPI work the same way as on older Pi models? Yes -- raspi-config's Interface Options menu is unchanged.


Where to Go From Here

Once gpiozero or lgpio feels like the natural default rather than an unfamiliar substitute for RPi.GPIO, the Pi 5's new PCIe FFC connector is worth exploring next for anyone wanting NVMe storage instead of relying on a microSD card. From there, the same GPIO fundamentals -- BCM numbering, I2C/SPI/UART enabled through raspi-config, HAT compatibility -- carry over directly to any future Pi model, since RP1's whole design goal was keeping that layer stable even as the main SoC evolves.

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.