The Raspberry Pi 3 (Model B and B+) utilizes the standard 40-pin GPIO header, operating at 3.3V logic. Unlike microcontrollers with built-in analog-to-digital converters (ADCs) or 5V-tolerant inputs, the Pi 3 requires strict adherence to its pinout to avoid catastrophic silicon failure. Below is the complete physical and BCM (Broadcom) mapping, followed by the wiring standards, hardware traps, and decision paths you need to interface sensors safely.
The Complete Raspberry Pi 3 40-Pin GPIO Reference Table
This table maps the physical pin number (counting from the top-left, closest to the SD card slot on the Pi 3B) to the Broadcom SoC GPIO number and its primary/alternate functions. Always reference the Physical Pin when wiring; use the BCM GPIO number when writing Python or C++ code.
| Phys | BCM | Function | Alt / Notes | Phys | BCM | Function | Alt / Notes |
|---|---|---|---|---|---|---|---|
| 1 | - | 3V3 Power | Max 50mA draw | 2 | - | 5V Power | Direct from USB in |
| 3 | 2 | GPIO 2 | SDA1 (I2C) / Pull-up | 4 | - | 5V Power | Direct from USB in |
| 5 | 3 | GPIO 3 | SCL1 (I2C) / Pull-up | 6 | - | Ground | - |
| 7 | 4 | GPIO 4 | GPCLK0 | 8 | 14 | GPIO 14 | TXD (Mini-UART) |
| 9 | - | Ground | - | 10 | 15 | GPIO 15 | RXD (Mini-UART) |
| 11 | 17 | GPIO 17 | UART0 RTS | 12 | 18 | GPIO 18 | PWM0 / PCM CLK |
| 13 | 27 | GPIO 27 | PCM FS | 14 | - | Ground | - |
| 15 | 22 | GPIO 22 | - | 16 | 23 | GPIO 23 | - |
| 17 | - | 3V3 Power | Max 50mA draw | 18 | 24 | GPIO 24 | - |
| 19 | 10 | GPIO 10 | SPI0 MOSI | 20 | - | Ground | - |
| 21 | 9 | GPIO 9 | SPI0 MISO | 22 | 25 | GPIO 25 | - |
| 23 | 11 | GPIO 11 | SPI0 SCLK | 24 | 8 | GPIO 8 | SPI0 CE0 |
| 25 | - | Ground | - | 26 | 7 | GPIO 7 | SPI0 CE1 |
| 27 | 0 | GPIO 0 | ID_SD (HAT I2C) | 28 | 1 | GPIO 1 | ID_SC (HAT I2C) |
| 29 | 5 | GPIO 5 | - | 30 | - | Ground | - |
| 31 | 6 | GPIO 6 | - | 32 | 12 | GPIO 12 | PWM0 |
| 33 | 13 | GPIO 13 | PWM1 | 34 | - | Ground | - |
| 35 | 19 | GPIO 19 | SPI1 MISO / PCM FS | 36 | 16 | GPIO 16 | UART0 CTS |
| 37 | 26 | GPIO 26 | - | 38 | 20 | GPIO 20 | SPI1 MOSI / PCM DIN |
| 39 | - | Ground | - | 40 | 21 | GPIO 21 | SPI1 SCLK / PCM DOUT |
Wire Color Standards: HAT Ribbon vs IEC 60446 vs NEC
When transitioning from bare jumper wires to a permanent installation or custom PCB, you must align your wire colors with the correct standard. Mixing embedded ribbon standards with industrial panel wiring causes dangerous confusion during troubleshooting.
- Raspberry Pi HAT Standard (Embedded/Ribbon): Red = 5V, Orange = 3.3V, Black = Ground, Yellow = Signal. This is the default for 40-pin IDE-style ribbon cables and Dupont jumper packs.
- IEC 60446 (EU/UK DC Control Circuits): Brown = Positive (+), Blue = Negative/Ground (-), Green/Yellow = Protective Earth (Shield). Used in European industrial enclosures housing a Pi.
- US NEC (US DC Control): Red = Positive (+), Black = Negative/Ground (-), White = Grounded Conductor, Green/Bare = Equipment Ground. Standard for US-based control panels.
The Rows People Get Wrong (And How They Brick Boards)
The Pi 3 has specific hardware quirks that differ from the Pi 4 and Pi 5. Misinterpreting these rows in the table above is the leading cause of dead System-on-Chips (SoCs) and silent communication failures.
1. The 5V Power Rail Headroom Trap (Pins 2 & 4)
The 5V pins are fed directly from the USB micro-B input. The Pi 3B+ requires approximately 1.3A for its own operation. If you are using a standard 2.5A Raspberry Pi power supply, you only have ~1.2A of headroom on the 5V rail for external relays, LED strips, or sensors. Exceeding this causes voltage sag, brownouts, and SD card corruption. For high-current 5V loads, wire a separate 5V buck converter directly to the load, sharing only the Ground (Pin 6) with the Pi.
2. The UART / Bluetooth Conflict (Pins 8 & 10)
On the Pi 3, the primary hardware UART (/dev/ttyAMA0) is hardwired to the onboard Bluetooth module. Pins 8 (TX) and 10 (RX) are routed to the secondary mini-UART (/dev/ttyS0), which lacks a stable baud rate clock and will drop data at high speeds. The Fix: If you need reliable serial for a GPS module or an ESP32, add dtoverlay=disable-bt to your /boot/config.txt file to reclaim the hardware UART for the header pins.
3. The 3.3V vs 5V Logic Instant Death (Pins 1 & 2)
The Pi 3 GPIO operates strictly at 3.3V. Pin 1 outputs 3.3V power, while Pin 2 outputs 5V. More critically, the GPIO inputs are not 5V tolerant. Feeding a 5V TX signal from an Arduino Uno or a 5V sensor into a Pi 3 RX pin will permanently destroy the Broadcom SoC's input pad. Always use a bidirectional logic level shifter (like the BSS138-based Adafruit 4-channel shifter) when bridging 5V and 3.3V domains.
4. The HAT ID EEPROM Pins (Pins 27 & 28)
GPIO 0 and GPIO 1 are reserved for the HAT (Hardware Attached on Top) identification EEPROM. They have specific pull-up configurations at boot. Do not use these pins for general-purpose I/O or external I2C sensors, as they will cause boot-time conflicts and prevent HAT auto-configuration.
Decision Tree: Which Pin Should You Actually Use?
Use this decision matrix to select the correct interface for your specific sensor or peripheral. Do not guess; follow the path to the concrete hardware requirement.
| Your Requirement | Protocol | Pi 3 Pins to Use | Concrete Hardware Pick |
|---|---|---|---|
| Read an analog sensor (potentiometer, MQ-2 gas, LDR) | SPI (via ADC) | 19, 21, 23, 24 | Buy: MCP3008 8-channel ADC breakout. (Pi has no native ADC). |
| Connect multiple I2C sensors with the same address | I2C (Multiplexed) | 3, 5 | Buy: TCA9548A I2C Multiplexer. (Allows up to 8 identical sensors). |
| High-speed data (TFT Display, SD Card module) | SPI0 | 19, 21, 23, 24 (CE0) | Use: Hardware SPI0. Avoid bit-banging on random GPIOs. |
| Control high-power AC loads or DC motors | Digital Out | 11, 13, 15 (Any standard GPIO) | Buy: 5V relay module with optical isolation. Never drive coils directly from GPIO. |
| Precise hardware PWM for servo control | PWM | 12 (GPIO 18) | Use: Hardware PWM0. (Other pins only support software PWM, which jitters). |
Safe Interpretation When Board Markings Are Faded
On older Pi 3 boards, or boards exposed to high-heat environments, the silkscreen text next to the GPIO header can fade or rub off entirely. If you cannot read the pin labels, use these two foolproof verification methods before applying power.
Flip the board over or look closely at the solder joints on the top side. Pin 1 is the only pin with a square solder pad. All other 39 pins have perfectly round solder pads. Pin 1 is always the 3.3V power pin, located on the edge closest to the SD card slot and USB ports.
Method 2: The Software Verification
If the board is powered and running Raspberry Pi OS, open the terminal and type:
pinout
This built-in command (part of the gpiozero library) renders a high-contrast ASCII art diagram of the exact pinout in your terminal, complete with color coding and BCM mappings. If the pinout command is missing, install it via sudo apt install python3-gpiozero. Never rely on third-party printed cheat sheets that may have misaligned the physical pin numbers; always verify against the physical square pad or the live OS terminal.






