Table of Contents

Smart Street Light Control System

author Pascu Mihail-Eugen ACES 2021
[Youtube Video]

1.Project Objective

The purpose of this application is to implement a system that makes the street lights more efficient than the conventional street lighting systems in the matter of energy conservation, reduction of maintenance costs, decrease of maintenance time and increase in the public safety.

2.Context of public lighting in Bucharest

The public lighting system in Bucharest is an important source of expenses for the Bucharest City Hall. 1)According to [3] in the last 5 years, the average cost of the public lighting was around 28.650.000RON. This increased cost is due to the fact that the system was not updated to the newer and more efficient lighting solutions. 73% of the bulbs that are used inside the lighting poles (the total numbers are around 90.000 poles and approximately 120.000 bulbs) are still incandescent bulbs which are less efficient and have a shorter life span than the bulbs with LEDs. The LED bulbs consume 75% less energy and have at least double life span, according to [4].
Because the civic spirit is not cultivated in our population and that no efficient maintenance system is in place for the street lighting system, issues are detected and reported after long periods of time. Also, because the issues are not fixed in short time, the public safety at night is at risk because of the possible street dangers (thieves, open sewer entry and others) can not be see without lighting.

3.Project Description

The system is composed of two main elements: a central hub and many pole controllers.

4.Hardware Description

All the components that were used in this project are:

Regarding the electrical connections, the central hub has no external devices connected to it. The central hub is connected just to the PC via TTL-USB in order to communicate with the PC, to find out the IP address of the web server hosted on it. The electrical circuit for the poles is presented in the below image [5]:

In the pole schematic can be seen that one analog input (GPIO36) is used to read the value from the LDR, one analog input (GPIO 34) is used to get the voltage that the ESP32 provides to the Bulb (for diagnostic purpose), one digital input(GPIO13) is used to read the signal from the PIR movement detection sensor and one digital output(GPIO2) is used to control the bulb of the pole. The power supply issue was not taken into consideration for when the system will be installed in a pole. Currently the pole hardware is powered via USB cable. As a solution for this issue, a step-down power supply could be used to connect to the 220V network and convert to 5V, to power up the system.

5.Software Description

The system architecture can be found in the image below:

As can be seen, the poles and the central hub establish a mesh network making use of the library painlessMesh [6][7]. This handles the message transmission environment between the poles and the centralHub. Beside this part of code that handles the mesh, there is also the logic part for handling the poles functionalities. This part is making use of the FreeRTOS [8] concepts, cyclical tasks.
Also, the software that was developed for this project is divided in two components:Pole and CentralHub code. Each part was again divided in multiple files to improve the code readability, update and maintenance time in this way (<part> can be pole or centralHub):

The software implemented make use of the following libraries: WiFi, SPIFFS, painlessMesh and ESPAsyncWebServer.

Pole Code is composed of the setup and loop functions and 5 tasks. This can be seen in the below diagram.

A detailed explanation regarding the functionality for each part is presented in the next rows.

Beside these tasks, on event trigger is used in the pole code. This is used when a new message is received from the centralHub. This message is in JSON format and it contains the mode in which the pole will make the control of the Bulb (by light intensity of by time interval).

Central Hub code is splitted in two parts: the code that runs on the ESP32 and handles the mesh network connection and the functionalities implementation (written in C); and another part that handles the web server part (written in HTML,CSS and JavaScript) [17][18].



The detailed explanation for each of the components of the C part code is:


6.Issues and Solutions

During the development of this project, series of obstacles and blocking points were found and overcome. Mostly were due to the fact that no prior experience was present with the ESP32 and the mesh networks. But with a deep research, all the issues were overcome. A list with a part of the issue found and solved:

7.Conclusions

The purpose of this project was to create a prototype that would show alternatives and improved ways of how the public lighting system could be improved. There is a long way until the classic lighting system will be replaced by smart one and limitations (like initial cost investment, cost of development and effort of installation), but, as shown in this project, a smart public lighting solution could solve many of the current issues. So maintenance time and cost will be decreased, power consumption will be decreased and public safety will increase.

The lessons learned during the development of this project are not few and here are just some of them:

For future development, a list of improvements will be provided:

8.Bibliography and Resources

[1] - Verison Intelligent Lighting Solutions :Smart Street Lighting System
[2] - iNELS SMART CITY - Smart street lighting
[3] - Costul anual al iluminatului public in Bucuresti
[4] - Incandescent vs CFL vs LED bulbs
[5] - NodeMCU ESP32 Pinout
[6] - PainlessMesh
[7] - PainlessMesh API
[8] - FreeRTOS
[9] - PIR Datasheet
[10] - Street Light Pole Height
[11] - ESP32 SleepModes
[12] - LED Broken Values
[13] - LED sense circuit
[14] - How LEDs Fail
[15] - ESP32 PWM
[16] - Read PWM value with ADC
[17] - ESP32 Asynchronous Web Server
[18] - ESP32 Web Server using SPIFFS

Download the source code

pascumihaileugen_aces_iotproject.rar

1) CMIPB - A non official source of information was used, because the CMIPB - Company of Public Lighting Bucharest site is not available for official data.
2) Parameter that is configurable via the central hub
3) More modes could be added in next iteration steps