Prototype Traffic Light Design Based Wireless Sensor Network With Multihop Topology

Increasing number of vehicles there are not combining by the increase highway facilities and means of adequate traffic, creating traffic jams can not be avoided. Therefore, it needs a traffic light system which can change the duration adaptive, so delays in traffic flow can be parsed automatically. In this thesis constructed an traffic light prototype that can change the duration of the traffic lights adaptively according to the conditions of real-time flow of the street using a detector such as a HMC5883L compass sensor. With a wireless sensor network and multihop topologies in terms of the system is easy to apply, because it does not require the transmission line in the form of cables and sensors can be added the number and spacing range. The main components used are Arduino Uno, Arduino Mega, XBee and HMC5883L compass sensors. Compass sensor detects the presence of vehicles by calculating magnitude value in the form of interference with Earth's magnetic field caused by cars metal, so the sensor nodes can send information pathways state conditions in the one intersection to the coordinator via another sensor nodes using xbee in multihop topologies. The results obtained after testing is setting plan to address the inequality of delay on the traffic system can work well with the sensor reading error 0.09% within a period of 2 minutes and the application topology multihop use the traffic light system can expand the detection range 400 m. But the number of hops is used affects the packet loss is greater, namely 0.192% at a distance of 200 m.


Background
Traffic congestion is a thing that is often found in almost all road networks in cities in Indonesia. This is the impact of the number of vehicles that are not offset by increments of highway facilities were adequate. Therefore, the function of the traffic lights become very important. However, despite the use of traffic lights at every intersection, the traffic flow is not necessarily evenly. This means that in certain directions happen to its high density, whereas for the other direction. Besides the fixed time method based on historical data on the traffic system is still widely used today is considered less effective because it does not take into account the real-time flow of the street. Therefore we need a traffic light system adaptive designed using wireless sensor networks so that congestion at a given point can be resolved automatically.
The design of the prototype traffic light-based wireless sensor network topology with multihop this is the design of the traffic light system adaptive where the duration of the traffic lights to change adaptively adjusting the conditions of real-time traffic density is detected by the sensor compass and processed by a microcontroller without using the control room monitoring and personnel carriers. The communication channel is built using a wireless sensor network that does not require a cable as a medium pentransmisiannya. Topology used is a multihop topology because in this topology, the sensor network can be expanded both the number and within reach.

Objectives
The purpose of making this Final Project, among others: 1. Building adaptive wireless sensor network for traffic light system. 2. Overcoming inequality waiting time at traffic light system. 3. Knowing the effect of the use on a network topology multihop traffic light system.

LITERATURE & THEORY
Control of Traffic Light ATCS (Area Traffic Control System) is a traffic management system that has the ability to traffic management by coordinating between the junction of the control center. ATCS Department of Transportation has implemented to manage traffic by taking into account the condition of the real-time flow of the street, but there are some constraints such as limitations in this case the operator to set the course of human traffic, as well as in terms of media pentransmisiannya. (DISHUB, 2010) One solution to overcome the limitations of the transmission by cable media is to use the wireless network. Utilizing the IP camera mounted on the intersection of roads to monitor traffic density. The traffic light can be controlled and monitored from a central office using a wireless network. But the weakness of this system is still widely used and power control room operator to monitor traffic conditions. (Salsabela & Arifin, 2013) Then developed traffic light control system based sensors using ultrasonic sensors as detectors, sensor performance is not perfect but this is due to the difficulty in gaining acceptance angle position at the appropriate recipient of the sender. Suggestion of this research is to replace the sensor detecting traffic density with a sensor that detects any metal materials such as cars, motorcycles and other vehicles. (Pangestiani & Firmansyah, 2013) In this final project further developed the traffic light system using a compass sensor that can detect the presence of metal materials. The traffic light system adaptive traffic lights where the duration can be changed dynamically adjusting the conditions of real-time traffic density is processed by a microcontroller that does not use a control room monitoring. The communication channel is built using a wireless sensor network because its design is flexible, easy installation, extension, and maintenance. (Kafi et al., 2012) Final also uses network topology multihop because in this topology, the sensor network can be expanded both in number and within reach.

HMC5883L Compass Sensor
The sensor is a transducer that converts some physical process into an electrical signal that can be measured by a digital processor. (Cheung & Varaiya, 2007). In this study used a compass sensor as in figure 2.1. Compass sensor works based on magnetic fields using the IC HMC5883L. HMC5883L IC chip which is designed to read magnetic field is applied to the IC AMR (Anisotropic Magnetoresistive) so that the compass sensor has the ability to detect the presence of vehicles by calculating the magnitude of the disruption caused by the metal. (

Xbee S2
XBee used as an enhancement to enable the microcontroller can communicate wirelessly to connect the sensor node 1 with other sensor nodes. XBee Series 2 has a maximum distance of 120 m outdoor. One node has one XBee sensor that serves as transceiverKomunikasi between sensors can use various topologies of them is a star topology, mesh, tree, bus and linear. Kind of -kind of topology can be seen in Figure 2.2.  (Pratama & Sinung, 2015) In this final project used a mesh topology applying multihop communication. Multihop communication means nodes -nodes in a network can communicate with the help of one or more nodes, which act as a relay node between the source node and the destination. So that at this topology radio communication distance limitations can be overcome. (Karl & Willig, 2006)

Method
In this final project as a whole series of implementation of the design and manufacture can be seen in figure 3.1. System specifications Traffic light system made are expected to have the following specifications : 1. Has the ability to detect the presence of vehicles using the compass sensor that can menentukkan HMC5883L traffic conditions based on the length of the queue . 2. Having the ability to compare the condition of the road from four lanes and menentukkan plan appropriate time for each -each track . 3. Able to transmit data from Arduino Arduino to another multihop via XBee with an effective range of 50 m using the XBee Series 2 outdoor ( urban) with a frequency of 2.4 GHz .

System Work Principal
The system is divided into two main node is a sensor node and coordinator node. In the sensor nodes, each Arduino Uno uses HMC5883L compass sensor to detect the presence of vehicles, this detection is done when all red or all red lines in the state, after the detection of the vehicle on the sensor node, then Arduino Uno charge of processing the data. This data is then transmitted from the sensor nodes using the XBee fourth heading sensor node in front of it (3.2 and 1) in multihop, then forwarded to the Coordinator node main inator, picture this system applies equally to the three other lines.
On the coordinator node data is received by the XBee and forwarded to the Arduino Mega, Arduino Mega compare and menentukkan plan counter that should be given to each track corresponding real conditions of eacheach track. Only data plan ready counter is transmitted through the cable towards each -each traffic light to be applied. The entire system can be seen in Figure 3.2. and 3.3. The prototype of this intersection is divided into four phases, namely phase A, phase B, phase and D.
Phase A: Line from west to east. Phase B: Line from south to north. Phase C: Line from east to west. Phase D: Line from the north to the south.

Hardware Design Sensor Node Design
In the sensor node 1 to 4 have the same hardware circuit. In Figure 3.4, arduino used HMC5883L associated with the compass sensor and XBee. Pin HMC5883L compass sensor that is connected to arduino is pin VCC, GND, SCL and SDA. VCC on the compass sensor is connected to the pin on arduino 3.3 Volt. GND GND connected to the arduino. SCL pins on the sensor is connected to pin A5 on. While the SDA pin is connected to pin A4 on arduino. More configuration in Figure 3  Coordinator Node Design On the coordinator node, arduino arduino mega used is connected to the XBee, GSM shield and relay traffic lights as much as 12 input. XBee DOUT pin is connected to pin RX 0 on arduino mega. Pin DIN XBee connected to pin TX 1 arduino. VCC on the XBee connected to pin 3.3 Volt and GND pin of the XBee connected to GND on arduino. Arduino Mega and driver traffic light is connected to pin as many as 12 pins. Each -each track dberikan the traffic lights (red, yellow and green), and connected to digital pin Arduino Mega pins 42-53.
After that connect the Arduino Mega with GSM shield. VCC pin on GSM shield is connected to a 9 Volt power supply and GND pin is connected to GND pin on the Arduino Mega. While the pin TX on GSM shield is connected to pin RX1-18 on Arduino Mega and RX pins connected to pins on the Arduino TX1-19.
Connecting Arduino Mega Module with Real Time Clock (RTC). 5V pin on the RTC is connected to 5V pin on the Arduino Mega. RTC GND pin is connected to GND pin Arduino, connected with the RTC SDA pin SDA pin 20 Arduino, while the SCL pin on the RTC is connected to the SCL pin 21 on the Arduino Mega.Rangkaian coordinator node can be seen in Figure 3.5.

Software Design
The software used to create the program to the Arduino is using the Arduino IDE. Software design is done by creating a flowchart before implemented in the form of the program. Flowchart sensor node can be seen in Figure 3.6.   In Figure 3.7 on the node coordinator stages of determining the plan begins with the receipt of the data transmitted by the sensor node first in each phase, then a sensor node compares the queue length each -each phase with the assumption that if the single phase (line) there are three sensor nodes were detected ( berlogic 1), then the condition is said to be the solid phase. Then after decides conditions of each phase, the coordinator node set plan counter how much should be applied to parse traffic density.

Setting On Traffic Lights
The setting of the traffic lights on the traffic system implements a default plan counter that has been determined by the ATCS (Area Traffic Control System) Semarang.
Setting Flowchart of the traffic lights is shown in Figure  3.8. The setting of the traffic lights started to plan the default (normal) as shown in Table 3.1, which began with flame green light on phase A, then when the condition of all red for 3 seconds, do the detection on the four phases, namely phase A, B, C and D in order to know the real conditions of each -each phase. After completion sensor nodes detect the presence of vehicles and transmits data from the multihop sensor node to sensor node first four on each -each phase, and then the data is sent to the coordinator node. On the coordinator node is done comparing the queue length of each phase so that node menentukkan coordinators can plan how much should be given to the next phase. However, the order granting the green light in the intersection remains permanently sorted starting from phase A -phase B -phase C and phase D. Only the duration of the green light for a denser phase longer than the phase with the short length of the queue of vehicles (deserted). There are 4 plan counter that is applied in accordance with the conditions of each lane in the intersection that plan 1 for the condition of the lines jammed, plan 2 to condition 2 lanes of traffic jams and plan 3 for 3 lanes jammed condition. While the default plan for all conditions jammed or all deserted.

Test Result
Test Result Data Threshold HMC5883L Compass Sensor.
Compass sensor sensitivity tested on metal objects by putting a sensor in the right position the car as in figure 3.9. Direction sensor is not directed towards the north of the earth because the sensor does not function as a compass, but functioned as a detector of the presence of metal or vehicle. So that in this test the x axis (west) on the sensor are directed to the right side of the car and sought its magnitude value to determine the threshold value of each phase results are presented in Table 3.2. The distance test between the sensor node module drive as far as 50 cm on the right side of the car body. Changes in the value of x, y and z investigated conditions at the time there were no cars and no cars turned on.  West -East 1500 4 East -West 800 Testing Results Data Distance Maximum XBee This system uses xbee mounted on a sensor node and coordinator node. The second node is the same -the same transmit and receive data resulting in two-way communication. Testing at a distance of 90 m of data obtained from the test range have a very good percentage that is equal to 97.9% with the loss of data as much as 7 as in Figure 3.10. Tests carried out on the condition of LOS (Line Of Sight) were tested in the field of urban areas.
In testing the maximum distance of 100 m XBee percentage obtained by 86.8%. At the time of the XBee LOS able to reach a distance of 100 m between nodes with good communication, it is due to the absence of hindrance or interference of other signals around the XBee as in Figure 3.12  Data Results Overall System Testing After testing the whole system on POLINES environment, it can be concluded that the system can run well. Testing is done by testing all counter plan to manipulate the conditions in a single intersection. The test results are shown in Figure 3.13, 3.14, 3.15, and 3.16   Testing plan 1 is done by positioning the car on one of the phases in this case the phase A. Car is positioned at a distance of a third sensor node detection, so that the solid phase is detected at the time of testing. While the other three phases, namely B, C and D are not detected density. Data obtained on the plan displayed on the coordinator node software Tera Term.
Plan 2 was tested in a way to position the car in the second phase in this phase A and C. The car is positioned at a distance of a third sensor node detection, so on the second solid phase is detected at the time of testing. While the other three phases, namely B, C and D are not detected kepadatan.Sedangkan plan 3 testing is done by positioning the car on 3 phase in this case the phase A, B and C. The car is positioned at a distance of a third sensor node detection, so at this phase solid detected at the time of testing. While the first phase the others are D undetectable density.

Multihop
Topology Data Testing Results Multihop topology testing conducted to determine how the effect of using this topology in a prototype traffic lightbased wireless sensor networks. Multihop topology tested by testing it on some variation of distance detection, see the response transceiver through X-CTU and determine packet loss is generated. In addition to the maximum distance multihop, also tested the effect of the number of hops the packet loss data. But in this test authors only observed on the receiving side.

2 Hops Testing
Testing 2 hop done by taking a sample of data as much as 150. The distance is taken as the test material varies from 30 m, 50 m, 70 m and 90 m with reference to the equation 3.1 as follows: Packet Loss = Jumlah paket error x100% (4.1) Jumlah paket diterima  So that the amount of data that is error more than the number of data errors that others with the same hop and a shorter distance. This is due to the farther the path that must be passed by the signal before it finally got to the other sensor nodes and the number of wifi connections were 2.4 GHz frequency caused so much interference that can not be avoided.

The Test Result Multihop Maximum Distance.
Testing the maximum distance multihop done by activating the 4 hops (single phase). In the 4 hop consists of four sensor nodes and one node coordinator. The distance was tested in this test is 75 m, 97.5 m, 180 m and 200 m. This test is performed to determine how the quality of the data obtained during the system applied in one lane on the road. After testing, the obtained data is as follows: Packet Loss Ratio or packet loss ratio is the ratio between the data packet error to the total number of packets received via a particular transmission medium (Iqbal, 2015). In Table 3.6 shown the percentage of data packets lost during shipment to 4 hops at once.
Based on testing that has been done is obtained as shown in Table 3.6. In testing the maximum distance as far as 75 m obtained packet loss of 0.05%. Error data obtained by sampling the data of 120 for 2 minutes. While the next image is testing delivery with extended range XBee is 97.5 m. In these tests obtained packet loss amounted to 0.075%. The error data were also obtained using data sampling a total of 120 for 2 minutes. Then performed again adding a distance of 82.5 m to 180 m. At a distance of 180 m obtained the data packet loss amounted to 0.167%. Last testing is a gap between hop of 50 m so that the distance of detection to 200 m. Packet loss is detected 0.192%. A distance of 200 m has the largest percentage of packet loss among the three other distances. This is due to the addition of farther distance so the more disturbance in the form of obstacle or another wifi signal interference is the same -the same occurred at a frequency of 2.4 GHz.
The maximum distance of 200 m in LOS outdoor / urban benefits in multihop systems. With the same performance with other topologies, multihop topology is clearly superior on the distance. Making a total of 120 data samples of data for following cycles of four phases, namely for ± 2 minutes or the equivalent of 120 s. The protocol provided by the coordinator node to node fourth sensor that every 1 s fourth sensor node sends the detection result to the vehicle where the coordinator node turns out to run in accordance with expectations. From the fourth sensor node after detection and then the data is sent and received by the third sensor node, the node storing data reception, detect and transmit the data to the sensor node. The second sensor nodes do the same thing with a third node because the function as a router. Once the data is received by the first node and forwarded to the coordinator node to do the setting plan. Although in one group (fourth phase) occur or incorrect data errors on sensor readings, but the traffic light system is still fairly accurate with the average -average sensor reading error of 0.09% at the maximum detection distance of 200 m.

CONCLUSION
Based on the results of testing the system has been implemented, it can be concluded that: 1. At the traffic light system, wireless sensor network technology can be implemented and run well. 2. Inequality waiting time at traffic light can be overcome with the use of wireless sensor network system for setting plan to address the inequality of delay on the traffic system can work well with the sensor reading error of 0.09% in 2 minutes. 3. Application multihop topologies on a traffic light system based on wireless sensor networks is very influential in the expansion of the detection range can be expanded up to 400 m. But the number of hops is used affects the packet loss is greater, namely 0.192% at a distance of 200 m.