Raspberry Pi Pico, an RP2040 microcontroller board with dual-core ARM Cortex-M0+ processor, 264k of internal RAM, and flexible Programmable I/O (PIO) feature.
Pins GP0 to GP22 are digital GPIO pins. Pins GP26, GP27, and GP28 are digital GPIO pins with analog input function.
|Name||Description||Analog input channel|
|GP0 … GP22||Digital GPIO pins (0 to 22)|
|GP26||Digital GPIO pin 26||0|
|GP27||Digital GPIO pin 27||1|
|GP28||Digital GPIO pin 28||2|
|GND.1 … GND.8||Ground pins *|
|VSYS, VBUS, 3V3||Positive power supply|
|TP4 †||Digital GPIO pin 23|
|TP5 †||Digital GPIO pin 25 + LED|
* The physical pin numbers of the ground pins are 3, 8, 13, 18, 23, 28, 33, and 38.
† These pins do not appear in the visual diagram editor, but you can use them in your diagram.json file.
Pins 3V3_EN / RUN / ADC_VREF are not available in the simulation and are therefore omitted from the table.
The Raspberry Pi Pico has an onboard LED, attached to GPIO PIN 25. The LED is lit when the pin is driven high.
You can also use the
LED_BUILTIN constant to reference the LED in your Arduino code:
See Blink for a complete code example.
The Raspberry Pi Pico is simulated using the RP2040js Library.
This table summarizes the status of the simulation features:
|Processor core||✔️||Only a single core is simulated|
|PIO||✔️||Not widely tested; PIO Debugger available|
|Timer||✔️||Pausing the timer not implemented yet|
|ARM SysTick Timer||🟡||Partial implementation|
|ADC + Temp sensor||❌|
|SSI||🟡||Just the minimum to make the bootloader happy|
|GDB Debugging||✔️||See the GDB Debugging guide|
🟡 Partial implementation/work in progress
❌ Not implemented
We're adding the missing features in weekly live streams. Expect the list above to update every week or two.
The Arduino core provides the built-in Arduino functions, such as
digitalRead(), as well as a set of standard Arduino libraries, such as Servo, Wire and SPI.
When compiling your code for the Raspberry Pi Pi Pico, you can choose between two different cores:
- The official Pi Pico core, based on Mbed OS. This is the default.
- The community maintained Pi Pico Arduino Core, built on top of the Pi Pico SDK.
You can learn about the key differences between these two cores in this GitHub comment.
To select a core, set the "env" attribute of the
wokwi-pi-pico part. For the official Arduino core, use the value "arduino-core". For the community maintained core, set "env" to "arduino-community". e.g.:
You can use the Serial Monitor to receive information from the code running on the Pi Pico, such as debug prints. To configure the serial monitor connection with the Raspberry Pi Pico, add the following connections to your diagram.json file:
The example assumes that the Pi Pico was defined with an id of "pico", e.g.
To initialize the Serial monitor in your code use
Serial1.begin(115200), and then print messages with
Serial1.println(). For example:
Note the usage of
Serial1. The standard
Serial in the Arduino Core uses Serial over USB (CDC), which is currently not supported in the simulation.
Serial1, in contrast, uses the hardware UART (connected to pins GP0/GP1).
For a complete example, check out the Pi Pico Serial Monitor Example.
You can upload the program from the emulator directly into a physical Raspberry Pi Pico board. The steps are:
- Press "F1" in the Wokwi code editor and select "Download UF2 Binary". The download should start within a few seconds.
- Start your Pi Pico in bootloader mode. You can do this by pressing the boot loader button while plugging the Pi Pico into the USB port of your computer.
- You should see a new drive appear on your computer (named "RPI-RP2"). Copy the UF2 file you downloaded into that drive.
The Raspberry Pi Pico supports MicroPython, and you can use it for running MicroPython projects in Wokwi. For more information, check out the MicroPython Guide.