Pin Information

Lyza Gardner edited this page Jul 7, 2016 · 9 revisions

The pins on the Raspberry Pi are a little complicated. There are multiple headers on some Raspberry Pis with extra pins, and the pin numbers are not consistent between Raspberry Pi board versions.

To help make it easier, you can specify pins in any of the following three ways:

  1. By function, e.g. 'GPIO18'
  2. By physical Pi pin number, e.g. 'P1-7'. The format is 'P[header]-[pin]'
  3. By WiringPi virtual pin number, e.g. 7

Note: If you specify a Number instead of a string, it is assumed to be a WiringPi number.

Note: Each pin is given a peripheral name, and is one of a few possibilities:

Name Peripheral Description
GPIOx GPIO General Purpose IO port x
PWMx PWM Pulse Width Modulator port x
TXDx UART Serial port x transmit pin
RXDx UART Serial port x receive pin
SDAx I2C Inter-Integrated Circuit port x data pin
SCLx I2C Inter-Integrated Circuit port x clock pin
MOSIx SPI Serial Peripheral Interface port x Master Out/Slave In pin
MISOx SPI Serial Peripheral Interface port x Master In/Slave Out pin
SCLKx SPI Serial Peripheral Interface port x Clock pin
CEx SPI Serial Peripheral Interface port x Chip Enable pin

Here is a table of the pin mappings on all of the support Raspberry Pi boards.

Model B Rev 1

P1 Header

Physical Pin Wiring Pi Pin Peripherals | Peripherals Wiring Pi Pin Physical Pin
P1-1 3.3V | 5V P1-2
P1-3 SDA0 | 5V P1-4
P1-5 SCL0 | GND P1-6
P1-7 7 GPIO4 | GPIO14/TXD0 15 P1-8
P1-9 GND | GPIO15/RXD0 16 P1-10
P1-11 0 GPIO17 | GPIO18/PWM0 1 P1-12
P1-13 2 GPIO21 | GND P1-14
P1-15 3 GPIO22 | GPIO23 4 P1-16
P1-17 3.3V | GPIO24 5 P1-18
P1-19 12 GPIO10/MOSI0 | GND P1-20
P1-21 13 GPIO9/MISO0 | GPIO25 6 P1-22
P1-23 14 GPIO11/SCLK0 | GPIO8/CE0 10 P1-24
P1-25 GND | GPIO7 11 P1-26

Model B Rev 2

P1 Header

Physical Pin Wiring Pi Pin Peripherals | Peripherals Wiring Pi Pin Physical Pin
P1-1 3.3V | 5V P1-2
P1-3 SDA0 | 5V P1-4
P1-5 SCL0 | GND P1-6
P1-7 7 GPIO4 | GPIO14/TXD0 15 P1-8
P1-9 GND | GPIO15/RXD0 16 P1-10
P1-11 0 GPIO17 | GPIO18/PWM0 1 P1-12
P1-13 2 GPIO27 | GND P1-14
P1-15 3 GPIO22 | GPIO23 4 P1-16
P1-17 3.3V | GPIO24 5 P1-18
P1-19 12 GPIO10/MOSI0 | GND P1-20
P1-21 13 GPIO9/MISO0 | GPIO25 6 P1-22
P1-23 14 GPIO11/SCLK0 | GPIO8/CE0 10 P1-24
P1-25 GND | GPIO7 11 P1-26

P5 Header

Physical Pin Wiring Pi Pin Peripherals | Peripherals Wiring Pi Pin Physical Pin
P5-1 5V | 3.3V P5-2
P5-3 17 GPIO28 | GPIO29 18 P5-4
P5-5 19 GPIO30 | GPIO31 20 P5-6
P5-7 GND | GND P5-8

Model A+/B+/Raspberry Pi 2/Raspberry Pi 3/Raspberry Pi Zero

P1 Header

Physical Pin Wiring Pi Pin Peripherals | Peripherals Wiring Pi Pin Physical Pin
P1-1 3.3V | 5V P1-2
P1-3 SDA0 | 5V P1-4
P1-5 SCL0 | GND P1-6
P1-7 7 GPIO4 | GPIO14/TXD0 15 P1-8
P1-9 GND | GPIO15/RXD0 16 P1-10
P1-11 0 GPIO17 | GPIO18/PWM0 1 P1-12
P1-13 2 GPIO27 | GND P1-14
P1-15 3 GPIO22 | GPIO23 4 P1-16
P1-17 3.3V | GPIO24 5 P1-18
P1-19 12 GPIO10/MOSI0 | GND P1-20
P1-21 13 GPIO9/MISO0 | GPIO25 6 P1-22
P1-23 14 GPIO11/SCLK0 | GPIO8/CE0 10 P1-24
P1-25 GND | GPIO7/CE1 11 P1-26
P1-27 Do Not Connect | Do Not Connect P1-28
P1-29 21 GPIO5 | GND P1-30
P1-31 22 GPIO6 | GPIO12/PWM0 26 P1-32
P1-33 23 GPIO13/PWM1 | GND P1-34
P1-35 24 GPIO19/MISO1/PWM1 | GPIO16 27 P1-36
P1-37 25 GPIO26 | GPIO20/MOSI1 28 P1-38
P1-39 GND | GPIO21/SCLK1 29 P1-40
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.