The Raspberry Pi Pico, Pico H, Pico W and Pico 2 all share the same 40-pin layout. That means wiring and code from one usually work on the others. This page lists every pin and explains the power pins, which cause most beginner problems.
The pins
Hold the Pico with the USB socket at the top. Pin 1 is top left, pins run down the left side to 20, then continue from 21 at the bottom right up to 40 at the top right. The table lists them in that order, so each row is one pair of pins facing each other across the board.
Power Ground GPIO / signal Control
| Also used for | Function | Pin | Pin | Function | Also used for |
|---|---|---|---|---|---|
| UART0 TX | GP0 | 1 | 40 | VBUS | USB 5 V |
| UART0 RX | GP1 | 2 | 39 | VSYS | 1.8–5.5 V in |
| GND | 3 | 38 | GND | ||
| GP2 | 4 | 37 | 3V3_EN | Low turns 3.3 V off | |
| GP3 | 5 | 36 | 3V3(OUT) | 3.3 V out | |
| I²C0 SDA | GP4 | 6 | 35 | ADC_VREF | ADC reference |
| I²C0 SCL | GP5 | 7 | 34 | GP28 | ADC2 |
| GND | 8 | 33 | AGND | Analogue ground | |
| GP6 | 9 | 32 | GP27 | ADC1 | |
| GP7 | 10 | 31 | GP26 | ADC0 | |
| GP8 | 11 | 30 | RUN | Reset when pulled low | |
| GP9 | 12 | 29 | GP22 | ||
| GND | 13 | 28 | GND | ||
| GP10 | 14 | 27 | GP21 | ||
| GP11 | 15 | 26 | GP20 | ||
| GP12 | 16 | 25 | GP19 | SPI0 TX | |
| GP13 | 17 | 24 | GP18 | SPI0 SCK | |
| GND | 18 | 23 | GND | ||
| GP14 | 19 | 22 | GP17 | SPI0 CSn | |
| GP15 | 20 | 21 | GP16 | SPI0 RX |
Almost every GPIO pin can do I²C, SPI, UART or PWM. The "also used for" column shows the defaults in Raspberry Pi's C/C++ SDK. Other choices work too, and the RP2040 and RP2350 datasheets list them all. In MicroPython, always pass the pin numbers you wired, for example I2C(0, sda=Pin(4), scl=Pin(5)), rather than relying on defaults.
The pins you can't see
A few GPIOs aren't on the header because the board uses them itself. On the Pico and Pico 2, GP25 drives the on-board LED, GP24 detects USB power, GP29 measures VSYS through a divider, and GP23 controls the power supply's mode. On the Pico W and Pico 2 W, the LED is wired to the wireless chip instead. In MicroPython, Pin("LED", Pin.OUT) works on all of them.
Powering the Pico
- VBUS (pin 40) is the 5 V from the USB socket. Use it to power 5 V parts while the Pico is plugged in.
- VSYS (pin 39) is the main input, accepting 1.8 to 5.5 V. Power the Pico from batteries here, for example 3 AA cells. It's fed from VBUS through a diode, so USB and a battery can both be connected.
- 3V3(OUT) (pin 36) is the regulated 3.3 V output. Use it for 3.3 V sensors. Raspberry Pi recommends keeping the load under about 300 mA.
- 3V3_EN (pin 37) turns the 3.3 V supply, and so the whole Pico, off when pulled to ground.
- RUN (pin 30) resets the chip when pulled to ground. A push button from RUN to GND makes a handy reset button.
Analogue inputs
GP26, GP27 and GP28 are analogue inputs ADC0 to ADC2. The ADC is 12 bit, and MicroPython's read_u16() scales the reading to 0 to 65,535 across 0 to 3.3 V. For cleaner readings, use AGND (pin 33) as the ground for analogue sensors. Our guide to ADCs covers noise, reference voltages and averaging.
Current limits
Each GPIO pin has a programmable drive strength of 2, 4, 8 or 12 mA, and 4 mA is the default. Treat GPIO pins as signals: a small LED through a resistor is fine, but switch anything bigger with a transistor.
Blink the on-board LED
from machine import Pin
import time
led = Pin("LED", Pin.OUT) # works on Pico, Pico W, Pico 2 and Pico 2 W
while True:
led.toggle()
time.sleep(0.5)
Sources
The main references behind this guide. Numbers we worked out ourselves, such as the code outputs, come from running the code.