Raspberry Pi GPIO Pinout: What Each Pin Does on Pi 4, Earlier Models

The best thing about any Raspberry Pi, including the Raspberry Pi 4, is that you can use it to build all kinds of awesome contraptions, from robots to retro gaming consoles and fart detectors. Most of the sensors, motors, lights and other peripherals that make these projects possible connect to the Pi's set of GPIO (General Purpose Input Output) pins. These pins offer a direct connection to the System on Chip (SoC) at the heart of the Pi, enabling the Pi to communicate with external components and addons known as HATs (Hardware Attached on Top). Every Pi model since the Raspberry Pi B+ in 2014 has had 40 GPIO pins, though on the Pi Zero and Zero  2 W, you have 40 holes that you can solder pins or wires into. If you haven't got a soldering iron, fear not, we have a list of the best soldering irons for you to choose from.

This guide has been updated to reflect the new capabilities of the Raspberry Pi 4, which still comes with 40 GPIO pins, but has a few extra I2C, SPI and UART connections available.

Les Pounder
Associate Editor

Les Pounder is an associate editor at Tom's Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program "Picademy".

  • DotNetMaster777
    Very nice and useful article !!
    Reply
  • MatsK
    It has a serious error.

    The operating voltage of the GPIO pins is 3.3v with a maximum current draw of 16mA. This means that we can safely power one or two LEDs (Light Emitting Diodes) from a single GPIO pin, via a resistor.
    The typical values for a 3 or 5mm LED is 1,8-3volt and 20mA depending on color and just one LED is over the maximum for the GPIO. So the statement in the article could potentially burn the GPIO pin!

    Please correct the article.
    Reply
  • seamusdemora
    SCL4 (I2C clock) appears on two different pins:
    pin 26 (GPIO 7)
    pin 21 (GPIO 9)

    There are other errors - are you confused - or is it me??
    Reply
  • chmedly
    MatsK said:
    It has a serious error.

    The operating voltage of the GPIO pins is 3.3v with a maximum current draw of 16mA. This means that we can safely power one or two LEDs (Light Emitting Diodes) from a single GPIO pin, via a resistor.
    The typical values for a 3 or 5mm LED is 1,8-3volt and 20mA depending on color and just one LED is over the maximum for the GPIO. So the statement in the article could potentially burn the GPIO pin!

    Please correct the article.

    Any circuit that drives an LED is going to have some form of current limiting. In most micro controller (and raspberry pi) schematics you'll see a resistor in series with the LED. This is the resistor mentioned in the article. This resistor controls the amount of current that will flow in the circuit.
    As you've stated, many LED spec sheets mention 20mA as the typical current. But most LEDs will still light up with far less current, just not as brightly. If you are using the LED as an indicator with an RPI I would expect that you could drive them with as little as 3-5mA and get suitable brightness. Considering the 3.3v GPIO output of a pi and a typical red LED, I would suggest a 330 Ohm resistor which will limit the current to well below the maximum capacity of the RPI.
    Reply