Skip to main content

ESP32 Simulation

The ESP32 is a popular WiFi and Bluetooth-enabled microcontroller, widely used for IoT Projects. Wokwi simulates the ESP32, ESP32-C3, ESP32-S2, ESP32-S3, ESP32-C6 (beta), and ESP32-H2 (alpha).

ESP32 boards

NameChipDescription
ESP32 DevKit v1ESP32Popular ESP32 development board
ESP32-S2-DevKitM-1ESP32-S2Entry-level ESP32-S2 development board
Franzininho WiFiESP32-S2Board by the Franzininho Community
Wemos S2 miniESP32-S2Small ESP32-S2 board by Wemos
ESP32-S3-DevKitC-1ESP32-S3Entry-level ESP32-S3 development board
ESP32-C3-DevKitM-1ESP32-C3Entry-level ESP32-C3 development board
Rust Board ESP32-C3ESP32-C3ESP32-C3 board designed for Rust trainings
ESP32-C6-DevKitC-1ESP32-C6Entry-level ESP32-C6 development board (beta)
ESP32-H2-DevKitM-1ESP32-H2Entry-level ESP32-H2 development board (alpha)

You can contribute additional boards by sending a pull request to wokwi-boards.

Getting Started

You can use the ESP32 simulator to run different kinds of applications:

  1. ESP32 Arduino Core projects (including ESP-IDF projects)
  2. MicroPython and CircuitPython projects (examples at https://wokwi.com/micropython)
  3. Rust projects (see https://wokwi.com/rust)
  4. Custom application firmware files (e.g. applications built using the ESP-IDF)

Arduino Core

Start from the Arduino-ESP32 Project Template, or from the ESP32 Blink Example.

If you want to use third-party Arduino libraries, add a libraries.txt file with the list of libraries that you use.

MicroPython

Start from the MicroPython ESP32 Project Template, or from the MicroPython ESP32 Blink Example.

Note: While the simulation is running, press Ctrl+C inside the Serial Terminal to get into the MicroPython REPL. Alternatively, you can edit the Blink Example code and remove the while loop. For more information, check out the MicroPython Guide.

Custom Application Firmware

Open the ESP32 custom application project template, and press "F1" in the code editor. Then choose "Upload Firmware and Start Simulation…". Choose any .bin, .elf or .uf2 file from your computer and the simulation will start.

info

When uploading a custom firmware, it's recommended to create a single .bin file that contains the bootloader, partition table, and application. You can use the esptool merge_bin command to create such file.

For ESP-IDF projects, you can also build a single UF2 file using the command: idf.py uf2. The file will be located in build/uf2.bin, and can be uploaded to the simulator.

Simulator Examples

Arduino Examples

MicroPython Examples

ESP-IDF Examples

The following examples use the ESP-IDF functions. They are compiled using Arduino ESP32 Core:

Sming Framework

Follow this guide to simulate Sming Framework projects.

Simulation Features

PeripheralESP32S2S3C3C6Notes
Processor core(s)✔️✔️✔️✔️✔️
GPIO✔️✔️✔️✔️✔️Interrupts supported
IOMUX✔️✔️✔️✔️✔️
PSRAM✔️✔️✔️4MB of external SRAM *
UART✔️✔️✔️✔️✔️
USB✔️✔️Support for UART over USB (CDC)
USB Serial + JTAG✔️✔️✔️Serial supported, JTAG not.
I2C✔️✔️✔️✔️✔️Master only. 10-bit addressing not supported.
I2SOpen for voting
SPI✔️✔️✔️✔️✔️
TWAI
RMT🟡🟡🟡🟡🟡Transmit-only, use to control NeoPixels
LEDC PWM✔️✔️✔️✔️✔️Used by analogWrite(), Servo, Buzzer, etc.
MCPWM
DMA✔️✔️✔️✔️✔️
WiFi✔️✔️✔️✔️✔️See the ESP32 WiFi Guide
BluetoothOpen for voting
Timers✔️✔️✔️✔️✔️
Watchdog
RTC🟡🟡🟡🟡🟡Only RTC Pull-up / Pull-down resistors
ADC✔️✔️✔️✔️✔️Note: analogRead() returns values up to 4095
RNG✔️✔️✔️✔️✔️Random Number Generator
AES Accelerator✔️✔️✔️✔️✔️
SHA Accelerator✔️✔️✔️✔️✔️
RSA Accelerator✔️✔️✔️✔️✔️
ECC Accelerator✔️
Hall Effect Sensor
ULP Processor✔️
GDB Debugging✔️✔️✔️✔️✔️Works with Wokwi for VS Code

Legend:
✔️ - Simulated
🟡 - Partial implementation/work in progress
❌ - Not implemented (but if you need it, please open a feature request)
— - Not available on this chip

* The amount of SRAM can be customized using the "psramSize" attribute.

WiFi Simulation

See the ESP32 WiFi Guide.

Advanced Usage

Flash and memory size

You can customize the size of flash and PSRAM by adding the following attributes to the chip:

AttributeDescriptionDefault
flashSizeFlash size in MB. Valid values: "2", "4", "8", "16", "32"."4"
psramSizePSRAM size in MB. Valid values: "2", "4", "8"."4"

Custom Partition Table

You can specifiy a custom partititon table by adding a "partitions.csv" file to your project. Check out the ESP32 Partition Table Guide for the exact format of this file.

Custom firmware offset

When loading a custom firmware, you can specify the offset of the firmware in the flash memory. By default, Wokwi will look at the firmware binary and try to figure out the offset automatically, based on the presence of the bootloader and the type of the chip. If Wokwi can't figure out the offset, it will assume that your firmware is an application firmware and load it at offset 0x10000.

You can specify the offset manually by adding the following attribute to the chip:

AttributeDescriptionDefault
firmwareOffsetOffset of the firmware in the flash memory, in bytes.""

Changing the MAC address

You can change the MAC address of the WiFi interface by adding the following attribute to the chip:

AttributeDescriptionDefault
macAddressMAC address of the WiFi interface, e.g. "24:0a:c4:12:45:56""24:0a:c4:00:01:10"