AlerSense is an attention monitoring system that tracks physiological data (Heart Rate, Skin Temperature, Galvanic Skin Response) via an ESP32 wearable, processes it through a data hub, and visualizes real-time alerts on a Next.js dashboard.
The project is divided into four main components:
- Wearable (
/wearable): ESP32 firmware that collects sensor data and transmits it via HTTP. - Data Hub (
/data-hub): A Python-based processing engine that runs inference on incoming data. - API (
/api): A Flask-SocketIO server that facilitates real-time communication between the hub and the frontend. - Frontend (
/frontend): A Next.js web application for real-time data visualization and user management.
The wearable uses an ESP32 to interface with MAX30105 (Heart Rate/SpO2) and MLX90614 (Temperature) sensors.
- Dependencies:
Wire.h,MAX30105.h,heartRate.h,WiFi.h, andHTTPClient.h. - Configuration: Update the WiFi credentials and the
serverName(pointing to your Data Hub IP) inesp_alersense.ino. - Data Transmission: Data is sent as a JSON POST request to the
/dataendpoint.
Both services are built with Python. It is best to use Python 3.13 to avoid any dependency errors.
- Setup:
# Navigate to the service directory (api or data-hub) python3 -m venv venv # make sure that api and data-hub do NOT share the same venv source api-env/bin-activate # adjust if you are using powershell, this is for linux pip install -r requirements.txt python3 main.py
The dashboard provides a real-time stream of health metrics.
- Setup:
cd frontend bun install bun dev
- Ingestion: The ESP32 sends a JSON payload containing
hr(Heart Rate),spo2, andtemp. - Processing: The Data Hub processes these metrics to determine if thresholds are exceeded.
- Broadcasting: The API receives processed updates and emits them via SocketIO events.
- Visualization: The Frontend listens for these events and updates the UI state without a page refresh.
Ensure you copy the .env.sample files in the api/, data-hub/, and frontend/ directories to .env and fill in the required keys, including your Firebase configuration for authentication and database management.
This is a bare-bones prototype for demo purposes. Ensure proper authetication methods and production hardening techniques for personal or commercial use.