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

Controlling an LED with a Snap Using the KY-037 Sound Sensor and Raspberry Pi

Controlling an LED with a Snap Using the KY-037 Sound Sensor and Raspberry Pi

Discover how to set up, code, and activate the LED based on detected sound with the Raspberry Pi...

Getting Started with the KY-037 Sound Sensor and Raspberry Pi: Detecting Sound Using Python

Getting Started with the KY-037 Sound Sensor and Raspberry Pi: Detecting Sound Using Python

In this tutorial, I’ll guide you through setting up the KY-037 sound sensor with a Raspberry Pi using...

How to Post to Reddit Using Python

How to Post to Reddit Using Python

Post to reddit automatically using a Python script.

How to Create a Time-Lapse Video with a Raspberry Pi Camera

How to Create a Time-Lapse Video with a Raspberry Pi Camera

Learn how to make a timelapse with your Raspberry Pi in Python.

How to Integrate the MPU6050 with the STM32 Blue Pill

How to Integrate the MPU6050 with the STM32 Blue Pill

Learn how to measure acceleration with the STM32 and the MPU6050 in the Arduino IDE.

Getting Started with STM32 Blue Pill in Arduino IDE Using a USB to TTL Converter — Write Your First Program

Getting Started with STM32 Blue Pill in Arduino IDE Using a USB to TTL Converter — Write Your First Program

This comprehensive tutorial will guide you through the process of setting up and programming the STM32 Blue Pill...

Automate Task Scheduling in AWS with Lambda, Step Functions, and CloudWatch

Automate Task Scheduling in AWS with Lambda, Step Functions, and CloudWatch

In this tutorial, I'll show you how to automatically schedule tasks in AWS at regular intervals using AWS...

Implementing Google reCAPTCHA in a Simple React and Node.js App

Implementing Google reCAPTCHA in a Simple React and Node.js App

Learn how to protect your React applications from bots and spam with Google reCAPTCHA integration! This step-by-step tutorial...

AWS Lambda Tutorial: Using Selenium with Chromedriver in Python

AWS Lambda Tutorial: Using Selenium with Chromedriver in Python

In this tutorial, I will guide you through the process of running Selenium with ChromeDriver inside an AWS...

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.

Back to blog

Leave a comment

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