Smart Room Lighting System for Energy Efficiency in Indoor Environment

The building sector absorbs 40% of global energy sources. Energy demand in the building sector is dominated by around 60 – 70% electricity, mainly used for air conditioning, water pumping machines, and lighting. On average, artificial lighting can consume 37% of the total electrical energy needs. Meanwhile, sunlight enters the room through the morning window from noon until the afternoon. Using unnecessary or excessive room lighting when there is a natural light source in the room consumes a relatively large total energy requirement of the building. There is a need for a smart lighting system specifically for indoors for efficient energy management and a lighting control system integrated with IoT, which utilizes the intensity of natural light in a room. In this paper, we proposed that the Smart Room Lighting System uses the fuzzy logic method based on ESP32 to control the lighting in the room to save electricity usage for a room lamp. The result of the tool's design, it can control the light starting from bright, dim, and lights go out. The results obtained by the Smart Room Lighting System can reduce power consumption by up to 93% and energy by up to 70%.


I. INTRODUCTION
According to the times, the rate of population growth, as well as the rate of social advancement and technological advancement, would likewise accelerate. It is predicted that by 2050, more than 70% of the global population will live in urban areas [1]. The increase in the flow of urbanization gives birth to new problems in various fields for urban areas. Of course, increasingly modern society has high expectations regarding a comfortable living and work environment, adequate public facilities, and the ease of accessing and managing all public services. These expectations can be realized in the form of a modern city based on information technology (ICT) or a smart city. A smart city is defined as a smart city with a concept designed to benefit the community, especially in managing resources so that it is efficient and effective. In a smart city environment, one thing that needs to be considered is energy use.
Along with population growth, the use of electrical energy will be more significant while the resources for electrical energy are increasingly limited. Building operations in 2021 accounted for 27% of all energy sector emissions and 30% of the world's final energy consumption, with 8% of those emissions coming directly from buildings and 19% coming indirectly through the generation of the power and heat those structures utilized [2]. Following the decline in 2020 induced by COVID-19 regulations, energy consumption and emissions increased to levels above 2019 [2]. Lighting accounts for 15%-20% of global electricity consumption in the building sector [3] [4]. According to Indonesia Energy Outlook 2019 data, energy demand in the commercial/building sector is dominated by electricity, around 60%-70%, which is mainly used for air conditioning, water pumping machines, and lighting (lamps) [5].
Of the several uses of electrical energy in buildings, artificial lighting, on average, can consume electrical energy needs of 37% of total electrical energy needs. In the meantime, during the early hours of the day, between the hours of noon and three in the afternoon, the natural light that comes into the room through the windows is sunlight. However, the sun's intensity is inconsistent and cannot be controlled by the user, so this natural light source is often considered less effective than artificial lighting. So building users prefer to use artificial lighting even during the day. Of course, this contradicts the energy-saving movement.
All activities can be easily carried out in this digital era using technology. Activities that are generally carried out for quite a long time and are tiring can be carried out quickly, precisely, and efficiently because of technology. Because of this, technology is widely applied in various areas of life to facilitate human work. This paper discusses that technology can be applied to lighting aspects, especially room lighting. The use of technology for room lighting is expected to create a smart city management system that can help reduce energy consumption and the electricity costs needed for lighting.
Based on the description above, a smart lighting system can be realized by implementing the Internet of Things (IoT). The Internet of Things (IoT) is a concept that aims to expand the benefits of being continuously connected to internet connectivity. The IoT is expected to reach 18 billion interconnected devices by 2022 [6]. As a result of these developments in technology, a significant amount of research has been conducted on IoT to improve communication and connect it with human labor [7]. That's why IoT in the smart room lighting system is expected to achieve energy efficiency results.
This paper proposes the Smart Room Lighting System to help reduce energy consumption by streamlining operating hours, changing light intensity, and saving budget expenses. The IoT can be applied to this Smart Room Lighting System by using light sensors connected to the internet network to control lighting that can be monitored remotely on smartphone devices through an application. The sensor's data can be used to condition lamps and set various other requirements. The fuzzy method is used to process sensor data when implementing the internet of things on the smart room lighting system.

II. METHOD
Generally, the level of sunlight that reaches the window surface varies. This relates to weather conditions, whether the sky is clear or cloudy. The amount of daylight with clear sky conditions is explicitly more than the days with cloudy sky conditions. Still, after reaching the window surface, the amount of sunlight distribution decreases exponentially for distance from the window. Therefore, it can be predicted that the distribution of sunlight in the room is only part of the sunlight on the window surface. By incorporating sensors into the LED dimming system, it is possible to achieve the dimming of the LEDs without the need for manual control [8]. The intensity of sunlight distributed in the room will be read by the LDR sensor, where the intensity value becomes a parameter of the dimming control system on the lamp. The lights will turn off when the intensity of the sunlight is significant, then the lights will turn on dimly if the daylight in the room dims, and the lights will turn on brightly when the LDR sensor reads almost no sunlight.
The design of this system is used to control the lights based on natural light conditions in the room so that the use of lights does not consume much power. After getting data from the port, the next activity is a literature study and field study. This system will adjust the light based on natural light, read by 2 LDR modules, and then processed by Fuzzy Logic as input. After the input LDR value is processed according to the fuzzy rules that have been made, it will produce an output in the form of a lamp value which is the level of brightness that the lamp will emit. The PZEM-004t sensor module is utilized to calculate the amount of electricity required to turn on a light that is a part of the Smart Room Lighting System. The results of fuzzy logic calculations and sensor readings are transmitted to the Firebase Server for storage. The next step is to create an Android application to monitor the system.
This system uses fuzzy logic to convert LDR values into lamp values. The PZEM-004t module will be used to measure the lamp's electricity consumption to compute the electricity savings compared to conventional systems. The captured data is transmitted via Wi-Fi to a database server with an internet connection. The server then saves the data to be presented on the application. To use the program, you must have an Android smartphone linked to the internet and can connect with sensor data sent to the cloud.

A. Fuzzy Logic
Fuzzy logic is a generalization of classical logic with only two membership values, namely 0 and 1 or false and true. In this logic, the truth value of a statement must range from entirely true to false [9]. Because the smart lighting systems for rooms use the parameters of the light conditions in the environment, it is impossible to say whether or not they are true or false; moreover, there is ambiguity and uncertainty regarding the boundaries.
In fuzzy logic, it is necessary to have rules for decision-making. In this final project, the input for fuzzy logic is the value of 2 LDR sensors. These values are organized into three different lighting settings, which are off, dim, and bright, respectively. Table  I provides a classification of the fuzzy rules that are available. The LDR sensor value collected gave a total of 9 different rules. The lights will switch off when LDR 1 has a value in the medium range and LDR 2 in the low range. When LDR 1 and LDR 2 are both at the medium setting, the lights will illuminate with a low level of brightness; but, when LDR 1 is at the medium setting while LDR 2 is at the high setting, the lights will glow with a high level of brightness. And the same goes for the remaining guidelines. As seen in the block diagram of Fig. 3, the rule was processed by applying the Fuzzy Mamdani algorithm to get the anticipated output. The LDR value obtained from the light reading in the room is saved in a specific variable as the result of the LDR reading. Low, medium and high conditions are assigned to this variable based on the analog reading from the LDR sensor. Each condition has its value range. It ranges from 0 to 1500 in low-light circumstances. Then, in medium states, it ranges from 1105 to 2905; in high states, it ranges from 2660 to 4095. The ADC value is converted into a digital value and then adjusted to the bit value employed in the microcontroller, which is 12 bits. This occurs when the sensor detects a voltage between 0 and 3.3 V. Equations (1) and (2) can be used to derive the ADC conversion from the range 0-4095.
Where, the n variable is the data processing bit value, so we get.
Because the range used for LDR modules 1 and 2 is the same, the same input graph is obtained, as shown in Fig. 4.  The standard light output range is 0 -100, corresponding to the lamp's power. Lights with variable output are created in three states: off, dim, and brilliant. Because the light is not powered at all when it is off, the range is still 0 in this situation. The range is then set to 5 to 20 in low light. Additionally, it is assigned a value ranging from 20 to 60 when exposed to light conditions, resulting in a graph analogous to the one shown in Figure 5. Then, based on the prior criteria, rules are formed following the regulations previously mentioned in Table I to obtain the required condition for the light output. The rules are formed by combining the IF-THEN and AND operators.

B. Room Lighting Reading by LDR Module
Light Sensor LDR (Light Dependent Resistor) is one type of resistor that can experience changes in resistance when experiencing changes in light reception [10]. The working principle of the LDR sensor is that if the light read by the sensor gets brighter, the resistance value will decrease to several hundred ohms. However, if the light conditions received by the sensor are getting darker, the resistance will be even more excellent up to MΩ. The value displayed on the Arduino IDE serial monitor is the ADC conversion value of the LDR sensor.
LDR1 and LDR2 are located in the same room and are 5 meters away from one another. The test room is a closed space with a window to allow sunshine to enter. LDR1 is positioned near the window, while LDR2 is positioned farther away. Even though LDR1 and LDR2 are put in the same room, their positioning impacts how much light the LDR will receive, resulting in a minor difference in value between them.
The LDR sensor module is utilized to find ambient light in the room. When there is a lot of natural light in the room, the LDR resistance value will be low. Conversely, a low level of natural light in the room will result in a high level of LDR resistance. The LDR sensor value is derived from the analog LDR sensor reading acquired from the calculations covered in the Fuzzy Logic subchapter in the form of the ADC conversion value. Therefore, the LDR sensor's output range is 0 to 4095. The LDR sensor's reading of environmental light is then stored in a dynamic array to increase the stability of the sensor reading and reduce flickering lights.

C. Daylight Harvesting Control System
Daylight harvesting is an intelligent light dimmer-based control method that is used to reduce light energy in the interior of a building when natural light is available in the spaces [11] [12]. The Dusk or Dawn control strategy is a form of anticipated occupancy strategy that may be calculated for any building site and is based on sunrise and sunset [13]. When it grows dark, the automatic lighting turns on and off again when there is sufficient light. This sort of control is utilized infrequently for interior lighting, but it is a good choice for atriums with abundant natural light or glazed halls connecting buildings. Using an external daylight sensor is not necessary to carry out this procedure. The on and off hours are something that a scheduler can provide.
The Daylight Harvesting Control Strategy (DHCS) enables facilities to reduce lighting energy consumption by utilizing daylight and supplementing it with artificial lighting to maintain the necessary lighting level [13]. A photocell measures the illumination level inside a space, on a surface, or at a particular point in the Daylight harvesting control technique. The system controller lowers the lumen output of the light sources if the ambient light level is too high. The controller raises the lumen output of the light sources if the light level is too low. Sensors are typically deployed in large regions, each regulating a distinct group of lights to keep the illumination intensity consistent across the space. This is accomplished by putting the sensors in strategic locations. The finished product utilizes the least lighting energy possible while successfully preserving the original illumination settings.
Additionally, the constant brightness technique can be offered by this system. Daylight harvesting devices are typically employed in spaces with large expanses of windows or skylights. Classrooms, tall office buildings, and retail spaces are other common applications. The potential savings range from 20% for daylight harvesting alone to over 50% for daylight harvesting combined with actual occupancy.

D. Daylight Responsive Dimming System
Daylight is a dynamic source of lighting, i.e., the illuminance from the sky is not constant, and the variations in daylight can be quite large depending on the season, location or latitude, and cloudiness. Different levels of skylights can be found under the same sunlight conditions, and even when sky conditions remain the same, the range of solar illumination can increase as a result of clouds or scattering of particles above the sun [14]. Daylight Responsive Dimming System is a dimming method. The purpose of a daylight-responsive dimming system, also known as a daylight photosensor system, is to maintain the illumination level in a room regardless of the amount of natural light available [15]. In order to achieve this objective, the lamp's light output is continuously modified in response to variations in the amount of natural light detected by the photosensor. These systems are used to increase the quantity and quality of the environment. They can significantly reduce the lighting requirements of lamps where natural light can serve as a valuable illumination source. An illustration of the application of the dimming control system method in the room can be seen in Fig. 6.

E. Electrical Usage Measurement
The PZEM-004t module is a sensor that measures power, voltage, current, and the active energy included in an electric current. This module is used to measure the amount of electricity that is used to light up a lamp. The PZEM-004t module uses serial communication to communicate. Analysis of the data retrieval process included in the PZEM-004T sensor is carried out by the system contained in the ESP32 microcontroller. The data obtained from the measurement results with and without the system will then be analyzed and compared to determine the electricity savings obtained.

F. Android Application
The developed Android application was designed to simplify the smart room lighting system monitoring for its customers. This application shows the present status of the room, the LDR value, and the amount of electricity used. Fig. 7 visually represents the process one must go through to comprehend how the Android application works. On the main page is a menu of LDR values and electricity usage. The LDR value menu is used to view the value read by the LDR sensor and the condition of the room at that time. The menu monitors electricity usage starting from voltage, current, power, and energy. The data displayed in this menu comes from the PZEM-004t sensor readings, which are used to read the electricity usage by the lamp. The menu and application layout are shown in Fig. 8.

III. RESULT AND DISCUSSION
A. LDR Sensor Reading Results i While exposed to light, the LDR sensor transmits electric current, whereas when it is dark, it retains electric current. As a result, in bright light, LDR resistance decreases, whereas, in darkness, LDR resistance increases. On several separate occasions, the test was carried out so that the light intensity level in the room could be determined as a criterion for the lamp conditioning process. The results of the tests are presented in Table II, where it can be seen that the LDR value rises when the light intensity drops. An estimate of the input value range can also be derived from the findings of the LDR sensor test performed on the amount of ambient light.

B. Fuzzy Logic
The results of the Fuzzy Logic test, between the fuzzy input, namely the LDR value, and the fuzzy output, namely the light value, which is generated from the processing of 9 fuzzy rules that have been made, are by the fuzzy design and what is expected. The LDR input and the resulting value of the lamp correspond to a predetermined range. Fuzzy Rules has also worked as intended. So it can be said that applying the Fuzzy Rule in this system has been successful. The Fuzzy Logic test results in the form of LDR values as input and lamp values as output can be seen in Table III.

C. Electricity Usage
Based on the Smart Room Lighting System test for 14 hours from 17:00 WIB to 06:00 WIB, data was obtained from electricity usage needed to turn on room lights. Measurements were made using the PZEM-004t module, and electrical parameters were obtained, namely voltage, current, power, energy, frequency, and power factor. The measurement results can be seen in Table IV. The power and energy parameters are collected from the measurement results of conventional lighting systems to compare with the results of the measurement of the new lighting system. Comparisons will be made between each system's power and energy values, and the amount of money saved will be determined.
In testing the electrical measurements used by lamps with conventional systems, the power value needed for 14 hours is stable, namely 7.1 watts, which is close to the power value of the light itself, 8 watts. Meanwhile, while measuring the electricity used by the lamp using the Smart Room Lighting System, the power required is 0 to 0.5 watts. For a comparison graph of the power of the Smart Room Lighting System with conventional lighting systems, see Fig. 9.  In testing the electrical measurements used by lamps with conventional systems, the total energy used for 14 hours is 0.1 kWh. Meanwhile, at the same time, lights using the Smart Room Lighting System consume 0.03 kWh of energy. The graph comparing the total energy of the Smart Room Lighting System with conventional lighting systems can be seen in Fig. 10. The graph in Fig.  10 shows that the energy used by the Smart Room Lighting System is stable with a value of 0.03 kWh from 20:00 to 6:00. Meanwhile, in conventional systems, the energy used is continuously increasing. It is because from 17:00 to 20:00, the lights do not light up immediately but depend on the light conditions in the room. From 17:00 to 18:00, the room is still illuminated by the setting sun's light. From 18:00 to 19:00, the room is no longer lit by sunlight, but some light is left, so the lights start to dim. Then beginning at 20:00, the room is completely dark with no light, so the light emitted by the lamp will be bright. The value of the light is also based on the processing of fuzzy rules that have been discussed previously. The application of the dimming method also affects the light emitted so that the intensity of the light can be controlled. Therefore, the energy expended does not increase or tends to be stable starting at 20:00. In contrast to the conventional system, in which, since 17:00, the lights have been turned on a total value or very bright, so maintaining the light emitted by the lights until 6:00 AM requires more energy than the smart room lighting system, which can control the light. The results of the calculation of the average use of electricity on power and energy parameters based on the measurement results can be seen in Table V.
Where, the pConventional variable is the average measurement result of the conventional system, and pSRLS is the average measurement result of the Smart Room Lighting System. Based on the calculation of the data in Table IV

IV. CONCLUSION
Smart Room Lighting System is one way to improve natural light in the room and save electrical energy in the room lighting sector. According to the results of the tests, the Smart Room Lighting System can monitor natural light in the room and manage the intensity of the light emitted using the LDR sensor. According to the test results, electric power savings can reach 93% compared to conventional systems. In the meantime, the total energy usage is 70% less than that of traditional room lighting. The results from tests conducted in sunny situations differ from those conducted in cloudy and rainy conditions. The lights illuminate softly in the daytime but in cloudy situations, following the light value detected by the LDR. In contrast, in rainy conditions, depending on how dark it is at that moment, the lights turn on brighter the darker it is outside. As a result, using the Smart Room Lighting System in the room has been shown to overcome the inefficiency of artificial room lighting during the day.