Smart Curtain
ม่านอัตโนมัติที่สั่งงานด้วยมือ ตามแสง หรือด้วยเสียงAn automatic curtain controlled by hand, by light level, or by voice.
โปรเจกต์วิชา Embedded SystemEmbedded system project · 2025
- ช่วงเวลาPeriod
- Nov 2025 — Dec 2025
- บทบาทRole
- เฟิร์มแวร์และเว็บแอปFirmware & web app
- สถานะStatus
- เสร็จแล้วCompleted
- เทคโนโลยีที่ใช้Stack
- ESP32, MQTT, Netpie, Node.js, React
ภาพรวมOverview
โปรเจกต์วิชา Embedded System ที่พัฒนาบนไมโครคอนโทรลเลอร์ ESP32 โดยให้ Sensor Node กับ Gateway Node คุยกันผ่านโปรโตคอล MQTT บน Netpie ทั้งการส่งคำสั่งผ่าน message และการเก็บสถานะผ่าน shadowAn Embedded Systems course project built on the ESP32, with the sensor node and gateway node talking over MQTT on Netpie — commands sent as messages, state kept in shadows.
ฝั่งผู้ใช้เป็นเว็บแอปที่เขียนด้วย Node.js และ React ควบคุมมอเตอร์ของม่านได้สามโหมด คือสั่งเอง ทำงานอัตโนมัติตามอุณหภูมิและแสง และสั่งด้วยเสียงThe user side is a Node.js and React web app that drives the curtain motor in three modes: manual, automatic based on temperature and light, and voice.
สิ่งที่สำคัญWhat mattered
MQTT over Netpie
Sensor Node, Gateway Node และ backend เชื่อมกันผ่าน MQTT โดยใช้ message สำหรับคำสั่งที่ต้องเกิดทันที และใช้ shadow สำหรับสถานะล่าสุดของอุปกรณ์The sensor node, gateway node and backend connect over MQTT — messages for commands that must happen immediately, shadows for the device's latest state.
Voice control that tolerates accents
โหมดสั่งด้วยเสียงใช้เทคนิคกลุ่ม Soundex คือใช้ Metaphone หาคำที่ออกเสียงใกล้เคียงกัน แล้วใช้ Levenshtein วัดระยะห่างระหว่างคำ คำสั่งที่ออกเสียงเพี้ยนเล็กน้อยจึงยังใช้งานได้Voice mode uses Soundex-family techniques: Metaphone to find similar-sounding words, then Levenshtein to measure the distance between them, so a slightly mispronounced command still works.
Three modes, one state
โหมดสั่งเอง โหมดอัตโนมัติ และโหมดเสียง เขียนคืนกลับไปที่สถานะเดียวกันของอุปกรณ์ หน้าเว็บทีคอนติดตามและควบคุมจึงไม่หลุดจากสถานะจริงของผ้าม่านที่การเคลื่อนไหวเปลี่ยนแปลงManual, automatic and voice modes all write back to the same device state, so the page tracking and controlling the curtain never drifts from where the curtain actually is.