The Pico 2 kept the original Pico's 40-pad layout, and the Pico W and Pico 2 W use the same one, so a single pinout covers all four boards. Of the 40 pads, 26 are GPIO that can each do several jobs. By default UART sits on GP0 and GP1, I2C on GP4 and GP5 and SPI on GP16 to GP19, analog input is on GP26 to GP28, and any GPIO can drive PWM. Only the W models change anything, and the changes are inside the board, where the header can't show them.
What is identical on Pico, Pico W, Pico 2 and Pico 2 W
Raspberry Pi's Pico-series documentation says the Pico and Pico 2 have the same pinout and board layout. When the company moved from the RP2040 chip to the RP2350, it kept the pin assignment on purpose. Every board in the family has 26 multi-function GPIO, three 12-bit ADC inputs on the header and 16 PWM channels. The pads are numbered anticlockwise from the USB connector, so pin 1 is GP0 beside the port and pin 40 is directly across from it. A breadboard layout drawn for one board fits the others without changes.
Pins 1 and 2 are GP0 and GP1, and pin 3 is the first of eight ground pads. GP2 to GP5 follow on pins 4 to 7, pin 8 is ground and GP6 to GP9 take pins 9 to 12, and the rest of that long edge keeps placing a ground after every fourth GPIO until it reaches the end away from the USB port. The other long edge starts at that end with GP16 and GP17, then a ground on pin 23, and runs back towards the port with four more GPIO, another ground and one last GPIO on pin 29. The non-GPIO pads at the high end are 30 and 33 to 40, with the three analog inputs, GP26 to GP28, placed between them on pins 31, 32 and 34. Because the grounds recur at a regular interval down both edges, one is easy to find by counting. That list is the same on the Pico, Pico W, Pico 2 and Pico 2 W. The only differences are off the header: the LED, and the four internal pins the W boards give to the wireless chip.
Pin 30 is RUN, the reset line. Pin 33 is AGND and pin 35 is ADC_VREF, both covered in the analog section below. Pin 36 is 3V3(OUT), the board's own 3.3 V supply for sensors and modules. Pin 37 is 3V3_EN, and pulling it to ground turns the board off. Pin 39 is VSYS and pin 40 is VBUS. VBUS carries the 5 V from the USB port. VSYS is the main power input and accepts 2 V to 5 V, so a battery pack or bench supply in that range goes on pin 39 and not on VBUS.
What the W boards change
The onboard LED is where the W boards differ. On the Pico and Pico 2 it is wired to GP25, to the left of the Micro USB port. On the Pico W and Pico 2 W it is in the same place, but the wireless chip drives it through a line called WL_GPIO0, and GP25 has nothing to do with it. Code that toggles GP25 to blink the LED works on a plain board and does nothing visible on a W. MicroPython on the W refers to the LED by the name LED rather than by a GPIO number.
Four of the microcontroller's I/O pins are used inside the board and never reach the header: GPIO 23, 24, 25 and 29. On the W models they control the wireless chip, which talks to the microcontroller over SPI at up to 33 MHz. Some of those lines have two jobs. The wireless chip's interrupt line shares a pin, so interrupts can only be checked when no SPI transaction is running. GPIO29 is also the ADC channel that reads VSYS, which is how a program watches its own supply voltage, and the same rule holds there: on a W, the ADC can read VSYS only while no SPI transaction is running.
Which pins to use for I2C, SPI, UART and PWM
The default pins most tutorials assume put UART TX on GPIO0 and RX on GPIO1, and I2C SDA on GPIO4 and SCL on GPIO5, which is the Arduino-style default. By job, with the physical pad numbers in brackets where they help: UART0 uses GP0 and GP1 (pins 1 and 2). I2C0 uses GP4 and GP5 (pins 6 and 7), and I2C1 uses the next pair, GP6 and GP7 (pins 9 and 10), on the other side of the pin 8 ground. SPI0 uses GP16 to GP19, split in the middle by the ground on pin 23, and SPI1 uses GP8 to GP11, split by the ground pad between GP9 and GP10. Because the GPIO are multi-function, these are defaults, and each peripheral can be moved to other pins when they are already taken.
The defaults collide in one place. In MicroPython, UART(1) and I2C(0) both default to GP4 and GP5, pins 6 and 7. When a project uses both, create each bus with its pins named explicitly, and put one of them on a different pair, such as I2C1 on GP6 and GP7.
Every GPIO can output PWM. The hardware behind it is eight independent generators, called slices, with two channels each, for 16 channels in total.
Analog inputs and the 3.3 V limit
The three analog inputs on the header are GP26 (ADC0, pin 31), GP27 (ADC1, pin 32) and GP28 (ADC2, pin 34). All three read at 12-bit resolution. Pin 35, ADC_VREF, supplies the reference voltage the converter measures against, so readings are only as steady as the voltage on that pin. Pin 33, AGND, sits between the ADC pins. It is one of the eight grounds, and it is the analogue ground that gives sensors a noise-free return.
The GPIO run at 3.3 V. The RP2040 in the Pico and Pico W is not 5 V tolerant: its absolute maximum input is the I/O supply voltage plus 0.5 V. Connect a 5 V module to any board in the family through a level shifter, and keep the ADC pins below 3.3 V.
The pin table is the same on all four boards; on the W models, the LED simply takes its orders from the radio chip instead of GP25.
New Raspberry Pi boards and releases are the news Eirik Haugland covers. He keeps the pieces short and dry.
1 article →