Raspberry Pi 5 Pinout, Datasheet, Schematic [Ultimate Guide]

In this guide, you’ll find the Raspberry Pi 5 pinout diagram (the full 40-pin GPIO header), the Raspberry Pi 5 datasheet and schematic details, and every pin group explained with its default pins, the Linux overlays that enable it, and the gotchas that are new on the Pi 5. Without further ado, let’s get right into it!

The Raspberry Pi 5 is a single-board Linux computer built around the Broadcom BCM2712 (4x Cortex-A76 at 2.4GHz) with 1GB to 16GB of LPDDR4X RAM. The big change for hardware projects is that its 28 header GPIOs no longer come from the main SoC: they belong to RP1, Raspberry Pi’s own I/O chip. The header layout is the same as on older Pis, but the libraries, the GPIO numbers and a few defaults are not.


Raspberry Pi 5 Pinout Diagram

Here is a detailed Raspberry Pi 5 GPIO Pinout Diagram with colored labels and legends to help you easily identify the functionalities that each pin can perform. Each pin of the 40-pin header shows its physical pin number, the BCM GPIO number, the Linux sysfs number, the WiringPi number, and every function you can enable in Raspberry Pi OS.

Raspberry Pi 5 pinout diagram with GPIO, PWM, UART, SPI, I2C, PCM and GPCLK pin functions of the 40-pin header
40-pin GPIO header

Read it from the grey strip in the middle: odd pins (1, 3, 5…) are the left column, which is the inner row on the board, and even pins (2, 4, 6…) are the right column, the row along the board edge. Pin 1 is at the top, at the end of the header next to the PCIe connector. The small square next to a GPIO means it’s 3.3v only, the PWM icon marks the hardware PWM pins, and the numbered badges point to the notes at the bottom of the diagram.

Buy a Raspberry Pi 5: If you don’t have one yet, you can get the official board from Amazon or AliExpress. The 4GB version is plenty for GPIO and sensor projects; pick 8GB or 16GB for a desktop, containers or local machine-learning work.

Download Raspberry Pi 5 Pinout Diagrams (Full Resolution)

The Raspberry Pi 5 40-pin header pinout diagram in full resolution (5120 px), in one ZIP file.


Raspberry Pi 5 Datasheet

Raspberry Pi doesn’t publish one big “datasheet” for the Raspberry Pi 5. The board’s official data is split between the product brief and the RP1 Peripherals datasheet (the I/O chip behind the 40-pin header). Here are the official documents you’ll need:

DocumentIDRevision / DateWhat You’ll Use It ForLink
Raspberry Pi 5 Product BriefRP-008348-DSPublished Nov 2026Specs, RAM options, power input (5v / 5A USB-C PD), operating temperature, production lifetimePDF
RP1 PeripheralsRP-008370-DSRelease 1 (Nov 2023)The GPIO function-select table (Table 4) and the UART, SPI, I2C, I2S, PWM and GPCLK blocks behind the headerPDF
Raspberry Pi 5 Mechanical DrawingRP-008347-DSRelease 1Board outline, mounting holes and connector positions for cases and HATsPDF
Compute Module 5 DatasheetRP-008180-DSLatest releaseThe GPIO alternate-function table the Raspberry Pi docs point to for the BCM2712 + RP1 platformPDF
GPIO Usage on Raspberry Pi DevicesRP-006553-WPWhite paperWhich GPIO libraries work on the Pi 5, the gpiochip reorder, and the gpioset behaviourPDF
Device Tree Overlays README–firmware repo (live)Every dtparam/dtoverlay option and its pins (uart0-pi5…uart4-pi5, i2c0-pi5…i2c3-pi5, spi overlays, pwm, pwm-pio)GitHub

Which document do I need? The product brief for the board specs, the official 40-pin header docs for the electrical limits, the overlays README to enable a bus on specific pins, and the RP1 Peripherals PDF only if you need the register-level detail. The board’s product page links the latest versions.


Raspberry Pi 5 Schematic

Raspberry Pi has not published a schematic for the Raspberry Pi 5. The reduced schematics on the official site stop at the Raspberry Pi 4, and the files you’ll find on Scribd, EasyEDA or Pinterest under “Raspberry Pi 5 schematic” aren’t official. What Raspberry Pi does publish is enough to wire the board safely:

  • The device tree (bcm2712-rpi-5-b.dts) shows how everything on the board is wired logically: the 40-pin header GPIOs are RP1 GPIO0–27 (bank 0), and the RP1 hangs off the BCM2712 on a PCIe link.
  • LEDs: the red PWR LED is on RP1 GPIO44 and the green ACT LED on a BCM2712 always-on GPIO, both active low. Neither is on a header pin.
  • Power button: the button is on BCM2712 GPIO20 with a pull-up (active low), as a KEY_POWER input. The J2 pads are wired in parallel with it, for your own button.
  • Fan (J17): driven by RP1 PWM1 channel 3, with its tachometer read back by the PWM block, and speed steps set by the thermal trip points in the device tree.
  • Debug UART (J16): the BCM2712’s own UART10 ( /dev/ttyAMA10), which is the boot console. That’s why the header UART isn’t the console on a Pi 5.
  • The mechanical drawing (RP-008347-DS) gives the board outline, the 4x M2.5 mounting holes and the connector positions.

What isn’t published: the series resistors or ESD protection (if any) between RP1 and the header, and the power-path parts. So treat every GPIO as a bare 3.3v pin and protect it yourself.


Raspberry Pi 5 Specs

Here are the Raspberry Pi 5 specifications, with the board-level details that matter when you wire it:

Raspberry Pi 5 single-board computer

Get a Raspberry Pi 5: the official board is the one I recommend. Grab it from Amazon or AliExpress.

FeatureRaspberry Pi 5
SoCBroadcom BCM2712, 4x Cortex-A76 (Arm v8.2) 64-bit @ 2.4GHz, 512KB L2 per core, 2MB shared L3, VideoCore VII GPU @ 800MHz
I/O controllerRP1 (Raspberry Pi silicon), on PCIe from the SoC: drives the 40-pin GPIOs, USB, Ethernet and MIPI
RAM1GB, 2GB, 4GB, 8GB or 16GB LPDDR4X-4267
StoragemicroSD card slot with SDR104 high-speed mode; NVMe through the PCIe connector and an M.2 HAT
WirelessDual-band 802.11ac Wi-Fi, Bluetooth 5.0 / BLE
EthernetGigabit Ethernet, PoE+ with the separate PoE+ HAT
USB2x USB 3.0 (5Gbps each, at the same time) + 2x USB 2.0; 1.6A total with a 5A supply, 600mA otherwise
Video / camera2x micro-HDMI (4Kp60 with HDR), 2x 4-lane MIPI camera/display transceivers
PCIePCIe 2.0 x1 on an FPC connector (needs an M.2 HAT or adapter)
GPIO header40-pin, 28 RP1 GPIOs (GPIO0–27), 3.3v logic, not 5v tolerant
Power input5v / 5A USB-C with Power Delivery (27W official supply); or 5v through the header from a HAT
On-board extrasPower button, real-time clock with a battery connector (J5), 4-pin fan connector (J17), 3-pin debug UART (J16)
Operating temperature0°C to 70°C
Size85 x 56mm, 4x M2.5 mounting holes
Production lifetimeUntil at least January 2036

Raspberry Pi 5 Specifications Summary

  • The Raspberry Pi 5 has 28 GPIOs on its 40-pin header (GPIO0–27, all on the RP1 chip); 26 are free for your circuits because GPIO0/1 (pins 27/28) are reserved for the HAT ID EEPROM.
  • All GPIOs are 3.3v only and not 5v tolerant: never apply 5v to a GPIO pin.
  • RP1 GPIO outputs have a selectable drive strength (2mA, 4mA, 8mA or 12mA settings; a typical 15.8mA source current at the 8mA setting), so keep each load to a few mA and buffer anything bigger.
  • Power pins: 5v on pins 2 and 4, 3.3v on pins 1 and 17, and 8 GND pins (6, 9, 14, 20, 25, 30, 34, 39).
  • There are no analog inputs: neither the BCM2712 nor the RP1 has an ADC on the header, so analog sensors need an external ADC.
  • UART: 5 on the header (UART0–UART4). UART0 is on pins 8 (TX) and 10 (RX) as /dev/ttyAMA0, but serial0 is the separate 3-pin debug UART.
  • I2C: the main bus is I2C1 on pins 3 (SDA) and 5 (SCL) (/dev/i2c-1), plus I2C0, I2C2 and I2C3 through the -pi5 overlays.
  • SPI: SPI0 on pins 19, 21, 23, 24 and 26, plus SPI1, SPI2, SPI3 and SPI5 through overlays.
  • PWM: 4 hardware channels (RP1 PWM0) on 6 pins: GPIO12, GPIO13, and the shared pairs GPIO14/GPIO18 and GPIO15/GPIO19.
  • Power: 5v / 5A USB-C PD; with a 3A supply the USB ports are limited to 600mA.
  • Linux GPIO numbers: libgpiod, gpiozero and pinctrl use the BCM number on gpiochip0; the deprecated sysfs uses 571 + BCM (GPIO17 = 588) on kernel 6.6+.
  • GPIO libraries: only the original RPi.GPIO and pigpio lack Pi 5 support. Raspberry Pi OS provides RPi.GPIO through rpi-lgpio; for new code use gpiozero, lgpio or libgpiod.

Raspberry Pi 5 RP1 Peripherals vs the 40-Pin Header

PeripheralOn the HeaderEnabled WithNotes
GPIO28 (GPIO0–27)Always availableRP1 bank 0; GPIO28+ stay on the board (Ethernet PHY, LEDs, fan, camera)
UART5: UART0–UART4dtparam=uart0=on, dtoverlay=uart1-pi5 … uart4-pi5All PL011, no mini UART; the console is UART10 on J16
I2C4: I2C0 (HAT ID), I2C1, I2C2, I2C3dtparam=i2c_arm=on, dtoverlay=i2c0-pi5 … i2c3-pi5I2C1 has the 1.8kΩ pull-ups
SPI5 usable: SPI0, SPI1, SPI2, SPI3, SPI5dtparam=spi=on, dtoverlay=spi1-1cs, spi2-1cs-pi5, spi3-1cs-pi5, spi5-1csRP1 SPI4 is slave-only, so it’s left out
PWM4 channels on 6 pinsdtoverlay=pwm / pwm-2chan, or pwm-pio on any GPIOCH2 and CH3 each come out on two pins
PCM / I2S1 (pins 12, 35, 38, 40)dtparam=i2s=on or a DAC overlayShares GPIO18/19 with PWM CH2/CH3
GPCLK3 (GPCLK0–2)Device tree / registersNot supported through WiringPi on the Pi 5
PIOAny of GPIO0–27pwm-pio overlay, piolibThe RP2040-style PIO block, new on the Pi 5
ADC / DACNone–Use an external ADC or DAC
CANNone–Use an SPI CAN controller (MCP2515 overlay)

Raspberry Pi 5 Quick Pin Selection Guide

Use CaseRecommended PinsWhy
Serial consoleThe 3-pin J16 debug connectorIt’s serial0 (/dev/ttyAMA10) on the Pi 5
UART to a devicePin 8 (GPIO14, TX), pin 10 (GPIO15, RX)UART0, /dev/ttyAMA0 with dtparam=uart0=on
A second UARTPins 7/29 (UART2) or pins 24/21 (UART3)Leaves the HAT ID pins and I2C1 alone
I2C sensors and displaysPin 3 (GPIO2, SDA), pin 5 (GPIO3, SCL)I2C1 (/dev/i2c-1), pull-ups already fitted
A second I2C busPins 15/16 (I2C3, pins_22_23) or pins 7/29 (I2C2)Free pins with no other default job
SPI devicesPins 19, 21, 23 + CE0 pin 24 / CE1 pin 26SPI0 (/dev/spidev0.0 and 0.1)
Hardware PWMPin 32 (GPIO12, CH0) and pin 33 (GPIO13, CH1)Their own channels, and GPIO18/19 stay free for I2S
I2S audio DACPins 12, 35, 38, 40The only PCM pins on the header
LEDs, buttons, relaysGPIO17, 27, 22, 23, 24, 25, 26, 16 (pins 11, 13, 15, 16, 18, 22, 37, 36)No default bus on them
Analog inputNone on the boardAdd an I2C or SPI ADC

Raspberry Pi 5 Pins to Use With Caution

PinReasonWhat to Do
Pins 27, 28 (GPIO0/1, ID_SD/ID_SC)The HAT ID EEPROM bus (I2C0)Leave them unconnected unless you fit a HAT EEPROM
Pins 3, 5 (GPIO2/3)Fixed 1.8kΩ pull-ups to 3.3v on the boardDon’t use them as inputs that need a pull-down
Pins 8, 12 (GPIO14/18)The same PWM channel (CH2)Use hardware PWM on only one of them
Pins 10, 35 (GPIO15/19)The same PWM channel (CH3)Use hardware PWM on only one of them
Pin 12 (GPIO18)PWM CH2, the I2S clock, and the pin many fan and LED HATs useUse only one of these on it
Pins 2, 4 (5v)Wired to the board’s 5v rail; a supply here skips the USB-C input protectionNever connect a second supply while USB-C is plugged in
Pins 1, 17 (3V3)No published current budget for the Pi 5Power big loads from their own regulator

Raspberry Pi 5 Pins Functions

Only 28 of the 40 pins of the Raspberry Pi 5 header are GPIO pins; the rest are power and ground. The 40 pins are divided into the following groups based on the hardware functionality they’re used for.

Besides the header, the Raspberry Pi 5 has its own connectors for the debug UART, the fan, the RTC battery and an external power button; they’re covered in the On-Board Connectors section. We’ll discuss each pin group in the following sections one by one in more detail.


Raspberry Pi 5 Power Pins

The Raspberry Pi 5 header has two 5v pins (2 and 4), two 3.3v pins (1 and 17) and eight GND pins (6, 9, 14, 20, 25, 30, 34 and 39). They’re highlighted in red and black in the pinout diagram.

Raspberry Pi 5 power pins (5v pins 2 and 4, 3.3v pins 1 and 17, GND pins 6, 9, 14, 20, 25, 30, 34, 39)

PinNameFunctionNotes
1, 173V33.3v outputFrom the board’s 3.3v rail; no official current figure for the Pi 5
2, 45V5v output or inputThe board’s 5v rail: an output for modules, or an input from a HAT
6, 9, 14, 20, 25, 30, 34, 39GNDGroundCommon ground for everything you connect

Power supply: the Raspberry Pi 5 wants a 5v / 5A USB-C supply with Power Delivery, like the official 27W one. It still runs from a 5v / 3A supply, but then it limits the four USB ports to 600mA in total instead of 1.6A, and warns you at boot. Below 4.63v (±5%) the board flags an under-voltage, and vcgencmd get_throttled reports it. The details are in the official power supply docs.

5V pins: Raspberry Pi’s docs say these pins provide 5v to peripherals or accept 5v input, which is how the PoE+ HAT and UPS HATs power the board. Power fed here doesn’t go through the USB-C negotiation, so the Pi can’t know the supply is good for 5A and keeps the USB limit at 600mA. HAT makers tell you to add usb_max_current_enable=1 to config.txt (and PSU_MAX_CURRENT=5000 in the bootloader EEPROM) when the HAT can really supply 5A (see Waveshare’s PoE HAT notes and Raspberry Pi’s USB Power Delivery white paper).

3V3 pins: a 3.3v output for sensors and modules. Raspberry Pi doesn’t publish a current budget for the Pi 5’s 3.3v pins, so keep the load to sensors and logic chips, and give motors, LED strips and other heavy loads their own supply.

Note: Never connect a supply to the 5v pins while the USB-C cable is plugged in. Power fed into the header bypasses the input protection of the USB-C side, and two supplies on one rail fight each other. Use one or the other, and if you power the Pi 5 from the header, use a regulated 5v supply rated for the current you need.

Never forget to connect the ground of every circuit to the Pi’s GND (common ground). External sensors and modules need the same ground line as the Raspberry Pi to communicate with it properly.


Raspberry Pi 5 GPIO Pins

The Raspberry Pi 5 has 28 GPIO pins (GPIO0 to GPIO27) on its 40-pin header, and every one of them is a 3.3v pin that is not 5v tolerant. On the Pi 5, all 28 belong to the RP1 I/O chip (bank 0), not the BCM2712, which is why old code that wrote the Broadcom GPIO registers directly doesn’t run on it.

Raspberry Pi 5 GPIO pins (28 RP1 GPIOs, GPIO0 to GPIO27, on the 40-pin header)

ParameterRaspberry Pi 5 GPIO
Logic level3.3v (high when connected to 3.3v, low at 0v)
5v tolerantNo, on every pin
Drive strengthSelectable 2mA / 4mA / 8mA / 12mA settings (typical source current 6.3mA / 9.5mA / 15.8mA / 19mA, RP1 Peripherals)
Internal pullsPull-up or pull-down on every GPIO, set in software
Fixed pull-upsGPIO2 and GPIO3 (pins 3 and 5): 1.8kΩ to 3.3v on the board
InterruptsAny GPIO can trigger on rising, falling or both edges (libgpiod events, gpiozero callbacks)

Drive strength isn’t a current limit: it’s the current at which the pin still meets its output voltage levels. Older Raspberry Pi pages quote “16mA per pin, 50mA total”, but that’s the Broadcom-era figure, so don’t plan a Pi 5 design around it. Keep loads to a few mA: an LED with a 330Ω resistor (about 4mA) is fine; anything that needs more, like a relay coil, a motor or a buzzer, needs a transistor or a driver board.

Raspberry Pi 5 GPIO Numbering: Physical vs BCM vs WiringPi vs Linux

Every GPIO on the Raspberry Pi 5 has four different numbers, and mixing them up is the most common beginner mistake. Take physical pin 11 as an example:

NumberingPin 11 IsUsed By
Physical (BOARD)11Counting pins on the header (1–40)
BCMGPIO17gpiozero, libgpiod, lgpio, pinctrl, the overlays README, and most tutorials
Linux sysfs (kernel 6.6+)588 (571 + 17)/sys/class/gpio (deprecated)
WiringPi (wPi)0The WiringPi library and gpio readall

Use the BCM number unless a tool asks for something else; on the Pi 5 it’s simply the RP1 line number. It works the same way as the GP numbers in our Raspberry Pi Pico & Pico W Pinout Guide: write the BCM number in code, and use the physical number only when you wire. The sysfs number is where the Pi 5 bites: the RP1 GPIO chip registers at base 571 on kernel 6.6+, so echo 17 > /sys/class/gpio/export fails with “Invalid argument” (users report it in processing4 #807). That base isn’t guaranteed, and Raspberry Pi says sysfs is due to be removed, so move to libgpiod, gpiozero or pinctrl instead.

Raspberry Pi 5 GPIO Libraries: Which Ones Work

Only the original RPi.GPIO and pigpio lack Raspberry Pi 5 support. Both write the Broadcom GPIO registers directly, and on the Pi 5 the header pins live in RP1 instead, so the original RPi.GPIO fails with “Cannot determine SOC peripheral base address” (one of the most reported Pi 5 problems, for example on the Home Assistant forum). Current Raspberry Pi OS installs rpi-lgpio under the RPi.GPIO name, so import RPi.GPIO works out of the box; I tested it on a Pi 5 and every feature passed. For new code, use gpiozero, lgpio or libgpiod, as Raspberry Pi’s white paper GPIO Usage on Raspberry Pi Devices recommends:

LibraryLanguageWorks on the Pi 5?Notes
gpiozeroPythonYesInstalled with Raspberry Pi OS; uses lgpio underneath
libgpiod (gpiod)C/C++, Python, CLIYesThe standard Linux GPIO interface; gpioset, gpioget, gpiomon
lgpioC, PythonYesUses /dev/gpiochip; also the backend of gpiozero and rpi-lgpio
WiringPiCYesUpdated for the Pi 5 and maintained (GitHub), but no GPCLK support
pinctrlCLIYesRaspberry Pi’s own tool to read and set pins
RPi.GPIO (rpi-lgpio)PythonYesWhat Raspberry Pi OS installs as RPi.GPIO: the same API on top of lgpio
RPi.GPIO (original)PythonNoDirect register access; not supported on the Pi 5
pigpioC, PythonNoDMA and register access; not supported on the Pi 5

gpiochip0 or gpiochip4? The first Pi 5 kernels put the header GPIOs on gpiochip4. In 2024, Raspberry Pi reordered them to gpiochip0 like the older models (raspberrypi/linux PR #6144), and Raspberry Pi OS adds a gpiochip4 symlink so old code keeps working. Many guides still say gpiochip4. The safe way is to open the chip by its label, pinctrl-rp1, or use gpiozero, which picks it for you.

Raspberry Pi 5 GPIO Code Example (C/C++ and Python)

Here’s one real job in both languages: a push button on GPIO17 (pin 11) toggles an LED on GPIO27 (pin 13). Wire the button between pin 11 and GND (pin 9); the code turns on the internal pull-up. Wire the LED’s anode to pin 13 through a 330Ω resistor and its cathode to GND (pin 14). The C version uses the libgpiod v2 API ( sudo apt install libgpiod-dev on Raspberry Pi OS Trixie; Bookworm ships the older v1.6 API), and the Python version uses gpiozero, which comes with Raspberry Pi OS.

C/C++ (libgpiod v2)

Python (gpiozero)

One Pi-specific detail: Raspberry Pi’s kernel keeps a GPIO at the value gpioset left it after the command exits (upstream Linux returns it to an input). Add dtparam=strict_gpiod to config.txt if you want the upstream behaviour.

Note: The Raspberry Pi 5’s GPIOs are not 5v tolerant. Raspberry Pi’s documentation warns that 5v on a GPIO can permanently damage the board. To connect 5v logic (an Arduino’s TX pin, a 5v sensor output), use a level shifter or a resistor divider.


Raspberry Pi 5 Analog Input Pins (ADC)

The Raspberry Pi 5 has no analog input pins: there’s no ADC on the 40-pin header, so every header pin is digital only. To read a potentiometer, a light sensor or any analog voltage, add an external ADC, such as an ADS1115 (16-bit, I2C) or an MCP3008 (10-bit, SPI), or hand the analog side to a microcontroller like the Raspberry Pi Pico. Power the ADC from 3.3v so its digital lines stay Pi-safe.


Raspberry Pi 5 UART Pins

The Raspberry Pi 5 has 5 UARTs on its header (UART0 to UART4, all full PL011 UARTs). UART0 is on pin 8 (GPIO14, TX) and pin 10 (GPIO15, RX) as /dev/ttyAMA0. Unlike older Pis, the Raspberry Pi 5’s serial0 console is not on these pins: it’s the separate 3-pin debug UART (J16).

Raspberry Pi 5 Default UART Pins: GPIO14 (UART0 TX, pin 8) and GPIO15 (UART0 RX, pin 10).

Raspberry Pi 5 UART pins (UART0 on pins 8 and 10, UART1 to UART4 on pins 27/28, 7/29, 24/21 and 32/33)

UARTTXRXCTSRTSconfig.txtLinux Device
UART0Pin 8 (GPIO14)Pin 10 (GPIO15)Pin 36 (GPIO16)Pin 11 (GPIO17)dtparam=uart0=on/dev/ttyAMA0
UART1Pin 27 (GPIO0)Pin 28 (GPIO1)Pin 3 (GPIO2)Pin 5 (GPIO3)dtoverlay=uart1-pi5/dev/ttyAMA1
UART2Pin 7 (GPIO4)Pin 29 (GPIO5)Pin 31 (GPIO6)Pin 26 (GPIO7)dtoverlay=uart2-pi5/dev/ttyAMA2
UART3Pin 24 (GPIO8)Pin 21 (GPIO9)Pin 19 (GPIO10)Pin 23 (GPIO11)dtoverlay=uart3-pi5/dev/ttyAMA3
UART4Pin 32 (GPIO12)Pin 33 (GPIO13)Pin 8 (GPIO14)Pin 10 (GPIO15)dtoverlay=uart4-pi5/dev/ttyAMA4
UART10 (debug)J16J16––Always on (boot console)/dev/ttyAMA10 = serial0

This is the biggest serial gotcha on the Raspberry Pi 5: /dev/serial0 points at /dev/ttyAMA10 (the J16 debug connector), so any tool or tutorial that opens serial0 talks to the 3-pin connector, not pins 8/10 (users hit it in OctoPrint, Home Assistant and the docs issue tracker). Open /dev/ttyAMA0 directly for the header UART, or add dtparam=uart0_console to move the console to pins 8/10. An older dtoverlay=uart2 line still works: the firmware swaps in the -pi5 version for you. The details are in the official UART configuration docs.

Note: UART1 uses pins 27/28, the HAT ID EEPROM pins, and its flow-control pins are the I2C1 pins, so prefer UART2, UART3 or UART4. And remember that the UART pins are 3.3v: a 5v USB-serial adapter or an Arduino’s 5v TX needs a level shifter. Cross the lines (Pi TX to the device’s RX, Pi RX to its TX) and connect GND.

There are so many modules that we can interface with the Raspberry Pi 5 using the UART, which include: GPS receivers, RS-485 transceivers (Modbus), LoRa and cellular modems, fingerprint sensors, microcontroller boards, and much more.


Raspberry Pi 5 I2C Pins

The Raspberry Pi 5 has 4 I2C buses on its header. The main one is I2C1 on pin 3 (GPIO2, SDA) and pin 5 (GPIO3, SCL), which appears as /dev/i2c-1 once you turn it on with dtparam=i2c_arm=on (or in raspi-config).

Raspberry Pi 5 Default I2C1 Pins: GPIO2 (SDA, pin 3) and GPIO3 (SCL, pin 5).

Raspberry Pi 5 I2C pins (I2C1 on pins 3 and 5, I2C2 and I2C3, and I2C0 on the HAT ID pins 27 and 28)

I2C BusSDASCLOther Pin Optionsconfig.txt
I2C1 (main)Pin 3 (GPIO2)Pin 5 (GPIO3)pins_10_11 (pins 19/23)dtparam=i2c_arm=on
I2C2Pin 7 (GPIO4)Pin 29 (GPIO5)pins_12_13 (pins 32/33)dtoverlay=i2c2-pi5
I2C3Pin 31 (GPIO6)Pin 26 (GPIO7)pins_14_15 (pins 8/10), pins_22_23 (pins 15/16)dtoverlay=i2c3-pi5
I2C0 (HAT ID)Pin 27 (GPIO0)Pin 28 (GPIO1)pins_8_9 (pins 24/21)Reserved for the HAT EEPROM

GPIO2 and GPIO3 have 1.8kΩ pull-up resistors to 3.3v on the board, so I2C1 works without external pull-ups. The other buses don’t have them: add 2.2kΩ–4.7kΩ pull-ups to 3.3v, or use modules that already carry them. Add ,baudrate=400000 to an overlay line for fast mode, and scan a bus with i2cdetect -y 1 (change the number for the other buses).

Note: Many I2C modules sold for Arduino pull SDA and SCL up to 5v. The Pi uses 3.3v signalling, so power such a module from 3.3v if it supports it, remove its 5v pull-ups, or put a bidirectional I2C level shifter between them.

There are so many modules and sensors that we can interface with the Raspberry Pi 5 using the I2C bus, which include: OLED displays (SSD1306), temperature and humidity sensors (BME280, SHT31), IMUs (MPU6050), ADCs (ADS1115) for analog inputs, GPIO expanders (MCP23017), PWM drivers (PCA9685), and much more.


Raspberry Pi 5 SPI Pins

The Raspberry Pi 5 has 5 usable SPI buses on its header. The main one is SPI0 on pins 19 (MOSI), 21 (MISO) and 23 (SCLK), with two chip selects on pin 24 (CE0) and pin 26 (CE1). Turn it on with dtparam=spi=on and it appears as /dev/spidev0.0 and /dev/spidev0.1.

Raspberry Pi 5 Default SPI0 Pins: GPIO10 (MOSI, pin 19), GPIO9 (MISO, pin 21), GPIO11 (SCLK, pin 23), GPIO8 (CE0, pin 24) and GPIO7 (CE1, pin 26).

Raspberry Pi 5 SPI pins (SPI0 on pins 19, 21, 23, 24, 26, plus SPI1, SPI2, SPI3 and SPI5)

SPI BusMOSIMISOSCLKCE0CE1config.txt
SPI0Pin 19 (GPIO10)Pin 21 (GPIO9)Pin 23 (GPIO11)Pin 24 (GPIO8)Pin 26 (GPIO7)dtparam=spi=on
SPI1Pin 38 (GPIO20)Pin 35 (GPIO19)Pin 40 (GPIO21)Pin 12 (GPIO18)Pin 11 (GPIO17)dtoverlay=spi1-1cs / 2cs / 3cs (CE2 = pin 36)
SPI2Pin 3 (GPIO2)Pin 28 (GPIO1)Pin 5 (GPIO3)Pin 27 (GPIO0)Pin 18 (GPIO24)dtoverlay=spi2-1cs-pi5 / 2cs-pi5
SPI3Pin 31 (GPIO6)Pin 29 (GPIO5)Pin 26 (GPIO7)Pin 7 (GPIO4)Pin 22 (GPIO25)dtoverlay=spi3-1cs-pi5 / 2cs-pi5
SPI5Pin 8 (GPIO14)Pin 33 (GPIO13)Pin 10 (GPIO15)Pin 32 (GPIO12)Pin 37 (GPIO26)dtoverlay=spi5-1cs / 2cs

SPI1 uses the I2S pins, SPI2 sits on the I2C1 and HAT ID pins, and SPI5 on the UART0 pins, so SPI3 is usually the easiest second bus. RP1 also has an SPI4, but it’s slave-only, so it isn’t listed here. The chip-select pin of each overlay can be moved to another GPIO with its cs0_pin parameter.

There are so many modules that we can interface with the Raspberry Pi 5 using the SPI bus, which include: TFT and e-paper displays, MCP3008 ADCs, MCP2515 CAN controllers, LoRa radios (SX127x), RFID readers (RC522), W5500 Ethernet modules, and much more.


Raspberry Pi 5 PWM Pins

The Raspberry Pi 5 has 4 hardware PWM channels (RP1 PWM0, channels 0–3) on 6 header pins: CH0 on pin 32 (GPIO12), CH1 on pin 33 (GPIO13), CH2 on pin 8 (GPIO14) or pin 12 (GPIO18), and CH3 on pin 10 (GPIO15) or pin 35 (GPIO19). The two pins of CH2 carry the same signal, and so do the two pins of CH3.

Raspberry Pi 5 PWM pins (PWM0 CH0 on pin 32, CH1 on pin 33, CH2 on pins 8 and 12, CH3 on pins 10 and 35)

ChannelHeader Pin(s)Example config.txt Line
PWM0 CH0Pin 32 (GPIO12)dtoverlay=pwm,pin=12,func=4
PWM0 CH1Pin 33 (GPIO13)dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4
PWM0 CH2Pin 8 (GPIO14) or pin 12 (GPIO18)dtoverlay=pwm (default: GPIO18)
PWM0 CH3Pin 10 (GPIO15) or pin 35 (GPIO19)dtoverlay=pwm-2chan (default: GPIO18 + GPIO19)

This is where Pi 4 guides go wrong on a Pi 5. They check for the pwm_bcm2835 driver and for pwmchip0/pwm0, but on the Raspberry Pi 5 GPIO18 is channel 2 of the RP1 PWM, and users report it shows up as pwm2 under a different pwmchip number (rpi_hardware_pwm #10, rppal #141). Check the pin with pinctrl get 18 (it should say PWM0_CHAN2) and find the chip with ls /sys/class/pwm instead of hard-coding it.

Need PWM on another pin? The Pi 5 has a new option: dtoverlay=pwm-pio,gpio=<n> makes PIO-driven hardware PWM on any of GPIO0–27 (up to 4 of them). Plain software PWM from gpiozero also works on any pin; it’s fine for dimming an LED but jitters too much for servos.

Note: GPIO18 and GPIO19 are also the I2S bit clock and frame sync, and many fan and LED HATs use GPIO18. With an I2S DAC, put your PWM on pins 32/33 (GPIO12/13), which have channels of their own.

There are so many things that we can control with the Raspberry Pi 5 PWM pins, which include: LED dimming, DC motor speed (through a driver), servo motors, fan speed, buzzers and tone generation, and much more.


Raspberry Pi 5 PCM / I2S Pins

The Raspberry Pi 5 has one PCM/I2S digital audio interface on the header: pin 12 (GPIO18, PCM_CLK), pin 35 (GPIO19, PCM_FS), pin 38 (GPIO20, PCM_DIN) and pin 40 (GPIO21, PCM_DOUT). It’s what audio DAC HATs, I2S amplifiers and I2S microphones use.

Raspberry Pi 5 PCM I2S and GPCLK pins (PCM on pins 12, 35, 38, 40; GPCLK0 on pins 7 and 38, GPCLK1 on pins 29 and 40, GPCLK2 on pin 31)

SignalPinGPIOI2S Name
PCM_CLK12GPIO18BCLK (bit clock)
PCM_FS35GPIO19LRCLK / WS (word select)
PCM_DIN38GPIO20Data in (microphone, ADC)
PCM_DOUT40GPIO21Data out (DAC, amplifier)

Enable it with dtparam=i2s=on, or better, with the overlay for your DAC (for example dtoverlay=hifiberry-dac), which also loads the right sound driver. The Pi 5 has no 3.5mm audio jack, so an I2S DAC (or HDMI audio) is how you get sound out of it.


Raspberry Pi 5 GPCLK Pins

The Raspberry Pi 5 has 3 general-purpose clock outputs on the header: GPCLK0 on pin 7 (GPIO4) or pin 38 (GPIO20), GPCLK1 on pin 29 (GPIO5) or pin 40 (GPIO21), and GPCLK2 on pin 31 (GPIO6). They output a clock divided down from one of RP1’s internal sources, which is handy as a reference clock for an audio codec, a camera sensor or another chip.

ClockPinAlternative Pin
GPCLK0Pin 7 (GPIO4)Pin 38 (GPIO20)
GPCLK1Pin 29 (GPIO5)Pin 40 (GPIO21)
GPCLK2Pin 31 (GPIO6)–

A device tree overlay for the chip that needs the clock sets them up. Note that WiringPi doesn’t support GPCLK on the Pi 5 (Raspberry Pi’s GPIO white paper says so).


Raspberry Pi 5 HAT ID EEPROM Pins

Pins 27 (ID_SD, GPIO0) and 28 (ID_SC, GPIO1) of the Raspberry Pi 5 are reserved for the HAT ID EEPROM. At boot, the firmware looks for an I2C EEPROM on these pins (I2C0) to identify an attached HAT and set it up automatically.

PinNameGPIOFunction
27ID_SDGPIO0I2C0 SDA to the HAT EEPROM
28ID_SCGPIO1I2C0 SCL to the HAT EEPROM

Leave these pins unconnected unless you’re fitting a HAT EEPROM. They can technically carry UART1 or SPI2, but put those on other pins. If you design your own HAT, follow the official HAT+ specification for the EEPROM.


Raspberry Pi 5 On-Board Connectors & Features

Besides the 40-pin header, the Raspberry Pi 5 adds a few small connectors that older Pis didn’t have. None of them is on a header pin, but you’ll meet all of them when you build a project.

Connector / FeatureWhereWhat It Does
Debug UART (J16)3-pin JST-SH labelled UART, between the micro-HDMI portsThe BCM2712 UART10, /dev/ttyAMA10 = serial0, the boot console at 115200 8N1. Plug in a 3.3v JST-SH serial cable such as the Raspberry Pi Debug Probe.
Fan (J17)4-pin JST-SH labelled FAN, next to the USB 2.0 ports5v fan with PWM speed control (RP1 PWM1 CH3) and a tachometer; the firmware runs it from the CPU temperature (fan_temp0… dtparams).
RTC battery (J5)2-pin JST-SH labelled BAT, next to the USB-C inputKeeps the real-time clock running when the board is unplugged. Use a rechargeable lithium-manganese cell (like the official one), not a Li-ion or a primary cell.
Power buttonOn the short edge, below the PCIe connectorShort press: clean shutdown (on the desktop it shows a menu; press twice to shut down). Press again to start a halted board. Hold to force power-off.
Power button pads (J2)Two pads between the RTC battery connector and the board edgeWire a normally open push button across them for your own case button; it does the same as the on-board button.
PCIe connectorFPC on the short edge, next to header pin 1PCIe 2.0 x1 for an M.2 HAT (NVMe SSD, accelerators). Enable with dtparam=pciex1.
PWR LED (red)Next to the USB-C inputDriven by RP1 GPIO44 (Linux LED “PWR”); active low; you can control it from Linux like any LED.
ACT LED (green)Next to the PWR LED (labelled STAT)Flashes on microSD activity (trigger mmc0); long/short flash patterns at boot are error codes.

RTC battery charging is off by default. The RTC has a 3mA constant-current, constant-voltage charger: enable it with dtparam=rtc_bbat_vchg=3000000 in config.txt, but only for a rechargeable cell. The official RTC docs and power button docs have the details.


Getting Started With Raspberry Pi 5 GPIO

Getting the Raspberry Pi 5’s pins working takes three steps: install the OS, enable the interfaces you need, and pick a GPIO library that supports the Pi 5.

  1. Install Raspberry Pi OS (Bookworm or newer, the first release with Pi 5 support) on a microSD card with Raspberry Pi Imager. The config file for overlays is /boot/firmware/config.txt.
  2. Enable the interfaces: run sudo raspi-config → Interface Options to turn on I2C, SPI and the serial port, or add the dtparam/ dtoverlay lines from the sections above to config.txt, then reboot.
  3. Pick a library: gpiozero for Python, libgpiod for C/C++ (and its Python bindings), and the pinctrl command to check or set a pin from the terminal. Old RPi.GPIO scripts run as they are on Raspberry Pi OS, which provides RPi.GPIO through rpi-lgpio.
Interfaceconfig.txt LineLinux Device / Tool
GPIO– (always on)/dev/gpiochip0 (libgpiod, gpiozero, pinctrl)
UART0 on pins 8/10dtparam=uart0=on/dev/ttyAMA0
UART1–4dtoverlay=uart1-pi5 … uart4-pi5/dev/ttyAMA1–4
Debug UART (J16)– (always on)/dev/ttyAMA10 = /dev/serial0
I2C1dtparam=i2c_arm=on/dev/i2c-1 (i2cdetect -y 1)
I2C0, I2C2, I2C3dtoverlay=i2c0-pi5, i2c2-pi5, i2c3-pi5/dev/i2c-0, /dev/i2c-2, /dev/i2c-3
SPI0dtparam=spi=on/dev/spidev0.0, /dev/spidev0.1
SPI1, 2, 3, 5dtoverlay=spi1-1cs, spi2-1cs-pi5, spi3-1cs-pi5, spi5-1cs/dev/spidevN.0
PWMdtoverlay=pwm-2chan (or pwm-pio)/sys/class/pwm/pwmchipN (check with ls)
1-Wiredtoverlay=w1-gpio/sys/bus/w1/devices/
I2Sdtparam=i2s=on or a DAC overlayALSA sound card (aplay -l)

Raspberry Pi 5 Common Problems & Fixes

Why does RPi.GPIO say “Cannot determine SOC peripheral base address”? That’s the original RPi.GPIO, which writes the Broadcom GPIO registers directly, while the Raspberry Pi 5’s header GPIOs are on RP1. If you see it on Raspberry Pi OS, check whether a pip or virtual-environment install pulled in the original package instead of the rpi-lgpio version the OS provides as RPi.GPIO ( pip show RPi.GPIO), or move to gpiozero, lgpio or libgpiod. Older HAT libraries that bundle the original RPi.GPIO fail the same way until they’re updated.

Why do I get “Invalid argument” when I export GPIO17 through sysfs? On kernel 6.6+, the Raspberry Pi 5’s sysfs numbers start at 571, so GPIO17 is 588. Check the real numbers in /sys/kernel/debug/gpio, but better, move to libgpiod, gpiozero or pinctrl, which all use the BCM number.

My code opens gpiochip4 and it fails (or works on one Pi and not another). The header GPIOs moved from gpiochip4 to gpiochip0 in 2024. Raspberry Pi OS keeps a gpiochip4 symlink, but other distributions may not. Open the chip by its label, pinctrl-rp1, or use gpiozero.

Why doesn’t serial work on pins 8/10? /dev/serial0 is the J16 debug UART on the Pi 5. Turn on UART0 with dtparam=uart0=on and open /dev/ttyAMA0, or move the console with dtparam=uart0_console. Also check the wiring is crossed and the adapter is 3.3v.

Why can’t I find hardware PWM on GPIO18? Pi 4 instructions look for pwmchip0/pwm0. On the Pi 5, GPIO18 is RP1 PWM0 channel 2, under whichever pwmchip number the kernel gives it. Load the overlay, run pinctrl get 18, then ls /sys/class/pwm and export channel 2.

My HAT powers the Pi through the 5v pins and USB devices disconnect. Why? Without USB-C Power Delivery, the Pi 5 limits the USB ports to 600mA. If the HAT can supply 5A, add usb_max_current_enable=1 to config.txt.

A pin stays high after my gpioset script exits. Is that a bug? No, Raspberry Pi’s kernel keeps the last value on purpose. Add dtparam=strict_gpiod to config.txt if you want released lines to go back to inputs.


Raspberry Pi 5 vs Raspberry Pi 4 and 3B

All three boards share the same 40-pin header layout, so most HATs and wiring carry over. What changes is what’s behind the pins: the Raspberry Pi 5 moved the GPIOs to its own RP1 chip, which brings more PWM channels and a new set of overlays, but also breaks the old register-level libraries.

FeatureRaspberry Pi 5Raspberry Pi 4 Model BRaspberry Pi 3 Model B
SoC / CPUBCM2712, 4x Cortex-A76 @ 2.4GHzBCM2711, 4x Cortex-A72 @ 1.8GHzBCM2837, 4x Cortex-A53 @ 1.2GHz
RAM1GB–16GB LPDDR4X1GB–8GB LPDDR41GB LPDDR2
GPIO controllerRP1 I/O chipSoCSoC
UART / I2C / SPI on the header5 / 4 / 56 / 6 / 62 / 2 / 2
Hardware PWM channels4 (6 pins)2 (4 pins)2 (4 pins)
Linux sysfs GPIO base (kernel 6.6+)571512512
RPi.GPIOYes, through rpi-lgpio (the original: no)YesYes
pigpioNoYesYes
serial0Debug UART (J16)Pins 8/10Pins 8/10
USB2x USB 3.0 + 2x USB 2.02x USB 3.0 + 2x USB 2.04x USB 2.0
ExtrasPower button, RTC, fan header, PCIePoE header–
Power input5v / 5A USB-C (Power Delivery)5v / 3A USB-C5v / 2.5A micro-USB

Pick the Raspberry Pi 5 for speed, PCIe storage and the extra PWM channels, as long as your libraries support it (gpiozero and libgpiod do). Pick the Raspberry Pi 4 when you depend on pigpio or a HAT whose software hasn’t caught up, or when the 5A supply is a problem. The 3B only makes sense for light jobs and existing projects.


Raspberry Pi 5 Pin Details

Here is every pin of the Raspberry Pi 5 40-pin header in physical order, with all four numbers, the functions you can enable in Raspberry Pi OS, and every RP1 alternate function (RP1 Peripherals Table 4; a5–a7 are RIO and PIO on every pin). Pin 1 is the square pad at the end next to the PCIe connector; odd pins are on the inner row and even pins on the board edge.

Click to expand the full pin table (40 pins)
PinNameBCMLinux #wPiMain Functions (Pi OS)All RP1 Alternate FunctionsDescription
13V3–––3.3v power–3.3v output from the board’s own 3.3v rail; feed sensors and modules from it, never a supply into it.
25V–––5v power–The board’s 5v rail: a 5v output for modules, or a 5v input from a HAT or regulated supply.
3GPIO225738I2C1 SDA, SPI2 MOSI, UART1 CTSa0: SPI0_CSn3, a1: DPI_VSYNC, a2: UART1_CTS, a3: I2C1_SDA, a4: UART0_IR_RX, a8: SPI2_SIO0The main I2C data line (/dev/i2c-1), with a fixed 1.8kΩ pull-up to 3.3v on the board.
45V–––5v power–Second 5v pin, the same rail as pin 2.
5GPIO335749I2C1 SCL, SPI2 SCLK, UART1 RTSa0: SPI0_CSn2, a1: DPI_HSYNC, a2: UART1_RTS, a3: I2C1_SCL, a4: UART0_IR_TX, a8: SPI2_SCLKThe main I2C clock line, with a fixed 1.8kΩ pull-up to 3.3v on the board.
6GND–––Ground–Ground.
7GPIO445757GPCLK0, UART2 TX, I2C2 SDA, SPI3 CE0a0: GPCLK0, a1: DPI_D0, a2: UART2_TX, a3: I2C2_SDA, a4: UART0_RI, a8: SPI3_CSn0General-purpose pin; GPCLK0 clock output and the default pwm-pio and 1-Wire pin.
8GPIO141458515UART0 TX, PWM0 CH2, UART4 CTS, SPI5 MOSI, I2C3 SDAa0: PWM0_2, a1: DPI_D10, a2: UART4_CTS, a3: I2C3_SDA, a4: UART0_TX, a8: SPI5_SIO0UART0 transmit (/dev/ttyAMA0); not serial0 on the Pi 5, which is the debug UART.
9GND–––Ground–Ground.
10GPIO151558616UART0 RX, PWM0 CH3, UART4 RTS, SPI5 SCLK, I2C3 SCLa0: PWM0_3, a1: DPI_D11, a2: UART4_RTS, a3: I2C3_SCL, a4: UART0_RX, a8: SPI5_SCLKUART0 receive, paired with pin 8; 3.3v levels only.
11GPIO17175880UART0 RTS, SPI1 CE1a0: SPI1_CSn1, a1: DPI_D13, a2: DSI1_TE, a4: UART0_RTSFree general-purpose pin; also UART0 RTS and SPI1 chip select 1.
12GPIO18185891PWM0 CH2, PCM CLK, SPI1 CE0a0: SPI1_CSn0, a1: DPI_D14, a2: I2S0_SCLK, a3: PWM0_2, a4: I2S1_SCLK, a8: GPCLK1Hardware PWM channel 2 (shared with pin 8) and the I2S bit clock.
13GPIO27275982GPIO onlya0: SDIO0_DAT3, a1: DPI_D23, a2: I2S0_SDO3, a3: AUDIO_IN_DAT1, a4: I2S1_SDO3, a8: SPI1_CSn1Free general-purpose pin with no default bus.
14GND–––Ground–Ground.
15GPIO22225933I2C3 SDAa0: SDIO0_CLK, a1: DPI_D18, a2: I2S0_SDI1, a3: I2C3_SDA, a4: I2S1_SDI1Free general-purpose pin; optional I2C3 data pin (pins_22_23).
16GPIO23235944I2C3 SCLa0: SDIO0_CMD, a1: DPI_D19, a2: I2S0_SDO1, a3: I2C3_SCL, a4: I2S1_SDO1Free general-purpose pin; optional I2C3 clock pin.
173V3–––3.3v power–Second 3.3v output, the same rail as pin 1.
18GPIO24245955SPI2 CE1a0: SDIO0_DAT0, a1: DPI_D20, a2: I2S0_SDI2, a4: I2S1_SDI2, a8: SPI2_CSn1Free general-purpose pin; SPI2 chip select 1.
19GPIO101058112SPI0 MOSI, UART3 CTS, I2C1 SDAa0: SPI0_SIO0, a1: DPI_D6, a2: UART3_CTS, a3: I2C1_SDA, a8: SPI4_SIO1SPI0 data out (MOSI) when dtparam=spi=on.
20GND–––Ground–Ground.
21GPIO9958013SPI0 MISO, UART3 RX, I2C0 SCLa0: SPI0_SIO1, a1: DPI_D5, a2: UART3_RX, a3: I2C0_SCL, a8: SPI4_SIO0SPI0 data in (MISO).
22GPIO25255966SPI3 CE1a0: SDIO0_DAT1, a1: DPI_D21, a2: I2S0_SDO2, a3: AUDIO_IN_CLK, a4: I2S1_SDO2, a8: SPI3_CSn1Free general-purpose pin; SPI3 chip select 1.
23GPIO111158214SPI0 SCLK, UART3 RTS, I2C1 SCLa0: SPI0_SCLK, a1: DPI_D7, a2: UART3_RTS, a3: I2C1_SCL, a8: SPI4_SCLKSPI0 clock.
24GPIO8857910SPI0 CE0, UART3 TX, I2C0 SDAa0: SPI0_CSn0, a1: DPI_D4, a2: UART3_TX, a3: I2C0_SDA, a8: SPI4_CSn0SPI0 chip select 0 (/dev/spidev0.0).
25GND–––Ground–Ground.
26GPIO7757811SPI0 CE1, SPI3 SCLK, UART2 RTS, I2C3 SCLa0: SPI0_CSn1, a1: DPI_D3, a2: UART2_RTS, a3: I2C3_SCL, a4: UART0_DSR, a8: SPI3_SCLKSPI0 chip select 1 (/dev/spidev0.1).
27ID_SD (GPIO0)057130HAT ID EEPROM SDA (I2C0), UART1 TX, SPI2 CE0a0: SPI0_SIO3, a1: DPI_PCLK, a2: UART1_TX, a3: I2C0_SDA, a8: SPI2_CSn0Reserved for the HAT ID EEPROM; leave it unconnected unless it’s a HAT EEPROM.
28ID_SC (GPIO1)157231HAT ID EEPROM SCL (I2C0), UART1 RX, SPI2 MISOa0: SPI0_SIO2, a1: DPI_DE, a2: UART1_RX, a3: I2C0_SCL, a8: SPI2_SIO1Reserved for the HAT ID EEPROM clock, like pin 27.
29GPIO5557621GPCLK1, UART2 RX, I2C2 SCL, SPI3 MISOa0: GPCLK1, a1: DPI_D1, a2: UART2_RX, a3: I2C2_SCL, a4: UART0_DTR, a8: SPI3_SIO1General-purpose pin; GPCLK1 clock output.
30GND–––Ground–Ground.
31GPIO6657722GPCLK2, UART2 CTS, I2C3 SDA, SPI3 MOSIa0: GPCLK2, a1: DPI_D2, a2: UART2_CTS, a3: I2C3_SDA, a4: UART0_DCD, a8: SPI3_SIO0General-purpose pin; GPCLK2 clock output.
32GPIO121258326PWM0 CH0, UART4 TX, I2C2 SDA, SPI5 CE0a0: PWM0_0, a1: DPI_D8, a2: UART4_TX, a3: I2C2_SDA, a4: AUDIO_OUT_L, a8: SPI5_CSn0Hardware PWM channel 0, the only header pin on that channel.
33GPIO131358423PWM0 CH1, UART4 RX, I2C2 SCL, SPI5 MISOa0: PWM0_1, a1: DPI_D9, a2: UART4_RX, a3: I2C2_SCL, a4: AUDIO_OUT_R, a8: SPI5_SIO1Hardware PWM channel 1, the only header pin on that channel.
34GND–––Ground–Ground.
35GPIO191959024PWM0 CH3, PCM FS, SPI1 MISOa0: SPI1_SIO1, a1: DPI_D15, a2: I2S0_WS, a3: PWM0_3, a4: I2S1_WSHardware PWM channel 3 (shared with pin 10) and the I2S frame sync.
36GPIO161658727UART0 CTS, SPI1 CE2a0: SPI1_CSn2, a1: DPI_D12, a2: DSI0_TE, a4: UART0_CTSFree general-purpose pin; UART0 CTS and SPI1 chip select 2.
37GPIO262659725SPI5 CE1a0: SDIO0_DAT2, a1: DPI_D22, a2: I2S0_SDI3, a3: AUDIO_IN_DAT0, a4: I2S1_SDI3, a8: SPI5_CSn1Free general-purpose pin; SPI5 chip select 1.
38GPIO202059128PCM DIN, SPI1 MOSI, GPCLK0a0: SPI1_SIO0, a1: DPI_D16, a2: I2S0_SDI0, a3: GPCLK0, a4: I2S1_SDI0I2S data in.
39GND–––Ground–Ground.
40GPIO212159229PCM DOUT, SPI1 SCLK, GPCLK1a0: SPI1_SCLK, a1: DPI_D17, a2: I2S0_SDO0, a3: GPCLK1, a4: I2S1_SDO0I2S data out.

Wrap Up

To conclude this guide article, the Raspberry Pi 5 is a very solid single-board computer for hardware projects: 28 GPIOs, five UARTs, four I2C buses, five SPI buses, and four hardware PWM channels on one header, with a fast Linux system behind them. Just remember what’s new: the pins belong to RP1, so pigpio and the original RPi.GPIO are out (Raspberry Pi OS ships rpi-lgpio as RPi.GPIO); serial0 is the debug connector, not pins 8/10; the sysfs numbers start at 571; and every pin is still 3.3v only.

I hope you’ve found this guide helpful for you to decide which pins to use for your project. For more boards, check out the Pinouts, Datasheets & Schematic Diagrams Library.

Share This Page With Your Network!
Join Our +25,000 Newsletter Subscribers!

Stay Updated With All New Content Releases. You Also Get Occasional FREE Coupon Codes For Courses & Other Stuff!

Photo of author
Author
Embedded systems engineer with several years of experience in embedded software and hardware design. I work as an embedded SW engineer in the Automotive & e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI/ML, and other fields I'm passionate about.
I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?

Leave a Comment