Skip to content
PSUT / IoTEngineering learning studio
WORKSPACE
Offline-first portalDr. Mohammad Alja’afreh
Embedded Systems StudioIoT Programming and ApplicationsExperimentsWorkspaces
ENGINEERING WORKSPACE
Home/Engineering Workspaces/Live MQTT Co-simulation
PSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
LIVE CO-SIMULATION
Supporting engineering workspace

Live IoT Telemetry Studio

Actual received MQTT messages from Wokwi or compatible devices, not generated browser values.

Read-only WSL bridge

Connect to your MQTT session

Offline

Subscription:

Start the local backend first. Subscription is shared by local browser tabs and remains active until stopped or the server exits. Starting a subscription clears previous in-memory records; export first.
Accepted messages0
Rejected payloads0
Retained ignored0

The bridge is an independent subscriber. Successful reception does not verify Node-RED, Telegraf, InfluxDB, Grafana, or physical actuation.

Sensor-driven greenhouse

Live visualization

Fan and pump state unknown: the original firmware does not transmit actuator feedback. Values older than 30 seconds are marked historical, not fresh. Source labels are self-declared; they cannot establish device identity.

Received measurement history

Per device and declared source. Horizontal axis uses bridge receipt time, not sensor acquisition time.

Message inspector

Subscription journal

Recent received records

Receipt time°CRH %Soil %QoSSequence

Up to 600 recent accepted records shared across devices, memory only. No cloud storage. This is not a loss-rate or end-to-end latency measurement: the firmware sends no sequence number or acquisition timestamp.

Deployment / step by step

Connect Wokwi → WSL → website

Existing toolkit and firmware are sufficient. Follow the steps in order. For first-time setup, open the deployment wizard.

1 · Ubuntu Bash — verify the existing environment

Start Ubuntu 24.04. Ensure the toolkit is in your Linux home directory. Use the existing setup page if a dependency is missing.

Ubuntu WSL · Bash
ls ~/psut-wsl
source ~/psut-wsl/activate.sh
python -c "from paho.mqtt.client import CallbackAPIVersion; print('MQTT library ready')"
sudo systemctl start mosquitto
ss -ltn | grep ':1884'
✓ Expected: A listening TCP socket for port 1884 should appear if the local MQTT broker is running.
Expected result for each action (5)
  1. ls ~/psut-wslThe toolkit directory listing includes setup_wsl.sh, labs, tools and wokwi.
  2. source ~/psut-wsl/activate.shThe toolkit virtual environment is selected in this terminal, usually with (.venv) in the prompt. Verify which python points into ~/psut-wsl/.venv.
  3. python -c "from paho.mqtt.client import CallbackAPIVersion; print('MQTT library ready')"The specified success message (paho-mqtt OK or MQTT library ready) is printed if the import succeeds.
  4. sudo systemctl start mosquittoNormally no output on success. Run systemctl is-active for the named service and confirm active; inspect logs if it fails.
  5. ss -ltn | grep ':1884'A listening TCP socket for port 1884 should appear if the local MQTT broker is running.

Expected: Python prints MQTT library ready and Mosquitto listens on port 1884. If systemd is unavailable, follow the setup troubleshooting instructions.

2 · Windows — start the live website

Extract the complete website into a new folder. Stop any existing Studio server on port 8760 by pressing Ctrl+C in its own terminal. Double-click START_LIVE_STUDIO.cmd. It starts the existing AI server using your toolkit's Python virtual environment, so Ollama is not required.

Open http://localhost:8760/live.html. Choose Mosquitto and click Start subscription. Expected: Subscribed (SUBACK accepted). No measurements yet.

3 · Ubuntu Bash — test MQTT before using Wokwi

In a separate Ubuntu terminal publish a single clearly labeled mock message:

Ubuntu WSL · Bash
mosquitto_pub -h 127.0.0.1 -p 1884 -t psut/iot/lab-local/greenhouse/test-node/telemetry -m '{"source":"mock","temperature":25.0,"humidity":60.0,"soil_moisture":42.0}'
✓ Expected: Usually silent on success. Confirm the exact topic and payload in a separate subscriber; this is not proof of database storage.

Expected: test-node / mock appears in the device selector. Optional automated check: double-click TEST_LIVE_MQTT.cmd in the website folder; it performs a separate local publish/subscribe test using the existing toolkit environment. If it does not, inspect SUBACK and verify the exact topic and port. This is a live MQTT test with mock values, not a Wokwi reading.

4 · Windows VS Code — open the existing Wokwi firmware

Open the Windows-side extracted folder psut-wsl/wokwi/esp32-greenhouse in VS Code (not Remote WSL). Verify PlatformIO and Wokwi extensions are installed and licensed if required. The supplied main.cpp uses:

Firmware configuration
BROKER = "host.wokwi.internal"
BROKER_PORT = 1884
STUDENT_ID = "lab-local"
NODE = "esp32-01"
✓ Expected: Use these firmware settings in the existing C++ project; rebuild and verify connection and reception. These are configuration values, not shell commands.

In Windows PowerShell verify access to the WSL broker:

Windows PowerShell
Test-NetConnection localhost -Port 1884
✓ Expected: Look for TcpTestSucceeded : True for the specified port. This proves TCP reachability only.

Expected: TcpTestSucceeded: True. If false, use the existing Setup networking/forwarding instructions. Wokwi uses its private gateway to access the host; do not expose the anonymous broker to the internet. Build the PlatformIO project, then use Wokwi: Start Simulator. Check serial output for Wi-Fi connected, MQTT connected and Publishing to the exact greenhouse topic. See Wokwi project documentation.

5 · Website — observe received Wokwi data

Wait for the firmware's 10-second publishing interval. Select esp32-01 / wokwi in the device selector. Change the DHT22 temperature/humidity and soil potentiometer in Wokwi, then inspect the next received samples, plots and JSON. A fresh sample verifies this subscriber received a message, not that other services did. Stop the subscription when finished.

Related implementation: P43 MQTT/Telegraf · Node-RED · InfluxDB and Grafana.

6 · Optional HiveMQ public demo or hardware source

Only mock or Wokwi demo values may be used on the public broker. Generate a session in Ubuntu:

Ubuntu WSL · Bash
python ~/psut-wsl/tools/mqtt_profile.py hive
✓ Expected: The requested broker profile and matching Node-RED flow are generated under ~/.config/psut-wsl; use the same profile/session in all terminals.

Use the printed STUDENT_ID, BROKER = broker.hivemq.com, and BROKER_PORT = 1883 in a separate firmware copy. Build again. Select HiveMQ in the website; the backend reads the same session file, never subscribes to all public topics. Topics are not authentication or privacy. Use the local profile only for physical hardware; a compatible device must publish the same schema and explicitly declare source hardware. Physical hardware needs a safe network path to the broker; the existing loopback-only listener will not be accessible from a separate device without additional network configuration. No actuator commands are sent by this studio.

Network performance laboratory

Investigate seeded abstract queueing, traffic scalability and QoS trade-offs separately from actual service deployment.

Open Network Lab →

Integrated IoT System Studio

Follow the complete telemetry pipeline, compare live and stored evidence, and investigate controlled failures.

Open integrated system workbench →
V19.6 · Hardware-in-the-loop

Live hardware engineering bench

Private MQTTs gateway, enrolled ESP32/Pi telemetry, bounded LED pulse, virtual comparison and evidence exports.

Open live hardware bench →