Skip to content

Lab: Sensor Streams and AI-Ready Windows

Course 1 · Module 5 Type: Hands-on lab (read sensors → filter/window → optional host view) Suggested time: 2.5–3.5 hours

Read first: Lesson · Cheatsheet · ← Table of Contents · ← M04 · M06 →

Note: the snippets in this lab use the API of the TESAIoT Bitstream firmware, which is not yet open source. See detail and equivalent examples in the public SDK in the note at the top of the lesson AI-ready Sensor Streams

Document Use when
Lesson sensor_*, fusion, SENSOR_CFG
TESAIoT Developer Hub The Sensors domain
Hackathon web-app ex01–ex06 to see values on the host
Bitstream Studio The Sensor Telemetry deck

  • Call sensor_*_startup / read for at least two kinds (e.g. SHT40 + BMI270)
  • Build a fixed-rate reading task with FreeRTOS
  • Apply a filter or normalisation in at least one form in the lab code
  • Build a data window from the IMU or a temperature series
  • (Recommended) watch the stream in Bitstream Studio or the Hackathon web-app
  • (Recommended) read a fusion result, or fire an event on a condition

  • Have passed M03 (UART) and M04 (can create tasks)
  • The board has sensors matching the kit used
  • Know which sensors are enabled in your firmware/project

  1. Call sensor_sht40_startup, then read temperature / humidity and print to UART
  2. Call sensor_bmi270_startup (if not already started at boot), then read acc_*
  3. Check sensor_*_is_ready before reading

Pass when: you get reasonable-looking values for both kinds on the terminal


Lab B — Fixed-rate sample task (required)

Section titled “Lab B — Fixed-rate sample task (required)”
  1. Create a task that reads a sensor with vTaskDelayUntil (e.g. SHT40 every 500–1000 ms, or BMI270 every 40 ms)
  2. Record which period you chose and why
TickType_t last = xTaskGetTickCount();
const TickType_t period = pdMS_TO_TICKS(40);
for (;;) {
(void)sensor_bmi270_read(&imu);
vTaskDelayUntil(&last, period);
}

Pass when: the reading period is consistent, with no busy-waiting


  1. Apply an EMA (or a short-window median) to temperature, or an acceleration axis
  2. Normalise at least one channel’s value into a given range (such as roughly [-1, 1], or 0..1)
  3. Print both the raw and the processed value

Pass when: you can explain how the filter reduces noise, from what you observe on the terminal


  1. Build a ring buffer / window of at least 16–32 samples from BMI270 or a temperature series
  2. Once the window is full, compute at least one feature (such as mean, variance, max−min)
  3. Print the feature over UART periodically

Pass when: you get a summary vector from a full window at least once per second (or at a reasonable period)


  • cm55_imu_fusion_bridge_push_raw_components + get_latest_result
  • Print pitch/roll or orientation
  • Flash/connect per your kit → open Bitstream Studio or the Hackathon web-app
  • Confirm the sensor value on the host moves in step with the board
  • When the feature or the EMA exceeds a threshold → turn on the LED + print EVENT ...

Pass when: you have completed one option with evidence (terminal / UI / LED)


  1. The sensors used + the sampling period
  2. The filter / normalisation method
  3. The window size + the feature(s) computed
  4. (If any) the fusion result, or a host screenshot
  5. What you plan to send on to the cloud in M06 (a conceptual payload)

Symptom Approach
is_ready is false Not started up yet · the sensor isn’t built into the project · a bus problem
Reading works only sometimes The period is too fast · the bus is contended with another task · try try_read / reduce the rate
The magnetometer won’t read through the I2C lock The BMM350 is I3C — use sensor_bmm350_* per the SDK
Fusion doesn’t update Raw data hasn’t been pushed yet · CM33 fusion isn’t running in the config you’re using
The host shows no value Bitstream not Linked yet · the HEX/VSIX are mismatched versions · SENSOR_CFG disabled

  • Labs A–D passed
  • At least 1 item from Lab E
  • The table in sensor-ai-prep.md filled in
  • The short report completed

Lesson · Cheatsheet · 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: Sensor Streams and AI-Ready Windows" 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: "แล็บ: สตรีมเซ็นเซอร์และหน้าต่างข้อมูลพร้อม AI" จาก 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/firmware-sdk-edge-ai/m05-sensor-data/l02-lab/

This lesson adapts the source below; keep its credit too.
https://github.com/drsanti/TESAIoT-Courses/blob/287c21814ba8c75f693136616dcd270349a15966/C1/M05/lab.md · Original content by Asst. Prof. Dr. Santi Nuratch (ผศ.ดร.สันติ นุราช), KMUTT. Course 1 (C1/) 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.

Full guide: how to cite TESA

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