Optimizing room occupancy estimation on the edge: A TinyML and sensor network approach

Read full text
Authors: Mehal Pandkar, Shashank Nambiar, Ayush Sinha, Prachi Sharma
Cited by: 0
References: 23

Abstract

• 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.

Fields of Study & Subjects

Building Energy and Comfort Optimization IoT and Edge/Fog Computing Arduino and IoT Applications

Publication details

Journal / source
Results in Engineering
Volume
29
Pages
109107–109107
Publication date
14 January 2026
Language
EN