An Energy-efficient Microcontroller-based Smart Light Controlling System

In this work, an energy-saving smart light controlling system has been proposed that can maintain the desired intensity of light in a room automatically. Unlike the conventional light control system, the proposed system splits a large room into several zones and analyzes the light intensity of each zone; hence, the controlling unit adjusts the light intensity to the desired level. The main controlling unit consists of a light sensor, a motion sensor, a relay with a driver unit, an LCD display, etc. for controlling light efficiently to reduce the power waste. The sensors measure the intensity of light, based on the standard light intensity data chart the controller units make a decision how many light bulbs are needed to be switched ON/OFF in a particular zone. Moreover, the system automatically switched-OFF all light bulbs when there is nobody in the room. Proteus design suite 8.0 is used to design and simulation of the proposed system. Moreover, the PCB layout is designed using ExpressPCB version 7.5.0. The proposed system is capable of minimizing the power loss by up to 44% in comparison to the conventional light management system.


Introduction
Over the years, the energy crisis is one of the most challenging global issues. With the gradual increase of energy demand, scientists and policy makers are harnessing new energy sources and technologies for power generation. Besides the power generation, the energy-saving trend is increasing popularity to the stakeholders, because saving the energy is comparatively manageable than the generation. At present, around 20% of energy is consumed for artificial lighting to the houses, offices, industries, laboratories, and agricultural facilities [1,2],and unfortunately, a large amount of this energy is wasted because of the inefficient utilization of these artificial lights. In Europe, approximately 40% of electrical power is used for illuminating the building that leads to about 35% of greenhouse gas emissions [3]. So, prolific researches have been conducting to monitor, control, and save energy for the lighting in recent years [4][5][6][7][8][9]. As a consequence, the adaptation of a smart light control system is an effective technology for energy saving that incorporates an automatic control system based on conditions of a room such as an occupancy, light intensity, or daylight availability.
At present, both the wired and wireless smart light control systems have been used for energy-saving purposes. Among them, a wireless Zigbee communication system incorporates the LED lights with novel drivers to illuminate the rooms [10]. This system also adopts the motion and light sensors, but this system is not suitable for every place due to its implementation limitations. Some state-of-the-art customized wired system controls dimming of intensity through the usage of the various resistant values in the circuit [6]. But the high installation cost and the requirement of a more system-oriented approach make that control system less successful. The fabrication cost of the smart light controlling system was calculated considering 3000 units per year production. Component cost, manpower, equipment, utility, and installation cost, along with a payback period of 2.45 years were considered, and the overall cost is estimated at 21$ per unit, which is cheaper than the conventional smart light controlling system [2]. So, by analyzing the conventional wired and wireless intelligent light controlling systems, this newly developed controller is more efficient, robust, and sustainable. The device meets the expectation of reducing the power consumption and also lowers the installation cost.
Smart light control technology had started its journey in the early nineties of the twentieth century when microcontroller-based technologies started to become flourishing. In 1997 [11], J. A. Baker invented a fluorescent lighting control system where he used an electronic ballast to control the intensity of high power fluorescent lamps. In that system, control signals were received from the occupancy sensor and light intensity sensor to turn ON or OFF the lamps and to control the light intensity of each lamp, respectively. This control system was not efficient because a single high-power fluorescent bulb, which was used in that case, was not able to illuminate the room uniformly. Light emitting diode (LED) is a more effective lighting device compared to a fluorescent lamp because of its reduced energy consumption nature, longevity, and eco-friendly constituent components [12]. A variety of wireless sensor network (WSN) technology named Zigbee communication incorporates these LED lights and novel drivers to reduce the power consumption during the illumination in different types of rooms [10]. This state-of-the-art Zigbee communication based automatic lighting control system adopts the motion sensors and light sensors [1,2]. Chew et al. reported an intelligent lighting control system where they implemented an optimized smart algorithm in a controller to produce control signals and vary the brightness of the LED lights by applying pulse width modulation (PWM) to a purpose-built LED driver. Magno et al. reported another smart system combining the motion sensors and light sensors using Zigbee communication. Here light sensors and wireless sensor network technology directly control an LED driver with distributed intelligence. But, the implementation of failures and shortfalls are the main limitations of this intelligent, Zigbee based system [9]. Limited resources of the Zigbee wireless network are another obstacle in implementing security features. Moreover, the nodes of this system are mainly battery-driven, having scare computational power and memory size.
In addition, occupancy sensor-based wired smart lighting systems are found in the global market and literature [13][14][15][16], but most of these sensing systems have comparatively lower energy savings capability. Recently an embedded microcontroller-based smart control system has been reported [6]. The system is customized by the initial measurement of the natural light in the room, and this results in an efficient lighting control adjustment to tune the LED bulb to achieve the desired light intensity. The light in the room is controlled by dimming its intensity through the usage of the various resistant values in the circuit. The dimming light technology that requires a more systems-oriented approach has been less successful. This is primarily due to the high cost of installation, maintenance, and the impossibility of retrofitting [17]. A state-of-the-art intelligent system for light control has been reported in the US patent [18], where the occupancy sensor is used to turn ON/OFF a plurality of the LED-based light source, and the ambient light intensity sensor is used to control the plurality of that LED to adjust intensity. It requires a control signal for each LED in a single light source and increases complexity when multiple numbers of LEDs are damaged in that source. So, when the control system sends the signal to turn ON particular LEDs that may have been damaged, then the required light intensity level would not be obtained. This system also limited to the LED-based lighting only.
Due to high costs, installation issues, and difficulty of maintenance, the existing light controlling systems are not successfully applied to home, office, and industrial buildings in the whole world, especially for the developing countries. This paper proposes a low cost, easy to install, adaptable, and smart light controlling system to automatically adjust the light intensity to save energy and maintaining user satisfaction. In this present innovation, the light intensity of a room has been adjusted by switching the required number of low power electric lights. The decision to switch ON/OFF the number of lamps is carried out by an intelligent processing unit that receives a signal from the light sensor. Moreover, the use of multiple numbers of low power bulbs ensures uniform light intensity distribution in every corner of a room, which is advantageous over a single high-power bulb. At the same time, the failure of one or two bulbs does not create a stagnant situation since the remaining bulbs are active in that zone. Moreover, our newly developed system is comparatively efficient than the existing smart control system, and this very low-cost system is able to save around 44% of electrical energy under the implemented test conditions.

Research Method
The block diagram of the microcontroller-based proposed smart light control system is shown in Fig. 1. The system consists of occupancy sensor, light sensor, control unit, relay switch driving unit, display unit, and firmware. These six constituting elements, along with their functions, are described in the following sub-sections.

Occupancy sensor
In this work, the popular passive infrared (PIR) sensor module has been employed as an occupancy sensor or motion sensor to detect the presence of a human. The PIR is a specialized sensor to receive infrared rays radiated from any living body. Usually, Fresnel lenses are used to increase the view of angles of the PIR sensor. This sensor can detect any movement of a living body within 10 meters and its working angle with lenses is near about 180° range. This module gives a logical HIGH output when any movement is identified, and the output becomes logical LOW when there is no movement in the room.

Light sensor
The light-dependent resistor (LDR) has been used as a light sensor to detect the level of ambient light. It is a light-controlled variable resistorto exhibit photoconductivity. The resistance of an LDR decreases with the increase of incident light intensity and vice versa. A voltage divider circuit has been constructed by connecting a variable resistor between the LDR and the power line in series. The voltage drop data across the LDR is sent to a microcontroller unit (MCU) for further processing. MCU evaluates the intensity of the ambient light from this data.

Microcontroller based control unit
The schematic diagram and the PCB layout of the control circuit are shown in Fig. 2 and Fig. 3, respectively.  In this demonstration, we have used PICmicrocontroller (PIC 16F876A), which is a CMOS FLASH 8-bit microcontroller IC with a 28-pin dual inline package (DIP) and it has been used for data processing and decision making. It consists of 5 analogs to digital converters (ADC) of 10 bits resolution and two comparators with the self-programming in-circuit debugger (ICD). Moreover, it has 256 bytes of EEPROM data memory. The control circuit has been designed to work in 4MHz frequency using an external crystal oscillator circuit, as shown in Fig. 2. The MCU receives analog signals from the occupancy sensor and light sensor. Then these analog signals are converted to digital signals by inbuilt ADC for further processing. A variable resistor has been used in series with the LDR to provide customization feature for the user to adjust the number of lights according to desired light-intensity. From the processed data, the MCU makes a decision about the number of lights to be switched ON and sends a digital command signal to the relay driver unit, as shown in Fig. 4. It also sends the signal to the display unit to show the present status of the switched-ON lights and ambient light level. A complete layout of the PCB of the control unit has been designed and developed (see Fig. 3).

Program firmware
In this work, an in-house program has been developed using the Flowcode version 8.0 software, and Fig. 7 shows the program flow chart of the smart light control system. This coding has been employed in the microcontroller chip using a microcontroller programmer. The program code is used to command the microchip for processing the received data from the sensors, making appropriate decisions, and generating control signals for the relay board and display unit.

Relay switch driving unit
Relay is one kind of electromechanical switch to control loads of high power using low power signals. In automatic mode, a set of relay switch that is controlled by the MCU signals has been employed to switch ON or OFF the light bulbs. The relays used in this system are activated by a relay driver circuit made up with NPN transistor, resistor and rectifier diode. The relay used in the system can control ac load up to 10 A/220 V as shown in Fig. 4. A PCB layout has been designed to build the relay driver unit (see Fig. 5).

Display unit
In this smart light control system, an LCD of 2 lines and 16 characters has been used to display the number of switched ON lights and the level of ambient light from the outside, as shown in Fig. 6. The contrast of this LCD is adjustable. In this proposed system, the 8-bit microcontroller chip PIC 16F876A is used to receive and process sensor data, and to make decisions for generating control signals. As there is no internal oscillator in it, an external crystal oscillator made of a 4MHz crystal along with two capacitors are connected to pin no. 9 and 10 (osc1, osc2) of the chip, as shown in Fig. 2. The passive infrared sensor (PIR) module is powered from the 5.0-volt rail. Its output pin is connected to the 2nd ADC input of the microcontroller chip, whose pin no. is 3 (AN1). A pull-down resistor is used between the output pin of PIR and the ground to avoid the false trigger. The light-dependent resistor (LDR) and a variable resistor (VR) are connected in series between positive power and the ground line to form a voltage divider. The junction point of LDR and VR is then connected to the input of the first ADC, which is the pin no. 2 of the chip (AN0), as shown in Fig. 3. A buzzer is connected to the GPIO (general purpose input/output) pin no. 17 (RC6). The microcontroller chip has 22 GPIO pins. The LCD display unit is powered from a 5.0-volt power rail. Its four-data pins D0-D3 are connected to the ground, and the next four-data pins D4-D7 are connected to the pin no. 23-26 of the chip, which is the GPIO pins RB2-RB5. GPIO pins RC0-RC5 (pin no. 11-16 of the microcontroller chip) are used to send control signals to the relay driver unit. A PCB layout was designed and developed to complete the circuit, as shown in Fig. 4.
The relay driver unit is comprised of 6 sets of relay switches, NPN transistors, diodes, and resistors, as shown in Fig. 4. The relay driver control signal from the GPIO pin of the microcontroller chip is fed to the base pin of NPN transistor through a current limiting resistor. The coil terminals of the relay are connected to the collector pin of transistor and the positive power rail. A general-purpose diode is connected to the relay coil terminal in a reverse biased mode to save the transistor from the back electric and magnetic field (EMF) of the coil. An LED with a current limiting resistor is connected to the collector pin of the transistor to indicate the ON/OFF state of the switch. A layout of the PCB is designed and developed to build the relay driver unit, as shown in Fig. 5.

Working Principle
A prototype of the smart light controlling system has been demonstrated, tested, and installed in an office-cum laboratory room of the institute of fuel research and development (IFRD), BCSIR, as shown in Fig. 6, for five months to observe the overall functionality and performance through different real-life conditions. The mentioned room has a window, and during the daytime, the curtains are left open, which allows sunlight to illuminate the room. In this situation, artificial lighting may be redundant as there is more than enough ambient light in the room to illuminate the workspace. The proposed smart light controlling system divides a large room into several zones. Then for each zone, a motion sensor senses occupancy of the room and sends data to the control unit. The PIR sensor receives radiated infrared light from any moving body within the range and generates a logic HIGH at the output. Its range is 10 meters and about 1800 of view angle. The microcontroller-based controlling unit assumes the zone as occupied when it receives a logic HIGH from PIR. Besides this, a light sensor measures the amount of daylight coming from the outside of the room and sends this data also to the main control unit. The LDR and a series resistor in series connection between the power rail work as a light sensor. When ambient light on LDR increases, the resistance of the LDR decreases and voltage drop across it decreases and vice versa. The microcontroller receives this voltage drop data to measure the level of ambient light.
After processing the received data from the motion sensor and the light sensor, the control unit makes a decision about the number of electric lights need to be switched ON for a specific zone to maintain an optimum illumination. This will lead to increase energy savings as the number of electric lights decrease with the increase of ambient light. The power consumption measurements of the system in different states are recorded. The obtained power consumption data of electric lights of the test room shows that this smart light control system can save up to 44% electric power than a conventional manual system.
Since the comfort level of illumination varies from man to man, there is a customization system (a variable resistor in series with LDR) to set the number of switched ON electric lights in a specific level of ambient light according to the users' need. The user only needs to set it once, and then the control unit will automatically follow the set value as a reference. The smart control unit receives data from the motion sensor to check the occupancy status of a zone. If the zone is occupied, the control unit turns ON the number of lights by analyzing the light sensor data comparing to the predefined reference data table. After waiting one minute, it checks for occupancy data along with light sensor data. If the control unit senses no motion in a zone, then it is considered as an empty zone. The control unit makes two beeps and waits for another 10 seconds to check any further movement. If there is still no motion, then the control unit switches all electric lights OFF for that zone. But when a person enters that zone, it instantly switches ON the number of lights according to the ambient light data.

Results and Discussion
At present, reducing the energy demand in residential, commercial, and industrial areas is an important global challenge. Particularly, a significant portion of total power consumption occurs for lighting purposes, and a huge amount of this energy is wasted due to inefficient light control system. Usually, in the case of the auditorium, large classrooms, office rooms, commercial places, etc., a large number of electric lights such as 10 to 100 lights are used to illuminate the room. Usually, these rooms obtain enough ambient light from outside during the daytime through the windows and doors. So, a significant amount of energy could be saved by adjusting the artificial light with ambient light. Moreover, power consumption could be further lowered by proper light management. To evaluate the proposed system in terms of power savings, at first, we manually controlled the lights of that room as needed. We randomly considered a total of twenty-seven days within a five months period (from February 2019 to June 2019), and the power consumption data of lights was recorded in that selected days from 10 AM to 4 PM. This recorded data of power consumption for manual mode was plotted against days, as shown in Fig. 8. In this case, we have found the average electric power consumption of the selected days as 0.572 kWh. Also, the automatic control system was implemented to control all the lights of that room for another discretely twenty-seven days within that mentioned period, and the consumed power data of the system was recorded. Fig. 9 shows the power consumption versus days graph in automatic control mode where the average electric power consumption is 0.318 kWh. The study result demonstrates that the proposed smart light-controlling system saves a significant amount of energy compared to the existing manual controlled system. More precisely, the proposed smart light-controlling system can save up to 44% electric energy over the existing system. Though normally, wired intelligent systems have comparatively lower energy savings capability ranging from 3-40% [13][14][15][16]. Fig. 10 illustrates a complete power consumption comparison between the automatic and manual light-controlling systems, where automatic light-controlling systems show better efficacy, in terms of power savings, compared to the manual system.

Conclusions
The design and implementation of a microcontroller-based energy-saving smart light controlling system has been presented in this paper. To examine the performance and the power consumption characteristics, we measured the electric power consumption for both the manual control and the proposed automatic control mode over a discrete twenty-seven (27) days' time period. The experimental data reveal that the proposed system reduces total power consumption by 44%. The result shows increased energy-saving behavior compared to the existing similar light controlling systems, especially for a system comprised of occupancy and motion sensors. Based on the cost-analysis, the designed energy-saving control system is found to be more cost-effective compared to a near-equivalent commercial setup while introducing additional autonomous daylight-linked control.

Patents
A patent application has been submitted (Patent Application No-11/2020, Dated: 16/01/2020, Department of Patents, Designs & Trademarks, Ministry of Industries, Government of the People's Republic of Bangladesh).
Supplementary Materials: Not applicable.