Raspberry Pi 40-pin header Pinout

1 3V3 power 3 GPIO 2 (SDA) 5 GPIO 3 (SCL) 7 GPIO 4 (GPCLK0) 9 Ground 11 GPIO 17 13 GPIO 27 15 GPIO 22 17 3V3 power 19 GPIO 10 (MOSI) 21 GPIO 9 (MISO) 23 GPIO 11 (SCLK) 25 Ground 27 GPIO 0 (ID_SD) 29 GPIO 5 31 GPIO 6 33 GPIO 13 (PWM1) 35 GPIO 19 (PCM_FS) 37 GPIO 26 39 Ground 2 5V power 4 5V power 6 Ground 8 GPIO 14 (TXD) 10 GPIO 15 (RXD) 12 GPIO 18 (PCM_CLK) 14 Ground 16 GPIO 23 18 GPIO 24 20 Ground 22 GPIO 25 24 GPIO 8(CE0) 26 GPIO 7(CE1) 28 GPIO 1(ID_SC) 30 Ground 32 GPIO 12 (PWM0) 34 Ground 36 GPIO 16 38 GPIO 20(PCM_DIN) 40 GPIO 21 (PCM_DOUT)

Voltages

Two 5V pins and two 3.3V pins are present on the board, as well as a number of ground pins (GND), which can not be reconfigured. The remaining pins are all general-purpose 3.3V pins, meaning outputs are set to 3.3V and inputs are 3.3V-tolerant.

Outputs

A GPIO pin designated as an output pin can be set to high (3.3V) or low (0V).

Inputs

A GPIO pin designated as an input pin can be read as high (3.3V) or low (0V). This is made easier with the use of internal pull-up or pull-down resistors. Pins GPIO2 and GPIO3 have fixed pull-up resistors, but for other pins this can be configured in software.

PWM (pulse-width modulation)

- Software PWM available on all pins

- Hardware PWM available on GPIO12, GPIO13, GPIO18, GPIO19

SPI

- SPI0: MOSI (GPIO10); MISO (GPIO9); SCLK (GPIO11); CE0 (GPIO8), CE1 (GPIO7)

- SPI1: MOSI (GPIO20); MISO (GPIO19); SCLK (GPIO21); CE0 (GPIO18); CE1 (GPIO17); CE2 (GPIO16)

I2C

- Data: (GPIO2); Clock (GPIO3)

- EEPROM Data: (GPIO0); EEPROM Clock (GPIO1)

Serial

- TX (GPIO14); RX (GPIO15)

Documentation

Color Legend

Raspberry Pi GPIO Usage Tips

  1. Always check the voltage requirements of your components. Raspberry Pi GPIO pins operate at 3.3V.
  2. Use a level shifter when connecting to 5V devices to prevent damage to your Pi.
  3. Ground pins are interchangeable - any GND pin will work for your circuit.
  4. For heavy power requirements, use the 5V pins, but be careful not to draw too much current.
  5. When working with sensitive components, consider using a GPIO protection board.
  6. For I2C communication, remember that GPIO 2 and 3 have built-in pull-up resistors.
  7. Always shut down your Pi properly before disconnecting power.