PROJECT

Flood Monitoring System.

ระบบติดตามและแจ้งเตือนระดับน้ำที่รวม Sensor, CCTV, Computer Vision/AI, Cloudflare และ Dashboard เข้าด้วยกัน

IoTAIAutomationMakerโดย Thospaakเผยแพร่ 7 ต.ค. 2569อัปเดต 13 ต.ค. 2569

Objective

สร้างระบบ Monitoring ที่วัดระดับน้ำได้ต่อเนื่อง เก็บประวัติ ตรวจสอบภาพจริง และแจ้งเตือนเมื่อระดับน้ำผ่าน Threshold ที่กำหนด

Architecture direction

Primary Sensor / External Data
            ↓
       Ingestion Worker
            ↓
        Data Store
            ↓
      API / Dashboard
            ↓
          Alerts

CCTV → Vision Pipeline ──┘

แนวคิดหลักคือไม่ผูกความน่าเชื่อถือของระบบไว้กับ AI เพียงตัวเดียว โดยแยก Measurement, Visual Verification และ Secondary Analysis ออกจากกัน

MVP data contract

PR41 เริ่มจาก deterministic fixture ก่อนต่อข้อมูลจริง เพื่อ lock พฤติกรรมของ Dashboard และ failure state ให้ตรวจสอบได้ โดย Measurement ทุก sample ต้องมีอย่างน้อย:

  • value และ engineering unit
  • timestamp ของเวลาที่ source วัดจริง
  • sourceId
  • quality เช่น good / suspect / invalid
  • freshness ที่คำนวณจากอายุข้อมูลและ stale policy

Severity เช่น Normal / Watch / Warning / Critical เป็น site policy ที่แยกจาก data freshness และไม่ใช่เกณฑ์เตือนภัยน้ำท่วมสากล ถ้า Primary Measurement stale หรือ unavailable หน้า App ต้องแสดงสถานะนั้นตรง ๆ แทนการเอาค่าครั้งสุดท้ายมาแสดงเหมือนเป็นค่าปัจจุบัน

CCTV / Vision ใช้เป็น Secondary Verification ใน MVP แรก ไม่เลื่อนขึ้นมาเป็น Primary Measurement อัตโนมัติเมื่อ Sensor หลักมีปัญหา

Candidate components

  • Distance/level sensor สำหรับ Primary Measurement
  • CCTV สำหรับ Visual Verification
  • OpenCV / Segmentation สำหรับ Waterline Detection
  • Vision AI สำหรับ Secondary Verification หรือ Anomaly Analysis
  • Cloudflare Worker สำหรับ ingestion/API/scheduled jobs ที่เหมาะกับ runtime
  • Database สำหรับ Time Series/measurement metadata
  • Astro สำหรับ Project documentation และ App frontend

Open questions

  • Sensor และ housing ที่เหมาะกับสภาพหน้างานจริง
  • Sampling interval และ retention policy
  • Data source ภายนอกที่อนุญาตให้เรียกใช้อย่างถูกต้อง
  • Alert channel และ escalation policy
  • Offline/failure behavior เมื่อ Sensor, Internet หรือ upstream data ใช้งานไม่ได้

Project นี้เผยแพร่ในสถานะ Active MVP เพื่อให้เห็นเส้นทาง Article → Lab → Project → App จริง ปัจจุบัน Flood Monitor ดึง latest water-level snapshot และ historical trend จาก ThaiWater public API ตรงจาก browser, มี Chao Phraya corridor สำหรับ C.2, C.13, C.29A และ C.29B, ใช้สวนเทพปทุมเป็น Local CCTV/reference ของเทศบาลเมืองปทุมธานีผ่าน Visual Verification contract ที่แยก operator/location/provenance ออกจาก Primary Measurement และระบุ operational readiness ว่า HTTP gateway ยังเป็น manual access เท่านั้น ไม่เท่ากับ camera health และยังไม่มี qualified media endpoint สำหรับ snapshot ingestion พร้อม Rainfall Context 1 ชม. / 24 ชม. ที่จับคู่ตามพื้นที่โดยไม่ปะปนกับ Measurement หรือ Severity ส่วน Worker-side probe/persistence และ Vision inference จะยังไม่ถูกเพิ่มจนกว่าจะมี deterministic media target และ ground-truth dataset ที่เหมาะสมจริง