Architecture & Hardware Integration
At the heart of the system sits a hardware pairing of an ESP8266 and an Arduino Mega connected through a serial bridge. The Arduino handles the sensors and actuators, while the ESP8266 runs the ESP8266WebServer, seamlessly serving static dashboard files and managing local network traffic directly from the edge.
Alerting was integrated without heavy cloud middleware. The ESP8266 firmware can post threshold and presence alerts directly to a configured Discord Webhook. A custom JSON snapshot keeps the Android interface in sync over Bluetooth, while mDNS makes the local web gateway discoverable without memorising an IP address.
Hybrid AI Prediction Engine
Rather than relying on simple threshold triggers, the system deploys a client-side TensorFlow.js (TF.js) prediction model. This model runs entirely in the browser, continuously ingesting data to predict necessary environmental actions based on an advanced matrix of 14 parameters.
The primary data feed includes an MH-Z14A CO2 sensor with UART, PWM, and analogue reading paths. The browser model predicts five lighting and ventilation actions from fourteen inputs. Separately, the embedded control loop reads the sensors and drives servo-controlled windows and lighting, keeping the experimental ML layer distinct from the deterministic hardware controls.
Key Highlights
- Designed and implemented ESP8266 + Arduino Mega sensor network including MH-Z14A CO2 monitoring
- Developed a TensorFlow.js model for client-side lighting and ventilation action prediction
- Implemented JSON-over-Bluetooth protocol for low-latency device communication
- Integrated Discord Webhooks for real-time alert notifications
- Implemented mDNS for automatic device discovery on the network
- Built a browser-based TensorFlow.js model for lighting and ventilation action prediction
