MCU Simulator Robotic and Embedded System Laboratory
← Open the simulator
Documentation

Getting started

What the MCU Simulator does, signing in, and your first sketch running in a minute.

The MCU Simulator runs Arduino sketches for ESP32, ESP8266, Arduino UNO and Nano, Raspberry Pi Pico W and STM32 boards in your web browser. You wire LEDs, buttons, sensors, displays and other parts to a simulated board, run your code, and watch it work, without any hardware. The simulated board can connect to IoT Platform exactly like a real one: it sends telemetry, receives commands, and uploads camera pictures. Nothing needs to be installed.

What you can do

  • Write Arduino code (C++) in an editor with autocomplete, and run it on thirteen boards: seven ESP32 and ESP8266 boards, Arduino UNO R3 and Nano, Raspberry Pi Pico W, and the STM32 Blue Pill, Black Pill and Nucleo-F401RE. See Boards.
  • Add parts from a list of 48: LEDs, relays, motors, buttons, sensors, displays, RFID, GPS, SD card and more. Real Arduino libraries talk to them, as on a real board. See Parts reference.
  • See the circuit three ways: the parts list, a wiring Diagram, and a Schematic. All three show the same circuit and change together.
  • Connect to IoT Platform over MQTT and HTTP with your own devices, using the platform's firmware templates. See Connecting to IoT Platform.
  • Save projects on the simulator, or export them as a file.

Signing in

On the simulator's home page choose Sign in with IoT Platform and sign in with your IoT Platform account; there is no second password. New to IoT Platform? Create account opens its sign-up page. The first time, IoT Platform asks you to allow the simulator to read your devices: this is what fills in device tokens for you. You can revoke this any time on IoT Platform under My profile → Connected apps.

This documentation can be read without signing in.

Your first sketch in a minute

  1. In the top bar, choose the example blink.ino under Example. The editor shows the sketch and the board panel shows an ESP32 DevKit.
  2. Press ▶ Run (or Ctrl+Enter in the editor). The sketch is compiled on the server, which takes a few seconds the first time, then runs in your browser.
  3. The built-in LED on the board blinks, and the Serial monitor shows what the sketch prints with Serial.println().
  4. Change delay(500) to delay(100) and press Run again: the LED blinks faster.
  5. Press ■ Stop to stop the board.

The examples come with their parts already wired. Try smart_garden.ino (sensors, relay, LCD) or iot_platform_mqtt.ino (talks to IoT Platform).

Add a part

  1. Below the board, under Parts, choose LED and press + Add. With Auto-wire the LED is connected to a free GPIO and to ground at once.
  2. The part's card shows its pin, e.g. GPIO 13. Change the sketch to blink that pin (pinMode(13, OUTPUT), digitalWrite(13, HIGH)) and press Run.
  3. Open the Diagram or Schematic tab above the editor to see the wiring; the LED lights up there too while the sketch runs.

How it works

Your sketch is compiled on the server into WebAssembly together with a copy of the Arduino and ESP32 libraries made for the simulator. It then runs in your browser, in the background of the page. The server only compiles: your program never runs on the server. Network access from the sketch goes the way a browser can: MQTT over WebSocket, and HTTP through the simulator server to a list of allowed hosts (see Network).

The simulator behaves like the real chips where it matters for learning: input-only pins cannot drive an LED, ADC2 pins read 0 while Wi-Fi is on, the MQTT library has a 256-byte buffer, and a wrong device token gives the same error as on a real board.