0% found this document useful (0 votes)
3 views

Design and Implement a Smart Traffic Light Controlled by Internet of ThingsPeriodicals of Engineering and Natural Scienc

This document presents the design and implementation of a smart traffic light control system using Arduino and IoT technologies to alleviate traffic congestion in Wasit City, Iraq. The system utilizes an Arduino Mega, ultrasonic sensors, and an ESP32 camera to monitor traffic flow at a three-line intersection, adjusting signal timings based on real-time vehicle counts and capturing violations. The proposed solution aims to synchronize traffic lights, reduce wait times, and enhance road safety by automatically documenting traffic violations via a database and Telegram app.

Uploaded by

Fernando LT
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Design and Implement a Smart Traffic Light Controlled by Internet of ThingsPeriodicals of Engineering and Natural Scienc

This document presents the design and implementation of a smart traffic light control system using Arduino and IoT technologies to alleviate traffic congestion in Wasit City, Iraq. The system utilizes an Arduino Mega, ultrasonic sensors, and an ESP32 camera to monitor traffic flow at a three-line intersection, adjusting signal timings based on real-time vehicle counts and capturing violations. The proposed solution aims to synchronize traffic lights, reduce wait times, and enhance road safety by automatically documenting traffic violations via a database and Telegram app.

Uploaded by

Fernando LT
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ISSN 2303-4521

Periodicals of Engineering and Natural Sciences Case Study


Vol. 9, No. 4, October 2021, pp.542-548

Design and implement a smart traffic light controlled by internet of


things
Zaman Abood Ramadhan1, Rasha hani salman2, Bahaa Kareem Mohammed3, Ali Hassanein Alwaily4
1
Computer science dept./ College of education for pure science/ Wasit university, Iraq
2
Studies and planning dept., Wasit University presidency, Iraq
3,4
Dept. of Electrical Techniques, Technical Institute Kut Middle Technical University Baghdad, Iraq

ABSTRACT

The rise of the population produces an increase in the number of vehicles on the road, which creates heavy
traffic in the roads and that causes many issues for the citizens and traffic cops an extra two emergency
instances so it is necessary with developing technology to solve this problem. In this research, we used the
Arduino UNO microcontroller board to build a new smart traffic light controller (STLC). Signal lights
produce traffic congestion, and the system makes every attempt to alleviate it. In this paper, we designed a
smart traffic control system by using Arduino to solve the problem of congestion at the intersection of the
Dor al Moalemen in Wasit City, working to prevent traffic jam and reduce time, Using Arduino mega,
ultrasonic sensor, and a camera esp32, the suggested technique analyses and manages everyday traffic at a
three-line intersection. Furthermore, the suggested system achieves three-line intersection sync and
implements a balance between the number of vehicles on each side and the green light. When traffic
violation happens, the camera will capture the car number and send it to the database by using telegram.
Keywords: Microcontroller, Ultrasonic Sensor, Smart Traffic Light, Esp32
Corresponding Author:
Bahaa Kareem Mohammed
Dept. of Electrical Techniques
Technical Institute Kut Middle Technical University Baghdad
Baghdad, Iraq
E-mail: [email protected]

1. Introduction
Traffic lights, which have been used to govern traffic flow at traffic signals, intersections, rail trains, and other
locations since 1912, are signaling devices. The green light indicates that traffic may proceed in the direction
indicated, the yellow light alerts drivers to prepare for a short interview, and the red light stops all traffic [1].
The necessity for a smart traffic light management system has been raised in Iraq because of the enormous
amount of time are stopping at each road intersection. In my country, the present traffic signal system is still
based on the old traditional traffic of a system based on a timer, and traffic is sometimes manually managed
through human involvement. Furthermore, the growth in vehicle numbers imported into Iraq, particularly after
2003, Because the current road grid was never enlarged or repaired to manage the increased number of
vehicles traveling along Iraqi roadways, huge traffic jams ensued [2]. Because of all of this, street crossings
became uncontrollably packed. It resulted in extremely long wait times at intersections and a rise in the
incidence of motor vehicle accidents. So, to reduce the time spent waiting at each traffic and minimize any
accidents, we considered traffic control with a smart traffic light system [3, 4]. One of the most important
aspects of Intersection control is transportation technology to increase traffic safety and relax traffic. In non-
signalized crossroads, drivers rely on physical contact to safely arrange their journey. The installation of
traffic signals has improved the flow of traffic at intersections. Congestion, pollutants, and accidents can all be
reduced with the proper installation of traffic lights and signal control systems. Because of its reliability and
cost-effectiveness, The initial control strategy, a pre-determined (static) Traffic Light Control management
© The Author 2021. This work is licensed under a Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0/) that
allows others to share and adapt the material for any purpose (even commercially), in any medium with an acknowledgement of the work's
authorship and initial publication in this journal.
542
PEN Vol. 9, No. 4, October 2021, pp.542-548

system, is presently being used in numerous crossings around the world [5, 6]. As the result, the number of
cars is increasing day by day and the pollution increases in congestion. As result our solution will reduce the
traffic jams then pollution will reduce also. In this paper, we use Arduino mega, ultrasonic sensor, and a
camera esp32, the suggested technique is used to analyze and manage everyday traffic at a three-line
intersection.

2. Related work
The goal of this article is to contribute to the development of directional signs by inventing a centralized
traffic signal control system that makes use of a one-of-a-kind wireless communication system. The most
prevalent forms of urban junctions were studied to establish the system's efficiency. For network traffic lights,
direct control routines were created, offering a complete control system for unusual conditions. Finally, safety
protocols were developed to communicate the traffic signal system lamps' operational condition to central
management. Using a logic analyzer connected to the outputs for every focal group, it was possible to create
an operational phases timing diagram with each traffic light. As a result, the system was validated based on
the similarities between theoretical and practical timing diagrams [7-9]. The design and implementation of this
investigation are described in this study of an autonomous traffic light management system with congested
road timing for enhancing traffic flow efficiency on city roads. It is also highlighted how the planned smart
traffic light system will aid in the regular updating of these durations in an automated manner, as well as the
importance of altering current traffic signal timing lengths to durations that vary based on the number of
vehicles in the avenues. To do so, an IoT system that is based on the Raspberry Pi system and a PIR sensor
will be constructed, with flexibility and a design for adding camera-related capabilities in mind [10]. This
study looks into how RFID may be utilized as a sensor to monitor traffic jams at every intersection of a
roadway utilizing RFID readers and labels. The purpose of this research is to make fixed and planned traffic
light behavior dynamic. The study presents a novel technique for making signal timing responsive to current
traffic congestion. The suggested intelligent system maintains the dynamic schedules of traffic lights by
sensing the frequency of traffic to avoid congestion using IoT-enabled sensors, which provide current and
robust communication technologies for residents [11, 12]. This study employs the Internet of Things (IoT) and
application development to provide a real-time traffic control management system. The density of traffic is
measured using ultrasonic sensors. The system controller analyzes sensor data and then makes a decision. It
uses a traffic management algorithm to set traffic signal timing and communicates Using a Wi-Fi module,
information to a cloud server. The proposed technology can forecast the likelihood of the crossroads is
congested. If an emergency car is spotted, the junction is given precedence, with a longer signal time. When a
vehicle runs a red light, the system can detect it and issue a fine, which may be paid via the Traffic Wallet
mobile application. This method is both cost-effective and simple to implement [13-15]. This project uses
computer vision technology to distinguish road lane lines and over 40 different traffic lights. In this project,
we will examine the smart city (SMC) concept and offer a model for developing a traffic management system
(TMS) built on the SS network to handle traffic concerns in an SMC environment [16, 17]. This work
develops an autonomous approach to adjust traffic signal time using artificial intelligence techniques and a
picture of cars at traffic lights. The algorithm is validated by comparing its results to those obtained manually.
The suggested algorithm, when implemented in a mode of transportation, will govern traffic flow and
eliminate wasted travel and time spent waiting on roadways [18, 19].

3. System components
A detailed description of the components for this type of control is given in this section.
3.1. In the ESP32-CAM
is a full-featured microprocessor with a micro SD card slot and a constructed video camera. It is low-cost and
simple to use, making it ideal for IoT devices that require complex functions like image tracking and
identification.

The following is a list of the ESP32-CAM specifications:


 The smallest Wi-Fi BT SoC module (802.11b/g/n)
 Limited 32-bit CPU that can also function as an application processor
 600 DMIPS overall processing power, up to 160MHz processor
 Additional 4MPSRAM, created 520 KB SRAM

543
PEN Vol. 9, No. 4, October 2021, pp.542-548

 features UART/SPI/I2C/PWM/ADC/DAC
 Support for picture upload over Wi-Fi
 Support for TF card
 Several sleep modes are supported.
 Free RTOS and Embedding Lwip
 STA/AP/STA+AP modes of operation are supported.
 Smart Config/Air Kiss tech should be supported.
 Serial port software upgrades are supported both local and remote (FOTA).

Figure 1. Esp32

3.2. Arduino mega


The Arduino Mega is an ATmega2560-based microcontroller board. A 16 MHz crystal oscillator, 54 digital
input/output ports (14 of which can be used as PWM outputs), 16 digital inputs, 4 UARTs (hardware serial
connections), a Connector, a power jack, an ICSP header, and a reset button are all found on this board. It
includes everything you'll need to get starting with the Arduino, including a USB cable to connect it to a
computer and an AC-to-DC converter or battery to power it. Because a plastic base plate protects the Mega,
there was no need to be concerned with intentional electrical discharge. The Mega 2560 R3 adds SDA and
SCL pins to the AREF. In addition, two extra pins have been added near the RESET pin. For example, the
IOREF enables the shields to adjust to the power level by the board. The other is unrelated and will be used
later. All existing shields are compatible with Mega 2560 R3, but can also adapt to new shields that need these
extra pins [20, 21].

Figure 2. Arduino mega

3.3. Ultrasonic sensor


The HC-SR04 ultrasonic distance sensor is seen here. This low-cost sensor provides non-contact measurement
of 2cm to 400cm with a 3mm ranging accuracy. Each HC-SR04 module comes equipped with ultrasonic
transmitters, a receiver, and a control circuit. On the HC-SR04, only four lines require attention: VCC
(Power), Trig (Trigger), Echo (Receive), and GND (Ground) (Ground). Setting up and using this sensor with
your next range-finding project will be a breeze [22].

544
PEN Vol. 9, No. 4, October 2021, pp.542-548

Figure 3. Ultrasonic sensor

3.4. Servo motor


It is a motor that rotates with a great degree of precision. A control circuit is typically found in servomotors,
which provides feedback on the present position of a motor shaft, allowing them to turn to great precision.
When you wish to spin an item at a certain angle or range, use this command, you use a servomotor. It is made
up of nothing more than a basic motor and a servomechanism. A DC servomotor runs on a DC power source,
whereas an AC servomotor runs on an AC power supply. For this lesson, we will just talk about how a DC
servomotor works. In addition to these major classes, there are many other types of servomotors depending on
the type of gear arrangement and operational characteristics. Using a gear arrangement on a servo, we can
build a high-speed servomotor in a smaller and lighter design.

Figure 4. Servomotor

4. System implementation (methodology)


With the ultrasonic sensor, our smart traffic system will be implemented by installing ESP 32 cam, which
collected the number of cars on each side if there is a side traffic jam, and the other side is empty, the camera
will send a signal to Arduino to traffic to open green light to reduce traffic jam. In addition, when a car crosses
the red light, the ultrasonic sensor will send a signal to the camera to take a picture of the car number and send
it via telegram and save it in the database as shown in figure 5. The following steps are used to implement our
smart traffic light management system.
Below pattern:
1- Our work includes a traffic light with three sides
2- The ESP32 cam will calculate the number of cars on each side when the side have a number of cars
and light of this side is red light will turn the green light
3- Ultrasonic sensor works when the car crosses the red light side will send the signal to the camera to
take picture of the car number below.
4- The pictures of cars crosses will send to the database by using the telegram app.

545
PEN Vol. 9, No. 4, October 2021, pp.542-548

Figure 5. System implementation

5. Circuit diagram
This is system architecture is shown in figure 6, which is consists of Arduino mega, ultrasonic sensor, cam
esp32 & servo motor, smart traffic light appliances that represented by ( three streets, three-color lights (red,
yellow, green )) which is shown in figure 6.
We have three lines have three lights (green, red, yellow), eertt ultrasonic sensors detect a car violating a red
traffic light then send the signal to the servo motor have cam esp32, each street we give angle the street
number 1 0 angles, street number 2 90 angles, street number 3 180 angle servo motor will move with cam
esp32 to that side a car violation a red traffic light to take picture car number and send it to our database by
using telegram.

Figure 6. Circuit diagram

The projected system can be developed more by adding IoT, cloud computing and ZigBee technologies as
future works [23-25].

546
PEN Vol. 9, No. 4, October 2021, pp.542-548

6. Code
1-The first section of code define wifi network, esp camera and telegram bot
#include <wifi . h>
#include <wificlientsecure,h>
#include “esp_camera. H”
#include “universalTelegramBotRZO . h”
2-initialize wifi connection to the router
Char ssid[ ] = “xxx”; // your network SSID (name)
Char password [ ] = “xxx”; // your network key
String chat_id;
3- initialize telegram bot
#define BOTtoken “yyy:xxx” //your bot token (get from bot father)
String token = BOTtoken;

7. Conclusion
We designed a smart traffic control system using Arduino to solve the problem of congestion at the
intersection of the Dor al Moalemen region, working to prevent traffic jam and reduce time, Using Arduino
mega, ultrasonic sensor, and a camera esp32, the suggested technique analyses and manages everyday traffic
at a three-line intersection. Humidity and temperature variations do not affect the system's accuracy.
Furthermore, the suggested system achieves three-line intersection sync and implements a balance between
the number of vehicles on each side and the green light. In the case of traffic violation, the camera will
capture the car number and send it to the database by using telegram.
References

[1] B. Ghazal, K. ElKhatib, K. Chahine, and M. Kherfan, "Smart traffic light control system," in 2016
third international conference on electrical, electronics, computer engineering and their applications
(EECEA), 2016, pp. 140-145: IEEE.
[2] A. H. M. Alaidi, I. A. Aljazaery, H. T. S. AlRikabi, I. N. Mahmood, and F. T. Abed, "Design and
implementation of a smart traffic light management system controlled wirelessly by arduino,"
International Journal of Interactive Mobile Technologies, Article vol. 14, no. 7, pp. 32-40, 2020.
[3] Y. Zhuang, L. Hua, L. Qi, J. Yang, P. Cao, Y. Cao, Y. Wu, J. Thompson, and H. Haas, "A survey of
positioning systems using visible LED lights," IEEE Communications Surveys Tutorials, vol. 20, no.
3, pp. 1963-1988, 2018.
[4] D. Z. Khutar, O. H. Yahya, and H. T. S. Alrikabi, "Design and Implementation of a Smart System for
School Children Tracking," in IOP Conference Series: Materials Science and Engineering, 2021, vol.
1090, no. 1, p. 012033: IOP Publishing.
[5] I. Mahjri, S. Faye, and D. Khadraoui, "Impact and Deployment of Dynamic Traffic Light Control
Strategies using a City-wide Simulation Scenari," in 2019 IEEE Intelligent Transportation Systems
Conference (ITSC), 2019, pp. 2213-2219: IEEE.
[6] B. K. Mohammed, M. B. Mortatha, and A. S. Abdalrada,"A comprehensive system for detection of
flammable and toxic gases using IoT," Periodicals of Engineering Natural Sciences, vol. 9, no. 2, pp.
702-711, 2021.
[7] L. F. P. de Oliveira, L. T. Manera, and P. D. G. Da Luz, "Development of a Smart Traffic Light
Control System with Real-Time Monitoring," IEEE Internet of Things Journal, vol. 8, no. 5, pp.
3384-3393, 2020.
[8] B. Mohammed, R. Chisab, and H. Alrikabi, "Efficient RTS and CTS Mechanism Which Save Time
and System Resources," international Journal of Interactive Mobile Technologies, vol. 14, no. 4, pp.
204-211, 2020.
[9] H. Alrikabi, and H.Tauma "Enhanced Data Security of Communication System using Combined
Encryption and Steganography," International Journal of Interactive Mobile Technologies, vol. 15,
no. 16, pp. 144-157, 2021.

547
PEN Vol. 9, No. 4, October 2021, pp.542-548

[10] N. Díaz, J. Guerra, and J. Nicola, "Smart traffic light control system," in 2018 IEEE Third Ecuador
Technical Chapters Meeting (ETCM), 2018, pp. 1-4: IEEE.
[11] A. Atta, S. Abbas, M. A. Khan, G. Ahmed, and U. Farooq, "An adaptive approach: Smart traffic
congestion control system," Journal of King Saud University-Computer Information Sciences, vol. 32,
no. 9, pp. 1012-1019, 2020.
[12] M. A. a. Roa'a, I. A. Aljazaery, and S. K. Al_Dulaimi, "Generation of High Dynamic Range for
Enhancing the Panorama Environment," Bulletin of Electrical Engineering, vol. 10, no. 1, 2021.
[13] A. K. M. Masum, M. K. A. Chy, I. Rahman, M. N. Uddin, and K. I. Azam, "An Internet of Things
(IoT) based smart traffic management system: a context of Bangladesh," in 2018 International
Conference on Innovations in Science, Engineering and Technology (ICISET), 2018, pp. 418-422:
IEEE.
[14] W. K. Meteab, H. T. S. ALRikabi, S. A. H. Al Sultani, and I. A. Aljazaery, "Controlling and
Monitoring a Robot-Car Based on Smart Phone Applications," in IOP Conference Series: Materials
Science and Engineering, 2021, vol. 1094, no. 1, p. 012096: IOP Publishing.
[15] H. Tuama, H. Abbas, N. S. Alseelawi, and H.. Salim, "Bordering a set of energy criteria for the
contributing in the transition level to sustainable energy in electrical Iraqi Projects," Periodicals of
Engineering and Natural Sciences, vol. 8, no. 1, pp. 516-525, 2020.
[16] S. Jain, A. Kumar, and M. Priyadharshini, "Smart city: Traffic management system using smart sensor
network," in Journal of Physics: Conference Series, 2019, vol. 1362, no. 1, p. 012129: IOP
Publishing.
[17] H. Salim, and N. A. Jasim, "Design and Implementation of Smart City Applications Based on the
Internet of Things," International Journal of Interactive Mobile Technologies (iJIM), vol. 15, no. 13,
pp. 4-15, 2021.
[18] Y. Suhweil and M. Al Yaman, "Smart controlling for traffic light time," in 2017 IEEE Jordan
Conference on Applied Electrical Engineering and Computing Technologies (AEECT), 2017, pp. 1-5:
IEEE.
[19] E. Q. Ahmed, I. A. Aljazaery, A. F. Al-zubidi, and H. T. S. ALRikabi, "Design and implementation
control system for a self-balancing robot based on internet of things by using Arduino
microcontroller," Periodicals of Engineering Natural Sciences, vol. 9, no. 3, pp. 409-417, 2021.
[20] N. A. Hussien, H. Salim, and F. Abed, "Monitoring the Consumption of Electrical Energy Based on
the Internet of Things Applications," International Journal of Interactive Mobile Technologies (iJIM),
vol. 15, no. 7, 2021.
[21] O. H. Yahya, H. T. S. AlRikabi, R. M. Al_Airaji, and M. Faezipour, "Using internet of things
application for disposing of solid waste," International Journal of Interactive Mobile Technologies,
Article vol. 14, no. 3, pp. 4-18, 2020.
[22] J. Liu, J. Han, H. Lv, and B. Li, "An ultrasonic sensor system based on a two-dimensional state
method for highway vehicle violation detection applications," Sensors, vol. 15, no. 4, pp. 9000-9021,
2015.
[23] A.A.H. Mohamad, Y. S. Mezaal, S. F. Abdulkareem, "Computerized power transformer monitoring
based on internet of things," International Journal of Engineering & Technology 7, no. 4, pp.2773-
2778, 2018.
[24] T. Abd, Y. S. Mezaal, M. S. Shareef, S. K. Khaleel, H. H. Madhi, and S. F. Abdulkareem. "Iraqi e-
government and cloud computing development based on unified citizen identification." Periodicals of
Engineering and Natural Sciences, vol.7, no. 4, pp.1776-1793, 2019.
[25] Z.K. Hussein, H.J. Hadi, M.R. Abdul-Mutaleb, Y.S. Mezaal, "Low cost smart weather station using
Arduino and ZigBee." Telkomnika , vol.18, no. 1, pp.282-288, 2020.

548

You might also like