The Simulation and Prototyping of a Density-Based Smart Traffic Control System for Learning Purposes

— With the tremendous technological progress and the widespread use of a variety of technologies, we note how smart cities are providing services efficiently by using technologies. The aim of this project is to build a Smart Traffic Control System (STCS) to facilitate and optimize traffic flow, minimize traffic congestion, and reduce the waiting time by detecting the density on each street. This work has been carried on four phases. Firstly, collecting data by a questionnaire and we received 331 responses. Secondly, using Proteus simulation. Thirdly, building a low fidelity prototype, and fourthly: building the STCS model by using hardware (Arduino tools) and software (Arduino Software IDE). Finally, we learned how to build a system and we recommend using such a system in busy roads to reduced congestion and making traffic flow more efficient.


Introduction
Recently, technology represents an integral part of our life and it is impractical to imagine our life without embedded devices [1]. Technology changes the lifestyle to be more efficient and reliable [2]. The scientific development witnessed by the modern world in the technological industries, which took the form of innovation and ease of dealing, has a significant impact on different areas, especially in smart cities. An example of that is the use of a driverless minibus service, a pressure management system to leverage water network data and lighting controls.
Smart cities distinguished by using high technologies to facilitate life for citizens [3]. The purpose of smart cities is to improve the quality of life, increase the level of development, increase economic growth and harnessing technology, especially technology that leads to efficient outcomes [4].
One of the problems we are trying to solve here is controlling the traffic congestion. Thus, we are working on building a prototype system for solving the traffic congestion issue. Throughout the literature review, the recommended solution was to design a density-based traffic signal system, for making traffic flow more efficient.
Our aim is to facilitate and optimize traffic flow, minimize traffic congestion, and reduce the waiting time.

Problem definition
Traffic congestion is a serious issue in several big cities worldwide. Traffic can be controlled in the main junctions by including either an automatic traffic light control system or by traffic police. However, the conventional traffic light system is based on a static/fixed time concept dedicated to each street regardless of the diversity of traffic density. Sometimes, the most congested road has to be prioritized, in terms of a number of vehicles. Thus, we propose a developed design that incorporates density as a factor that affects the traffic light system.

Objective
The objective of our project is to regulate the traffic flow by means of introducing sensors at traffic lights on the main roads as a Smart Traffic Control System (STCS). Based on these sensors, the streets' density is detected, traffic monitoring, and automatic control of the traffic light to reduce traffic congestion. The sensors calculate the traffic density on a particular road and change the priority of traffic light based on the cars' numbers waiting on the same road thus reduce the waiting time.

Literature Review
Traffic Congestion is a persistent issue in several cities worldwide. Traffic lights play a vital role in traffic safety. Even though road safety is important [5] and even though we are in the 4th industrial revolution era, unfortunately, the current traffic system still has many problems since it's based on a fixed time concept dedicated to each street (side of the junction) regardless of the diversity of traffic density.
Traffic delay has many side effects on daily life. To a commuter or a traveler, congestion means wasting time, wasting opportunities, and frustration. In addition, for business providers, congestion means losing trade opportunities, delivery delays, and increasing costs [6]. These issues need to be solved by developing automated transportation management systems. Many pieces of research and studies have been conducted that provided different hypotheses and solutions. Lo and Chow explained the Dynamic Intersection Signal Control Optimization (DISCO) system which is a platform for modeling dynamic traffic in Hong Kong [7]. Ref. [8] provided a traffic light control system based on Wireless Sensor Networks (WSN) that has the ability to revolutionize control technology and traffic surveillance due to its potential for large scale deployment and low cost. Ref. [9] designed an HMS Algorithm based on the Modified Round Robin algorithm. HMS reveals the enhancement of traffic light services in Iraq where it reduced waiting time and ensure the maximum use of roads. Ref. [7] explained another solution that used multiple IR sensors that had been installed on roads for density measurement. The increases in the number of IR sensors have improved the accuracy of density measurement. Moreover, it was explained that the traffic lights that are connected with the output port of the IR sensors and Arduino processor were linked with an input port of the Arduino processor through the feedback path. A system such as this acts as an interfacing device which supports the Lab VIEW software and better decision making on road base upon traffic density. Finally, the traffic light control system using Arduino is a system designed to make traffic lights more flexible, so that it can measure the proportion of traffic density, a central device where all the traffic lights are linked, it can be controlled remotely and it changes its scheduling without the need to change it manually. A Comparison between some traffic control systems is shown in Table 1. [11] Next, the methodology of conducting this study will be explained.

Materials and Methods
Four stages have been done to learn how to solve the problem of controlling the traffic based on the density of the roads.
Firstly: before we create the system, we distributed a questionnaire to investigate some important issues such as the community's acceptance of the idea. The questionnaire was in Arabic, for all ages and both genders in Jeddah, Saudi Arabia. It was an online survey using Google forms, it contained 11 questions and we received 331 responses.

Analysis of the collected data
Significantly, about 80% of the responders agreed that the current traffic signal system needs to be developed and about 94% of responders support the need to have a traffic system that changes the time based on traffic density (see Figure 1). We found that the community accepts the smart traffic control system and the community believes that it is a good idea and it would be beneficial to them. Secondly: We used the Proteus simulator to check the concept in software before the hardware implementation (see Figure 2). iJOE -Vol. 16, No. 12, 2020 Implementing the concepts in the simulator by using a combination of an ultrasonic sensor, open source Arduino IDE and MATLAB to develop the real system of traffic light control. Keeping in mind that the sensors are used to detect the traffic density by calculating the number of cars in each road and then analyzing that data. The calculations are done by dividing the time to serve the four roads based on the needs and this concept also known as the inclusion management strategy in the administration field. In the simulation of the STCS we employed Arduino Uno and an ultrasonic sensor. The ultrasonic sensor and the signals are connected to the Arduino microcontroller to control the traffic lights. The Traffic light changes to RED or GREEN based on traffic density using the changing resistance RV1 and RV2 which is what we used for the simulation to pretend that there is traffic or not because we could not use cars for density test in the simulation. If there is traffic at a signal, the signal will turn GREEN and vice versa it turns RED. We worked in the simulation to make sure everything is feasible to be applied with real parts (hardware) with confidence.
Thirdly: Building a prototype which has been done since this is a vital facet of the product design and development process. Building prototypes helped to reduce the design risk of wasting cost and time of a full production [12]. System design and implementation is the phase of developing an executable software system in the process of software engineering process [13]. During the design development phase, all the decisions that are related to the design, equipment's and functional requirements to the used shapes, objects and the basic colors were documented [14].We found at this phase that the act of building prototypes encourages reflection in the design aspect, as recognized by designers from many disciplines, is an important aspect of the design process [15]. The product regularly goes through various versions of prototypes before the design is completed. See Fig.3 of the low fidelity prototype.  Figure 5). Furthermore, the Arduino has been chosen for the following reasons: • Arduino boards are relatively inexpensive.
• The Arduino Software (IDE) can be run on different operating systems such as Macintosh, Linux and Windows. • C++ programming language can be used [18].

Fig. 4. The Ultrasonic Sensor
An ultrasonic sensor had been used because it reflected sound waves and then measured the distance to an object by measuring the time taken by the sound to reflect back from the object. Ultrasonic Sensor has 4 pins. Ultrasonic distance sensor module is an electrical device that measures the distance of an object by emitting ultrasonic sound waves and converts the reflected sound into an electrical signal [19].
Two sensors have been placed next to each traffic light to detect nearby cars. Arduino Uno is a microcontroller board which has 14 digital input/output pins and can be programmed with Arduino Software IDE [6]. Figures 6 and 7 show the connection between Ultrasonic sensors, traffic lights, the breadboard (the white one) and Arduino Board via wires.

Results and Discussion
As mentioned, that STCS is based on the traffic density on the road, where the vehicles that existed on the road are counted by the sensor which is placed on each side of the road and automatically controls the traffic lights according to the traffic density.
In this system, two pairs of sensors are placed on each side of road and four traffic lights. Arduino Microcontroller controls the ultrasonic and counts the number of vehicles passing on the road where the signals are changed when the sensor assumes that there is traffic congestion on the road. There are 3 cases in this system as follows: 1. If there are no vehicles present on the road then light is (Red), until vehicles are arrived (see Figure 8).  3. In the case of all roads having an equal density, its actives the status of the sequential arrangement between the roads and the system will work normally by controlling the signals one by one.

Testing
In order to run the whole system, we needed: • Led traffic light module: That showed the lights red, yellow and green • Arduino Microcontroller: Physical programmable circuit board that contains the code from the Arduino IDE software [20] • Wires male-female: A group of electrical wires in a cable, with a connector or pin at each end • Breadboard: A construction tool base for the prototyping of electronics used to design and test the circuit • Arduino Adaptor: Used to power the Arduino board via the plug from a wall outlet.
• Laptop Then, we applied functional testing for evaluating the system and verifying each function of the system, to check if it conforms to the required specification, the tests include: unit testing, integration testing, compatibility testing and system testing. Unit Testing is done during the development (coding phase) of an application by the developers [21]. The unit testing was applied to all cases as described. Integration testing: a complete system is tested to guarantee that the requirements of the software have been met [22]. During the system testing we were focusing on validating the proper work complete system after the integration. four cases have been coved as follows: • By default, all traffic lights are in (red) until vehicles are present • In the case of a denser road, it has the priority to turn the traffic light into (green) • In the case of all roads having an equal density, it activates the status of the sequential arrangement between the roads • In the case of two roads with the same density, the priority is to turn the traffic light green to the road who started congesting first

Conclusion and Future Work
With the rapid increase in motorization industry, urbanization, population growth, and changes in population density, the problem of traffic congestion has increased worldwide. Therefore, we built an STCS with the aim of regulating traffic flow and reducing traffic congestion. This will lead to providing a good service for the community. We wish to succeed in the future by applying this smart system nationally and internationally.

Difficulties and limitation
During the work on the project, COVID-19 disturbed the world and we could not buy more tools. The process of learning how to connect the Arduino parts was not easily managed online since we were as a team that needs to meet face to face, in the quarantine period. Furthermore, we discovered that the Ultrasonic Sensor has a limited detection range so it is will work only for the prototype.

Future work
We recommend using Mega Arduino instead of Uno Arduino because of its better capacity. Future research can link this system with google maps. Furthermore, we recommend transferring data from the microcontroller and sensors to an application so users can access the data collected by the system and make some visualizations and predictions. Further research can add more sophisticated improvements on the current applied system.