Wokwi - An Amazing Free Online Microcontroller Simulator

Wokwi is an amazing free online microcontroller simulator. You choose your parts. Draw virtual wires and write a program. It seems to have a few rough edges but can be fun and educational. I spend a couple of minutes at the end of my class lectures doing a demo of these projects that you can run by clicking the link below and clicking the Play triangle button.

To simulate a obstacle avoiding robot with a distance sensor mounted on a servo for a robotics camp that I am running, I developed the following. Distance are simulated with random numbers.

My own Pac-Man!

5 Likes

This was one of my favorite parts of the ESP8266 class!

1 Like

Considering that this was no more than four minutes, that quite a complement! Thanks!

I don’t really teach this segment. I just do a ten thousand foot flyover to let students know what’s available in the virtual world before we start connecting physical components together.

Wokwi is truly amazing.

Lately I’ve been rabbit-holing with RISC-V assembly language. My interest was driven by, among other things, the introduction of ESP32 derivatives (ESP32-C3 and ESP32-C6) with RISC-V cores.

I discovered that Wokwi supported these ESP32 RISC-V chips, so I thought I’d see if I could use inline assembly code to blink the LED on the following ESP32-C3 Wokwi project.

A link to the modified version with the in-line assembly code is given below. The hardest part was figuring out how to connect the assembly code to the C++ code. After lots of googling and many restarts, a working solution was found.

Many different things were tried before the LED actually blinked. As a result, there are 3 different assembly code techniques to access the LED. Each can be tried by changing the jump target in the following line.

        "beq zero, zero, option3 \n"  // jump targest: option1, option2, or option3

Here’s the modified project. This app alternately displays a brief local weather message. Note that the location and time settings have been changed in the code to pull weather for Dallas (Little Elm) and use Dallas time.

If you run either the original or modified example and get nothing but period chars on the LCD display, this probably means the server is too busy and can’t make the virtual wifi connection. The only option I found was try again later.

NOTE: Use of inline assembly was inspired by collaboration with @themitch22 to configure a peripheral to deliver an inverted signal, when this feature wasn’t yet supported in microPython. Kudos, Mitch!

Assembly language is so much fun. One never has to worry about what’s going on under the hood because…you’re under the hood :slight_smile:

2 Likes

Really nice overview of Wokwi by Andreas Spiess. Just released on November 26.

Spiess has some good videos but he’s such an Arduino IDE fanboy it makes me crazy. The Arduino IDE is the most abysmal IDE I’ve ever used!

1 Like

While I do not disagree with you at all, I used the Arduino IDE for all my Arduino Nano, ATtiny85 and ESP8266 classes and would do so again if I go back to those microcontrollers. The reason is that I target my classes to beginners. If you look at intro level YouTubes, they are heavily oriented to the Arduino IDE. If they talk to friends, again, they are likely to be using the same.

I consider myself to be the unofficial DMS electronics training cheerleader. If you or anyone else offered a class on another product, I would be on the front row and would likely start using it at home. But I would still use Arduino IDE in classes.

I like The Guy With The Swiss Accent also.