The Raspberry Pi Pico layout is built around a 40-pin dual in-line package (DIP) with a standard 0.1-inch (2.54mm) pitch, exposing 26 multifunction GPIO pins. Unlike larger single-board computers, the Pico is a microcontroller designed to plug directly into a breadboard or be soldered to a custom PCB. Understanding the physical layout—specifically the power rail segregation, I2C bus routing, and the 'mirrored pinout' trap—is the difference between a working prototype and a fried RP2040 chip.
This guide breaks down the physical Raspberry Pi Pico layout, walks through a complete I2C sensor build, and provides the exact debugging steps for the most common breadboard wiring failures.
The Physical Raspberry Pi Pico Layout & Spec Sheet
Before pushing wires into a breadboard, you need to understand the board's physical constraints. The layout is symmetrical, which creates a common bench mistake: if you flip the board over to read the silkscreen on the bottom, the left and right pin columns swap. Always orient the board with the micro-USB (or USB-C on the Pico 2) port facing 'up' away from you to match standard pinout diagrams.
If you are designing a custom PCB rather than using a breadboard, the Pico layout features castellated half-holes on the outer edges. This allows you to SMD-solder the Pico flat to your board, saving 10mm of Z-height compared to using standard 2.54mm male headers.
| Parameter | Specification / Value | Layout Notes |
|---|---|---|
| Form Factor | 40-pin DIP, 0.1" pitch | Fits standard 830/400 tie-point breadboards, leaving 1 row of holes on each side. |
| Dimensions | 51mm x 21mm x 1mm (3.5mm with headers) | USB connector overhangs the board edge by ~1.5mm. |
| GPIO Count | 26 multifunction pins (GP0-GP28) | GP23, GP24, GP25 are often routed internally on the W variant for the wireless chip. |
| Power Input (USB) | Pin 40 (VBUS) - 5V nominal | Fused. Do not backfeed 5V here if USB is connected. |
| Power Input (External) | Pin 39 (VSYS) - 1.8V to 5.5V | Has an internal Schottky diode to prevent USB/VSYS back-feeding. |
| Logic Voltage | Pin 36 (3V3_OUT) - 3.3V | Max draw ~300mA. Never feed 5V into this pin. |
| Default I2C0 | GP4 (SDA), GP5 (SCL) | Physically located on the right side of the board (Pins 6 & 7). |
| Default ADC | GP26, GP27, GP28 | Located at the bottom right. GP29 is internally tied to VSYS/3 voltage divider. |
Project Build: I2C Environmental Monitor
To demonstrate proper layout utilization, we will wire a BME280 environmental sensor to the Pico W using the default I2C0 bus. This project targets the Raspberry Pi Pico W (with pre-soldered headers) running MicroPython.
Difficulty Rating: Beginner | Time Required: 15 minutes
Parts List
- Microcontroller: Raspberry Pi Pico W (Pre-soldered headers variant)
- Sensor: Adafruit BME280 I2C/SPI Breakout (Product ID: 2652) or equivalent generic BME280 module with onboard 3.3V LDO and pull-ups.
- Prototyping: 400 tie-point solderless breadboard
- Wiring: 22 AWG solid-core jumper wires (Dupont male-to-male)
Pin Mapping Table
| Pico W Pin (Physical) | GPIO / Function | BME280 Breakout Pin | Wire Color (Suggested) |
|---|---|---|---|
| Pin 36 | 3V3_OUT | VIN (or VCC) | Red |
| Pin 38 | GND | GND | Black |
| Pin 6 | GP4 (I2C0 SDA) | SDA | Blue |
| Pin 7 | GP5 (I2C0 SCL) | SCL | Yellow |
Wiring Steps
- Seat the Pico: Press the Pico W into the breadboard spanning the center trench. Ensure the USB port faces the top edge of the breadboard. Pins 1-20 should be on the left, 21-40 on the right.
- Route Power: Connect Pin 36 (3V3) to the red power rail on the right side. Connect Pin 38 (GND) to the blue ground rail on the right side.
- Place the Sensor: Seat the BME280 breakout at the bottom right of the breadboard.
- Connect I2C Data: Run a jumper from Pin 6 (GP4) to the sensor's SDA pin. Run a jumper from Pin 7 (GP5) to the sensor's SCL pin.
- Connect Sensor Power: Jump the breadboard's red rail to the sensor's VIN, and the blue rail to the sensor's GND.
MicroPython Code & I2C Bus Debugging
The RP2040's PIO (Programmable I/O) and flexible GPIO matrix mean you can technically map I2C to almost any pin. However, sticking to the default layout mappings (GP4/GP5 for I2C0) prevents software configuration headaches. Below is the complete MicroPython code to initialize the bus, scan for the sensor, and read data with robust error handling.
import machine
import time
import bme280 # Requires bme280.py library in your root directory
# Pin definitions based on physical Pico layout
I2C_SDA_PIN = 4 # Physical Pin 6
I2C_SCL_PIN = 5 # Physical Pin 7
I2C_FREQ = 400000 # 400kHz Fast Mode
def setup_i2c():
try:
i2c = machine.I2C(0, sda=machine.Pin(I2C_SDA_PIN), scl=machine.Pin(I2C_SCL_PIN), freq=I2C_FREQ)
return i2c
except Exception as e:
print(f'Failed to initialize I2C bus: {e}')
return None
def main():
i2c = setup_i2c()
if not i2c:
return
# Scan the bus to verify physical layout connections
devices = i2c.scan()
if not devices:
print('Error: No I2C devices found. Check wiring.')
return
# BME280 default I2C address is 0x76 or 0x77
bme_addr = 0x76 if 0x76 in devices else 0x77 if 0x77 in devices else None
if not bme_addr:
print('Error: BME280 not found at expected addresses.')
return
try:
sensor = bme280.BME280(i2c=i2c, address=bme_addr)
print('BME280 initialized successfully.')
except OSError as e:
print(f'Sensor initialization failed: {e}')
return
while True:
try:
temp = sensor.temperature
hum = sensor.humidity
pres = sensor.pressure
print(f'Temp: {temp} | Humidity: {hum} | Pressure: {pres}')
time.sleep(2)
except OSError as e:
print(f'Read error: {e}')
time.sleep(1)
if __name__ == '__main__':
main()
Debugging: The 'Errno 121' Bus Failure
When working with the Pico layout on a breadboard, the most common failure mode is the I2C bus throwing an I/O error. If your console outputs the exact error string OSError: [Errno 121] EIO, the RP2040 attempted to clock data but received no acknowledge (NACK) from the target device.
The first three things to check when it fails:
- Common Ground Missing: The Pico and the sensor must share the exact same ground plane. If you are using a split breadboard (where the power rails are divided in the middle) and forgot to bridge the two ground halves, the I2C pull-up resistors have no return path. Fix: Add a jumper wire bridging the left and right blue ground rails.
- SDA and SCL Swapped: Because the Pico layout places GP4 and GP5 adjacent to each other, it is incredibly easy to cross them on the breadboard. I2C will fail silently or throw Errno 121 if the clock and data lines are reversed. Fix: Verify GP4 (Pin 6) is strictly SDA, and GP5 (Pin 7) is strictly SCL.
- Missing Pull-Up Resistors: If you are using a raw BME280 chip or a cheap clone breakout board lacking onboard resistors, the I2C lines will float. The RP2040 has internal pull-ups, but they are often too weak (~50kΩ) for reliable 400kHz I2C communication. Fix: Add external 4.7kΩ resistors between the SDA/SCL lines and the 3.3V rail.
Extending and Simplifying Your Pico Layout
Once your basic I2C layout is stable, you will inevitably run out of pins or breadboard space. Here is how to scale your design.
How to Extend the Build
- Add a Second I2C Bus: The RP2040 has two hardware I2C controllers. Instead of using an I2C multiplexer, route your second device (like an SSD1306 OLED display) to I2C1 using GP6 (SDA) and GP7 (SCL) located on physical pins 9 and 10. This keeps the buses electrically isolated.
- Utilize the ADC Pins: Add an analog component, like an NTC thermistor or a potentiometer, to GP26 (ADC0) on physical pin 31. Remember that the Pico's ADC reference voltage is tied to the 3.3V rail, so your voltage divider must not exceed 3.3V.
How to Simplify the Layout
Breadboards are great for prototyping, but the Pico's 0.1" pitch leaves only one row of holes for wiring on a standard 400-point board, making complex layouts messy. To simplify:
- Use a Pico Expansion Board: Modules like the MakerFocus Pico Breadboard Kit break the Pico layout out to dual power rails and label every pin on the silkscreen. This eliminates the 'mirrored pinout' confusion entirely.
- Move to a Perfboard: For permanent installations, solder the Pico to a 2x20 female header on a protoboard. Use the castellated edge pads for power and ground planes to reduce wire clutter.
Frequently Asked Questions
What is the difference between the Raspberry Pi Pico and Pico W layout?
The physical footprint, pin count, and GPIO assignments are identical between the original Pico and the Pico W. The difference is internal and on the top-side RF shielding. On the Pico W, the CYW43439 wireless chip uses GP23, GP24, and GP25 internally for SPI communication and antenna control. Therefore, you should avoid using GP23-GP25 for your own peripherals on the W variant, whereas they are freely available on the non-W Pico.
How do I fix the 'SDA/SCL pins not valid' layout error?
If MicroPython throws a ValueError: bad SCL pin or similar, you have assigned a GPIO pin that cannot be routed to the requested I2C block in the RP2040's IO matrix. For example, I2C0 can only be mapped to specific pin pairs (like GP4/GP5 or GP8/GP9). Consult the official Pico datasheet GPIO function table to ensure your chosen physical pins support the specific I2C block (I2C0 vs I2C1) you are initializing in code.
Can I power the Raspberry Pi Pico layout directly from a 5V breadboard rail?
No, not directly into the 3.3V logic pins. If you have a 5V breadboard rail (perhaps from an Arduino or external supply), you must feed it into Pin 39 (VSYS). The Pico layout includes an internal Schottky diode on VSYS that will drop the 5V down to a safe ~4.7V for the onboard SMPS (Switch-Mode Power Supply) to regulate down to 3.3V. Never feed 5V into Pin 36 (3V3_OUT), as this will instantly destroy the RP2040 core logic.
Which pins are strictly for power and ground in the Pico layout?
Out of the 40 pins, 8 are dedicated to ground (GND) to provide short return paths for high-speed signals. The dedicated power pins are Pin 36 (3V3_OUT), Pin 37 (3V3_EN), Pin 39 (VSYS), and Pin 40 (VBUS). Pin 37 (3V3_EN) is the enable pin for the onboard 3.3V regulator; tying it to ground will shut down the 3.3V rail, which is useful for ultra-low-power sleep layouts but will brick your active circuit if accidentally grounded.






