Skip to content

ESP32 Simulation in the Browser

ESP32 Simulation in the Browser

Wokwi (wokwi.com) is the most useful “run real ESP32 code in a browser” tool today: it simulates firmware execution, not just volts and amps — you write Arduino/ESP-IDF-style code, wire up virtual LEDs, buttons, OLEDs, sensors, and Wi-Fi, and see whether the logic holds. For product validation, teaching, and showing a customer a working concept, it turns “I have not fabbed the board yet” into “I am already running the logic”. This section covers Wokwi’s capability boundary, typical uses, and which conclusions must not be taken as real. By the end you will be able to:

  • Build a principle validation of ESP32 plus peripherals in Wokwi and prove the software path
  • Judge which peripherals and timings to trust in simulation and which need hardware
  • Use Wokwi for collaboration (shareable, embeddable links) and teaching
  • Design a simulation-to-hardware comparison so simulation does not give false positives
  • Completed Chapter 22 Section 1 (Falstad — the circuit-level vs code-level split)
  • Basic C/Arduino or MicroPython syntax
  • A piece of application logic to verify (e.g. button debounce + state machine + reporting)

Wokwi simulates “the program running”, not “the current flowing”

Section titled “Wokwi simulates “the program running”, not “the current flowing””
Wokwi is good at Wokwi is not trustworthy for
Firmware logic, state machines, task scheduling Real analogue accuracy (ADC noise, divider error)
Digital peripheral interaction (button, LED, I²C/SPI device behaviour models) Power integrity, voltage drop, power-up sequencing
Demonstrating “does Wi-Fi/MQTT connect” RF performance, real throughput and disconnect behaviour
Timing logic (debounce window, timeout, retry) Nanosecond timing and signal integrity
Fast, shareable concept demos Power draw, heating, EMC

Core discipline: Wokwi validates “is the logic and protocol interaction correct”, not “is the hardware well built”. Any conclusion that depends on electrical reality goes back to the board.

  1. Fast software-path validation: before the board arrives, run the sensor read → filter → decide → report chain, and lock the logic and API shape early
  2. Virtual peripheral assembly: DHT22, SSD1306 OLED, servo, motor, I²C devices connected from the part library, validating wiring and init order
  3. Collaboration and review: send the project link; the colleague runs it, changes parameters, and reproduces the issue in the browser — faster than shipping a zip to compile
  4. Teaching and pre-sales: show someone with no environment at all “an ESP32 can be used like this” — a lead-capture handle
  • Built-in boards: several ESP32 variants (including S2/S3/C3 class) and common modules
  • Custom parts: diagram.json describes wiring and virtual elements; complex devices can use custom WASM parts (advanced)
  • Sensor injection: many parts let you change values live on the panel (temperature, light, button) to simulate input variation

Treat simulation as the first filter, not the destination:

  1. After locking logic and interfaces in Wokwi, write an “expected hardware behaviour” list
  2. When the board lands, rerun the same cases and check item by item — differences are either electrical effects the simulation did not model or environment differences
  3. For every “passed in sim, failed on hardware” case, classify it into power / timing / accuracy / protocol-implementation difference and write it back to the design notes

[Needs real-hardware cross-check] The fidelity of specific ESP32 variants in Wokwi and the accuracy of real peripheral models can only be quantified after comparing against board and firmware.

Check Expected result Verified
Software path runs in Wokwi No crash, state machine transitions as expected
Virtual peripheral init order I²C/SPI devices enumerate correctly in sim
Expected-hardware-behaviour list Records which conclusions need hardware re-check
Comparison experiment Hardware reruns same cases, differences classified
Collaboration link runs Others open the link and reproduce directly

Issue 1: all good in sim, sensor unreadable on hardware

Section titled “Issue 1: all good in sim, sensor unreadable on hardware”

Cause: Wokwi uses idealised device models, ignoring real pull-ups, addresses, supply and init timing.

Action: treat I²C address, pull-up resistors, and power-enable pins as must-check-on-hardware items and confirm each against the datasheet.

Issue 2: wanting to validate analogue accuracy or power draw

Section titled “Issue 2: wanting to validate analogue accuracy or power draw”

Cause: wrong tool; these are not Wokwi’s strengths.

Action: analogue accuracy — Falstad for trend plus a hardware calibration; power draw must be measured on the real board with a current meter.

  • Do: lock logic and protocol interaction in Wokwi, leave electrical-truth conclusions to hardware
  • Do: keep a “passed in sim” list and compare each to hardware, classifying differences
  • Do: use shareable links for collaboration, review, and pre-sales demos
  • Don’t: take Wokwi’s ADC/timing/power readings as performance conclusions
  • Don’t: equate “runs in sim” with “the board will definitely work”

Key points of this section:

  1. Wokwi simulates the program running, not current flowing: strong on logic/protocol/timing, weak on electrical reality
  2. It is a pre-fab logic-locking tool, turning wait time into validation time
  3. Shareable links serve collaboration, review, and pre-sales
  4. The comparison experiment is the discipline: simulation is the first filter; only hardware re-check and classified differences make a conclusion
  5. Analogue accuracy, power, RF must go back to hardware, never taken from sim

Building a commercial IoT product?

We provide ESP32 ODM design-to-manufacturing services. From prototype to production — the team behind this tutorial can build it with you.

💡 Mention tutorial.imagrove.com in your Alibaba chat with us — get 10% off your custom project quote.

Talk to us →

First published attutorial.imagrove.com/kicad-hardware-design/02-esp32-simulation-in-the-browser/Please credit Imagrove and link back to this page when quoting or republishing.

Questions or issues with this tutorial?

Sign in with GitHub to leave a comment. If a step fails for you, tell us — we verify it and update the tutorial.