Optimizing room occupancy estimation on the edge: A TinyML and sensor network approach
• TinyML-based system achieves real-time room occupancy estimation on the ESP32. • Combines environmental sensing with edge-based machine learning for smart buildings. • Random Forest model outperforms others with R² = 0.923 and MAE = 0.217. • Low latency (997 µs) and minimal storage (1.426 MB) ensure edge deployment feasibility. • Offers a low-cost, privacy-conscious alternative for occupancy detection. This research study has developed a new method of determining room occupancy in real time using TinyML (Machine Learning) and an ESP32 Microcontroller to create more efficient smart buildings that consume less energy. It consists of collecting environmental data from non-intrusive sensors, including CO₂ concentration, temperature, humidity, light intensity, and human presence. Machine Learning models provide support in predicting occupancy levels with sufficient accuracy based on the collected environmental data. From the tested machine learning models (Linear Regression, K-Nearest Neighbors, Decision Tree, Gradient Boosting, Random Forest, XGBoost), Random Forest model outperformed all others with the lowest Mean Absolute Error (MAE = 0.217), Mean Square Error (MSE = 0.115), and highest R² score (0.923) when measured against testing datasets. The occupancy predictive model has a very low inference latency (997 μs) and a small amount of memory stamps to conserve resources, using only 1.426 MB storage and 1.175 MB memory when deployed in an ESP32. These results validate the ESP32’s capability for accurate, low-latency, edge-based occupancy estimation, providing a low-cost, energy-efficient solution for enhancing real-time automation in smart building environments.
Authors
- Pushkar Sharma (ORCID: https://orcid.org/0000-0001-6861-0508)
- Ayush Sinha (ORCID: https://orcid.org/0000-0003-0391-1195)
- Mehal Pandkar
- Shashank Nambiar
Institutions
- Vellore Institute of Technology University (IN)
Publication Details
- Journal
- Results in Engineering
- Published
- 2026-01-14
- DOI
- https://doi.org/10.1016/j.rineng.2026.109107
- Primary Topic
- Building Energy and Comfort Optimization
- Type
- article
- Field-Weighted Citation Impact
- 0.00