Projects/HomeSync — IoT Home Security Monitor
HomeSync — IoT Home Security Monitor

HomeSync — IoT Home Security Monitor

Smart home security system spanning STM32 sensors, an ESP32-S3 MQTT bridge, a Node.js/Prisma backend, and a Next.js real-time dashboard with live alerts.

STM32ESP32CArduino IDEMQTTNETPIENode.jsExpressPrismaPostgreSQLNext.jsRecharts

About this project

Built for Chulalongkorn's Embedded System Lab, HomeSync needed to turn raw sensor readings into a live web dashboard with near-zero latency. An STM32 NUCLEO-F411RE reads ultrasonic, infrared, and vibration sensors and serializes {distance, tilt, accident} over HUART6 to an ESP32-S3, which publishes the payload to NETPIE's MQTT broker. A Node.js/Express service subscribes to the broker, runs threshold-based alert logic, and persists every event to Postgres (Neon) via Prisma; the Next.js 14 frontend polls three REST endpoints every ~2 seconds to keep the SensorDashboard, Recharts time-series charts, and AlertPanel live. The most deliberate architectural decision was splitting firmware across two MCUs — STM32 owns all sensor I/O while ESP32-S3 owns Wi-Fi and MQTT, so each layer can be changed or upgraded independently.

  • STM32 NUCLEO-F411RE serialises sensor data over HUART6 to ESP32-S3
  • NETPIE MQTT broker decouples hardware from backend — backend subscribes, not polls
  • Prisma + Postgres (Neon) persists SensorEvent + alerts tables with type/severity
  • Next.js frontend polls /api/sensor, /api/sensor/history, /api/alerts every ~2 s

Key features

3 sensors

Ultrasonic / infrared / vibration

MQTT bridge

ESP32-S3 → NETPIE broker

Alert engine

Threshold rules + DB persistence

Live dashboard

Next.js + Recharts, ~2 s refresh


Tech stack

STM32
ESP32
C
Arduino IDE
MQTT
NETPIE
Node.js
Express
Prisma
PostgreSQL
Next.js
Recharts

Other projects