The Raspberry Pi 5 retains the physical 40-pin header layout of its predecessors, but the underlying architecture has fundamentally changed. GPIO is now managed by the RP1 southbridge chip, which alters drive strengths (up to 12mA default), default pull-up states, and peripheral routing. If you are migrating from a Pi 4, assuming the electrical characteristics are identical will lead to logic errors or damaged silicon.

The Complete Raspberry Pi 5 GPIO Pinout Reference

The table below maps the physical header pins to the RP1/BCM GPIO numbers and their primary alternate functions. Read this table assuming the board is oriented with the USB ports facing you and the GPIO header on the top right.

Pin BCM/GPIO Name Function / RP1 Notes
1-3V33.3V Power (Max 1.5A total across all 3V3 pins)
2-5V5V Power (Direct from USB-C/PMIC)
32SDA1I2C1 Data (Hardware 1.8k pull-up to 3.3V)
4-5V5V Power
53SCL1I2C1 Clock (Hardware 1.8k pull-up to 3.3V)
6-GNDGround
74GPCLK0General Purpose Clock 0
814TXD0UART0 Transmit (Primary console/serial)
9-GNDGround
1015RXD0UART0 Receive
1117GPIO17General Purpose / SPI1 CE1
1218PWM0Hardware PWM0 / SPI1 CE0
1327GPIO27General Purpose
14-GNDGround
1522GPIO22General Purpose
1623GPIO23General Purpose / SPI1 CE2
17-3V33.3V Power
1824GPIO24General Purpose
1910MOSISPI0 MOSI (Main SPI Data Out)
20-GNDGround
219MISOSPI0 MISO (Main SPI Data In)
2225GPIO25General Purpose
2311SCLKSPI0 Clock
248CE0SPI0 Chip Select 0
25-GNDGround
267CE1SPI0 Chip Select 1
270ID_SDI2C0 Data (HAT EEPROM ID only)
281ID_SCI2C0 Clock (HAT EEPROM ID only)
295GPIO5General Purpose
30-GNDGround
316GPIO6General Purpose
3212PWM0Hardware PWM0 (Alternate mapping)
3313PWM1Hardware PWM1
34-GNDGround
3519MISOSPI1 MISO (Secondary SPI)
3616GPIO16General Purpose / SPI1 CE2
3726GPIO26General Purpose
3820MOSISPI1 MOSI (Secondary SPI)
39-GNDGround
4021SCLKSPI1 Clock (Secondary SPI)

Rows People Get Wrong (And How to Avoid Bricking the RP1)

CRITICAL VOLTAGE WARNING: The RP1 southbridge operates strictly at 3.3V logic. Unlike older BCM283x chips which had some 5V-tolerant pins, no GPIO pin on the Raspberry Pi 5 is 5V tolerant. Feeding 5V into any BCM-numbered pin will permanently destroy the RP1 chip. Always use a logic level shifter (like the TXS0108E) when interfacing with 5V sensors or relays.

Beyond the voltage trap, makers consistently misconfigure three specific pin groups:

  • Pins 27 & 28 (GPIO 0 & 1): These are reserved for the I2C0 bus, which reads the HAT EEPROM during boot. They lack standard pull-ups and are not routed to the primary Linux I2C drivers by default. Do not use these for general I2C sensors.
  • Pins 3 & 5 (GPIO 2 & 3): These feature hardwired 1.8kΩ pull-up resistors to 3.3V on the physical PCB. They are perfect for I2C, but if you use them as open-drain inputs expecting external 5V pull-ups, the onboard 1.8k resistors will fight your external circuit, causing logic threshold failures.
  • Pins 2 & 4 (5V Power): Backfeeding 5V into these pins from a battery pack or UPS HAT bypasses the Pi 5's input polyfuse and PMIC protection. If your external 5V source spikes to 5.5V+, you will fry the power management IC. Always backfeed through the designated 5V input pads or use a HAT with proper power-path management.

Regional Wire Color Standards for Custom GPIO Harnesses

While the Pi 5 pinout is universal, the wire colors you use to build custom harnesses or cable assemblies should follow your region's low-voltage DC standards to prevent catastrophic miswiring during maintenance. Below is the decision matrix for selecting wire colors based on IEC (Europe/UK) and NEC-adapted (US) practices for Class 2 low-voltage circuits.

Function IEC 60446 / EU Standard US / NEC Adapted Standard Recommended Ribbon Cable Color
3.3V Power (V+) Brown or Red Red Red
Ground (V- / GND) Blue or Black Black Black
Signal / Data (TX, SDA, MOSI) Yellow, White, or Grey Yellow or White Yellow
Clock (SCLK, SCL) Green or Orange Green or Orange Green
Chip Select / Interrupt Pink or Violet Blue or Purple Blue
Harness Pro-Tip: When crimping Dupont or JST-XH connectors for Pi 5 projects, always use a 5-color ribbon cable mapped to the 'Recommended' column above. If you must splice into a 240V AC mains relay module, strictly enforce IEC Brown (Line), Blue (Neutral), and Green/Yellow (Earth) on the high-voltage side to maintain visual isolation between logic and mains.

Safe Interpretation: Identifying Pin 1 on Faded or Housed Boards

When working in the field, silkscreen markings wear off, or the Pi 5 is mounted inside an opaque aluminum case with only the header exposed. Never guess Pin 1. Use this physical verification sequence:

  1. The Square Pad Rule: Flip the board over (or look closely at the top). Pin 1 is the only solder pad on the GPIO header that is square. All other 39 pins are circular.
  2. USB Port Orientation: If the board is right-side up with the USB-A and USB-C ports facing your chest, the GPIO header is on the top-right. Pin 1 is the top-left corner of that 2x20 grid.
  3. The Multimeter Blind Test: If the board is fully enclosed and you cannot see the pads, set your multimeter to continuity mode. Connect the black probe to the metal shield of the USB-C power port (which is tied to system ground). Probe the header pins with the red probe. The 8 pins that beep (GND) are 6, 9, 14, 20, 25, 30, 34, and 39. Pin 1 (3.3V) will be the pin immediately adjacent to the GND pin closest to the USB-C port side of the header.

Protocol Decision Tree: Exact Pin Picks for I2C, SPI, and UART

The RP1 chip offers more flexible peripheral routing than the BCM2711, but Linux device tree overlays still default to specific pins. Use this decision path to select your pins without writing custom DTOs (Device Tree Overlays).

Protocol Need Condition / Constraint Concrete Pin Pick (Physical) BCM / GPIO Mapping
I2C Standard sensors (BME280, OLED) Pins 3 & 5 GPIO 2 (SDA) & 3 (SCL)
Need a second I2C bus (avoiding ID pins) Pins 27 & 28 (Requires dtoverlay=i2c-gpio) GPIO 0 & 1 (Software I2C)
SPI Primary high-speed (Displays, ADC) Pins 19, 21, 23, 24 GPIO 10, 9, 11, 8 (SPI0)
Secondary SPI (Dual displays, LoRa) Pins 35, 38, 40, 12 GPIO 19, 20, 21, 18 (SPI1)
UART GPS modules, Serial Console, ESP32 Pins 8 & 10 GPIO 14 (TX) & 15 (RX)
PWM Motor control, LED dimming Pins 12 & 33 GPIO 18 (PWM0) & 13 (PWM1)

Default Recommendation: If you are building a standard IoT sensor node, hardwire your I2C to Pins 3/5, your primary SPI display to Pins 19/21/23/24, and reserve Pins 8/10 exclusively for UART debugging. This layout matches 95% of pre-compiled Adafruit and Pimoroni Python libraries, eliminating the need to pass custom pin arguments in your code.

For deeper architectural details on the RP1 southbridge, including how to configure the new programmable drive strengths via the pinctrl utility, refer to the official Raspberry Pi hardware documentation. For further reading on low-voltage wiring standards and harness building, the wire color coding guide at All About Circuits provides excellent baseline safety practices.