The Raspberry Pi Zero 2 W utilizes the standard 40-pin GPIO header layout identical to full-size Pi models, but it ships with unpopulated through-holes requiring you to solder a 2x20 male pin header. Below is the exact physical and BCM pinout, followed by the wire color standards you must follow when connecting peripherals to avoid short circuits and logic-level damage.
The Complete Raspberry Pi Zero 2 W Pinout Diagram
Read this table by matching the Physical Pin (1-40) on your board to the BCM (Broadcom SoC channel number) used in Python/C code. The Function column lists the primary default, while alternate functions (like PWM or SPI) are noted where applicable.
| Phys | BCM | Function / Notes | Phys | BCM | Function / Notes |
|---|---|---|---|---|---|
| 1 | 3V3 | 3.3V Power (Max 50mA draw) | 2 | 5V | 5V Power (Direct from USB in) |
| 3 | 2 | SDA1 (I2C1 Data) + Pull-up | 4 | 5V | 5V Power |
| 5 | 3 | SCL1 (I2C1 Clock) + Pull-up | 6 | GND | Ground |
| 7 | 4 | GPIO4 (GPCLK0) | 8 | 14 | TXD0 (UART Transmit) |
| 9 | GND | Ground | 10 | 15 | RXD0 (UART Receive) |
| 11 | 17 | GPIO17 (SPI1 CE1) | 12 | 18 | GPIO18 (PCM CLK / PWM0) |
| 13 | 27 | GPIO27 (SPI1 MISO) | 14 | GND | Ground |
| 15 | 22 | GPIO22 (SPI1 SCLK) | 16 | 23 | GPIO23 (SPI1 MOSI) |
| 17 | 3V3 | 3.3V Power | 18 | 24 | GPIO24 (SPI1 CE0) |
| 19 | 10 | MOSI0 (SPI0 Master Out) | 20 | GND | Ground |
| 21 | 9 | MISO0 (SPI0 Master In) | 22 | 25 | GPIO25 |
| 23 | 11 | SCLK0 (SPI0 Clock) | 24 | 8 | CE0 (SPI0 Chip Enable 0) |
| 25 | GND | Ground | 26 | 7 | CE1 (SPI0 Chip Enable 1) |
| 27 | 0 | SDA0 (I2C0 Data) - No Pull-up | 28 | 1 | SCL0 (I2C0 Clock) - No Pull-up |
| 29 | 5 | GPIO5 (GPCLK1) | 30 | GND | Ground |
| 31 | 6 | GPIO6 (GPCLK2) | 32 | 12 | GPIO12 (PWM0) |
| 33 | 13 | GPIO13 (PWM1) | 34 | GND | Ground |
| 35 | 19 | GPIO19 (PCM FS / SPI1 MISO) | 36 | 16 | GPIO16 (SPI1 CE2) |
| 37 | 26 | GPIO26 | 38 | 20 | GPIO20 (PCM DIN / SPI1 MOSI) |
| 39 | GND | Ground | 40 | 21 | GPIO21 (PCM DOUT / SPI1 SCLK) |
Wire Color Standards: IEC, NEC, and Old UK Practices
When wiring sensors, relays, or external power to your Pi Zero 2 W, you must select wire colors that match the regulatory standards of your region and the voltage class of the circuit. A common bench mistake is applying mains AC color codes to low-voltage DC signal wires, leading to catastrophic confusion during troubleshooting.
| Standard / Region | Mains AC (L / N / PE) | DC Control / Signal (V+ / GND / Signal) | Application to Pi Zero 2 W |
|---|---|---|---|
| IEC 60446 / 60204-1 (EU, UK post-2004, Global) |
Brown / Blue / Green-Yellow | Black (Power) / Blue (DC Control) / Yellow (Interlock) | Use Blue for 3.3V logic signals, Black for 5V power, and Green-Yellow strictly for chassis grounding shields. |
| NEC / NFPA 79 (United States, Canada) |
Black / White / Green-Bare | Red (DC V+) / Black (DC GND) / Yellow (External interlocks) | US hobbyists and industrial panels use Red for 5V, Orange or Yellow for 3.3V logic, and Black for GND. Never use White for DC ground. |
| Old UK Standard (Pre-2004, legacy panels) |
Red / Black / Green | Red (V+) / Black (GND) / Yellow (Signal) | Avoid mixing legacy UK mains wiring with modern Pi projects. A legacy Red (Mains Live) wire reused for a Pi 5V rail is a severe shock hazard if crossed. |
Which standard applies to you? If you are wiring a Pi into an industrial control cabinet in the EU, follow IEC 60204-1 (Blue for DC control). If you are building a standalone prototype in the US, follow standard TIA/EIA-568 or breadboard conventions (Red=5V, Black=GND, Orange=3.3V). For authoritative reference on Pi hardware limits, consult the official Raspberry Pi hardware documentation.
Rows People Get Wrong (And How to Avoid Bricking Your Pi)
The Pinout.xyz database is the gold standard for visual reference, but physical wiring errors still occur. Here are the specific rows and symbols that cause the most hardware failures on the Zero 2 W.
- Pin 1 (3.3V) vs Pin 2 (5V): The 3.3V rail (Pins 1 and 17) is generated by an onboard LDO regulator and can only supply roughly 50mA. If you connect a high-draw component like a standard 5V relay module or a bright LED strip to Pin 1, you will brown out the Pi or burn the regulator. Always use Pin 2 or 4 (5V) for high-current loads, and ensure your 5V USB power supply can handle the total amperage.
- I2C Pull-Up Resistors (Pins 3/5 vs 27/28): Pins 3 (SDA1) and 5 (SCL1) have physical 1.8kΩ pull-up resistors to 3.3V on the Pi board. Pins 27 and 28 (I2C0) do not. If you wire an I2C sensor to Pins 27/28 without adding external pull-up resistors, the bus will float and fail to initialize.
- UART TX/RX Crossover (Pins 8/10): Pin 8 is TX (Transmit) and Pin 10 is RX (Receive). The most common mistake is wiring TX to TX. You must cross the lines: Pi TX (Pin 8) goes to Sensor RX, and Pi RX (Pin 10) goes to Sensor TX.
- The 'BCM' vs 'BOARD' Symbol Confusion: In Python (RPi.GPIO or gpiozero), you must declare your numbering scheme.
GPIO.setmode(GPIO.BCM)uses the Broadcom channel numbers (e.g., GPIO17).GPIO.setmode(GPIO.BOARD)uses the physical pin numbers (e.g., Pin 11). Mixing these up will cause your code to toggle the wrong physical pin, potentially driving 3.3V into a grounded sensor line.
Decision Path: Selecting the Right Interface and Pin
Use this decision tree to terminate your design phase and select the exact pins and breakout boards required for your peripheral.
| Sensor / Peripheral Type | Protocol | Required Pi Zero 2 W Pins | Concrete Action / Part Pick |
|---|---|---|---|
| Temperature, Humidity, OLED, Accelerometer | I2C | Pin 1 (3.3V), Pin 6 (GND), Pin 3 (SDA), Pin 5 (SCL) | Default Pick: Wire directly. Ensure sensor supports 3.3V logic. If 5V only, buy a BSS138 bidirectional logic level converter. |
| High-speed ADC, SD Card module, TFT Display | SPI | Pin 19 (MOSI), 21 (MISO), 23 (SCLK), 24 (CE0) | Default Pick: Use hardware SPI0. Do not bit-bang SPI on the Zero 2 W if high throughput is needed; the quad-core CPU can handle it, but hardware SPI is vastly more efficient. |
| GPS Module, Cellular Modem, RS485 adapter | UART | Pin 8 (TXD), Pin 10 (RXD) | Default Pick: Disable Linux serial console in raspi-config to free up /dev/ttyAMA0. Use a MAX3232 chip if connecting to legacy RS232 DB9 equipment. |
| Potentiometer, Analog Soil Moisture, Load Cell | Analog | N/A (Pi has no native ADC) | Default Pick: Buy an ADS1115 16-bit ADC breakout board. Wire it to I2C (Pins 3 and 5). Do not use an MCP3008 (SPI) unless you specifically need >800 SPS sampling rates. |
Safe Interpretation When Board Markings Are Faded or Missing
The Pi Zero 2 W is a compact board, and the silkscreen text next to the GPIO holes is notoriously small. If you are working with a clone board, a board with flux residue obscuring the text, or a damaged silkscreen, you must safely identify Pin 1 before applying power.
If the board is already soldered and you cannot see the pads, use physical orientation. Hold the board so the SD card slot is facing your stomach and the mini-HDMI/USB ports are facing away from you. The GPIO header is on the right edge. Pin 1 is the top-left pin of the header, closest to the SD card corner.
Verification Step: Before connecting any expensive I2C or SPI sensors, power the Pi via the micro-USB port. Set your multimeter to DC Voltage. Place the black probe on the metal shield of the micro-USB port (which is tied to system ground). Use the red probe to verify that the outer-top pin reads exactly 3.3V (Pin 1) and the pin immediately to its right reads 5.0V (Pin 2). If you read 5V on the left pin, your header orientation is flipped, and you must correct your wiring before attaching 3.3V logic sensors.






