wokwi.toml- a configuration file that tells Wokwi how to run your project.diagram.json- a diagram file that describes the circuit.
wokwi.toml
A basicwokwi.toml file looks like this:
| Board | Supported firmware types |
|---|---|
| Arduino Uno/Mega, ATtiny85 | .hex, .elf |
| Raspberry Pi Pico | .hex, .uf2, .elf |
| ESP32 Family | .bin, .uf2, .elf, flasher_args.json |
| STM32 Family | .hex, .bin, .elf |
elf field is optional, but providing it can speed up the simulation in some cases.
You can test your configuration by pressing F1 and then selecting “Wokwi: Start Simulator”. Make sure you compile your program before starting the simulation.
ESP-IDF Support
For ESP-IDF apps, setfirmware to 'build/flasher_args.json' to automatically load the complete application (including the bootloader and partition table) to ESP32. The flasher_args.json file is automatically generated by the idf.py build command.
Logic Analyzer VCD Export
If your diagram includes a Logic Analyzer, Wokwi automatically saves the captured signals to a VCD file when the simulation stops. By default, the file is saved aswokwi.vcd in your project root.
You can customize the output path by adding the following to your wokwi.toml file:
Serial Port Forwarding
Wokwi for VS Code allows you to connect to the serial port of the simulated microcontroller using an RFC2217 TCP server. To enable this feature, add the following configuration to your wokwi.toml file, inside the[wokwi] section:
- Serial Monitor extension (select TCP monitor mode)
- PuTTY (select Telnet connection type)
- PySerial’s RFC2217 support to connect from Python code:
Make sure the simulator tab is visible in VS Code, otherwise the simulation may pause and you won’t get any serial output from the microcontroller.
IoT Gateway (ESP32 WiFi)
Wokwi for VS Code includes a bundled version of the Wokwi Private IoT Gateway, which allows you to connect the virtual WiFi of the simulated ESP32 to your local network and the Internet. You can also connect to the simulated ESP from your computer (e.g. you are running a web server on the ESP32). To do so, set up port forwarding in wokwi.toml. For instance, to forward local port 8180 to port 80 on the ESP32, add the following configuration:[[net.forward]] sections.
For a complete example, see the ESP32 Web Server project.
Custom Chips
You can load custom chips to the simulation by adding[[chip]] sections to your wokwi.toml configuration. The following example will load a chip from “chips/inverter.chip.wasm” and make it available under the name chip-inverter in Wokwi’s diagram:
chips/inverter.chip.json in the above example). For a complete example, check out the inverter-chip repo.
You can add multiple chips to your project by adding multiple [[chip]] sections, each with a different name and binary.