Detection of Road Traffic Congestion Using V2V Communication Based on IoT

Intelligent Transportation Systems (ITS) have been developed to improve the efficiency and safety of road transport by using new technologies for communication. Vehicle to Vehicle (V2V) and Vehicle to Infrastructure (V2I) are a subset of ITS widely used to solve different issues associated with transportation in cities. Road traffic congestion is still the most significant problem that causes important economic and productivity damages, as well as increasing environmental effects. This paper introduces an early traffic congestion alert system in a vehicular network, using the internet of things (IoT) and fuzzy logic, for optimizing the traffic and increasing the flow. The proposed system detects critical driving conditions, or any emergency situation blocking the road, and broadcasts remote warnings to the following vehicles. Since not all vehicles are equipped with new technologies, Liquid Crystal Display (LCD) fixed on the roads displays the alert to warn the other vehicles which have neither communication nor sensors. The system was designed with Raspberry Pi 3 Model B equipped with sensors and GPS module to emulate real-world vehicles. The results and observations collected during the experiments showed that the proposed system is able to monitor the road conditions, detect the emergency situation, and broadcast a warning message to the approaching vehicles.


Introduction
The major impact of high vehicle densities in urban environments is the phenomenon of congestion. When a vehicle cannot move toward its destination because the number of vehicles exceeds the road capacity and blocks the route, it would wait until the leading one can move. The essential impacts of this pause are the increments in fuel consumption, drive time and CO2 emission. For avoiding emergency situations or congested areas on the road, vehicles demand a real-time communication process. Such a process is not only important for the vehicle that is actually nearest to the congestion area, but also to other vehicles that are not involved. Intelligent Transportation Systems (ITSs) provide capabilities to vehicle and infrastructure to exchange information. Vehicle-to-Vehicle (V2V) and Vehicle-to-Infrastructure (V2I) are communications paradigms that enable the vehicles to share multiple types of information, such as safety information in case of an accident, traffic jams prevention messages, and alerts about road work and bad weather. Figure-1 illustrates the principle of V2V communication between vehicles.
Vehicle Ad Hoc Networks (VANETs) is a newly emerging technology that integrates vehicles with new generations of wireless network capabilities. Wireless communication is provided between the moving vehicles via VANETs, which are defined as mobile ad-hoc network (MANET) applications with the possibility of improving road safety and providing travelers with comfort [1]. The key concept is to enable ubiquitous connections to on-road mobile nodes and efficient vehicle-to-vehicle communication facilitating the ITS. The IEEE standardized the entire stack of communication through the 1609 family of standards corresponding to Wireless Access in Vehicular Environments (WAVE). V2VCommunication happens when vehicles are able to communicate with other vehicles or with fixed equipment next to the road, defined as roadside unit (RSU), forming a V2I. Dedicated Short-Range Communications (DSRC) is among the technologies invented to perform vehicle communications. It could be combined with every vehicle as an onboard unit (OBU) and established along roads as an RSU in order to create a wide network that transfers the safety messages and non-safety applications [2]. Other wireless access technologies, including Wi-Fi, WiMax, and cellular networks, are also suggested for this purpose [3] Many works studied the traffic congestion problem but it has not been fully resolved because of some technical challenges. In an earlier study [4], the author proposed a vehicle to vehicle communication using Named Data Networking (V2VNDN), which deals with the content retrieval instead of point to point communication. The exchanged warning messages in this system usually include all the traffic information, such as damage on the road, traffic flows, car accidents, etc. The drawback of this system is that, when a large number of messages flow through the network, the clients are only concerned with the content that is related to them. A high number of redundant packets floods the network and leads to an increase in packet delay. Dedicated Short-Range Communication Traffic Direction (DSRC) access technology was used in another study [5] to design a DSRC-Actuated Traffic Lights (DSRC-ATL) through a Computation Unit that runs a traffic signal control algorithm based on the messages sent from (DSRC OBU) of vehicles to roadside units (DSRC RSU). Research results demonstrated the poor ability of DSRC to support efficient and reliable V2X communications by revealing its poor performance in high vehicle density environments [6]. The system proposed in another work [7] aims to predict potential traffic flow at various intersections based on a linear algorithm. Through this prediction, a central controller begins reducing the level of congestion by replanning the vehicle route. The problem with such approaches is that the computing process to assign the new alternative path to each vehicle is too long in high density; thus, the vehicle may have reached the congested area. The proposed system was also shown to detect road traffic congestion levels periodically using fuzzy logic and V2V communication [8]. When traffic congestion is detected, validation messages containing relevant information (vehicle ID, position coordinates, driving speed, driving direction, and time stamp) are exchanged among vehicles to determine the traffic congestion level. Transferring such data is considered vulnerable and leads to several privacy and security attacks. Furthermore, there is a massive risk when a malicious vehicle injects fraudulent messages and employs the network for any dangerous activity or could easily make the whole traffic system in danger. The system discussed in another article [9] for traffic congestion detection combines V2V, V2I, I2I communications and big data. Such a system consumes time due to processing a large amount of data, which requires a huge amount of bandwidth and has limitations of storage, computing, and energy.
The real-time communication process and sharing warning messages are necessary for allowing the vehicles on the roads to be knowledgeable of the situations ahead and making the right decision to avoid traffic congestion as well as a series of collisions. This paper proposes an embedded system prototype that is able to sense and detect the critical environmental conditions and broadcast warning messages. The work was performed using intelligent robotic cars controlled by Raspberry Pi microcontroller equipped with sensors to emulate a real-world scenario. This system benefits from the IoT technology to establish the VANET network that shares the emergency information between vehicles via a low-cost and more efficient access technology, which is WiFi. The prototype proposed is a hybrid solution between the field experiments and computer simulations. The performance of the system was evaluated on the basis of different measurements which are time-consumption, driving privacy, flooding, message redundancy, and cost.
This paper provides detail of the concept of (IoT) followed by the proposed system, which is divided into subsections includes the hardware component and the construction of the system, software language, the experiment, the communication technique used to transfer the packets, and implementation of the system which also has two subsections: congestion detection and communication process, followed by discussions on the experimental results obtained. Finally, the conclusion and future enhancements are drawn at the end of the paper.

Internet of Things
IoT is an emerging technology that allows different objects to communicate in an environment in such a way that the physical world could be accessed and managed through a software [10]. The Internet Protocol (IP) is utilized as a standard for IoT. The IoT has introduced massive opportunities for the management of urban infrastructures, including industrial control, smart cities, and environmental monitoring. This was made possible by the integration of several technologies, such as the embedded devices, smart sensors, internet protocols, and communication technologies [11]. Similar to any other internet application, traffic control could use the IoT to achieve efficient collection and utilization of traffic data in real-time, for purposes of congestion prevention and route planning.
Intelligent vehicles are combined with smart infrastructure to accomplish a safer environment and better traffic conditions [12]. An intelligent vehicle is described as an improved vehicle with vision, reasoning, and actuating devices that permit the driving task to be automated, via avoiding obstacles, taking safe lanes, and avoiding dangerous situations. It is possible to imagine supplying the vehicle with communication devices and sensors that receive warning signals of predicted congestion, fog, or ice (from roadside sensors). The sensors must be capable of covering the necessary area effectively and over a long period of time [13]. Smart vehicles that detect abnormal road conditions may disseminate this information to all smart vehicles nearby. The importance of vehicular ad hoc communication networks will grow dramatically, as market diffusion of supplied vehicles increases.

The Proposed System
The proposed system consists of two parts, which are the software and hardware. The hardware is design as an embedded system that simulates the intelligent vehicle, in which the Ultrasonic Sensor is used for obstacle detection. Radio frequency (RF) Transmitter Receiver modules allow vehicles to send and receive RF signals to announce their presence. The vehicles receive the information via WiFi communication technology. The speed of the vehicles is adapted by the fuzzy controller.

Hardware Components of the Proposed Embedded System
This section illustrates the main elements of the hardware used to perform the experiments and its specifications. i. Raspberry Pi is a low cost small credit-card-sized computer that can be used as a controlling unit in an electronics project. It is the central unit that controls the interfaced devices according to the program being written. The SD card is used as the basic gadget for a Raspberry Pi board like a PC hard disk. ii. Smart robot car kit is a 2-wheeled high-torque robotics platform powered by batteries. It uses two DC gear motors with one mounted on each side. iii. Motor Driver (L298) is a dual motor driver based on a dual H-Bridge motor driver. The L298 is a monolithic integrated circuit that independently controls two dc gear motors in either direction. The Raspberry Pi is easily used and interfaced with it. It also offers a 5V Regulator aboard. The two dc gear motors are linked to Raspberry Pi, with one mounted on each side, powered by batteries and run using Pulse Width Modulator (PWM). iv. The ultrasonic sensor is an electronic tool used for detecting objects. It generates ultrasonic sound waves to determine a target object's distance and converts the reflected waves into an electric signal.

Software Language
The experiment is implemented using the Python programming language installed on a Raspberry Pi microcontroller. To get started, Python requires less overhead and offers the option of multithreading, which allows the Python code to run concurrently.

Experiment
The important factors for ITS success are the sensors and sensor data. The main drawback of computer simulations is that they cannot provide sensor data, and therefore, it is not a suitable platform for certain ITS applications. On the other hand, the field test involves performing tests on real cars in a live environment. The biggest challenges of performing physical tests are logistics, time and costs. Tests have to be performed in a closed environment for safety purposes. Also, such tests often need regulatory approval from the government, which will increase both the cost and time needed to perform tests. The robotic intelligent vehicle is a hybrid solution that attempts to fill a gap in the field of testing ITS applications by combining the speed and modularity from computer simulations with sensor-data and real-world scenarios from field testing. A hybrid solution is not perfect, but can give valuable insights and results that computer simulations and physical testing might not cover within time and cost constraints [14] . This intelligent robotic vehicle is an experiment to more easily test and develop the applications of ITS with real-world capabilities.

Communication Technique
Wi-Fi is the wireless access used in this study to enable V2V or V2I communications in this VANET. Wi-Fi is a short-range [+/-200 m] wireless local area network (WLAN) technology that is based on the IEEE 802.11p network standard, running on a radio frequency of 2.4 GHz, and providing high data rates [up to 150 Mbps]. The range of the WiFi up is up to 300 m with the outdoor antenna, while reaching 150m indoor. It provides a reliable, high throughput, and lower-delay connection [1]. Cellular networks may be considered a reasonable option for use in the vehicular domain, as the cellular base stations are mostly deployed throughout the cities and already providing mobile network services. The cellular networks, however, are suffering from low data rates. GSM EDGE and UMTS HSPDA, for example, technically offer data rates of 1 and 7.5 Mbps, respectively. Such data rates are incomparable with those provided by some of the 802.11 family's recent standards. Second, the cellular systems work on a licensed frequency spectrum that cellular companies purchase (or rent) for dedicated use. Communication costs can be comparatively higher over cellular frequencies than WLANs, as they compensate for charges incorporated with utilizing the dedicated spectrum. Notably, both the network speed and the communication cost are related directly to the base station of the cellular system. It is well known that building a base station, in a remote area, for example, is a significant financial burden. The operating costs are also very high for the base stations. Because all the mobile nodes must communicate on a two-hop link through the base station, the overall speed of the network depends on the base station 's capacity [15].
In comparison with DSRC (dedicated short-range communication or IEEE 802.11a), WiFi access technology is considered more efficient for intelligent transportation systems. The two standards (WiFi and DSRC) are investigated using the NS2 simulator under two different scenarios (residential and highway) for a communication range of 500m. The tested performance parameters were the packet delivery ratio, throughput, and delay [2]. The table below shows the performance of both standards. The motivation of using WiFi (IEEE 802.11p) is that: (1) It is appropriate for usage in vehicle environments where it is important to deliver time-critical information without having to go through the infrastructure. (2) The networks that use such technology are widely deployed, and (3) 802.11p WAVE, a variant of this technology, was standardized for vehicle communication [15].
In Raspberry Pi 3, sending and receiving packets is achieved by built-in an onboard wireless interface. IEEE 802.11n standard provides ad-hoc functionality that serves this VANET implementation. Raspberry Pi needs some configuration. A unique, static IP-address is assigned to each Raspberry Pi to communicate in an ad-hoc manner. This makes the devices capable of communicating with the other devices in its communication range. In this work, the User Datagram Protocol (UDP) is used. It needs an IP address and a port. The client simply sends the data to the address through the selected port. Neither establishing a connection with the server nor closing it is needed. Eventually, the sender does not know whether the recipient received the message, or if another entity intercepted the message. This protocol perfectly fits the dynamic network that is the theme of V2V communication.

The Proposed System Flowchart
The chart below illustrates the mechanism used in this study to navigate the robotic vehicle and detect the congestion.

Congestion Detection implementation
The application of the proposed system was tested in different scenarios with two or more intelligent robotic cars. The planning of robotic paths is an interesting issue in determining the best direction. The main aim of robot path planning is to obtain optimal path (shorter path) in describing the environment between two different positions and, at the same time, to f ind a safe path (collision-free). The environment is categorized into two forms, namely static and dynamic. Dynamic environments have dynamic obstacles, while static ones include static obstacles [16]. Applying the fuzzy logic methods to a mobile robot route planning facilitates a mobile robot's collision-free navigation and is easily modeled using linguistic terminology.
While the vehicle passes the roadway, it periodically senses the driving condition in front of it using the ultrasonic sensor which is used for obstacle detection. The project uses an ultrasonic transducer which consists of a transmitter and receiver. A trigger pulse is sent by Raspberry Pi to the ultrasonic sensor which then transmits the ultrasonic waves. If the transmitted waves are reflected back (echo=1), it implies that there is an obstacle ahead.
When the ultrasonic sensor detects an obstacle, it gives the Raspberry Pi an echo-pulse. The sound signal is converted by the ultrasonic sensor to an electrical signal which is analyzed to determine the distance in a microcontroller. Taking into account the velocity of sound, the total time needed from sending the wave to receiving it is calculated. Then, a program running on the microcontroller calculates the distance, as shown in equation (1) [17] : D = ½ T x C (1) where D is the distance, T is the time and C is the speed of sound (~ 343 meters/second).

V2V Communication
The smart vehicle reacts properly according to obstacle data recognized by sensing environmental information (D). The calculated distance can be used by the intelligent vehicle as a control parameter to produce an alert and activate automatic control outputs for deceleration and automatic braking depending on the software program's fuzzy rules. The warning system composition consists of LED, LCD, and message shared with the following vehicles.
The input to the fuzzy controller is responsive to the sensing distance (D) within the environment. Depending on the sensed distance, the fuzzy controller determines the action of the robotic car. The output of the fuzzy obstacle avoidance controller is represented by velocity (V) for the two driving wheels. The input D is used as a proposition variable with four fuzzy linguistic sets identified as "Close (C)", "Near (N)", "Medium (M)" ,and "FAR (F)" .The membership function is explained in Fig-5.a. The range of D discussion is equal to [0, 90cm]. The output variable V is described by four fuzzy linguistic sets identified by "Stop (S)", "Slow (L)", "Medium (M)" and "Fast(F)". The membership function is illustrated in Fig-5. b, where the discussion regions for V is chosen within the range of (0 to 50 cm/s).
The adjustment of the membership functions of all input and output variables to achieve optimum control is illustrated in Figure-6. The general rules of the procedure meet the following criteria:  When the obstacle is far away from the front of the robotic vehicle or there is no obstacle (no reflected waves) in the environment, the wheels of the robotic car will move fast, meaning that "F" is the output.  As the robotic vehicle identifies an obstacle, it enables appropriate avoidance of reactive obstacles by altering the moving speeds of driving wheels according to the distance of the obstacle.
When the obstacle is detected by the ultrasonic sensor and its location is less than the safe distance, the vehicle activates additional procedure to be sure that the area is really congested. This procedure is based on sensing and counting the number of surrounding vehicles in this area at that moment, using RF sensors equipped with the vehicle. Each vehicle announces its presence by sending a radio frequency (RF) signal-codes periodically, using the RF transmitter. This signal-code includes the vehicle-ID which is specific and unique. The RF receiver on the affected vehicle counts the number of (IDs) that have been received. When the number of surrounding vehicles exceeds a predetermined threshold, the vehicle makes a decision that there is congestion and translates it to a warning message to be shared between vehicles. In this case, the output of the fuzzy controller is "Stop (S)". Otherwise, the vehicle just changes the lane.

Implementation of V2V and V2I Communication
Python sockets are used to implement this functionality. The socket binds to an IP-address and port to send and receive data over the network. User Datagram Protocol (UDP) is utilized for sending and receiving packets. The network broadcast address is bound to the socket to make it able to broadcast messages. In our network setup, the broadcast address is 192.168.0.255. Upon receiving messages, the server socket is established for listening to the messages sent to its IP-address and port. When the output of the fuzzy controller is Stop "S": a) The intelligent vehicle generates a warning message. Raspberry Pi is the central unit that constructs the message according to the program being written. The massage is attached to the IP address of the affected vehicle to make it unique. Also, the message contains the position of the blocked point which is gained from the GPS module equipped with the vehicle. The vehicle broadcasts this message to the following vehicles in a radius that has a value equal to WiFi coverage. b) Each vehicle that receives the message will re-transmit it to other vehicles in its range. But before receiving the message, it will check whether the same message has been seen before by checking the IP address and the location of the first sender . If so, it will not receive the message, otherwise it will accept and broadcast it again and at the same time. Based on that message and the position of the congestion, the vehicle that receives this information will change its path. c) The LCD fixed on the roads will receive the warning message either from the affected vehicle itself, if it is in the coverage area, or from the other cars that receive the message, and re-transmit it. The LCD displays the alert (the presence of an abnormal situation and its position) to notify the vehicles which have no communication technologies.

Experiment Results and Discussion
In order to test the performance of the traffic congestion detection system, intelligent robotic cars are the test platform that combines the advantages of computer simulations and experiments on actual cars. This platform is a hybrid solution to test the applications of ITS in a controlled environment. The implementation was tested in different scenarios with two or more intelligent robotic cars. The system implementation was evaluated during the simulation, based on the expected actions identified by the requirements that include intelligent vehicle movement precision and vehicles communications. Evaluation of the requirements was based on observations obtained during the simulations, as it was difficult to find quantitative metrics to measure the implementation. The strategy used for the evaluation is, therefore, composed of a qualitative approach based on the requirements. Overall, the system acts as expected within the requirements given, based on the observations. Compared with related studies, the performance measurements applied to the proposed system were time-consumption, privacy, flooding, message redundancy, and cost. Firstly, the time complexity of the proposed system implementation code is (O(n)), which indicates that it does not consume time. The time parameter plays a vital role in the safety applications of V2V communication, because it needs real-time information about the road conditions which eventually impacts the speed of information dissemination. The system protects driving privacy because the transmitted message does not contain sensitive information (such as driving direction or timestamps), which makes the system a trusted and invulnerable architecture that prevents security attacks. This system prevents the redundancy of the messages and the flood of the network, because the received message is checked for whether it has been seen before. If so, it will not be received, otherwise it will be accepted. Thus leads to decrease the packet delay. Furthermore, the broadcast process is activated just in case of emergency situations that lead to maintain the channel bandwidth. Also, the system employs low-cost and broadly available communication technology (i.e., WiFi) which allows longer range communication and throughput requirements that could not be supported by DSRC technology alone, as illustrated in in Table-1. WiFi technology reduces the need for costly DSRC infrastructure. This leads to a costeffective solution for traffic control, since the hardware and software platforms needed for its implementation are of low cost.

Conclusions and Future Enhancements
The proposed model is an embedded system controlled by a Raspberry Pi model B, interfaced with different modules (sensors, GPS, DC motor) constructing an intelligent robotic vehicle. The system broadcasts early traffic alerts to the approaching vehicles to avoid the obstacles, congested areas, or any emergency situation. Using this system can help in providing an immediate warning in case of unfortunate accidents, congestion, or blocking the road by any obstacle such as a fallen tree or icy roads and so on. Gathering and disseminating emergency traffic information between the vehicles by this system on the road can contribute to reducing the drive time, fuel consumption, and CO2 emissions. Also, it can increase traffic flow and road capacity and aids in congestion avoidance.
The proposed system was theoretically tested in many places in a controlled environment. The system is not fully perfect but can provide valuable insight and results. There are some issues associated with sensors and can affect accuracy. Sensors may fail during drastic weather conditions and often do not work during a blizzard or heavy snowfall. This study still continues to develop and some enhancements will be added. A camera should be interfaced with the system to provide a precise view by capturing an image, recognize the traffic condition, and accurately detect the obstruction. Also, we intend to expand the communication process to include more destinations.