A simulated board talks to IoT Platform exactly like a real ESP32: over MQTT (telemetry, desired state, commands, status, firmware report, rule JSON) and HTTP (telemetry, camera pictures). Everything you see on the platform (dashboards, charts, rules, alarms) works with it.
Your devices
Signed in, the top bar has ๐ Devices. It lists your IoT Platform devices and the devices shared with you, with a dot showing whether each is online. For each device there are three buttons:
| Button | What it does |
|---|---|
| Open template | Opens the platform's firmware template for the device, with the server, broker, topic prefix and access token already filled in, on the matching board: ESP32-CAM devices get the camera template, ESP32-C3 OLED devices the OLED template, the others the ESP32 MQTT template. ESP8266 devices get the simulator's NodeMCU sketch with a DHT11 and an LED. It replaces the sketch and parts (you are asked first). |
| Template + variables | The same template, plus a part and its code for every variable of the device
that the template does not handle yet: a temperature and humidity variable gets a DHT22, lux a BH1750, a distance
in cm an HC-SR04, a pump or fan a relay, an angle a servo, and so on. Variables it cannot guess become a potentiometer. The
added code is marked // ---- added by MCU Simulator for the device variables. Needs a device with variables. |
| Token only | Keeps your sketch and writes the device's token, topic prefix and broker into its constants
(TOKEN, TOPIC_PREFIX, MQTT_HOST, MQTT_PORT, USE_TLS, SERVER); a sketch without
them gets the token copied to the clipboard. The board follows the device's board type. |
All three also use the device's MAC address for the simulated board. A device you can only view has no token for you: ask its owner to make you an editor.
The first time, IoT Platform asks you to allow the simulator to read your devices. If you signed in before that, the list shows Allow on IoT Platform: you stay signed in and are asked once.
Your first device on the platform
- On IoT Platform, create a device and give it a variable or two (for example
temperatureยฐC andlamp). - In the simulator, ๐ Devices โ Template + variables next to the device.
- Press โถ Run. The serial monitor shows Wi-Fi and MQTT connecting, the MQTT chip turns green, and the device becomes online on the platform.
- Move the temperature slider of the added sensor: the new value appears on the platform's dashboard. Switch
lampon the platform: the LED lights up in the simulator.
Topics and messages
The templates use the platform's MQTT topics, all under <prefix>/<token>/:
| Topic | Direction | Meaning |
|---|---|---|
telemetry | board โ platform | measured values, JSON such as {"temperature": 24.5} |
desired | platform โ board (retained) | the state the board should have, e.g. {"lamp": 1} |
commands/<id>, commands/<id>/response | both | a command and the board's answer; a command past its expires_at is not carried out |
status | board โ platform (retained) | online, and offline as Last Will when the board goes away |
firmware | board โ platform | firmware name and version, board, MAC address |
rules/<id>, rules/<id>/ack | both | rule JSON published from the platform, and the board's receipt |
errors | platform โ board | what the platform could not accept |
On the platform's broker the username and password are the device's access token, and the topics must contain it: a
wrong token gives state 5 (not authorised), as on a real board.
Camera pictures (ESP32-CAM)
With an ESP32-CAM device, Open template gives the platform's camera template on the ESP32-CAM board. The
Capture now button on the platform sends the capture command: the board takes a picture (test pattern or your
camera), uploads it to /api/v1/<token>/snapshot and answers with the picture's id. The flash, frame size,
quality and snapshot interval can be set from the platform.
HTTP instead of MQTT
Example iot_platform_http.ino sends telemetry with HTTPClient to
/api/v1/<token>/telemetry. HTTP requests go through the simulator server, see
Network.
What differs from a real board
- Firmware updates (OTA) are refused: the template reports the update as
FAILEDwith OTA is not supported in the simulator. - CoAP is not available (a browser cannot send UDP); use MQTT or HTTP.
- HTTP requests reach the platform from the simulator server's address, not from your computer.