# Sensor Interfacing

## Session 02: IMU Sensors และ Motion Processing

***

### วัตถุประสงค์การเรียนรู้

หลังจบ Session นี้ นิสิตจะสามารถ:

1. เข้าใจการทำงานของ IMU Sensor (BMI270) และการอ่านค่าผ่าน I2C
2. แปลงค่า Raw Data เป็นหน่วยทางฟิสิกส์ (m/s², rad/s)
3. เพิ่มฟังก์ชันประมวลผลข้อมูล (Magnitude, Motion Detection, Filtering)
4. ใช้ C Programming - Arrays, Structs, Pointers กับข้อมูล Sensor

***

### โปรเจกต์หลัก (Base Project)

```
mtb-example-psoc-edge-sensor-hub-imu
├── proj_cm33_s/              # Secure Project
├── proj_cm33_ns/             # Non-Secure Project (เราทำงานที่นี่)
│   ├── main.c
│   ├── sensor_hub_daq_task.c # <-- ไฟล์หลักที่เราจะเรียนรู้และต่อยอด
│   └── sensor_hub_daq_task.h
└── proj_cm55/                # CM55 Project
```

> **สำคัญ:** Labs ทั้งหมดจะเป็นการเพิ่มฟังก์ชันเข้าไปใน `sensor_hub_daq_task.c` ไม่ใช่การสร้างโปรเจกต์ใหม่!

***

### โครงสร้างการเรียนรู้ (3 ชั่วโมง)

<table><thead><tr><th width="100" align="center">ลำดับ</th><th>หัวข้อ</th></tr></thead><tbody><tr><td align="center">1</td><td>ภาพรวม IMU Sensor และ I2C</td></tr><tr><td align="center">2</td><td>Lab 1: ทำความเข้าใจโค้ด Sensor Hub</td></tr><tr><td align="center">3</td><td>Lab 2: คำนวณ Acceleration Magnitude</td></tr><tr><td align="center">4</td><td>Lab 3: ตรวจจับการเคลื่อนไหว</td></tr><tr><td align="center">5</td><td>Lab 4: Moving Average Filter</td></tr><tr><td align="center">6</td><td>Lab 5: ระบบ Motion Detection สมบูรณ์</td></tr><tr><td align="center">7</td><td>สรุปและแบบทดสอบ</td></tr></tbody></table>

### ภาพรวม IMU Sensor (Accelerometer + Gyroscope)

<figure><img src="/files/D05C0Ph9K6xwUEiqxwVM" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/vNclHYIFYH8WxOmtVEZR" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/7y42V4A5UUT1xtX2Umri" alt=""><figcaption></figcaption></figure>

**จบ Session 2** | **ต่อไป:** Session 3: LVGL Display


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aic-eec.com/interfacing-with-infineon-psoc-tm-edge/sensor-interfacing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
