3 Free Simulation Tools to Work Around the Global Chip Shortage
Tags: embedded, simulation, iot
Published: 2022-03-25 13:44:47

---
title: 3 Free Simulation Tools to Work Around the Global Chip Shortage
published: true
date: 2022-03-17 19:16:14 UTC
tags: Embedded,simulation,IoT
canonical_url: https://blog.benjamin-cabe.com/2022/03/17/3-free-simulation-tools-to-work-around-the-global-chip-shortage
---

There is something that’s been seriously bothering me ever since I started to work with embedded devices: **trying out new things when you don’t have an actual device at hand is hard**!

Over the years, I’ve had the following happen more often than I care to admit:

1. 💡 Hear about an interesting embedded tool or library ;
2. 🧑‍💻 Check out the provided code samples ;
3. 😔 Realize none work with any combination of the—dozens!—embedded boards and sensors I own ;
4. 🚶‍♂️ Give up…

With the ongoing [global chip shortage](https://en.wikipedia.org/wiki/2020%E2%80%93present_global_chip_shortage), the problem is just so much worse these days. Even if I were to go through the hassle of ordering the required hardware, I would have to face incredibly long lead times—sometimes well over a year!

[![](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/Screenshot-2022-03-11-170537.png)](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/Screenshot-2022-03-11-170537.png)
<figcaption>Do I really want to wait a full year until I get started with my IoT/Embedded project idea?</figcaption>

Luckily, there has been a lot of innovation around making it **easier to simulate embedded hardware** over the past years, and I have found myself using the following tools on a regular basis.

For each, I will (briefly) explain what they do, what I like about them, and I will include a link to a quick demo for you to realize first-hand how much time they can save you!

* * *

[![](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/renode-logo-768x116-1-300x45.png)](https://renode.io/)

## Renode

[**Renode**](https://renode.io/) is an open-source framework that allows you to run, debug and test unmodified embedded software right from your PC.

Out of the box, Renode supports a wide variety of embedded [boards](https://renode.readthedocs.io/en/latest/introduction/supported-boards.html#) and [peripherals](https://renode.readthedocs.io/en/latest/introduction/supported-boards.html#supported-peripherals), with more being added regularly. If the board or peripheral you need is not in the list, there is a good chance they can be added with minimal work. Renode has a really elegant and extensible mechanism to [describe platforms](https://renode.readthedocs.io/en/latest/advanced/platform_description_format.html), as well as to [model peripherals](https://renode.readthedocs.io/en/latest/advanced/writing-peripherals.html).

I am using Renode to drastically simplify and speed up my “inner dev loop” when I build Azure RTOS applications. It can emulate pretty complex peripherals such as LCD touchscreens, which means I can even test my GUIX applications!

[![](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/guix-demo.gif)](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/guix-demo.gif)
<figcaption>Azure RTOS GUIX Home Automation Demo running on a simulated STM32F746G-DISCO board in Renode.</figcaption>

I have to give extra bonus points to Renode for [allowing debugging](https://renode.readthedocs.io/en/latest/debugging/gdb.html) of the simulated code, as well as providing a [complete framework for automated testing](https://renode.readthedocs.io/en/latest/introduction/testing.html).

I have assembled in the [GitHub repository](https://github.com/kartben/azure-rtos-renode-samples) below some examples of Azure RTOS applications running on Renode, including an example showing how to use the testing framework mentioned above.

{% embed https://github.com/kartben/azure-rtos-renode-samples %}

There is a lot more that can be done with Renode (multi-node simulation, networking, …) so I will probably write some more about it in the future.

* * *

[![](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/wokwi-300x71.png)](https://wokwi.com)

## Wokwi

It is becoming increasingly common to **develop right from a web browser**. While it is a significant paradigm shift for long-time embedded developers, it also brings tons of benefits and makes it much easier to setup reproducible (and versioned!) development environments and toolchains. In fact, I already spoke about this a while ago in [this video](https://www.youtube.com/watch?v=-enIM4x-KPA) 😊.

[**Wokwi**](https://wokwi.com/)is a web-based hardware simulation environment that can be used to simulate a wide variety of micro-controllers (Arduino Uno, ESP32, Raspberry Pi Pico, …) , electronic parts, sensors, and actuators.

[![](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/image-1024x701.png)](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/image.png)

At first sight, Wokwi feels like a tool that is only targeting “hobbyists”, but it is in fact really powerful and so much more than a toy (for example, it too does come with [debugging support](https://docs.wokwi.com/gdb-debugging))! It comes with an online web IDE that resembles the Arduino IDE, but you can also bring your pre-compiled ELF binary if you want to keep using your usual development environment.

Beyond the fact that Wokwi “just works” and the fact that **sharing a project with someone is as simple as giving them the URL to access it** (!), I really love the following Wokwi features:

[![](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/image-3.png)](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/image-3.png)
<figcaption>Example of Wokwi’s Logic Analyzer capturing the I2C traffic between the MCU and an RTC (real-time clock) module.An external tool such as PulseView can then read and decode the captured traffic.</figcaption>

- [**Logic analyzer**](https://docs.wokwi.com/guides/logic-analyzer) for capturing/debugging the various signals in your system (ex. I<sup>2</sup>C or SPI traffic)

- [**Network traffic capture**](https://docs.wokwi.com/guides/esp32-wifi#viewing-wifi-traffic-with-wireshark) for analyzing Wi-Fi traffic in Wireshark. You can e.g. troubleshoot the connection to your IoT cloud, something that’s pretty cumbersome or even impossible to do when running on “real” hardware.

When you use Wokwi to simulate an ESP32 application, you can actually connect to a Wi-Fi, right from within the simulation. Your application may simply connect to the simulated “Wokwi-GUEST” WLAN to access the Internet. Pretty convenient for simulating your next IoT project, eh?

As a way to show you how much easier things are when you don’t have to worry about the hardware, you may check out [this Wokwi project](https://wokwi.com/projects/322313026680128082).

[![](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/wokwi-azure-iot-central-1024x520.png)](https://wokwi.com/projects/322313026680128082)

It is showing the [official Azure IoT Central sample code application for ESP32](https://github.com/Azure/azure-sdk-for-c-arduino/tree/main/examples/Azure_IoT_Central_ESP32), running in a fully simulated environment. Getting the sample to run is really straightforward:

1. Create an Azure IoT Central Application, if need, and provision a new device, as per the [sample’s instructions](https://github.com/Azure/azure-sdk-for-c-arduino/tree/main/examples/Azure_IoT_Central_ESP32#create-the-iot-central-application).
2. Enter your Azure IoT Central and device information into the sample’s `iot_configs.h`.
3. Run the simulation! The application will automatically get compiled by Wokwi, and then run within your browser.

As the application starts, the simulated device will attach to the—simulated—wireless network, and will show up shortly thereafter in Azure IoT Central.

You will be able to interact with the LEDs or the LCD display by sending commands from Azure IoT Central, as well as see the telemetry corresponding to the various sensors (you can control what “fake” temperature, acceleration data, etc. the sensors are reporting by clicking on them in the Web interface.

* * *

[![](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/1200px-Logo-tinkercad-wordmark.svg_-300x98.png)](https://tinkercad.com/)

## TinkerCAD

[![](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/image-4-1-218x300.png)](https://blog.benjamin-cabe.com/wp-content/uploads/2022/03/image-4-1.png)
<figcaption>TinkerCAD’s circuit simulator is the perfect companion to ensure you don’t fry the actual components of your next project.</figcaption>

I discovered [**TinkerCAD**](https://www.tinkercad.com/)‘s circuit simulation capabilities only recently. Compared to Renode and Wokwi, TinkerCAD will get you the closest to the “metal”. It helps validate the circuit down to making sure you have the wiring 100% correct, and do not risk frying a component due to a missing resistor!

TinkerCAD lets you simulate Arduino UNO and micro:bit-based circuits, but I must admit that I haven’t spent a lot of time using it for actual projects just yet. The fact that it doesn’t allow to simulate network communications makes it a bit impractical for IoT scenarios anyway. However, there are some great projects in the [online gallery](https://www.tinkercad.com/things?type=circuits&view_mode=default) that should give you a sense of what the tool is capable of.

* * *

I highly recommend you give these amazing (and did I mention _free_?) tools a try.

You should be able to get all the examples I shared up and running in no time, which I hope is making my point regarding how much of a time-saver they can be.

I would also love to hear about other simulation/emulations tools out there that you may be using to speed up your embedded & IoT development workflow—just let me know in the comments!