wokwi-pi-pico Reference | Wokwi Docs (2024)

Raspberry Pi Pico, an RP2040 microcontroller board with dual-core ARM Cortex-M0+ processor, 264k of internal RAM, and flexibleProgrammable I/O (PIO) feature.

wokwi-pi-pico Reference | Wokwi Docs (1)

Pin names

Pins GP0 to GP22 are digital GPIO pins. Pins GP26, GP27, and GP28 are digital GPIO pins with analog input function.

NameDescriptionAnalog input channel
GP0 … GP22Digital GPIO pins (0 to 22)
GP26Digital GPIO pin 260
GP27Digital GPIO pin 271
GP28Digital GPIO pin 282
GND.1 … GND.8Ground pins *
VSYS, VBUS, 3V3Positive 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.

Onboard LED

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:

pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);

See Blink for a complete code example.

Simulation features

The Raspberry Pi Pico is simulated using the RP2040js Library.
This table summarizes the status of the simulation features:

PeripheralStatusNotes
Processor core✔️Only a single core is simulated
GPIO✔️
PIO✔️PIO Debugger available
USB🟡USB CDC (Serial) supported, see Serial Monitor below
UART✔️
I2C✔️Master mode only
SPI✔️Master mode only
PWM✔️
DMA✔️Only for the PIO peripheral
Timer✔️Pausing the timer not implemented yet
ARM SysTick Timer✔️
Watchdog
RTC
ADC + Temp sensor✔️Temperature sensor always reads 0
SSI🟡Just the minimum to make the bootloader happy
GDB Debugging✔️See the GDB Debugging guide

Legend:
✔️ Simulated
🟡 Partial implementation/work in progress
❌ Not implemented

Arduino core

The Arduino core provides the built-in Arduino functions, such as pinMode() and digitalRead(), as well as a set of standard Arduino libraries, such as Servo, Wire and SPI.

When compiling your code for the Raspberry Pi Pico, you can choose between two different cores:

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.:

 "parts": [
{
"type": "wokwi-pi-pico",
"id": "pico",
"attrs": {
"env": "arduino-community"
}

},

]

Serial Monitor

You can use the Serial Monitor to receive information from the code running on the Pi Pico, such as debug prints. By default, the Serial Monitor communicates withthe Pi Pico over USB.

Setting up the USB connection can take some time, and any messages printed duringthe USB setup time will be lost. Therefore, it's recommended to tell setup() to wait for the Serial Monitor connection before printing anything:

void setup() {
Serial.begin(115200);
while (!Serial) {
delay(10); // wait for serial port to connect. Needed for native USB
}
// Now you can safely print message:
Serial.println("Hello, Serial Monitor!");
}

Serial Monitor over UART

The Serial Monitor can also communicate with the Pi Pico over the physical UART interface. To configure the UART communication between the Raspberry Pi Pico and the Serial Monitor, add the following connections to your diagram.json file:

 "connections": [
[ "$serialMonitor:RX", "pico:GP0", "", [] ],
[ "$serialMonitor:TX", "pico:GP1", "", [] ],

]

The example assumes that the Pi Pico was defined with an id of "pico", e.g.

 "parts": [
{
"type": "wokwi-pi-pico",
"id": "pico",

},

]

The use the Serial1 object in your code: initialize the port using Serial1.begin(115200), and then print messages with Serial1.println(). For example:

void setup() {
Serial1.begin(115200);
Serial1.println("Hello, world!");
}

void loop() { }

For a complete example, check out the Pi Pico Serial Monitor over UART Example.

Exporting UF2 binary

You can upload the program from the emulator directly into a physical Raspberry Pi Pico board. The steps are:

  1. Press "F1" in the Wokwi code editor and select "Download UF2 Binary".The download should start within a few seconds.
  2. Start your Pi Pico in bootloader mode. You can do this by pressing the boot loader button whileplugging the Pi Pico into the USB port of your computer.
  3. You should see a new drive appear on your computer (named "RPI-RP2"). Copy the UF2 file you downloaded into that drive.

MicroPython Support

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.

Simulator examples

  • Pi Pico and LCD1602
  • Pi Pico Traffic Light
  • Pi Pico C++ SDK Blink
  • Pi Pico C++ SDK 7-Segment Example
wokwi-pi-pico Reference | Wokwi Docs (2024)

FAQs

Which programming language is best for Pi Pico? ›

A Raspberry Pi Pico responds to a variety of coding languages, including C, C++, and MicroPython. MicroPython is a more lightweight and simple version of traditional Python, and it is the most common language used by Raspberry Pi Pico hobbyists.

What is the Wokwi? ›

Wokwi is an online Electronics simulator. You can use it to simulate Arduino, ESP32, STM32, and many other popular boards, parts and sensors. Here are some quick examples of things you can make with Wokwi: Arduino Uno "Hello World" Blink an LED on ESP32.

What type of microcontrollers can be simulated using Wokwi? ›

Microcontrollers​
FamilyMicrocontrollers
AVRATmega328P (Arduino Uno), ATmega2560 (Arduino Mega), ATtiny85
ESP32Xtensa: ESP32, ESP32-S2, ESP32-S3 RISC-V: ESP32-C3, ESP32-C6, ESP32-H2, ESP32-P4*
STM32STM32C031, STM32L031
Pi PicoRP2040 (Raspberry Pi Pico), an dual-core ARM Cortex-M0+ microcontroller

Is Wokwi open source? ›

Publicly available on https://github.com with an OSI approved open-source license; and.

Is Raspberry Pi Pico faster than Arduino? ›

When it comes to processing power, the Raspberry Pi Pico boasts a dual-core ARM Cortex-M0+ processor running at 133 MHz, making it a formidable contender in the microcontroller arena. On the other hand, Arduino boards vary in terms of processing capabilities, with some featuring simpler architectures than others.

Can Pi Pico run Python? ›

MicroPython is a version of the Python programming language for microcontrollers, such as your Raspberry Pi Pico W. MicroPython lets you use your Python knowledge to write code to interact with electronics components. Connect the small end of your micro USB cable to the Raspberry Pi Pico W.

Is Wokwi free? ›

Click the button below to generate a personal 30-day license for Wokwi VS Code. After clicking, click on "Open Visual Studio Code" and then "Open" in the popup that appears. Wokwi for Visual Studio code is free for open source projects. For commercial use, you will need to purchase a license.

What is the power source of Wokwi? ›

Pins VIN / 5V are connected to the positive power supply. There are also two additional power supply pins, 5V. 1/5V. 2, at the top of the dual-row female header connector.

Can Wokwi connect to Wi-Fi? ›

Wokwi simulates a WiFi network with full internet access. You can use the ESP32 together with the virtual WiFi to prototype IoT projects. Common use cases include: Connect to MQTT servers to send sensor data.

What is the most ubiquitous microcontroller? ›

What Is the Most Popular Microcontroller?
  • STM32. A family of 32-bit microcontroller integrated circuits by STMicroelectronics, the STM32 is based on the ARM Cortex-M processor. ...
  • ESP8266. ...
  • ESP32. ...
  • Raspberry Pi Pico. ...
  • ATmega328. ...
  • Arduino Mega 2560. ...
  • ATmega32u4. ...
  • PIC16F877A.

Which microcontroller is most used in robotics? ›

The Arduino microcontroller is super popular in industries because it's easy to use and can do lots of things. It has strong features and tools that make it great for industrial jobs. You can use it for automation, testing, and more. It works well with many sensors and devices, making it handy.

What is the most popular microcontroller programming in the digitally embedded system world? ›

ARM Microcontroller

It's the most popular Microcontrollers Programming in the digital embedded system world, and most of the industries prefer only ARM microcontrollers since it consists of significant features to implement products with an excellent appearance.

Is Wokwi good? ›

Bottom line is that the Wokwi Arduino simulator makes learning easier with the ample amount of good examples provided to get one started🏇.

What is the difference between Wokwi and extension? ›

Wokwi offers a VS Code extension that allows you to simulate a project directly in the code editor by only adding a few files. For more information, see Wokwi documentation. You can also debug your code using the VS Code debugger, see Debugging your code.

Who created Wokwi? ›

Uri Shaked is the co-founder of Wokwi, a platform for teaching Arduino, IoT and Electronics. He co-organizes the IoT Makers and JavaScript Israel meetup groups, and regularly blogs about his making projects which combine Web technologies, Electronics, 3D-Printing, Robotics, and Neuroscience.

What coding language does Pico 8 use? ›

Pico-8 runs on an easy to understand programming language called Lua.

Can you use C++ on Pico? ›

However, if you are intending to develop for Pico on a Raspberry Pi, then you can set up the C/C++ toolchain quickly by running our setup script from the command line. You should make sure the OS on your Raspberry Pi is up to date before running the setup script.

What languages are supported by Pico? ›

Raspberry Pi Pico Programming Languages

The Raspberry Pi Pico can use a range of popular programming languages such as C/C++/Arduino and CircuitPython, however the most popular is arguably MicroPython. You'll find the majority of projects and examples on the internet use MicroPython.

Which programming language is best for Raspberry Pi? ›

Python. Python takes the crown as the most widely used with Raspberry Pi programming language. It is the go-to language for developing web applications, machine learning algorithms, and electronics projects. Python's simple and intuitive syntax makes it a favorite among students, developers, and Pi users.

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Twana Towne Ret

Last Updated:

Views: 6247

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Twana Towne Ret

Birthday: 1994-03-19

Address: Apt. 990 97439 Corwin Motorway, Port Eliseoburgh, NM 99144-2618

Phone: +5958753152963

Job: National Specialist

Hobby: Kayaking, Photography, Skydiving, Embroidery, Leather crafting, Orienteering, Cooking

Introduction: My name is Twana Towne Ret, I am a famous, talented, joyous, perfect, powerful, inquisitive, lovely person who loves writing and wants to share my knowledge and understanding with you.