RETIRED - Raspberry gPIo

This Tutorial is Retired!

This tutorial covers concepts or technologies that are no longer current. It's still here for you to read and enjoy, but may not be as useful as our newest tutorials.

View the updated tutorial: Raspberry gPIo

Pages
Contributors: jimblom
Favorited Favorite 2

GPIO Pinout

The majority of I/O pins on the Raspberry Pi exist on the 26-pin header labeled "P1". It's over in the corner of the board, adjacent to the composite video connector.

Raspberry Pi P1 location

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:

Broadcom PinFunctionP1 PinP1 PinFunctionBroadcom Pin
3.3V1 25V
2SDA3 45V
3SCL5 6GND
47 8TX14
GND9 10RX15
1711 12PWM18
2713 14GND
2215 1623
3.3V17 1824
10MOSI19 20GND
9MISO21 2225
11SCLK23 24CE08
GND25 26CE17


Legend:5V3.3VGNDI2CSPIPWM


Note: The Broadcom pin numbers above relate to Rev2 of the Raspberry Pi only. If you have an older Rev1 Pi, check out this link for your Broadcom pin numbers.

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