Design and Implement a Smart Traffic Light Controlled by Internet of ThingsPeriodicals of Engineering and Natural Scienc
Design and Implement a Smart Traffic Light Controlled by Internet of ThingsPeriodicals of Engineering and Natural Scienc
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.
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
544
PEN Vol. 9, No. 4, October 2021, pp.542-548
Figure 4. Servomotor
545
PEN Vol. 9, No. 4, October 2021, pp.542-548
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.
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