Smart Traffic Light Control System
Smart Traffic Light Control System
Authorized licensed use limited to: Ontario Tech University. Downloaded on July 11,2024 at 16:08:46 UTC from IEEE Xplore. Restrictions apply.
• Red: Forbids passing of vehicular traffic and permits The Raspberry Pi 2 microcontroller handles the LED light-
pedestrian crossing. Lasts between 28 to 40 seconds. ing of the traffic light according to the times previously
• Amber: Warns that the light is about to change from green set with Python code. Depending on the output of the Pir
to red. Lasts between 2 to 5 seconds. motion detector sensor which, when detecting the infrared
• Green: Allows vehicular traffic to pass and indicates radiation change through its line of sight, sends a HIGH to the
and forbids pedestrian crossing. Lasts between 28 to 40 microcontroller. On the PCB board all the red-colored LEDs
seconds. are solded in parallel. They will flash when the traffic light
This system has prevailed since its introduction, due to changes from red to green. The common cathod RGB LED
its relatively low cost. Guayaquil is a city still maintains display, solded in parallel on the PCB board, consists of 4
traditional traffic lights. Traffic congestion is generated at terminals. The longest terminal corresponds to the common
intersections due to the waiting times for each way. The cathod while the other 3 terminals correspond to the emission
system described below will solve this problem, dynamically of red, green light and blue respectively. The microcontroller
allocating time to each way according to the realtime traffic will send PWM signals to each of these terminals and depend-
situation. ing on the work cycle that is applied to the PWM signal of
Traffic lights color timing shouldn’t be fixed, but allocated each terminal, the RGB LED of a will light up with the correct
dynamically following some variables such as actual traffic color. A resistance of 100 ohms was used for each terminal
flow, average speed of crossing, distance between vehicles, per color of the RGB LED display, to avoid excess current
etc. Taking this into account, a more useful light timing could that could burn these components. To connect the components
be determined and thus avoiding excess vehicles queuing at of the PCB with the Raspberry, a 40-pin data bus welded on
intersections for an extended period of time. The system the PCB was used. On this bus, the male-female jumpers are
proposed will build on realtime traffic data collected on-site, to connected to the Raspberry Pi 2.
achieve the installation of “Smart” traffic light on city streets.
IV. D ESIGN OF P ROPOSAL
D. Communication technologies in IoT In Guayaquil, one-sided traffic lights are ubiquitous. They
Automation is one of the main growth areas of technology, normally consist of 3 lenses, however there are traffic lights
due to the constant increase in industrial production. In the vast that have up to 4 faces due to the number of intersections.
majority of automation developments, the Internet is essential The traffic control system described in this paper, in addition
for their operation. to having additional functions and actions to the traditional
Sensors and actuators are fundamental components of IoT traffic lights.
applications, because information is constantly obtained to be
processed, stored or sent to other devices through wireless
networks. [3].
Large number of devices are connected to the Internet, via
TCP/IP. This model can be used for large networks, like the
Internet, or small ones like a personal area network. However,
energy consumption varies per application. [4]
The aforementioned project is based on the application of
IoT design principles: a motion sensor is at the heart of
the solution. It measures the infrared light radiated from the
objects located in its field of vision [5], which in this case
are the vehicles. Through the TCP/IP protocol, the traffic
lights communicate with each other, and with the information
obtained by the PIR sensor, the behavior of the traffic lights
is determined, as it will be explained in this article.
Authorized licensed use limited to: Ontario Tech University. Downloaded on July 11,2024 at 16:08:46 UTC from IEEE Xplore. Restrictions apply.
This design also incorporates a bar of red LEDs that indicate tested with two traffic lights that communicate with each other
the countdown of the completion of the waiting stage of the connected to the same network either by ethernet cable or with
vehicles, which is signaled as a red traffic light. This design a wifi module. When the traffic light 1, in red, detects the
will also have a PIR sensor, which will be located towards the arrival of a vehicle through the PIR sensor, it sends a message
vehicles that pass in the street controlled by that traffic light. to the traffic light 2, in green, indicating that it finishes its
The functionality of the system is described below: time and goes to yellow to later be red, while the traffic
• The traffic light initially operates like any other traffic light 1 starts a countdown through the array of LEDs and
light, with usual fixed times for each state. the indicator of the red LED bar. Upon ending the red light
• At an intersection of two traffic lights, both are constantly of traffic light 1, it sends another message to traffic light 2 to
communicating with each other as they are connected to tell it to turn yellow and then red, while traffic light 1 turns
the same network. green, with the respective delays necessary to avoid accidents.
• Each traffic light receives information from the corre- All of these times can be configured by programming in
sponding PIR sensors, during the normal operation of the Python according to the needs of each intersection. All this
traffic light. was achieved successfully through the first prototype and for
• When the PIR Sensor of a traffic light captures a vehicle, the next prototype it is expected to implement artificial vision
it transmits a message to the other traffic light, making it and achieve correct vehicle counting.
change its state to red. The traffic light that captured the The prototype that has been built consists of several parts:
car and sent the message proceeds to change its state to PCB, Circuit Schematic, Python Code and Basic design of the
green. traffic light housing.
• Each traffic light has a minimum duration of green state,
that is, if the other traffic light receives a vehicle through
its way, but the traffic light that is in green state has not
yet elapsed its minimum time, the other traffic light will
have to wait that minimum time for changing its color
and it will not do so instantaneously.
• While a traffic light is in red, the matrix of red LEDs
display the number of remaining seconds before changing
to green.
• With the design of this system there are a number of pos-
sibilities regarding the operation of the LED Matrix that
can be configured according to the needs or preferences
desired by the customer, or the intersection in which it
will be placed.
V. C AMERA SYSTEM
The PIR sensors will be replaced by video cameras as
initially planned [7], which will process the images with the
Figure 2. Prototype
OpenCV open source library using Python to determine the
number of vehicles, speed, distance between vehicles, and
other important variables [8]. Thanks to this, the traffic lights A. PCB design
in turn will generate data-based statistical reports, so that the The components were layed out in the PCB in a cyclops-
colors of the traffic lights will be dinamically set. In this type form traffic light with a 5x7 array of leds at its center
way the traffic lights will be set up with the best timing to write 2-digit numbers and different shapes and symbols
based on data for each time slot per weekday. Additionally, such as X, seen, circle, ”ok” , among others. These forms are
image recognition function will be added to capture the license configurable in Python code. Below the circle of LEDs is the
plates of the vehicles circulating in the traffic light location, bar of red LEDs. The plate was printed on both sides. The
and also to be able to determine which vehicles violate dimensions of the plate are 145mm x 105mm. The diameter
traffic laws either by passing the Red, speeding, or any other of the semaphore circle is 100 mm. The LED bar is 12.5mm
contravention. x 60mm.
VI. R ESULTS B. Design in PCB
This first prototype of the intelligent traffic light manages to The circuit basically consists of the connection between the
speed up the intersections in which one avenue is not transiting Raspberry GPIOs to the female data bus soldered on-board, in
vehicles in a moment of time while in the other street there such a way that the Raspberry feeds the RGB LEDs which are
are cars waiting, since when not detecting vehicles in the first, connected in parallel. The LED bar is powered with a single
it automatically gives way to the second. The operation was GPIO. The color displayed is controlled by the PWM pulses
Authorized licensed use limited to: Ontario Tech University. Downloaded on July 11,2024 at 16:08:46 UTC from IEEE Xplore. Restrictions apply.
timing of each color, delay times between colors, IP address of
each traffic light, count to be made in the array of LEDs, must
be previously configured in a user-friendly interface. All this
is easy to configure thanks to the distribution by functions of
the programming which is commented for easy understanding.
Figure 5. Lighting
Authorized licensed use limited to: Ontario Tech University. Downloaded on July 11,2024 at 16:08:46 UTC from IEEE Xplore. Restrictions apply.