Raspberry Pi Pico/Pico W Free Simulator

Recently, I discovered a useful tool that makes coding on the Raspberry Pi Pico and Pico W more accessible. Wokwi, a free online simulator available at wokwi.com, allows you to effortlessly simulate your projects without needing the physical hardware.

With this simulator, you can not only write and test your code but also simulate adding various peripherals, connecting to the Internet, and replicating a full real-life setup to some degree. This means you can experiment, debug, and perfect your projects in a virtual environment before deploying them on actual hardware, saving both time and resources in some cases. Whether you’re a beginner or an experienced developer, Wokwi provides a powerful platform to enhance your Raspberry Pi Pico and Pico W development experience.

Before we delve into the topic, we invite you to support our ongoing efforts and explore our various platforms dedicated to enhancing your IoT projects:

  • Subscribe to our YouTube Channel: Stay updated with our latest tutorials and project insights by subscribing to our channel at YouTube — Shilleh.
  • Support Us: Your support is invaluable. Consider buying me a coffee at Buy Me A Coffee to help us continue creating quality content.
  • Hire Expert IoT Services: For personalized assistance with your IoT projects, hire me on UpWork.

ShillehTek Website (Exclusive Discounts):

https://shillehtek.com/collections/all

ShillehTekAmazon Store:

ShillehTek Amazon Store — US

ShillehTek Amazon Store — Canada

ShillehTek Amazon Store — Japan

Step 1: Accessing Wokwi

  1. Visit Wokwi: Go to wokwi.com and create a free account if you haven’t already. You can even get started without an account if you like.
  2. Explore the Simulator: Familiarize yourself with the interface. You will see options to create new projects, view templates, and explore examples. You do not have to select the Pico, they have other controllers to chose from as well.

Step 2: Creating a Project

They offer a wide range of template projects to choose from. One of these is a simple Blink LED project using the Pico SDK for C. Setting up the Pico SDK for C can be daunting for beginners, so having access to an easily configurable environment is a significant advantage for those just starting out.

We see upon running the script that the Raspberry Pi on the right starts to blink periodically, per the code instructions.

You can then create the same functionality in MicroPython in the IDE.

1-) Copy this code in:

# MicroPython script for blinking an LED on the Raspberry Pi Pico

from machine import Pin
import time

# Check if the default LED pin is available
try:
LED_PIN = Pin(Pin.PICO_DEFAULT_LED_PIN, Pin.OUT)
except AttributeError:
# If PICO_DEFAULT_LED_PIN is not defined, use Pin 25 which is the default LED pin for the Pico
LED_PIN = Pin(25, Pin.OUT)

# Blink the LED
while True:
LED_PIN.value(1) # Turn the LED on
time.sleep(0.25) # Wait for 250 milliseconds
LED_PIN.value(0) # Turn the LED off
time.sleep(0.25) # Wait for 250 milliseconds

2-) Change the name of the file to .py extension

Now you can run and see the same outcome, easily switching between coding languages in the same IDE! This is something you cannot easily do with a real Raspberry Pi Pico.

Step 3: Using Peripherals

What’s great about this simulator is that it allows you to add a variety of common sensors and components, such as LEDs, resistors, accelerometers, and more. You can easily add these parts using the plus button, or explore other projects that have already incorporated them.

For example you can go to and select a simple project, the NeoPixel ring. And see how it works https://wokwi.com/projects/314265138001609280

You see that once you start running it changes colors. This is great for beginners who do not have a device yet or do not want to buy NeoPixels.

Finally, another interesting feature is the ability to simulate accelerometer input or physical input in general. Since an accelerometer requires movement to produce data, the simulator provides a sliding bar that allows you to manually adjust the input. While this is a useful feature, it does highlight the limitation of not being able to physically move the device through space as you would with a real prototype. You can see an example using the MPU6050 with an Arduino here. This example also imports external code, a capability you can utilize in all of your projects using the simulator. Although this example uses an Arduino, you can achieve the same functionality with the Pico or Pico W. Simply click on the MPU6050 while the code is running to adjust the acceleration values and simulate real-life changes.

https://wokwi.com/projects/305937156771152449c

Conclusion

In conclusion, the simulator offers a convenient and flexible way to work with various sensors and components, such as accelerometers, LEDs, and more. Its ability to import external code and manually simulate sensor inputs provides valuable learning and prototyping opportunities. However, it does have limitations, such as the inability to replicate physical movement accurately. Despite these drawbacks, it remains a powerful tool for beginners and experienced developers alike.

If you found this information useful, follow me on Medium and YouTube for more tutorials and insights!

Create a free account to access full content.

All access to code and resources on ShillehTek.

Signup Now

Already a member? Sign In

Explore More on Our Blog

How to Connect MLX90614 Infrared Thermometer to Raspberry Pi Pico W: MicroPython Tutorial!

How to Connect MLX90614 Infrared Thermometer to Raspberry Pi Pico W: MicroPython Tutorial!

Learn how to use the MLX90614 with the Raspberry Pi Pico W and get infrared values in MicroPython.

Raspberry Pi Pico/Pico W Free Simulator

Raspberry Pi Pico/Pico W Free Simulator

Discover how to simulate Raspberry Pi Pico projects using Wokwi, a free online simulator for Arduino and MicroPython....

Interfacing the MPU6050 with Raspberry Pi Pico W in C++

Interfacing the MPU6050 with Raspberry Pi Pico W in C++

Interface with the MPU6050 using the Raspberry Pi Pico W in C++.

How to Write your First C++ Program on the Raspberry Pi Pico W

How to Write your First C++ Program on the Raspberry Pi Pico W

Write your first C++ Program on the Pico W in a few simple steps.

How to Use ThingSpeak with the Raspberry Pi Pico W

How to Use ThingSpeak with the Raspberry Pi Pico W

Learn how to create a real-time environmental monitoring system with the Raspberry Pi Pico W and ThingSpeak!

How to Use ADS1115 with the Raspberry Pi (Part 1)

How to Use ADS1115 with the Raspberry Pi (Part 1)

Discover how to expand your Raspberry Pi projects by integrating the ADS1115 ADC for precise analog signal reading....

How to Install Pip Packages in AWS Lambda Using Docker and ECR

How to Install Pip Packages in AWS Lambda Using Docker and ECR

Learn how to streamline AWS Lambda deployments by using Docker and Amazon Elastic Container Registry (ECR) to package...

Create Tabular Product Descriptions on Your Shopify Store

Create Tabular Product Descriptions on Your Shopify Store

Enhance your Shopify store's product pages with our comprehensive guide on implementing tabular descriptions. Learn how to add a...

SSH Into Raspberry Pi with Tailscale VPN

SSH Into Raspberry Pi with Tailscale VPN

Effortlessly access and manage your Raspberry Pi from anywhere using Tailscale's secure mesh VPN.

Send Email with Lua and the ESP32

Send Email with Lua and the ESP32

In this tutorial, we delve into sending emails with the ESP32-S3 using Lua, focusing on the Xedge IDE's built-in SMTP...

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.