Internet of Things Based Parking Lot LED Lighting System

In order to reduce energy consumption due to lighting, a good control mechanism should be established and more efficient lighting products should be designed. Conventional lighting products consume a lot of energy and pose a threat to the environment. And also, because of these lighting products which are based on time-dependent on-off control mechanism or manually switched on-off mechanism, sufficient efficiency and saving cannot be achieved. In this study, to minimize these drawbacks, a LED driver system and an Internet of Things based control system is presented for parking lot lighting. Instead of conventional lightings, LED lighting is used; and an efficient LED driver circuit is designed with the light level control option. To ensure the synchronous control of LED lighting, Internet of Things, one of the rapidly growing technologies, is integrated into the system. All data from the lighting nodes are sent to the cloud database via internet connections of the wireless sensor nodes. And a control software which is designed processes the data in the cloud database and writes back the light levels of each lighting nodes to the cloud database. As a result, an efficient lighting environment is created, unnecessary lightings are prevented, in case of failure of the lighting nodes necessary repairs can be planned easily, and also necessary statistical reports can be created according to the data locates in the cloud database.


Introduction
Because of the increasing energy usage and costs, significant attention is required to take precautions for energy saving. It is estimated that more than 19% of electrical energy is used for lighting all around the world by the International Energy Agency (Zhang et al, 2011). With the developing technology in the lighting applications, LEDs become more common, they have some advantages such as being more energy-efficient, longer lifetime and no harmful mercury content like conventional fluorescent lamps (Hui et al, 2009). If all conventional light sources were replaced with LEDs, the total energy saving would be around 1000 TWh/year (Krames et al, 2007). Moreover, if we can control the LED lighting systems more effectively than it is now, we can significantly increase the amount of savings and lighting quality achieved.
To obtain a good control scheme, one of the hot topics these days, the Internet of Things (IoT), should be integrated into the system. IoT is a network contains smart devices that use embedded processors, communication hardware, sensors, and actuators (Patil et al, 2017). IoT based systems are used in various application areas, such as home monitoring (Kung et al, 2018), life monitoring for vehicles (Ni et al, 2018), smart irrigation (Taştan, 2019), fire alarm (Çeltek et al, 2017), mini aquarium (Lin et al, 2019). IoT devices collect data from the environment, analyzed these data locally or share these data by sending to the cloud through the Internet (Jin et al, 2014). According to the obtained sensor data, unnecessary active state durations of the lighting nodes can be minimized; furthermore, better lighting can be obtained.
In this study, an IoT based LED lighting system is proposed for parking lot illumination. As a LED driver circuit, an offline led driver circuit topology is used. For internet connection and control mechanism, ESP8266, a system-on-chip (SoC), which includes a 32-bit Tensilica microcontroller, standard digital peripheral interfaces, antenna switches, RF balun, power amplifier, low noise receive amplifier, filters, and power management modules, is chosen (ESP8266EX, 2019). The Firebase Realtime Database which is a cloudhosted NoSQL database stores the data which are sent from wireless nodes. A windows application written in C# connects to the database and decides the light levels of every node, and write these decisions to the database to inform each wireless nodes.
The rest of this paper is structured in four sections. In Section II the proposed system's methodology is presented and discussed. In Section III whereas a discussion on results is presented and finally in Section IV concludes the research.

Material and Method
Although the LED lighting systems consist of several different parts, each with its own specific set of tasks to perform, the circuit of the proposed lighting system can be broken down into four main parts: the LED driver, the power factor correction, the DC power circuit, and the control part; ESP8266, PIR motion sensor and LDR circuit. The block diagram and the connections between these parts can be seen in Fig.1. A low cost, high efficiency, offline driver circuit is used to supply DC power to the serially connected LEDs in the array. The driver circuit is based on buck converter topology and it has wide input voltage range. CPC9909 is used as an LED driver IC in a buck converter circuit with current control. When the switching MOSFET (Q1) which is controlled by CPC9909 is turned on, current flows through the LED fluorescent and then inductor (L1). That flowing current is limited according to the current limiting resistor (R2) that locates after the switching MOSFET. When the voltage drop on the R2 resistor exceeds the threshold value, the CPC9909 turns switching MOSFET off. Q1 remains at off position for the fixed minimum off-time, and then it is turned on again. This same process repeats itself. Even if the limiting resistor is used to set the maximum LED current, a pulse width modulation (PWM) dimming function can be used via PWMD pin to limit the maximum LED current. According to the proposed design, the maximum output current of the LED driver circuit is 350mA. The driver circuit is tested for long periods of time at 55 degrees Celsius, and it is powered off and powered on more than 30000 times to make sure the circuit is designed properly.
Because the bridge rectifier with a capacitor is used to supply DC signal to the driver circuit, the AC line current ceases to be a sinusoidal signal. This results in a poor power factor condition, where the apparent input power is much higher than real power, power factor ratios of 0.5 to 0.7 are common. To improve the power factor, a simple and an effective passive power factor correction (PFC) circuit which is called Valley Fill is added between bridge rectifier and LED driver circuit (Drapela et al, 2008).
The DC power circuit is designed to power up the motion sensor circuit, LDR circuit and ESP8266 wifi module. The flyback topology is used which is the most common topology in low power applications because of its simplicity and low cost. As a control component, TOP200 switch which has three pins has all required functions for switched-mode power supply controls, such as switching MOSFET, internal oscillator for gate driving PWM signal, fault protection circuitry (TOP200-4/14, 1996). The high DC voltage is applied to the primary side of the transformer and it is switched at 100 kHz via the internal oscillator and the integrated high voltage MOSFET of the TOP200. At the secondary side of the circuit to get 5V DC voltage three-terminal positive voltage regulator, 78L05, is used for the PIR motion sensor circuit bias and light detector circuit bias. At the following of this regulator, another low dropout (LDO) voltage regulator, AMS1117 3.3V, takes place to apply 3V DC voltage to the ESP8266.
The control part of the proposed lighting system can be thought as a brain of this system. The control part consists of three components; ESP8266, PIR and LDR circuitry. ESP8266 is a wifi system on a chip device produced by Espressif Systems. It provides full internet connectivity in a small package with full TCP/IP stack and microcontroller capability. It is mostly used for the development of IoT (Internet of Things) embedded applications.
A passive infrared sensor, PIR, is an electronic sensor which measures infrared light radiating from objects. So, it is used to sense any motion in its field of view. The LDR circuit is usually used to detect the light level of the environment, however, in the proposed design, it is used to detect that if the LED array is functional or not. If it is not functional, it is reported to the maintenance service and necessary measures are taken as soon as possible. Because of the ESP8266-01 module has no analog input, the LDR sensor is used with operational amplifier comparator circuit.
The database which is used to store all sensor nodes data is the Firebase Realtime Database, a cloud-hosted database. Data received from any connected client sensor node, and remote monitoring and control PC is stored as JSON and synchronized in realtime (Firebase, 2019). The clients are connected directly to the Firebase Cloud and they write and read data from the realtime database periodically. The client nodes have a limited number of tasks due to their limited resources. One of their mission is to check the motion sensor, and turn on the light according to the existence of the motion; or at the absence of movement, to set the level of light according to the forced light level read from the database. This algorithm which is run on the ESP8266 is shown in Fig. 2. The control software, which runs on the remote computer, gets the all data from the firebase database and it decides to the optimum light levels of each client nodes and writes the forced light level on the database. And also according to the LED array errors which are set by nodes, it directs the repair staff to the relevant location. According to the monthly movements in the database, the control software makes plans of maintenance, cleaning, etc., and reports the statistics.

Results and Discussion
The prototype circuit of the proposed lighting system is shown in Fig. 3. The printed circuit board (PCB) is designed to fit in the LED fluorescent case; that's why the PCB is long and thin as possible as. In Fig.3.a the top side, in fig.3.b the bottom side of the prototype are shown. All components are chosen from the surface mount component packages; only the PIR sensor is used as a throughhole package. And finally Fig. 3.c shows the LED fluorescent. The current of the LED array which is used in the design is 120 mA at the maximum light level. The light level is adjusted to 100% at the node that detects movement by PIR sensor. Moreover, the light levels at the neighborhood nodes of that active node are set to the different light levels such as 20%, 40%, 60% or 80% by the control software according to the closeness of this active node. For example; the level of light is set to 80% at the closest node to the active node, and at the furthest node, this level is set to 20%. In Fig. 4. the light level of 20% is shown. At the nodes which are not at the neighborhood of the active nodes, the level of lights is set to 0% to save energy. The light level of each node is adjusted through PWMD pin of LED driver integrated circuit with the PWM signal which is applied from ESP8266.

Fig. 4. The light level is 20%
In order to achieve the above objectives, the proposed lighting system is designed as it is shown in Fig.5. When the nodes are set up for the first time, their unique ID numbers are saved in the Firebase Realtime Database (Fig.6. left side). From the control software ( Fig.6. right side), which is programmed by using C#, the IDs of each node are matched with the floor IDs. To test the proposed lighting system, a sample database was created by using one designed LED Fluorescent prototype and five ESP8266 wifi nodes which PWM outputs were followed through a single LED. These nodes were assigned at different locations at the parking lot through the control software. Error scenarios were created and monitored both through the database and the control software. In case of movement detection at the prototype node, the operating states of the system were performed.

Conclusions and Recommendations
This paper presents an IoT based LED lighting system for parking lot lighting. Each lighting node, in other words, LED Fluorescent, includes a motion sensor, LDR sensor, ESP8266 Wi-Fi module, LED array and LED driver circuit. According to motion sensor output, ESP8266 turns on the light and send the related data to the firebase realtime database via internet connection. The control software turns on the neighboring lights of the node that is detected the movement, according to their distance to this node. While the nearest neighbor's light is too high, the farthest neighbor's light is less, and the irrelevant light nodes are kept off position so the wastage of power is reduced. If there is no illumination even though the node light is turned on, the node reports an error in the LED array; thus, the repair process can be done without any delay. Since any data got from the nodes is saved in the database, any report can be derived at any time. By adding the image processing features with the camera located at the entrance of the parking lot, this system can provide illumination of the road which the person or vehicle is supposed to go.