Lab: Build a Virtual Device and Event Script
Course 2 · Module 3 Type: Hands-on (Virtual Device + optional Blender → GLB) Suggested time: ~3–3.5 hours for the Virtual Device (+ ~1–1.5 hours for Lab E)
Read first: Lesson · Device checklist · Blender cheatsheet · Template · ← Table of Contents · ← M02 · M04 →
Useful references during the lab
Section titled “Useful references during the lab”| Document | Use when |
|---|---|
| M02 lab | Getting a Studio / Simulator session ready |
| Hackathon | Scene presets / web-app evidence |
| Course 1 M05 | What the sensor values mean |
| Blender Manual 4.5 | Modeling / Texturing / Animation |
| INC111-2021 playlist (Thai) | A Thai-language video tutorial |
| ternion-3d-assets-free | Sample GLB / textures |
Lab Goals
Section titled “Lab Goals”- Have a Virtual Device with at least 2 kinds of sensor defined
- Have at least 1 behaviour path (an input → an observable state)
- Have a repeatable event script/timeline, with the result visible in the visualization
- Fill in device-model-checklist.md
- (Recommended) a short Blender exercise: model, or texture, or animation → export GLB
Suggested time: ~3–3.5 hours (the Virtual Device) + ~1–1.5 hours (Lab E Blender, if done)
Prerequisites
Section titled “Prerequisites”- Lab M02 passed (you can open Bitstream Studio)
- Choose a path: Simulator and/or a board that can stream
- Have a
lab-notes/folder for model files + evidence - (Lab E) install Blender
Lab A — Create the model (required)
Section titled “Lab A — Create the model (required)”- Copy sample-virtual-device.template.json to your own file, such as
lab-notes/device-model.json - Set
deviceId/displayNameto something your team can recognise - Enable at least 2 sensor kinds from: switch, temperature/pressure, IMU
- Set
defaultand themin/maxrange (or equivalent) sensibly - Name at least 1 actuator (an LED / a flag / a log sink)
On the host: open the Simulator or a board, then choose a scene matching the model (such as Lab Quiet for a slow demo, Motion when there’s an IMU)
Pass when: the model file reads sensibly, and the host shows at least one value related to the sensors you chose
Lab B — Behavior (required)
Section titled “Lab B — Behavior (required)”Define and demonstrate at least one rule, such as:
- A command/button → an LED, or a UI status
- Temperature over a threshold → an event / a log message / a mode change
Write it as a WHEN … THEN … sentence in the checklist
Pass when: a teammate can trigger the input and point to the result on screen without guessing
Lab C — Event script (required)
Section titled “Lab C — Event script (required)”Write a timeline of at least 4 beats (see the example in the lesson), then actually run it:
- Start from the default values / Lab Quiet
- Trigger a scalar or a switch at a set time
- Trigger the IMU, or switch to Motion (if the model has an IMU)
- Record what you saw (before/after screenshots, or a short clip)
You may run it with a stopwatch + by hand if the tool has no automatic script file yet — but it must be repeatable on a second round.
Pass when: rerunning the script gives roughly the same sequence of results
Lab D — Optional polish
Section titled “Lab D — Optional polish”- Add a second behaviour (a threshold + a command)
- Compare the Lab Quiet vs Motion scene on the same sensor set
- Open the Hackathon
web-app/as an outer Visualization screen
Lab E — Blender for Twin (recommended)
Section titled “Lab E — Blender for Twin (recommended)”Use blender-twin-cheatsheet.md as your link map. A Thai-language tutorial: the INC111-2021 playlist
Choose at least one track to complete:
E1 — Modeling
Section titled “E1 — Modeling”- Install Blender
- Build a simple part (a box case / a flat board) from a mesh primitive
- Use Extrude / Bevel / Mirror per the Modeling intro
- Set the origin + Apply Scale
E2 — Texturing
Section titled “E2 — Texturing”- Unwrap the UV (UV unwrapping)
- Add Principled BSDF + a Base Color
- (Optional) use a texture from ternion-3d-assets-free textures
E3 — Animation
Section titled “E3 — Animation”- Keyframe a rotation or a lid opening for 2–3 seconds (Keyframes)
- Play it in the Timeline to see it clearly
E4 — Export & view
Section titled “E4 — Export & view”- Export → glTF 2.0 →
.glbper the glTF exporter - Load it into Bitstream Studio (or compare it against a model in the free assets)
- Record a screenshot + the
.glbfilename in the checklist
Pass when (Lab E): there is a .glb file and evidence it opens in the host, or at least opens again in Blender after re-importing
Deliverables checklist
Section titled “Deliverables checklist”-
device-model.json(or equivalent) - Labs A–C passed
- device-model-checklist.md filled in completely
- Evidence the script ran (an image/clip)
- (Recommended) Lab D
- (Recommended) Lab E + a
.glb
Troubleshooting
Section titled “Troubleshooting”| Symptom | Approach |
|---|---|
| The model is written but the screen doesn’t change | Not Linked yet / it’s in a different mode, Simulator vs Bitstream |
| The IMU doesn’t move | You’re on the Environment or Lab Quiet scene — switch to Motion, or trigger per the script |
| A behaviour shows no result | You haven’t clearly set an observation point (LED/UI/log) |
| The values look too “fake” | Normal for the Simulator — note in the model that it’s synthetic |
| Can’t reproduce a run | Write times in seconds, and always start from the same default |
| The GLB has no texture | You forgot the UV / didn’t use Principled / turned off Materials on export — see glTF materials |
| The GLB has no animation | The Action wasn’t active / Animation wasn’t turned on for export |
| The model is too big in Studio | Reduce subdivision · decimate · check the scale |
Lesson · Device checklist · Blender cheatsheet · Table of Contents · M04 →
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: Build a Virtual Device and Event Script" 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: "แล็บ: สร้าง Virtual Device และ event script" จาก 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/m03-virtual-device/l02-lab/
This lesson adapts the source below; keep its credit too.
https://github.com/drsanti/TESAIoT-Courses/blob/287c21814ba8c75f693136616dcd270349a15966/C2/M03/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