Development of Wireless Control System for Smart Street Lighting using ESP8266

—In this paper, we report a smart street lighting control system us-ing the ESP8266 which is a low-cost Wi-Fi chip with full TCP/IP stack and microcontroller capability. Our system is equipped with a web server developed in HTML code. Hence, our smart street lighting system can be controlled wirelessly to turn ON or turn OFF. Moreover, our system can monitor the environmental condition, that is the temperature and humidity parameters around the street-light. All sensors used in this system are pure digitally-outputted sensor: DHT11 to monitor the ambient temperature and humidity and BH1750 to adjust the street light intensity automatically. The dimming technique was applied in the control system by using Pulse Width Modulation (PWM). The system was divided into two main parts: Gateway and Node in which these two parts employ the ESP8266. The Gateway as a coordinator will send a message to the node as an end device. In this work, the streetlight is set as a Node. Later, the node will send the ACK to the Gateway. Based on the performance test, we found that each node in the system can send a message to other nodes.


Introduction
Street lighting is one of the city's infrastructures that gets particular concern from the city government because it provides many significant benefits. Street lights are one of the city's strategic assets in providing safety aspect for drivers, riders, and pedestrians, inviting public areas and enhancing security in homes, businesses, and city center. Street lighting is one of the most massive electrical consumption for municipalities area. A case study of BEE reports that the street lighting comprises of 10 -38% of total energy consumption in typical cities worldwide [1]. It is estimated that street lights are operating up to 12 hours a day.
However, the management and control of street light in the city have a problem nowadays because most of them still use the uncontrolled street light (manual control). Therefore, effectiveness in effort and efficiency in costs is still relatively low.
The controllable street lighting is the perfect solution; it can serve special features, namely real-time monitoring and automatic control system [2]. The design of a smart street lighting system taking into account the light intensity for luminous control (i.e., ON/OFF/DIM) offers many advantages; it can save the energy costs by 40%, maintain the prices by 50%, and increase the lamp's lifetime by 30% [3]. There are various numbers of scientific works that propose a control system for the street lights, as in [4] [9]. In [4], the microcontroller PIC16F877A was used as a brain to control the street light system. They use two sensors which are Light Dependent Resistor (LDR) sensor to indicate a day/night time and the photoelectric sensor to detect the movement on the street.
There is drawback in [4], that is the used sensor in detecting light intensity. LDR sensor requires a complicated calculation to obtain the accurate value. In this case, the LDR can be substituted by the BH1750; it has more accurate sensing for light intensity and easier to use. With the BH1750, the light intensity can be directly measured in Lux parameter, without needing calculations. BH1750 was used for various applications, e.g., an intelligent control system for automobile sun visor [5], IoT-based smart home automation [6], sunlight radiation [7], agricultural greenhouses [8], etc. In this paper, we focus on the implementation of BH1750 for street lighting application. Later, in [9] develop the street light system using ESP8266 module, it was used as a communication device as well as a controller device. They employed DHT22 and LDR sensor.
The ESP8266 module is the best suited for the application case because of its lowcost, low-power, and programmable IC [10]. Prior work proposed a wireless sensor network (WSN) consists of Wi-Fi for a node to server communication [11]. Each node mainly comprises of an ESP8266 Wi-Fi module to communicate with the primary server using Raspberry Pi. Similar work as done by Thaker addressed his system for general indoor applications, such as office and industrial building or any closed place provided that there is a Wi-Fi network. In this work, we do not use Raspberry Pi. Hence, the system architecture is different from [11].
To more save the power consumption in LED-based lighting systems, the dimming technique should be applied as in [12]. It can be realized by controlling the duty cycle (D) of Pulse Width Modulation (PWM) signals from the microcontroller. This technique can improve the resolution of luminous intensity, luminous efficiency, and extends the life of the device [13].
In this paper, we develop a control system for smart street lighting suitable for sensors monitoring and remotely controlling the street lights. It has an automatic controller using ESP8266. We design the system to consider several factors, e.g., costeffective, more accurate, and more straightforward to implement.
The novelty of the contribution is our system regulates the luminous flux of lightemitting devices by sensors that monitor environmental parameters. While the innovation impact of the proposed concept is our system can reduce energy consumption in street lighting systems. In this paper, the system is described in detail, but methods for dealing with interference have not been discussed, and it will be concerned in further research.

Methods
The control system of smart street light consists of four parts, namely 1) gateway as a coordinator, 2) node as end-device, 3) wireless router, and 4) web server as a user, i.e., mobile-user using a smartphone or fixed user using admin-PC. Fig. 1 shows a block diagram of the control system. The gateway is responsible for coordinating the node and sending the brightness data. Node receive message from the gateway. Web server data is accessed from the gateway through a wireless network formed by the router. Fig. 1 illustrates the block diagram of the complete system where the hardware (gateway & node) and software (firmware & webserver interface) parts are explained in Section 2.1 and Section 2.2, respectively.
Indonesia is a country with relatively high humidity and temperature. Therefore, we can predict the weather (cloudy/rainy/sunny/fog) issues accurately by using humidity and temperature values. A smart street lighting system can involve proper sensors to control the lamp based on environmental status, including Lux, o C, and humidity levels.
We put the sensor (light, humidity, and temperature) on the host placed in the right position, not in node with the consideration for a low-cost application system. Further research, we will add more than two lamp units in the node integrating via Mesh connection. Accordingly, our system pays high-cost implementation if we install it in the node side because it requires more sensors. Hardware design The first part is a gateway system that has functioned as a coordinator in the system; it has several services such as web service, an ambient light sensor using BH1750, temperature and humidity sensor using DHT11. The design of the gateway part is shown in Fig. 1(a).
Two voltage sources power the gateway part, i.e., 5 VDC and 3.3 VDC with output currents of 0.5 -1 A. The gateway system uses an ESP8266EX type. ESP8266 is an SoC module created by Espressif that is a low-cost Wi-Fi module integrated with 32bit Tensilica L106 microcontroller [14]. The ESP8266 has several features such as inbuilt Wi-Fi (802.11 b/g/n), GPIO, I²C, ADC, SPI, UART, and PWM. There are some versions of the ESP8266 module with different capacities [15].
The BH1750 is an ambient light intensity sensor that has a 16-bit ADC built-in, so the sensor output is a pure digital signal. It means the use of analog signal processing (Op-Amp's comparator) is negligible. Compared to the analog outputted sensor (e.g., LDR, photodiode, photosensor) that require manual adjustment with further calculation, the BH1750 is more practice and simple to be operated. The sensor output is in Lux unit, and it can detect a wide range at high resolution (about 1 to 65535 Lux). Therefore, the light intensity can be changed and controlled according to the needs. In this work, the ESP8266 module is programmed with instructions to control the light intensity by producing a PWM signal.
The DHT11 is a commonly used temperature and humidity sensor. In previous research, we have developed a sensor node using DHT11 applied in the indoor environment [16]. The DHT11 uses one wire communication, so it only requires one access I/O pin to read the data. It works at the level of 3 -5 VDC. The sensor can measure temperature from 0 -50 °C and humidity from 20 -95% with an accuracy of ±2°C and ±5% respectively. The gateway circuit is visualized in Fig. 2; we first assemble the components (DHT11 and BH1750 sensors, ESP8266, and LED indicator) in a breadboard. The gateway has a dimmer control unit with switch driver topology that used to provide dimming control for street lights. The driver uses 0 -10 VDC to control dimming functions. Fig. 3 shows the schematic circuit of the dimmer control unit. An ac to DC adapter takes a 220 Vac/50 -60 Hz signal and converts it to 5 VDC. The power module used in ac to DC adapter is Hi-Link module, which is an isolated power supply with an input range of 100 -240 Vac and output of 5 VDC. We used N-channel MOSFET FQP30N06L for dimmer control. The second part is a node system that consists of a power supply, ESP8266EX, and dimmer control. The circuit of the node is the same to the gateway, but there are no sensors installed in the node as in Fig. 2(b). The node will receive data which consist of brightness value. The PWM signal can be used for LED brightness control.

Software design
The software part covers network firmware and the webserver. The firmware used is a networkable foundation to facilitate communication between gateway and node. The messages between different nodes are sent in JSON format. The gateway will send the brightness data according to the Lux value.

Fig. 4. Connection diagram of smart street lighting
The gateway has several tasks such as reading sensor data, sending brightness values, and receiving the acknowledgment (ACK) from the node. While the functions of the node as follows: waiting for messages from the gateway, receiving messages from the gateway, and sending the ACK to the gateway. The connection diagram of smart street lighting is illustrated in Fig. 4. For sending the data purpose, a unique data format is required. Thus, the data can be received between the gateway and the node. We designed a data package that can be shown in Table 1. The length total of JSON packets are 13 Bytes (comprising 6 Byte destination address + 6 Byte source address + 1 Byte data type) + n-Byte from data payload). Since the gateway and the node have different functions, so the workflow also changed, as shown in Fig. 5 and Fig. 6.
The second part is a web server; it serves to control the node as well as display information, e.g., sensor values, lighting condition, so on. Web server programming is embedded in the gateway. To access it, we need to access the IP gateway directly. The following features are available on the webserver such as sensor information, network information, ON/OFF feature, and dimming functionality. Web server interface is shown in Fig. 7.  Results and Analysis

PWM measurement
The PWM measurement is done by using a digital oscilloscope (RIGOL DS1102E). The measurement scheme refers to Fig. 4, we first connect all of the components used such as a gateway, router, driver, node (LED module), a PC installed web server application in HTML code, and a digital oscilloscope to display the PWM signal. Fig. 8 shows a photograph of an experimental setup. The changing of PWM value is carried out in the webserver application. To calculate the PWM value correctly, we used the equation from [9].
Based on the test result, it can be seen that the width of the PWM pulse varies according to the light intensity. The difference in the PWM value will affect the dimming value of the LED module. The changing in pulse width based on the PWM value can be seen in Fig. 9. Once the PWM signal has been measured by four sample settings, i.e., 100%, 75%, 50%, 25% (Section 3.1), later we observe the effect of changing PWM against the power consumption. We vary the PWM signal from 0 -100% per 10%. The testing scenario is the same as Fig. 8; we involve a digital multimeter to measure the dimmer voltage and current. The measurement result is shown in Table 2. It can be concluded that the use of dimming technique using PWM can save power consumption. The dimmer voltage, current, and power decrease when the PWM value gets smaller.

RSSI measurement
The next measurement is received signal strength indicator (RSSI), which is a measurement of the relative signal strength transmitted and the level of power received by the receiver [17]. This experiment is carried out at a location that meets the requirements of the Line of Sight (LOS) condition.
Hence, we test our system in the outdoor area. With regards to the results, the maximum distance obtained is 84 m with RSSI -of 93 dBm. RSSI analysis is shown in Table 3. The most crucial phase of RSSI measurement is to extract the obtained RSSI from the Access Point. The code is programmed in the Arduino IDE. Later, the sketch is compiled to the ESP8266 module. The RSSI is a negative dBm value, a value closer to 0 dBm indicates that the signal is strong. We observe that ESP8266 generally does not recognize the signal strength less than -95 dBm [18]. We calculate the output power (received) for a particular dBm value. Equations (1) and (2) represent the conversion of dBm to milliwatt and milliwatt to dBm, respectively. = 10 10 (1) From the equation, we calculate the conversion of RSSI values into milli-Watt (mW) unit. The RSSI value calculated in Table 4 represents the value of several RSSI values from several available data.

System prototyping
Since the number of LED module is limited (only one unit in our laboratory) so we made a street light prototype. We used five LEDs with 3 Watt to represent a real street light lamp. The different brightness as shown in Fig.10.

Conclusion
The smart street lighting control system using the ESP8266 has been designed. In this work, we configure the ESP8266 as a gateway and a single node (street light). The sensors used are DHT11 to measure the temperature and humidity parameter and BH1750 to measure the ambient light intensity, in which these sensors are installed in the gateway. The web server interface is involved in the system realized in HTML code, so our system can monitor the street light condition whether the lamp was turning ON/OFF, Lux level, temperature and humidity values. Moreover, our system can be automatically controlled by the ESP8266 module.
In this work, we conducted the tests in the laboratory and has not been tested in street lighting systems. Therefore, we more highlight the description of prototype system development, not the implementation. In the future work, we will address the problems associated with the use of Wi-Fi modules in actual operating conditions, taking into account interference and blocking signal transmission by urban buildings, also will be reflected.