Raspberry gPIo

Pages
Contributors: jimblom, MTaylor
Favorited Favorite 19

GPIO Pinout

The Raspberry Pi offers up its GPIO over a standard male header on the board. Over the years the header has expanded from 26 pins to 40 pins while maintaining the original pinout.

Old and New Pi Model Pinouts

Header configuration for early and late model Pi computers

If you're coming to the Raspberry Pi as an Arduino user, you're probably used to referencing pins with a single, unique number. Programming the Pi's hardware works much the same, each pin has its own number...and then some.

There are (at least) two, different numbering schemes you may encounter when referencing Pi pin numbers: (1) Broadcom chip-specific pin numbers and (2) P1 physical pin numbers. You're usually free to use either number-system, but many programs require that you declare which scheme you're using at the very beginning of your program.

Here's a table showing all 26 pins on the P1 header, including any special function they may have, and their dual numbers:

Pi 2+ GPIO Header

Element14 pin description, annotated


Wedge Silk Python (BCM) WiringPi GPIO Name P1 Pin Number Name WiringPi GPIO Python (BCM) Wedge Silk



3.3v DC Power 1 2 5v DC Power


SDA
8 GPIO02 (SDA1, I2C) 3 4 5v DC Power


SCL
9 GPIO03 (SCL1, I2C) 5 6 Ground


G4 4 7 GPIO04 (GPIO_GCLK) 7 8 GPIO14 (TXD0) 15
TXO



Ground 9 10 GPIO15 (RXD0) 16
RXI
G17 17 0 GPIO17 (GPIO_GEN0) 11 12 GPIO18 (GPIO_GEN1) 1 18 G18
G27 27 2 GPIO27 (GPIO_GEN2) 13 14 Ground


G22 22 3 GPIO22 (GPIO_GEN3) 15 16 GPIO23 (GPIO_GEN4) 4 23 G23



3.3v DC Power 17 18 GPIO24 (GPIO_GEN5) 5 24 G24
MOSI
12 GPIO10 (SPI_MOSI) 19 20 Ground


MISO
13 GPIO09 (SPI_MISO) 21 22 GPIO25 (GPIO_GEN6) 6 25 G25
CLK
(no worky 14) GPIO11 (SPI_CLK) 23 24 GPIO08 (SPI_CE0_N) 10
CD0



Ground 25 26 GPIO07 (SPI_CE1_N) 11
CE1
IDSD
30 ID_SD (I2C ID EEPROM) 27 28 ID_SC (I2C ID EEPROM) 31
IDSC
G05 5 21 GPIO05 29 30 Ground


G6 6 22 GPIO06 31 32 GPIO12 26 12 G12
G13 13 23 GPIO13 33 34 Ground


G19 19 24 GPIO19 35 36 GPIO16 27 16 G16
G26 26 25 GPIO26 37 38 GPIO20 28 20 G20



Ground 39 40 GPIO21 29 21 G21

This table shows the Pi pin header numbers, element14 given names, wiringPi numbers, Python numbers, and related silkscreen on the wedge.

As you can see, the Pi not only gives you access to the bi-directional I/O pins, but also Serial (UART), I2C, SPI, and even some PWM ("analog output").