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

ampheoampheo
3 min read

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 TypeCountDetails
3.3V Power2Max 50mA per pin (limited total)
5V Power2Direct from USB-C (max ~1.2A shared)
Ground (GND)8Common ground for circuits
Digital GPIO263.3V logic, programmable as input/output
PWM (Hardware)2GPIO 12, 13, 18, 19 (2 channels)
UART2TX (GPIO 14), RX (GPIO 15)
I2C2 busesI2C0 (GPIO 0/1), I2C1 (GPIO 2/3)
SPI2 busesSPI0 (GPIO 7-11), SPI1 (GPIO 16-21)
Special Pins4ID EEPROM (GPIO 0-3 for HATs)

๐Ÿ”Œ Electrical Specifications

ParameterValue
Logic Voltage3.3V (NOT 5V tolerant!)
Max Current per GPIO Pin16mA (safely)
Total Current Limit (All GPIOs)50mA (3.3V rail)
Input Threshold (High)~1.3V (min)
Input Threshold (Low)~0.8V (max)
PWM FrequencyConfigurable (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).


ApplicationRecommended Pins
LEDs & ButtonsAny GPIO (3.3V-safe)
Servo MotorsGPIO 18 (Hardware PWM)
I2C SensorsGPIO 2, 3 (I2C1)
SPI Displays (OLED)SPI0 (GPIO 9-11)
Serial CommunicationGPIO 14, 15 (UART)

โš ๏ธ Protection & Best Practices

  1. Avoid Short Circuits (always check wiring).

  2. Use Resistors (e.g., 330ฮฉ for LEDs).

  3. Level Shifters Needed for 5V devices (e.g., Arduino).

  4. 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.

0
Subscribe to my newsletter

Read articles from ampheo directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

ampheo
ampheo