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.

PhysBCMFunctionAlt / NotesPhysBCMFunctionAlt / Notes
1-3V3 PowerMax 50mA draw2-5V PowerDirect from USB in
32GPIO 2SDA1 (I2C) / Pull-up4-5V PowerDirect from USB in
53GPIO 3SCL1 (I2C) / Pull-up6-Ground-
74GPIO 4GPCLK0814GPIO 14TXD (Mini-UART)
9-Ground-1015GPIO 15RXD (Mini-UART)
1117GPIO 17UART0 RTS1218GPIO 18PWM0 / PCM CLK
1327GPIO 27PCM FS14-Ground-
1522GPIO 22-1623GPIO 23-
17-3V3 PowerMax 50mA draw1824GPIO 24-
1910GPIO 10SPI0 MOSI20-Ground-
219GPIO 9SPI0 MISO2225GPIO 25-
2311GPIO 11SPI0 SCLK248GPIO 8SPI0 CE0
25-Ground-267GPIO 7SPI0 CE1
270GPIO 0ID_SD (HAT I2C)281GPIO 1ID_SC (HAT I2C)
295GPIO 5-30-Ground-
316GPIO 6-3212GPIO 12PWM0
3313GPIO 13PWM134-Ground-
3519GPIO 19SPI1 MISO / PCM FS3616GPIO 16UART0 CTS
3726GPIO 26-3820GPIO 20SPI1 MOSI / PCM DIN
39-Ground-4021GPIO 21SPI1 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.
Warning: Never use Green/Yellow (IEC) or Green/Bare (NEC) for a standard GPIO signal line. These colors are universally reserved for earth ground and shielding. Using them for a 3.3V I2C data line will confuse any technician who services your enclosure later.

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 RequirementProtocolPi 3 Pins to UseConcrete 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.

Method 1: The Square Pad Rule
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.