What are the specifications of the GPIO pins in Raspberry Pi 4 Model B?


The GPIO (General-Purpose Input/Output) pins on the Raspberry Pi 4 Model B allow interfacing with sensors, LEDs, motors, and other electronics. Below is a detailed breakdown of the 40-pin GPIO header specifications.
๐ GPIO Header Overview (40-Pin)
Pin Type | Count | Details |
3.3V Power | 2 | Max 50mA per pin (limited total) |
5V Power | 2 | Direct from USB-C (max ~1.2A shared) |
Ground (GND) | 8 | Common ground for circuits |
Digital GPIO | 26 | 3.3V logic, programmable as input/output |
PWM (Hardware) | 2 | GPIO 12, 13, 18, 19 (2 channels) |
UART | 2 | TX (GPIO 14), RX (GPIO 15) |
I2C | 2 buses | I2C0 (GPIO 0/1), I2C1 (GPIO 2/3) |
SPI | 2 buses | SPI0 (GPIO 7-11), SPI1 (GPIO 16-21) |
Special Pins | 4 | ID EEPROM (GPIO 0-3 for HATs) |
๐ Electrical Specifications
Parameter | Value |
Logic Voltage | 3.3V (NOT 5V tolerant!) |
Max Current per GPIO Pin | 16mA (safely) |
Total Current Limit (All GPIOs) | 50mA (3.3V rail) |
Input Threshold (High) | ~1.3V (min) |
Input Threshold (Low) | ~0.8V (max) |
PWM Frequency | Configurable (up to kHz range) |
โ ๏ธ Warning:
Do not connect 5V signals directly to GPIO (can damage Pi).
Use level shifters for 5V devices.
๐ GPIO Pinout Diagram (RPi 4 Model B)
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
(Physical pin numbers in brackets)
โ๏ธ Special Functions
1. PWM (Pulse-Width Modulation)
Hardware PWM: GPIO 12, 13, 18, 19 (2 channels).
Software PWM: Any GPIO (less precise).
2. I2C
I2C0 (Default): GPIO 0 (SDA), 1 (SCL) (used for HATs).
I2C1: GPIO 2 (SDA), 3 (SCL).
3. SPI
SPI0: GPIO 9 (MISO), 10 (MOSI), 11 (SCLK), 8 (CE0), 7 (CE1).
SPI1: GPIO 19 (MISO), 20 (MOSI), 21 (SCLK), 16 (CE0), 17 (CE1).
4. UART (Serial)
UART0 (Default): GPIO 14 (TX), 15 (RX) (for terminal/console).
Mini-UART (Secondary): GPIO 32 (TX), 33 (RX) (less reliable).
๐ง Recommended Usage
Application | Recommended Pins |
LEDs & Buttons | Any GPIO (3.3V-safe) |
Servo Motors | GPIO 18 (Hardware PWM) |
I2C Sensors | GPIO 2, 3 (I2C1) |
SPI Displays (OLED) | SPI0 (GPIO 9-11) |
Serial Communication | GPIO 14, 15 (UART) |
โ ๏ธ Protection & Best Practices
Avoid Short Circuits (always check wiring).
Use Resistors (e.g., 330ฮฉ for LEDs).
Level Shifters Needed for 5V devices (e.g., Arduino).
Do NOT draw >16mA per GPIO (risk of damage).
๐ Conclusion
26x Digital GPIOs (3.3V, 16mA max per pin).
Hardware PWM, I2C, SPI, UART support.
5V/3.3V/GND power pins available.
Total 3.3V current limit: 50mA (shared).
For full pinout diagrams, check the official Raspberry Pi docs.
Subscribe to my newsletter
Read articles from ampheo directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
