This post summarizes how to check the Raspberry Pi’s GPIO pins layout.
Introduction
The GPIO pin layout on a Raspberry Pi can be confusing. I always have to look up the pin layout before working with it.
Since I often forget how to check it, I’m leaving this note as a reminder.
Note: This article was translated from my original post.
Environment
The GPIO pin layout is the same (40 pins) on Raspberry Pi 2, 3, and 4. This post assumes those models.
On the other hand, the Raspberry Pi 1 Model B+ and earlier have a different layout (26 pins).
Prior to the Pi 1 Model B+ (2014), boards comprised a shorter 26-pin header.
Checking the Raspberry Pi GPIO Pin Layout
There are two main ways to check the GPIO pin layout:
- Using the
pinout
command - Checking official documentation
Checking with the pinout
Command
You can quickly check the pin layout by running the pinout
command in the Raspberry Pi terminal:
pi@raspberrypi:~ $ pinout ,--------------------------------. | oooooooooooooooooooo J8 +====== | 1ooooooooooooooooooo PoE | Net | Wi 1o +====== | Fi Pi Model 4B V1.2 oo | | ,----. +---+ +==== | |D| |SoC | |RAM| |USB3 | |S| | | | | +==== | |I| `----' +---+ | | |C| +==== | |S| |USB2 | pwr |hd| |hd| |I||A| +==== `-| |---|m0|---|m1|----|V|-------' Revision : c03112 SoC : BCM2711 RAM : 4GB Storage : MicroSD USB ports : 4 (of which 2 USB3) Ethernet ports : 1 (1000Mbps max. speed) Wi-fi : True Bluetooth : True Camera ports (CSI) : 1 Display ports (DSI): 1 J8: 3V3 (1) (2) 5V GPIO2 (3) (4) 5V GPIO3 (5) (6) GND GPIO4 (7) (8) GPIO14 GND (9) (10) GPIO15 GPIO17 (11) (12) GPIO18 GPIO27 (13) (14) GND GPIO22 (15) (16) GPIO23 3V3 (17) (18) GPIO24 GPIO10 (19) (20) GND GPIO9 (21) (22) GPIO25 GPIO11 (23) (24) GPIO8 GND (25) (26) GPIO7 GPIO0 (27) (28) GPIO1 GPIO5 (29) (30) GND GPIO6 (31) (32) GPIO12 GPIO13 (33) (34) GND GPIO19 (35) (36) GPIO16 GPIO26 (37) (38) GPIO20 GND (39) (40) GPIO21 POE: TR01 (1) (2) TR00 TR03 (3) (4) TR02 For further information, please refer to https://pinout.xyz/
Checking the Documentation
If you are logged into the Raspberry Pi, using the pinout command is the easiest method. However, you can also check the layout from official documentation.
The Raspberry Pi Official Documentation provides details on the GPIO pin layout and hardware specifications:
You can also check the GPIO layout on pinout.xyz.
The pinout command actually references this site in its output:
# Last line of the pinout command output
For further information, please refer to https://pinout.xyz/
Conclusion
This post summarized how to check the GPIO pin layout on a Raspberry Pi.
It’s easy to make mistakes when connecting pins, so be careful when working with them. Using a reference card with the pin layout might also be a good idea.
I hope this note helps someone!
[Related Articles]
References
- Raspberry Pi GPIO Pinout
- documentation/documentation/asciidoc/computers/os/using-gpio.adoc at develop · raspberrypi/documentation · GitHub
- Raspberry Pi OS - Raspberry Pi Documentation
- GPIO Pin Numbering - Raspberry Pi Forums
- Raspberry Pi hardware - Raspberry Pi Documentation
- Raspberry Pi hardware - Raspberry Pi Documentation