Design and Fabrication of Smart Traffic Signal Using Arduino Card

Traffic jam is becoming a headache in the big cities all over the world, which causes a significant delay for drivers and passengers. A smart on/off traffic signal optimization based on a motion IR Sensor (Infrared) is now a necessity to overcome this problem. This work is a design and implementation of a smart traffic signal (STS) that controls the time of the traffic signals (Red–Yellow–Green) according to the traffic congestion on the road. The STS is designed to imitate a side road (with a low traffic move) with a highway road (with a high traffic move). A motion IR sensor along with an Arduino PIC were installed to automatically control the traffic signals on/off delay times based on the existence of the vehicles on the side road. When the side road is empty, the highway traffic signal is always green (highway–always–on mode). However, when a vehicle reaches the traffic signal in the side road, the motion IR sensor sends a signal to the Arduino card, so that the highway traffic signal turns red, while the side road traffic signal turns green letting the vehicle to pass the intersection. The system will then automatically set back to the highway–always–on mode. The entire system is designed and simulated using Proteus workbench.


Introduction
Every day, the number of vehicles on the road grows exponentially. The current traffic signal system is controlled by an open loop system, according to a recent poll, worldwide car sales peaked at 52.57 million in 2012 and rose to 75.24 million in 2016 [1]. For the fifth year in a row, automakers sold more than 17 million vehicles in 2019. Analysts estimate that 16.7 million to 17.1 million vehicles will be sold in 2020 [1].
Traffic jams are a problem on many city roads because they are the source of the majority of vehicle accidents, incremental delays, and vehicle operating costs such as fuel consumption, pollution emissions, and stress that result from vehicle interference in the traffic stream, especially as traffic volumes approach a road's capacity, so many strategies to make traffic signals automated and respond to traffic density rather than fixed timings have been proposed in the literature. PIC microcontrollers, IR sensors, and Xbee communication; novel algorithms such as fuzzy and genetic algorithms, IoT devices; and other methodologies were used in these solutions [2,3]. To reduce vehicle's wait times and allow more cars to pass through the intersection in less time, an adaptive traffic light control algorithm is developed. Vehicles should avoid making as many stops as possible to reduce the number of accelerations and decelerations, as slowing down to stop and then speeding up to return to speed Iraqi Journal of Industrial Research (IJOIR) increases the number of accelerations and decelerations. As the number of road users has expanded, traffic congestion has evolved on road networks, resulting in slower speeds, longer travel times, and longer queuing times. The faster a vehicle travels, the better; the less time spent waiting, the more cars that can pass over the crossing. As a result, CO2 emissions from vehicles can be reduced [4].
In this study, we describe an intelligent traffic light control strategy based on infrared IR that can minimize vehicle CO2 emissions by reducing vehicle waiting and stop times at the instruction that shows in Figure (1).

 Related work
A large number of studies have been conducted in recent years to decrease the problems related to traffic jams for example in 2019 by Nik Nur Shaaadah [5] use an Arduino attached to four infrared sensors that count the number of vehicles traveling across the road, particularly at the intersection Each car was placed to a 3 second delay, and all vehicles going through the intersection were measured and processed accordingly. Each sensor was set at a 100-meter range from the traffic light. If no car is seen after 1 second, the traffic signal will change to another. As a result, the green light will have a longer delay period on roads with higher traffic density, allowing for more effective traffic control.
Askarzade et al. [6] propose a four-lane traffic intersection, a fuzzy logic technique with sensors was developed. Sensors were installed in all four lanes of the intersection to count the automobiles in the lines.
The most of studies have been focusing on four-direction traffic jams. In this paper, it has been proposed an intersection of a crowded public street and a secondary road with few cars passing through it, if the fixed cycle time traffic system is applied, a lot of time and fuel will be wasted and leading to more producing Co2. So, we use an Arduino with IR sensor fixed on the secondary way to apply a dynamic cycle time traffic system to save time and fuel.

 THE CO2 EMISSIONS MODEL
The CO2 emissions are calculated based on the state of each moving vehicle to describe the relationship between CO2 emissions and vehicle motion. These variables are commonly classified into two groups: parameters of the vehicle and those of the traffic/road. Vehicle mass, fuel type, engine displacement, and vehicle class are just a few of the elements to consider. On the other hand, network parameters (traffic and road conditions) take into consideration instantaneous vehicle kinematics (e.g., speed or acceleration), aggregated factors (e.g., time spent in acceleration mode), and other variables [4]. The following two formulas present the situation: …………. (2) E signifies CO2 emissions [g], and Kc denotes the coefficient in equation (1)

System Components and Description
There are two primary parts to the project: hardware and software. The procedure is described in the following steps and depicted as a block diagram and as algorithm as demonstrated in Figures (1 & 2).

Hardware Components
 Arduino UNO: is an ATmega328P-based microcontroller board. It contains 14 digital input/output pins, 6 analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header, and a reset button. It comes with everything you need to get started with the microcontroller and can be linked to a computer by USB or powered by an AC-to-DC adapter or a battery [8].
 Infrared IR Sensor Obstacle Avoidance: The built-in IR transmitter and IR receiver in the Infrared Obstacle Sensor Module send out IR energy and seek for reflected IR energy to detect the existence of any obstacle in front of the sensor module as shown as Figure (3). At the beginning of the experiment the infrared Sensor (FC-51) was used. It worked well inside the laboratory with one variable resistance to adjust the distance as shown as Figure (4), but when exposed to sunlight, it began to sense the infrared rays found in the solar spectrum , and thus it did not serve the research idea, so it was replaced by another infrared sensor (KY-032), It had two variable resistances, one to adjust the distance range (2-40cm)

Resistors Array
calibrate the sensor receiver to respond only one wavelength, it about 700 nm and filtered out the other wavelengths to avoid infrared interference as shown as shown in Figure (5) [5,9].
 Traffic light module: This is a high-brightness mini-traffic light display module that is ideal for producing traffic light system models. It is featured with its small size, simple wiring, targeted, and custom installation as shown as Figure (8).
 Segment display (common-cathode): The negative terminal of an LED is called the cathode. There are two terminals on an LED. The anode (the longer leg) is connected to the circuit's positive voltage on one side. The other terminal is the cathode (the shorter leg), which is connected to the circuit's negative voltage or ground.
 Power supply: It is powered by a single lithium-ion battery (3.7V output) and the 18650 Battery Charge Holder V3 0.5A USB Type-A Charging Protection Board, which is Arduino-compatible. The maximum output current is 2A.

Program Code (See Appendix)
Program codes were written using the free software of Arduino integrated development environment (IDE). The programming steps were achieved according to the flowchart of Figure (6) and are shown in Appendix (I).

System Design and Fabrication
As an intersection, a prototype is created. Three traffic lights make up the system, two of them connected together and are installed on the highway (two sides) and the third one on sub-street with one IR sensor Installed at a distance of (10 cm) with a 7-segments display to show the countdown for the green light, the suggested system was simulated by using Proteus program as shown in Figure (7). The practical control system model was constructed by using IR Sensor to controlling the sub-street, it had 4 legs, the VCC leg connected to 5V pin, GND leg connected to GND pin on the Arduino board sequentially, the OUT leg connected to digital input pin 0 on the board and enable (EN) leg is not used in this case, this object sends output 0 (low-voltage) when there is a vehicle and output 1(high-voltage) when there is no vehicle on the sub-street, this senor is not sensitive to the time. The high-way has two traffic light modules installed on each side of the road and connected together, each one has 4 legs, GND leg connected to GND pin on Arduino board, green leg, yellow leg and red leg are connected to digital output pins11,12 and 13 sequentially on the Arduino board, and the third traffic lights module is installed on the sub-street and its legs connected to digital output pins 8, 9 and 10 on the board with 7-segment display to count down when the sub-street traffic light is on-mode, whereas the final prototype is shown in Figure (8).
The program code was written by the Arduino IDE software, which is based on the C++ programming language. The code was uploaded through USB D type connector to the Arduino UNO board [10].

Results and Discussion
In this scenario, The system eliminates traffic congestion and wait times on main highways to reduce the CO2 emission of fuel and to minimize fuel waste and passengers delay, When the sensor detecting an obstacle (in this case a moving vehicle), it will turn the signal from green led to yellow led on the highway for 10 seconds and then switches it to red led for 30 second in the same time the green led on the sub-street is on, and then returns to the first case as Table (1) depicts the sequence, The amount of carbon dioxide produced varies from one car to the next, depending on the manufacturer, according to data from the European Environment Agency, which monitored CO2 emissions from new passenger cars in 2019 [11], the annual average was around (2704.65kgm), implying that the average CO2 emission closeness is approximately (0.086gm/sec).
Car traffic peaks for 16 hours during the day, if we apply a fixed cycle time (without sensor) for each road, the high way traffic and the sub-way traffic will take 8 hours of that time, So the car on the highway must be wait even if and the secondary road is empty, so it can produce 2.46kg of Co2 (8hours × 0.086gm/sec) per a day. If there are at least 10 cars, the result will be 24.6kgm of Co2 emission, so we can reduce this rate if we apply the smart traffic light system.

Conclusions
The purpose of this design is to manage traffic based on infrared rays and creates a dynamic, flexible system that addresses the defects of the usual systems, such as reducing the waiting time, spent fuel and preserving the environment, and thus overall, the quality of life, and this work can be developed by using IOT device to get a real time value from Google map for more accurate and we can also use Weight sensitive sensor to determine the weight of cars passing on the road and register a violation To prevent cracks in roads and bridges and to improve the road system.