A Comprehensive Guide on Raspberry Pi 3 and Raspberry Pi Zero and Zero W GPIO pinout

GPIO or General-Purpose Input/Output is a generic pin that is controllable by a user in execution time. You can program these pins to interact to the real world – from lighting an LED on/off to controlling microcontrollers like the Arduino. In short, GPIO enables you to do physical computing. Raspberry Pi single board computers have their own set of GPIO headers but we are going to focus on the 40-pin connector of the newer models – Raspberry Pi 3 and Raspberry Pi Zero/Zero W.

Let’s start by looking at the figure on the left. You can see that the pins were color coded.

These pins when used together with other peripheral devices like servos, relays, sensors etc. makes a powerful tool for controlling the outside world and will help you become the “MASTER” of physical computing, like turning on/off that lamp a few feet away from you.


POWER Pins pull power directly from the Raspberry Pi. You can use them to power other devices connected to your Raspberry Pi.

To put it out there, the 5V pins (Pins 2 and 4) are directly connected to the 5V0 rail (power supply) 1. This means that you can, in theory, power the raspberry pi via one of these pins. But of course that’s all in theory where everything is round, and frictionless, and pV = nRT etc., powering the raspberry pi here also means that your raspberry pi is subject to no protection from voltage and current surges. If you are really that desperate to power you raspberry pi here, try reading this tutorial on making a full on power switch via the GPIO.


GROUND are the pins you use to ground your devices. It doesn’t matter which pin you use as they are all connected to the same line.


GPIO Pins (General Purpose Input/Output) are your standard pins that are used to turn devices on and off. Think of them as switches that you can program when to turn on and turn off depending on your set conditions. They can also be used as buttons if you program them to “signal” you when they are shorted to ground. You can do these things via the RPi.GPIO or GPIOZero modules in Python.

We recommend the GPIOZero for its simplicity and zero boilerplate philosophy – which means you can focus on the logic of your programs rather than on those lines of code you don’t need to understand anyway. GPIOZero also made programming buttons and LEDs easier to implement since all the boilerplate codes were already taken cared of by this magnificent module. In addition to that, they also have a very good documentation.


Of course when talking about physical computing you can’t leave out sensors and microcontrollers. If your set up is a body, your Raspberry Pi is the brain (“master”) and these peripherals like sensors and microcontrollers (“slaves”) are your eyes, nose, skin, arms, feet etc. There’s a lot of things that you can do with your Raspberry Pi alone, but sometimes you need special devices that can detect temperature, pressure, and maybe some microcontrollers. The following pins are your Raspberry Pi’s interfaces to these devices so you can communicate with them.


Let’s start with the classic UART or Universal Asynchronous Receiver/Transmitter. Serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus.

In Raspbian, the UART is by default used as connection for Raspbian’s terminal. This is particularly useful if you want to access your Raspberry Pi’s terminal in a PC but you can’t connect via SSH (e.g. you don’t have network/internet connection). You can follow this tutorial to access your Raspberry Pi’s terminal using your pc. Of course the UART is not limited to this application, for example, you can use these pins to connect to a network by plugging it in a PC connected to the internet.

The default baud rate (bits per second) of the Raspberry Pi is 115200. That means the UART can pass data 115200 bits per second or for all of you math geniuses out there it’s 115.2 kbps. It might be a little slow, but it’s fast enough for most of your projects. You can try to overclock (which means editing the maximum baud rate) this limitation but it may lead to poor data integrity. Also, you can only control one UART device when using the Raspberry Pi’s GPIO header. You need 1 connnection for transmitting and 1 connection for receiving data which has a total of 2 connections for each device. Pin 8 is for transmitting while Pin 10 is for receiving data. Since the Raspberry Pi has only this two pair it means you can only control 1 UART device. Shift to the SPI or I2C enabled devices if you need more.

SPI Pins

SPI or Serial Peripheral Interface is another interface that allows multiple control of slaves as long as you have multiple chip select connections. With respect to Raspberry Pi’s GPIO header – by “multiple”, I mean two. The minimum number of connections needed for a single SPI device is four – 3 connections for the transferring, receiving, and synchronizing data, and 1 connection for identification when controlling multiple devices. This single connection is called the Chip Select and Raspberry Pi has currently 2 Chip Select pins, pins 24 and 26. That means you can only use at max 2 SPI devices at the same time using your Raspberry Pi.

In terms of speed, the SPI has the fastest speed compared with the other two interfaces (UART and I2C) in exchange for some extra wires. Again, it all depends on what device and purpose you want to install with your Raspberry Pi.

I2C Pins

I2C or Inter-Integrated Circuit allows for multi-slave control using your Raspberry Pi. It only uses 2 connections, (pins 3 and 5 in Raspberry Pi 3) to control multiple slaves. You may prematurely say, “hey, this is the best choice to control multiple slaves so I should buy peripherals that uses I2C!“. However, it is only good for lower-speed peripherals so if you need a faster communication between your Raspberry Pi 3 and your chosen sensor, you may want to use the SPI enabled peripherals instead.

It is also appropriate to note that when the Raspberry Pi 3 is in halt or shutdown mode, you can “wake” it up by shorting pin 5 to ground.


These pins are reserved for I2C communication with an EEPROM (electrically erasable programmable read-only memory) which means you can not use them. From the raspberry pi stack exchange, EEPROM should only be used to communicate with a HAT’s EEPROM. It lets Linux to automatically install required drivers for the HAT to function. In other words, just don’t connect anything here.

In conclusion, the GPIO header of your Raspberry Pi enables you to act as control peripherals, act like buttons, or automated switches. Depending on your use case, you may use different interfaces to fully maximize the capacity of your Raspberry Pi.


[1] Power supply through GPIO

Leave a Reply