This paper presents an Automatic Lighting and Control System, designed as a general-purpose, scalable IoT-based automation solution for residential, commercial, and institutional environments. The system uses an ESP8266 (NodeMCU) microcontroller as the core controller, driving a four-channel active-low relay module to switch AC lighting loads. A Hi-Link HLK-5M05 AC/DC converter supplies 5?V to the MCU. The system supports dual-mode operation: under normal conditions it connects to a cloud server (Firebase Realtime Database) for remote control via a React.js web dashboard, while under network outage it seamlessly switches to a local offline mode using manual push-button overrides. Time-based scheduling is implemented using Network Time Protocol (NTP) synchronization to Indian Standard Time, eliminating the need for a hardware RTC. A real-time synchronization mechanism ensures that the cloud database and device state remain consistent, and a periodic heartbeat signal provides system health monitoring. Experimental implementation (using a simple test setup with LED loads) demonstrates responsive relay switching (?40?ms delay) and scheduling accuracy within ±0.5?s. Compared to existing IoT lighting solutions, the proposed system offers a higher degree of versatility by combining cloud control, local manual override, and precise time scheduling in one package.
Introduction
The study proposes a general-purpose IoT-based smart lighting automation system that improves energy efficiency, convenience, and reliability by integrating cloud-based remote control with local manual operation. Unlike many existing systems that are designed for specific environments such as classrooms or occupancy-based lighting, the proposed solution is scalable and suitable for homes, offices, laboratories, and other buildings.
The system is built around an ESP8266 NodeMCU microcontroller powered by a Hi-Link HLK-5M05 AC-DC converter. A 4-channel relay module controls AC lighting loads, while physical push-buttons allow manual operation. The system operates in two modes: Cloud Mode, where the NodeMCU communicates with a Firebase Realtime Database for remote monitoring and control through a React.js web dashboard, and Local Offline Mode, where push-buttons continue to control lights independently during Internet or Wi-Fi failures. Time-based automation is implemented using the Network Time Protocol (NTP), eliminating the need for a separate real-time clock.
The major contributions include:
Development of a dual-mode IoT lighting architecture with cloud synchronization and local control.
Integration of manual push-button overrides for uninterrupted operation.
NTP-based scheduling and heartbeat monitoring for reliability.
A scalable architecture that can be extended with additional relays, sensors, or voice assistants.
Literature Survey
Previous studies mainly focused on specialized IoT lighting applications:
PIR sensor-based occupancy lighting.
Classroom-specific automation.
Hybrid cloud-local smart home systems.
Firebase-based monitoring applications.
Most existing systems lack a combination of remote control, manual override, real-time synchronization, and scalability. The proposed system addresses these limitations by providing a flexible lighting automation platform suitable for multiple environments.
Proposed System Architecture
The system consists of four major components:
Hardware Layer: ESP8266 NodeMCU, Hi-Link power supply, four-channel relay module, push-buttons, and AC lighting loads.
User Interface: React.js dashboard enables real-time monitoring, scheduling, and remote switching.
Communication Layer: Wi-Fi provides bidirectional synchronization between the dashboard and NodeMCU.
The NodeMCU continuously synchronizes device states with Firebase while maintaining local functionality during connectivity failures.
Hardware Design
The hardware includes:
ESP8266 NodeMCU as the main controller.
HLK-5M05 AC-DC module converting 230 V AC to 5 V DC.
Four active-low relay channels for switching electrical loads.
Four push-buttons with internal pull-up resistors for manual control.
AC lamps connected through relay contacts.
A software debounce algorithm prevents false triggering from mechanical switch bouncing.
Software Architecture
The software consists of embedded firmware and a React.js dashboard.
The NodeMCU firmware performs:
Wi-Fi and Firebase connectivity.
Push-button monitoring.
Relay control.
Real-time Firebase synchronization.
NTP-based scheduling.
Heartbeat generation.
Watchdog protection.
The React.js dashboard allows users to:
Turn lights on or off remotely.
Configure automatic schedules.
Monitor real-time device status.
Display heartbeat information indicating device connectivity.
Methodology
The proposed methodology emphasizes uninterrupted operation through:
Cloud Mode
Remote commands are sent through Firebase.
NodeMCU immediately updates relay states.
Device status is synchronized continuously.
Offline Mode
Internet failure automatically switches the system to local operation.
Push-buttons continue controlling the relays.
Once connectivity returns, the NodeMCU synchronizes any local changes with Firebase.
Real-Time Synchronization
Firebase stores:
Current relay status.
Scheduled switching times.
Heartbeat timestamps.
Whenever the dashboard or physical switches change a relay state, the database is immediately updated, ensuring consistent synchronization between users and devices.
Key Features and Advantages
Supports both remote and manual control.
Continues operating during Internet outages.
Real-time cloud synchronization.
Accurate NTP-based scheduling.
Heartbeat monitoring for device health.
Low-cost hardware using ESP8266.
Scalable architecture supporting additional devices and sensors.
Suitable for homes, offices, laboratories, and industrial environments.
Conclusion
This paper has presented an IoT-based Automatic Lighting and Control System that demonstrates a robust and flexible approach to smart lighting. The system’s key features—dual cloud/offline operation, manual override, real-time cloud synchronization, NTP scheduling, and heartbeat monitoring—address many challenges of practical deployment. By combining a low-cost ESP8266 microcontroller with a React/Firebase cloud platform, the design leverages modern IoT tools for a seamless user experience. Experimental evaluation validated the system’s responsiveness and reliability. The proposed architecture is general-purpose, making it suitable for diverse environments. In future work, we plan to integrate more sensors, enhance security, and explore voice control integration, further improving the automation and convenience of lighting control.
References
[1] T. D. Makanju et al., “IoT-Enabled Smart Lighting Control System with Motion Detection Using Passive Infrared Sensor Technology,” New Horizons of Science, Technology and Culture, vol. 4, 2025, pp. 77–97.
[2] S. S. M. Y. Grandhi, “An IoT-Based Smart Lighting System for Real-Time Occupancy Monitoring and Energy Management,” International Journal of Emerging Technology and Advanced Engineering, vol. 2, no. 5, 2022.
[3] S. Parthiban et al., “Smart Home Automation: Intelligent Control for Modern Living,” International Journal of Scientific Research and Engineering Trends, vol. 11, no. 5, Sept.–Oct. 2025, pp. 1–6.
[4] A. Hasib and A. S. M. A. S. Akib, “Cloud-Enabled IoT System for Real-Time Environmental Monitoring and Remote Device Control Using Firebase,” arXiv preprint arXiv:2601.17414, 2026.
[5] D. B. Prasetyo et al., “Prototype Design of IoT Remote Monitoring System for Industrial Process Using Firebase Realtime Database,” in Proceedings of LPPM UPN “Veteran” Yogyakarta Conference, vol. 1, no. 1, 2020.
[6] Y. S. Parihar, “Internet of Things and NodeMCU: A Review of Use of NodeMCU ESP8266 in IoT Products,” JETIR, vol. 6, no. 6, pp. 33–38, June 2019.
[7] Shenzhen Hi-Link Electronic Co., Ltd., “HLK-5M05 AC to DC 5V 5W Step Down Power Module,” Product Datasheet, 2021.
[8] Nabto, “ESP8266 for IoT: A Complete Guide,” Nabto.com, 2024.
[9] Espressif Systems, “ESP8266EX Datasheet,” Version 7.1, 2025.