What is the GPIO pinout of Raspberry Pi?

ampheoampheo
2 min read

The GPIO pinout of a Raspberry Pi refers to the layout of the 40-pin GPIO (General Purpose Input/Output) header available on most Raspberry Pi models (e.g., Pi 3, Pi 4, Pi 5). These pins are used to interface with sensors, modules, and other hardware.


Raspberry Pi 40-Pin GPIO Header Pinout

Here's a simplified view of the 40-pin layout:

mathematica

Pin | Name       | Function               | Pin | Name       | Function
----+------------+------------------------+-----+------------+---------------------
  1 | 3.3V       | Power                  |  2  | 5V         | Power
  3 | GPIO2      | SDA (I2C)              |  4  | 5V         | Power
  5 | GPIO3      | SCL (I2C)              |  6  | GND        | Ground
  7 | GPIO4      | General I/O            |  8  | GPIO14     | UART TX
  9 | GND        | Ground                 | 10  | GPIO15     | UART RX
 11 | GPIO17     | General I/O            | 12  | GPIO18     | PWM / General I/O
 13 | GPIO27     | General I/O            | 14  | GND        | Ground
 15 | GPIO22     | General I/O            | 16  | GPIO23     | General I/O
 17 | 3.3V       | Power                  | 18  | GPIO24     | General I/O
 19 | GPIO10     | SPI MOSI               | 20  | GND        | Ground
 21 | GPIO9      | SPI MISO               | 22  | GPIO25     | General I/O
 23 | GPIO11     | SPI SCLK               | 24  | GPIO8      | SPI CE0
 25 | GND        | Ground                 | 26  | GPIO7      | SPI CE1
 27 | GPIO0      | ID_SD (EEPROM)         | 28  | GPIO1      | ID_SC (EEPROM)
 29 | GPIO5      | General I/O            | 30  | GND        | Ground
 31 | GPIO6      | General I/O            | 32  | GPIO12     | PWM / General I/O
 33 | GPIO13     | PWM / General I/O      | 34  | GND        | Ground
 35 | GPIO19     | SPI / PWM              | 36  | GPIO16     | General I/O
 37 | GPIO26     | General I/O            | 38  | GPIO20     | General I/O
 39 | GND        | Ground                 | 40  | GPIO21     | General I/O

GPIO Functional Categories

  • Power Pins: 3.3V (Pin 1, 17), 5V (Pin 2, 4)

  • Ground (GND): Multiple pins (6, 9, 14, 20, 25, 30, 34, 39)

  • General-Purpose I/O: GPIO2–GPIO27, GPIO0–GPIO21 (depending on model)

  • Special Functions:

    • I2C: GPIO2 (SDA), GPIO3 (SCL)

    • UART: GPIO14 (TX), GPIO15 (RX)

    • SPI: GPIO10 (MOSI), GPIO9 (MISO), GPIO11 (SCLK), GPIO8/7 (CE0/1)

    • PWM: GPIO12, 13, 18, 19


Notes

  • The BCM numbering (Broadcom SoC GPIO numbers) is used in Python libraries like RPi.GPIO and gpiozero.

  • Some GPIOs are reserved or have special startup states, so always check before using.

0
Subscribe to my newsletter

Read articles from ampheo directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

ampheo
ampheo