How yoyuqre/smartsense works
This is a capstone system with two distinct paths: ESP32 firmware samples room sensors and emits serial readings, while a simulated historical dataset feeds analysis, ML, anomaly detection, and fail-safe lighting/HVAC decisions. A Streamlit dashboard presents frozen replay results and includes a serial mode whose live-hardware validation remains outstanding. The graph follows documented phase boundaries and indexed source references; unsampled firmware and dashboard details are kept at the level the README supports.
Main entry points: phase5_run.py Historical replay · dashboard_data.py Dashboard data access · preprocessing.py Validation and splits · modeling.py Model training
Components 17
Firmware
- ESP32 firmware
src/main.cpp - Serial readings
src/main.cpp
Historical data
- Shared configuration
src/config.py - Dataset generator
src/data_generator.py - Frozen sensor data
data/sensor_data.csv
Analysis and ML
- Validation and splits
src/preprocessing.py - Exploratory analysis
src/eda.py - Model training
src/modeling.py - Persisted models
models/occupancy_model.pkl
Detection and control
- Anomaly and health rules
src/detection.py - Fail-safe decisions
src/control_logic.py - Historical replay
src/phase5_run.py - Control decisions
data/control_output.csv
Dashboard
- Dashboard data access
src/dashboard_data.py - Streamlit dashboard
app.py
Other components
- Room sensors
- Lighting and HVAC outputs
Connections 22
- Room sensors → ESP32 firmware: provide readings
README.md - ESP32 firmware → Serial readings: emits samples
README.md - Shared configuration → Dataset generator: configures
README.md - Dataset generator → Frozen sensor data: generates
README.md - Frozen sensor data → Validation and splits: loads and validates
src/preprocessing.py - Validation and splits → Exploratory analysis: supplies data
src/eda.py - Validation and splits → Model training: supplies splits
src/modeling.py - Dataset generator → Model training: provides generator reference
src/modeling.py - Model training → Persisted models: persists models
README.md - Frozen sensor data → Historical replay: replayed over
README.md - Validation and splits → Historical replay: loads dataset
src/phase5_run.py - Model training → Historical replay: loads occupancy model
src/phase5_run.py - Anomaly and health rules → Historical replay: provides detection
src/phase5_run.py - Fail-safe decisions → Historical replay: provides decisions
src/phase5_run.py - Historical replay → Control decisions: writes replay results
README.md - Validation and splits → Dashboard data access: loads frozen data
src/dashboard_data.py - Model training → Dashboard data access: provides metrics
src/dashboard_data.py - Anomaly and health rules → Dashboard data access: provides detection rules
src/dashboard_data.py - Control decisions → Dashboard data access: reads replay output
README.md - Dashboard data access → Streamlit dashboard: serves dashboard data
app.py - Serial readings → Dashboard data access: optional serial ingestion
README.md - ESP32 firmware → Lighting and HVAC outputs: drives outputs
README.md