Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Smart Street Light System Using Raspberry pi

Chaitali Manani, Prem Gandhi, Shweta Gade, Chetan Bansode, Dr. Sandhya Kadam
K. J. Somaiya Institute of Engineering and Information Technology Sion, Mumbai, India
c.manani@somaiya.edu, prem.gandhi@somaiya.edu, shweta.ag@somaiya.edu, chetan.bansode@somaiya.edu,
sandhyakadam@somaiya.edu
Abstract— Lighting consumes a huge amount of energy, by the streets late in night. In this system, when the vehicle is
which improving the efficiency is a significant challenge. Smart approaching near street light, light will be turned to full
street lights which use light-emitting diode (LED) lights for intensity, when the vehicle is moved away, the street light
illumination and monitoring is being used for less power automatically turns to low intensity. The street lights used in
consumption and environmental
K. J. Somaiya Institute ofefficiency. As smart
Engineering and street light
Information this system are
Technology LED
Sion, lights which
Mumbai, Indiaconsumes less electricity.
system with detection of vehicle for the use of traffic is not been This system also detects speed and distance of vehicle from
widely used, Smart street light system using raspberry pi is an street light with the help of headlights and taillights.
intelligent system of street light which minimizes the problem of
electricity power consumption which is caused late at night when
the street lights are working. The street light work for nearly 12 II. RELATED WORK
hours i.e from evening 18:00 to next day morning 06:00AM To work on proposed system, technical details are
which are not majorly used from 23:00PM to 05:00AM. As for studied by surveying different papers based on the given
the mentioned 6 hours, there are very less vehicles as well as
system [1]. In this paper [2], the system is used for street
people on the streets and a huge wastage of electricity. Smart
street light system using raspberry pi as the proposed system lights when a vehicle moves at night the light turns to 100%
focuses on minimizing the power consumption as well as to intensity. The components used in this system are arduino,
detect the velocity or speed of the vehicle. The system is designed led, ldr and ir sensors. Advantage of this system is intensity
using LED, PIR sensor, LDR sensor, SD card, camera module, is dependent on vehicle and this system saves power
with all this components which are connected and controlled consumption. Disadvantages of this system are multiple IR
using raspberry pi. This system will detect the vehicle and it sensors are used for a single street light. In this system [3]
turns the street light to full intensity when the vehicle passes and light intensity is reduced when there is no movement and
the street lights are automatically turned to low intensity if not turns to full intensity when there is movement. The
required and it also detects speed and distance of the vehicle
components used in this system are microcontroller, laser
from street light.
gate, led. Advantages of this system are when there is no
Keywords— detection, electricity, vehicle, consumption, movement lights are turned to low intensity and this system
raspberry pi, intensity, minimizes. saves power consumption. Disadvantages of this system are
laser gate is needed to be connected to all the street lights. In
I. INTRODUCTION this system [4] street lights are off when there is no
movement and turns to full intensity when there is
Lights are essential and one of the most important movement. The components used in this system are
components of building the environment. Lights are very
microcontroller, photo diode, led. Advantages of this system
important at night as it helps to maintain safety of people and
is Street lights are turned off when there is no movement on
to prevent crime. There are lights on each and every street,
highways, parking lots etc. As for every 30 meters, there is a roads and it saves a lot of power consumption. In this
street light. So, we can imagine how many lights may be system [5] camera is used to detect the vehicle, using
there in a city or in the country and worldwide. As these kalman filter and optical flow. The components used in this
street lights are used by public widely consuming more system are camera, image processing, machine learning.
electricity. We thought of solution for saving electricity. Advantages of this system is it can detect vehicle upto
With such a huge number of street lights and a huge amount 20km/hr and velocity of vehicle can be calculated. A
of power consumption, there is a huge usage of electricity in disadvantage of this system is it can not detect object in
cities and there is a lot of pollution and emission of carbon cluster. This system [6] is used to detect the movement of
dioxide. As of now energy saving and environmental vehicle and calculate the speed of the vehicle by using block
awareness is trending in current research, from the technical extraction. The components used in this system are camera,
view, light emitting diode is commonly used as solid state matlab ,digital video recorder. Advantages of the system are
light source technology in general applications, because of velocity and distance of vehicle can be calculated.
less power consumption, long life and no use of mercury gas Disadvantages of this system are it is very complex and time
as compared to conventional lamps. consuming. This system [7] contains vehicle detection and
Electricity consumed by lights nearly accounts for 25% tracking using datasets of headlights and taillights. The
of world electricity consumption out of which 10% is used in components used in this system are camera, image
public areas such as street lights, parking lots etc. The street processing, machine learning. An advantage of this system
lights are ON from 18:00 to 06:00 which is for 12 hours. Out is velocity of vehicle can be calculated and it has high
of which for nearly 6 hours there are very less vehicles and accuracy. Disadvantage of the system is motorcycles
people on the streets from 23:00PM to 05:00AM. The streets velocity can not be calculated.
lights remain ON which causes electricity consumption. This Many papers[8] - [14] are studied in detail and
contributes to a huge waste of energy and therefore it is compared for its advantages, disadvantages and power
important to manage this waste more efficiently in order to consumption and proposed an Intelligent system using
create a better world. Conventional street light system use Raspberry- Pi which can be used in near future and useful
constant illumination of light which leads to high energy for the people.
consumption up to 60% of total electricity expenditure.
The proposed system as Smart street light system using
raspberry pi is an intelligent system which can control the
street light to optimize the problem of power consumption of
1

Electronic copy available at: https://ssrn.com/abstract=3871011


III. PROPOSED SYSTEM

A. Overview of the project


The block diagram of the proposed shown in Fig. . The
various phases are involved in the process of building the
system. The initial phase depends on data and focussing on
data collection and pre-processing of data. The next phase is
about training a model to identify vehicles. It uses the
algorithm which includes the model and training of the
model. Then, next is the the prediction phase where the
input is from frames of video which is passed to the model
to detect the presence of the vehicles. The next phase
involves the hardware which acts in response to the result of
prediction. The Raspberry pi 3 B+ will activate the
streetlights as per the result of prediction.

Fig 2. Flow of the system

The block diagram is shown in fig 3. Which


describes the process for a series of streetlights. When
vehicle is detected by the first one, the first and second
street lights are switched on with high intensity. The
velocity and distance from the next streetlight is calculated.
For each streetlight in the series we check if the calculated
distance is equal to difference between distance of vehicle
from camera and distance from first streetlight to the
Fig.1. Block Diagram of the Proposed System current. If the condition is satisfied then the next street light
is turned on.
B. Flow of the system
The flowchart is shown in fig 2. It gives different
phases. The first phase, where street lights are ON with low
intensity to capture images/videos which are then passed
through the model for detection. If vehicles detected then
street lights are turned on with high intensity, if not then we
repeat the same process. Once the vehicle is detected and the
street lights are turned ON, with the help of PIR and LDR
sensor, system will calculate the velocity and distance of
vehicle from street light.

Fig 3. Outlook of system

The data is collected for detecting vehicles from a


dataset of GTI which was a Nighttime Vehicle Detection
database (NVD), it has been gathered from real traffic
cameras publicly available from five different locations on

Electronic copy available at: https://ssrn.com/abstract=3871011


highways: Richmond, Walnut, California, Connecticut and C. Tensorflow Object Detection API Setup:
Gelderland. The cameras record monochrome video (gray Starting with TensorFlow Object Detection API Setup.
scale) at night, and in the five scenarios, vehicles usually Downloading a faster rcnn model so that we have a base on
appear with complex illumination patterns and large flashes, which to train. Here we are using the concept of transfer
instead of well-defined lights. The dataset includes images learning, so a pretrained model which knoes to recognize
and annotations describing these illumination patterns. The feautures will be made to recognize features from our
images can be found in this folder. Each location is split into custom dataset. After downloading
train and test dataset. Same split for the ground truth files faster_rcnn_resnet50_v1_640x640_coco17_tpu-8 model, we
which are in xml format. We used scripts written in matlab create a a folder for setting up Tensorflow where we clone
to convert these ground truths into files that can be used for the git repository as we will need the object_detection
training the model. We used 4 scripts, first to convert the module inside it. We install all dependencies required for
ground truths into csv files. Second added the information of it.The Tensorflow Object Detection API uses Protobufs to
boundary boxed to be marked where vehicle is found to the configure model and training parameters. Before the
csv files thus creating bbox csv files. The next 2 scripts were framework can be used, the Protobuf libraries must be
for getting the data in coco format. Coco format is the downloaded and compiled. This protoc command does it.
general way data is represented for object detection using We set path for models to our system so that it can find the
faster rcnn model. Once, the data was processed it train the modules.Installation of the Object Detection API is achieved
models for object detection using Tensorflow 2 API. This by installing the object_detection package. This is done by
required setting up object detection libraries, getting a running the commands of setup.py from within
pretrained model provided by Tensorflow, configuring it to Tensorflow\models\research. This cell of imports is like a
custom train it. Since the training is completed and we have check to see if setu is completed.
the trained model and checked for the prediction by loading.
We load the model. Here, we provide the images where
vehicles are to be detected with the result of detected images D. Generating Tfrecords:
with a percentage and a box around the vehicle. After this we have to convert the json files to tfrecords
and we do that using conversion.py and giving it the
necessary details from dataset.
IV. FLOW OF THE PROPOSED SYSTEM
The flow of the project goes as follows to get the
E. Configuring Model And Pipeline:
desired output of the system. The steps which were followed
are as follows:- We get model_main_tf2 and exporter_v2 files and edit
the pipeline.config file to set our dataset paths as input, the
A. Collection Of Data: batch size, number of steps, class_names (which is only one
Starting with data collection for detecting vehicles. We here: vehicle) and other parameters if needed.
found a dataset from gti which was a
Nighttime Vehicle Detection database (NVD) [15], it had
F. Starting Tensorboard:
been gathered from real traffic cameras publicly available
from five different locations on highways: Richmond, Tensorboard is a kind of a tool which provides
Walnut, California, Connecticut and Gelderland. The calculation during workflow of machine learning. It also has
cameras record monochrome video (gray scale) at night, and some metrics like loss and accuracy and more.
in the five scenarios, vehicles usually appear with complex
illumination patterns and large flashes, instead of well- G. Training The Model:
defined lights.
Now that setup and configuration is done all we need is
to run the model_main_tf2.py file to start training, we
B. Data Processing: provide it path for model and config file.
The dataset includes images and annotations describing
these illumination patterns. The images can be found in this H. Saving The Model:
folder. Each location is split into train and test dataset. Same
Once training is done, we use exporter_main_v2.py file
split for the ground truth files which are in xml format. We
used scripts written in matlab to convert these ground truths to save it in a directory. As we do this the model has been
into files that can be used for training the model. We used 4 saved.
scripts, first to convert the ground truths into csv files.
Second added the information of boundary boxed to be I. Loading The Model:
marked where vehicle is found to the csv files thus creating Then comes loading the model to see the predictions.
bbox csv files. The next 2 scripts were for getting the data in Tensorflow gives a saved_model.load() function we used.
coco format. Coco format is the general way data is We load the model as we are done with saving.
represented for object detection using faster rcnn model.

J. Generating Predicitions:
Then we set category index using the label map created
for our dataset, we also set images on which prediction to be

Electronic copy available at: https://ssrn.com/abstract=3871011


performed. Then run this code which prepares the images as
numpy array then converts it to tensor. We pass this
input_tensor for detection, we get class, score and boxes
from detection which are displayed on the image and the
images are plotted using pyplot from matplotlib.

K. Hardware Model:
As we are done with the software part now we start with
the hardware part. We are using the raspberry pi, we connect
all the components to the raspberry pi and we can see the
output on the breadboard. We need to connect the sd card to
laptop and we have to completely format the sd card and
then place the sd in raspberry pi. Then we need to open the
network and sharing in laptop and connect ip address of
Ethernet cable and open putty and type the ip address and
we get started with raspberry pi. Graphical interface xming
need to be opened then the raspberry pi will open in system
tools so now we can start the raspberry pi software and enter
the code in raspberry pi so we get the desired output. Fig 4. Circuit Diagram

V. HARDWARE COMPONENTS AND SOFTWARE USED VII. ANALYSIS


Smart street light system using raspberry pi is a The data is collected for detecting vehicles from a
system which has both hardware and software involved in it dataset from GTI which is a Nighttime Vehicle Detection
to get the desired output. A software requirement for this database (NVD), it’s been gathered from real traffic cameras
system is operating system for windows os, linux os, publicly available from different locations on highways.
Python, Tensorflow 2. For hardware, the components such The cameras record monochrome video (gray scale) at
as raspberry pi, LED, LDR sensor, PIR Sensor, resistors, night, and in different scenarios, vehicles usually appear
memory card, camera module, etc are used. Raspberry pi is with complex illumination patterns and large flashes, instead
a small device used in this project which sends the software of well-defined lights. The dataset includes images and
program from our laptop to this device and device is annotations describing these illumination patterns.
connected with the breadboard to get the output. LDR is First scripts are converted from the ground truths
light dependent resistor which is used to control the into csv files. Second added the information of boundary
intensity of street lights in this system. We used memory boxed to be marked where vehicle is found to the csv files
card to save the program in the raspberry pi. Camera module thus creating bbox csv files. The next 2 scripts were for
is a small camera which enables to take pictures of the getting the data in coco format. Coco format is the general
vehicle and detect the vehicle. Other some common way data is represented for object detection using faster rcnn
components are breadboard, connecting wires, power supply model. Once the data is processed, model is trained for
etc. are also been used in this hardware part of the system. object detection. As one of the resources led us to
Tensorflow 2 API. This required setting up object detection
libraries, getting a pretrained model provided by
VI. IMPLIMENTATION
Tensorflow, configuring it to custom train it.
The detailed circuit diagram is shown in fig.5. The
heart of our system is the raspberry Pi which is most
preferred when developing Advanced Applications. So
raspberry is a 40 pin IC. Pi is used for making on and off VIII. RESULTS
street lights and also it will give the instructions to
minimum to maximum intensity of light. Uu gear light
sensor=This is used to manged the efficiency of light GND,
Vcc which is connected to 3.3v. The digital, the output pin
from GPIO4. The pi camera module is a portable light
weight camera which supports raspberry pi. It
communicates with pi using the MIPI camera serial
interface protocol. It is normally used in image processing.
This cable of camera we have to connect CSI (camera serial
Interface) port of the pi. PIR sensor is used to sense motion
and detect the vehicle when it passes by. In this system,
when vehicle is coming, it will detect the motion and alert
the camera. GPIO is connected to the GPIO23. And at the
output section we are using LED as a street lights.

Electronic copy available at: https://ssrn.com/abstract=3871011


Fig 6(b). Output of Original Image
Fig 5(a). Original Image

Fig 7. Output at Hardware part of the System

Fig 5(b). Output Of Original Image By proper study and implementation of the system,
the desired output is obtained. The image results are already
displayed as the original image (input) there is no detection
of vehicle and when we process the image through the
software we get the desire output as we can see above the
output has the square boxes in front of the vehicle which
means the system has detected the vehicle. As we can see
from figure 5(a) the vehicle are moving so from their
headlights and taillights we can see in figure 5(b) that the
vehicle are now covered with green boxes which indicates
that system has detected the vehicle movement, And same
can be seen in figure 6(a) and 6(b). In figure 7 we have got
the partial output of the system we can see that raspberry pi
is connected and we can see that the LED is turned on.

IX. CONCLUSION
The proposed system saves a large amount of energy by
controlling electricity consumption. For now, there are
yellow conventional lights used in majority of the cities and
Fig 6(a). Original Image states, and replacing it with LED lights that can save power
consumption. This system uses sensors as well as camera for
detecting the vehicle and turning the streets lights to full
intensity and low intensity depending on detection of vehicle.

Electronic copy available at: https://ssrn.com/abstract=3871011


In addition, the system can detect the speed and distance of [8] Yu-Sheng Yang, Shih-Hsiung Lee, Guan- Sheng Chen, Chu-Sing Yang,
vehicle from the street light. This system provides more Yueh-Min Huang, Ting-Wei Hou, “An Implementation Of High Efficient
Smart Street Light Management system For smart City”, IEEE Access,
benefits then the currently available system in variety of 2020.
aspects. Further, it can be modified as LED lamps can be
replaced with solar lamps to make it more eco-friendly [9] Gul Shahzad, Heekwon Yang, Arbab Waheed Ahmad, Chankil Lee,
system by using available natural resources as solar energy. “Energy Efficient Intelligent Street Lightning System Using Traffic
Adaptive Control”, IEEE Sensors Journal, 2016.

X. REFERENCES [10] James Crowther, Christoph Herzig, Gordon Feller, “The Time is Right
[1] Rishikesh Lohote, Tejal Bhogle, Vaidehi Patel, Vishakha Shelke, for Connected Public Lighting Within Smart Cities”, Cisco Internet
“Smart Street Light Lamps”, International Conference on Smart City and Business Solutions Group (IBSG) Cisco System, 2012.
Emerging Technology (ICSCET), 2018.
[11] Michele Magno, Tommaso Polonelli, Luca Benini, Emanuel Popovici,
[2] Aziera Abdullah, Siti Hajar Yusoff, Syasya Azra Zaini, Nur Shahida “A Low Cost, Highly Scalable Wireless Sensor Network Solution to
Midi, Sarah Yasmin Mohamad, “Smart Street Light Using Intensity Achieve Smart LED Light Control For Green Buildings”, IEEE Sensor
Controller”, 7th International Conference on Computer and Communication Journal, 2015.
Engineering (ICCCE), 2018.
[12] Ahmed Farahat, Anna Florea, Jose Luis Martinez Lastra, Christian
[3] Deepak K. Srivatsa, B. Preethi, R. Parinitha, G. Sumana, A. kumar, Branas, Francisco Javier, Azcondo Sanchez, “Energy Efficiency
“Smart Street Lights”, Texas Instruments India Educators Conference, Considerations for LED-Based Lighting of Multipurpose Outdoor
2013. Environments”, IEEE Journal Of Emerging And Selected Topics In Power
Electronics, 2015.
[4] N Yashaswini, N Raghu, S Yashaswini, G Prathib Kumar, “Automatic
Street Light Control By Detecting Vehicle Movement”, 3rd IEEE [13] Mohsen Mahoor, Farzad Rajaei Salmasi, Tooraj Abbasian Najafabadi,
International Conference on Recent Trends in Electronics, Information & “A Hierarchical Smart Street Lighting System With Brute-Force Energy
Communication Technology (RTEICT), 2018. Optimization”, IEEE Sensors Journal, 2017.

[5] Jozef, Gerat, Dominik Sopiak, Milos Oravec, Jarmila Pavlovicova, [14] Gangyong Jia, Guangjie Han, Aohan Li, Jiaxin Du, “SSL: Smart Street
“Vehicle Speed Detection From Camera Stream Using Image Processing Lamp Based on Fog Computing for Smarter Cities”, IEEE Transactions On
Methods”, International Symposium ELMAR, 2017. Industrial Informatics, 2018.

[6] Ranjit Singh Sarban Singh, Siti Aisyah Anas, S. K. Subramaniam, Kim [15] Nighttime Vehicle Detection Database
Chuan Lim, “Real Time Vehicle Speed Detection Algorithm Using Motion “https://sites.google.com/view/visionlearning/databases/nighttime-vehicle-
Vector Technique”, 3rd International Conference On Electrical & detection”.
Electronics, 2012.
[16] How To Train Your Own Object Detector Using Tensor Flow Object
[7] Taun Anh Pham, Myungsik Yoo, “Night Time Vehicle Detection and Detection API “https://neptune.ai/blog/how-to-train-your-own-object-
Tracking With Occlusion Handling By Pairing Headlights and Taillights”, detector-using-tensorflow-object-detection-api”.
Applied Sciences, 2020.

Electronic copy available at: https://ssrn.com/abstract=3871011

You might also like