This is a top view of the pinouts on the Raspberry Pi Pico. Click on the image for an enlarged, less blurry view. The pin labels are on the bottom of the board.

Another nice diagram is available at https://pico.pinout.xyz/. Click on "Advanced" to see extra information.

See the Downloads page for a paper template you can put underneath the Pico to label the pins.

There are two I2C peripherals available, I2C0 and I2C1, two SPI peripherals, SPI0 and SPI1, and two UART peripherals, UART0 and UART1. You can assign any of these to the pins on which they are available. So for example, you can use GP0/GP1 for I2C0, and simultaneously use GP2/GP3 for I2C1, but you cannot use GP0/GP1 together with GP4/GP5 for I2C use, because they are both usable only with I2C0.

In CircuitPython, you don't need to specify exactly which peripheral is used. As long you choose valid pins, CircuitPython will choose a free peripheral.

No Basic Default board Devices

The Pico does not label specific pins as the defaults to use for I2C, SPI, or UART connections. So CircuitPython running on the Pico does not provide board.I2C(), board.SPI(), or board.UART(), since it's not immediately obvious what they would correspond to. For example:

CircuitPython for the Pico does include board.STEMMA_I2C() to work with the STEMMA I2C connector on the Adafruit Proto Cowbell. See the next section for details.
import board

i2c = board.I2C()    # Does not work on the Pico.

Instead, use the busio module to create your bus and then specify the specific pins you want to use. To do so, use the pinout diagram above to find available pins, for example I2C0_SDA is on GP0 (as well as other locations). You then use the board.GPx pin name when creating the bus.

Here are some specific examples.

I2C Example

To setup an I2C bus, you specify the SCL and SDA pins being used. You can look for "SCL" and "SDA" in the pin names in the pinout diagram above.

  • I2Cx_SCL = SCL
  • I2Cx_SDA = SDA

For example, here is how you would setup an I2C bus to use GP1 as SCL and GP0 as SDA:

import board
import busio

i2c = busio.I2C(scl=board.GP1, sda=board.GP0)

SPI Example

To setup a SPI bus, you specify the SCK, MOSI (microcontroller out, sensor in), and MISO (microcontroller in, sensor out) pins. The Pico uses a different naming convention for these:

  • SPIx_SCK = SCK
  • SPIx_TX = MOSI
  • SPIx_RX = MISO

So use that mapping to help find available pins.

Here's an example:

import board
import busio

spi = busio.SPI(clock=board.GP2, MOSI=board.GP3, MISO=board.GP4)

UART Example

To setup a UART bus, you specify the TX and RX pins. Be sure to use the UARTx pins and not the similarly named SPIx ones.

Here's an example:

import board
import busio

uart = busio.UART(tx=board.GP4, rx=board.GP5)

The board.STEMMA_I2C() Object

CircuitPython running on the Pico includes the board.STEMMA_I2C() object. This represents a STEMMA QT connector connected to IO4 (SDA), and IO5 (SCL).

You can use it in your code when using the Adafruit PiCowbell Proto for Pico with a STEMMA QT breakout connected to the included STEMMA QT connector.

Power Sensing Pins Available in CircuitPython

There are two pins available in CircuitPython for power sensing on the Pico.

  • VOLTAGE_MONITOR (GP24) - This pin is connected to Vsys, which feed the voltage regulator, via a voltage divider. You can connect a battery to Vsys, and the voltage monitor pin can be used as a crude battery voltage monitor.
  • VBUS_SENSE (GP29) - This pin is high if the board is powered by USB.

This guide was first published on Jan 21, 2021. It was last updated on Mar 18, 2024.

This page (Pinouts) was last updated on Mar 08, 2024.

Text editor powered by tinymce.