Lab: Telemetry Pipeline and MQTT on Twin
Companion videos
Watch on YouTube (opens in a new tab)
-
BS-10: MQTT Publisher & Subscriber Asst. Prof. Dr. Santi Nuratch (KMUTT)
Videos by Asst. Prof. Dr. Santi Nuratch, Department of Control Systems and Instrumentation Engineering, Faculty of Engineering, King Mongkut's University of Technology Thonburi (KMUTT) · The whole series in the playlist AIoT Foundation
Course 2 · Module 5 Type: Hands-on (classify · Live Data quality · MQTT pub/sub · fault injection) Suggested time: ~3.5–4 hours
Read first: Lesson · Lab notes · ← Table of Contents · ← M04 · M06 →
Useful references during the lab
Section titled “Useful references during the lab”| Document | Use when |
|---|---|
| M04 lab · the ex05 walkthrough | The basic Live Data consumer |
| Course 1 M06 | MQTT on the firmware / QoS |
Hackathon web-app/ |
ex08, ex09–ex15 |
| Bitstream Studio | Start broker · Twin publish |
Lab Goals
Section titled “Lab Goals”- Separate and send at least one instance each of the Telemetry / State / Event concepts
- Check on a dashboard or a subscriber that the fields/units are correct
- Start an MQTT broker in Studio and complete at least one pub/sub pair
- Try at least one lossy / disconnect / schema-break case
- Fill in telemetry-mqtt-lab-notes.md
Prerequisites
Section titled “Prerequisites”- M04’s bring-up passed (a stable Link · know Simulator XOR Bitstream)
- The Hackathon folder has
web-app/ - Know how to Serve Web App Folder over HTTP (M04)
- A
lab-notes/folder for evidence
Lab A — Classify & design topics (required)
Section titled “Lab A — Classify & design topics (required)”Design (on paper, or in the lab notes):
- Telemetry — a topic + one example JSON block + an approximate rate
- State — a topic + when it will be sent (a mode change / LED / Link)
- Event — a topic or event name + a short condition
You may use the example structure from the lesson, such as:
device/<id>/devkit-twin/telemetrydevice/<id>/statedevice/<id>/event/<name>Pass when: a teammate reads the topic and correctly guesses the data type, without having to guess from the payload alone
Lab B — Live Data quality with ex08 (required)
Section titled “Lab B — Live Data quality with ex08 (required)”- Link Studio (a single mode)
- Serve
web-app/→ openex08_stale_and_route.html - Note the
route,COM open,last origin - Make at least one sensor go stale, then return to fresh
- Take a screenshot of the event log + pills
Pass when: you can explain that stale is a host-side Event when telemetry has a gap — and the origin matches Studio’s mode
Lab C — MQTT broker + ex09 subscriber (required)
Section titled “Lab C — MQTT broker + ex09 subscriber (required)”- In Bitstream Studio: Start broker
- Open
ex09_mqtt_subscriber.html— wait forconnected - Publish to the topic the web page subscribes to (default
device/devkit-twin-01/devkit-twin/telemetry, or per?device=/?topic=)- Publish source: the DevKit Twin MQTT tab / Sensor Studio connectivity / another tool you have
- Confirm Last payload’s fields and units match
- Take a paired screenshot: the publish source + the ex09 page
Pass when: the message count is ≥ 1, and the JSON can be explained as Telemetry (or the intended type)
Lab D — Pipeline / schema drill (recommended)
Section titled “Lab D — Pipeline / schema drill (recommended)”Choose at least one:
- Remove a field from the payload and see exactly where the subscriber/dashboard breaks
- Deliberately send the wrong unit, and note that the UI “still looks fine but means the wrong thing”
- Open ex14 and try QoS + retain on
lab/qos-demo, then have a friend open a subscriber (such as ex11) after you’ve retained a message
Pass when: there is at least one line of “what broke / what didn’t” in the lab notes
Lab E — Lossy / reconnect (recommended — part of the complete deliverable)
Section titled “Lab E — Lossy / reconnect (recommended — part of the complete deliverable)”Choose at least one case, and fill in the table in the lab notes:
| Case | Example way to do it |
|---|---|
| Stop / Start the broker briefly | Watch ex09 go reconnecting → connected |
| Briefly stop the publisher | Watch for a gap · or ex08’s stale |
| Close the ex09 tab and reopen it | If a state topic has retain — do you get the latest value or not? |
Pass when: you can name the behaviour seen (drop / retry / reconnect / stale) without guessing
Lab F — Optional ladder
Section titled “Lab F — Optional ladder”If time remains, choose more:
- ex10 publishing from the browser
- ex12 gauges
- ex15 a combined dashboard
- Publishing from real firmware after Wi‑Fi (C1 M06) into the lab’s broker
Deliverables checklist
Section titled “Deliverables checklist”- Labs A–C passed
- Lab E (or at least Lab D, if time is short)
- telemetry-mqtt-lab-notes.md filled in completely
- Screenshot evidence: ex08 + ex09 (+ schema/lossy, per what you did)
Troubleshooting
Section titled “Troubleshooting”| Symptom | Approach |
|---|---|
| ex08 is disconnected | Studio/the bridge · serve the correct web-app/ folder |
| ex09 is stuck connecting | Start broker · check ws://127.0.0.1:8883/mqtt |
| connected, but Waiting for messages | No publisher exists yet · the topic doesn’t match · check ?device= / ?topic= |
| Live Data is fine, MQTT is empty | Different pipes — don’t fix the firmware before checking the broker/topic |
| The origin is confusing | Don’t mix Simulator + Bitstream · clear it and Link fresh |
| Retain makes a value “stuck” | Check you’re experimenting on the lab topic, not a dense telemetry one |
Lesson · Lab notes · Table of Contents · M06 →
Cite this lesson
If you teach from this lesson or reuse it in slides or documents, credit it with the text below. If you changed it, add (adapted) after the title.
"Lab: Telemetry Pipeline and MQTT on Twin" from TESA Open Knowledge by the Thai Embedded Systems Association (TESA), https://github.com/tesaiot/tesa-qualification-program, licensed under CC BY-NC 4.0
Thai attribution: "แล็บ: ท่อ telemetry และ MQTT บน Twin" จาก TESA Open Knowledge โดยสมาคมสมองกลฝังตัวไทย (Thai Embedded Systems Association: TESA) https://github.com/tesaiot/tesa-qualification-program สัญญาอนุญาต CC BY-NC 4.0
Lesson link: https://tesaiot.github.io/tesa-qualification-program/en/courses/digital-twin/m05-telemetry-cloud/l02-lab/
This lesson adapts the source below; keep its credit too.
https://github.com/drsanti/TESAIoT-Courses/blob/287c21814ba8c75f693136616dcd270349a15966/C2/M05/lab.md · Original content by Asst. Prof. Dr. Santi Nuratch (ผศ.ดร.สันติ นุราช), KMUTT. Course 2 (C2/) of drsanti/TESAIoT-Courses. TESA funded the work and holds the rights; published here under CC BY-NC 4.0. The upstream repository carries no licence file. Text kept faithful; structure, front matter, quizzes and notes added by TESA Open Knowledge.
TESA Open Knowledge · © 2026 สมาคมสมองกลฝังตัวไทย (TESA) · CC BY-NC 4.0
Content is licensed CC BY-NC 4.0. Reuse it non-commercially and credit the Thai Embedded Systems Association (TESA) every time. · How to cite TESA