An Adaptive and Scalable Indoor Lighting Control System Using ESP32 Microcontrollers, IoT, and Machine Learning
In modern buildings, energy-efficient indoor lighting ensures both cost-effective operation and a respon- sible approach to sustainability. Many traditional lighting systems do not address variability in natural daylight and occupancy patterns, resulting in higher energy consumption and decreased occupant comfort. This study proposes an adaptive indoor lighting control system integrating ESP32 microcontrollers, machine learning (ML) algorithms, and IoT technology. To ensure adjusting an optimum room Light intensity, the ML dataset incorporated a Light Dependent Resistor (LDR) to monitor the ambient light level, a passive infrared (PIR) sensor to detect human presence, and the weather condition retrieved via the OpenWeather API. Subsequently, an optimization-based label approach, advanced data preprocessing, and comprehensive feature engineering—incorporating environmental and occupancy interactions—were used to refine the input data, thereby enhancing the accuracy of ML predictions. The optimized dataset was then utilized to train the ML models—Decision Regression and Multilayer Perceptron (MLP) Neural Networks—which were compared using performance metrics (R2, RMSE, and MAE) and verified through cross-validation in scenarios with or without feature engineering. Employing feature engineering improved the R2 score by approximately 29% and 32%, while the MAE reduced by 46% and 47% for the Decision Tree Regression and MLP models, respectively. The system was tested for a duration of five days, illustrating a reduction in energy consumption of 34.8% in comparison to a non-adaptive approach. A consistent lighting adjustment approach resulted in maintaining a standard deviation of 5 lux, enhancing the occupant comfort. Additionally, the Blynk IOT platform facilitates the remote monitoring and controlling of the system. The flexible and adaptable structure enables the support for more devices or sensors for various smart building uses. The findings suggest that the system successfully manages energy efficiency while ensuring occupant comfort and presents an adaptable and scalable option for smart building settings due to its decentralized distribution.