0% found this document useful (1 vote)
1K views

Final Report-TrafficLightController

The document presents a final report on a traffic light controller project. It aims to develop a smart traffic light system that utilizes sensor data and machine learning algorithms to optimize traffic flow. The proposed solution involves sensors to detect vehicle counts at intersections and adjust green light times accordingly. It describes a system architecture using Arduino, ultrasonic sensors, local and cloud servers to collect data, analyze traffic patterns and control light timings in real-time to minimize congestion. Experiments were conducted to detect vehicle counts using ultrasonic sensors. The goal of the project is to eliminate traffic inefficiencies through an adaptive, self-learning traffic light system.

Uploaded by

hamed raza
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
1K views

Final Report-TrafficLightController

The document presents a final report on a traffic light controller project. It aims to develop a smart traffic light system that utilizes sensor data and machine learning algorithms to optimize traffic flow. The proposed solution involves sensors to detect vehicle counts at intersections and adjust green light times accordingly. It describes a system architecture using Arduino, ultrasonic sensors, local and cloud servers to collect data, analyze traffic patterns and control light timings in real-time to minimize congestion. Experiments were conducted to detect vehicle counts using ultrasonic sensors. The goal of the project is to eliminate traffic inefficiencies through an adaptive, self-learning traffic light system.

Uploaded by

hamed raza
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Salam Zantout ID: 14761707 June 15, 2017

Traffic Light Controller


Project Final Report
Motivation
In 2014 54% of the total global population were urban residents [1]. The prediction was a growth of nearly
2% each year until 2020 leading to more pressure on the transportation system of cities. Additionally, the
high cost of accommodation in business districts lead to urban employees living far away from their place
of work/education and therefore having to commute back and forth between their place of residence and
their place of work. More vehicles moving need to be accommodated over a fixed number of roads and
transportation infrastructure. Often, when dealing with increased traffic, the reaction is: just widen the lanes
or increase the road levels. However, cities should be making their streets run smarter instead of just making
them bigger or building more roads.
Figure 1 shows a typical intersection along with the traffic lights and pedestrian walk lamps and buttons.
Figure 2 presents all the movements by cars and pedestrians that happen at an intersection. Both Figures
indicate how complicated a smart traffic light system would be to implement. Many external factors such
as the existence of several traffic lights, pedestrian lights, multiple vehicle movements and pedestrian
movements play a decisive role when controlling such a system. Any error might result in congestion and
the loss of time, money and effort. In addition, in a city, traffic flow through one intersection can affect
other intersections increasing the complexity of the system.

Figure 2: Diagram of intersection with corresponding lights [2] Figure 1: Typical vehicular and pedestrian movements [9]

A crucial part of making the streets smarter is utilizing traffic signals that use sensor data, communication
and automated algorithms to keep traffic flowing more smoothly [3]. In other words, intersection signals
should be able to adjust, in real-time, to traffic conditions resulting in minimizing both the hassle and cost
of commuting as well as minimizing the carbon footprint of the transportation vehicles by making the
system more fuel efficient and minimizing wear and tear resulting from excessive breaks. A smart
transportation system is expected to also minimize the number of accidents which will lead to fewer
fatalities, less patients in hospitals and less pressure on emergency response systems. This will in turn
release funds which might be used to make the life of citizens better rather than buying more supplies for
hospitals and emergency vehicles and increasing their number. The system is also expected to benefit
individual commuters by lowering insurance rates (since there are less accidents happening), fuel cost and
Salam Zantout ID: 14761707 June 15, 2017

cost of lost time and arriving late to work/school.

Proposed Solution
A smart traffic light system utilizing sensor data, communication and automated algorithms was developed
to keep traffic flowing more smoothly. The aim was to optimally control the duration of green for a specific
traffic light at an intersection. The traffic signals should not flash the same stretch of green all the time, but
should depend on the number of cars present. When traffic is heavy in one direction, the green lights should
stay on longer; less traffic should mean shorter greens.
This solution is expected to eliminate inefficiencies at intersections and minimize the cost of commuting
and pollution.
System Architecture
The proof of concept system block diagram is presented in Figure 3. The traffic lights are LEDs and the car
counting sensor is an ultrasonic sensor. Both blocks are connected to an Arduino Uno using physical wires.
The Arduino is the traffic light controller which receives the collected sensor data and manages the traffic
lights by switching between green, yellow and red. The Arduino computes the number of cars in the street
of the intersection it is monitoring based on the distances measured by the ultrasonic sensor and the timing
between those measurements. The Arduino then sends the number of cars every minute (this time was
chosen based on little study, additional experiments should be conducted to determine the optimal
frequency at which to send the number of cars to the local server) to the local server which is a laptop. This
communication is done using the Arduino’s serial port. The local server exchanges the number of cars
received with the cloud server in order to train and update the machine learning algorithm to better predict
the changes in timings of the traffic light. This communication is done using Wi-Fi. More specifically, the
cloud server uses a logarithmic equation that takes the data received (number of cars) as input then
determines the seconds of green needed for a smooth traffic flow. This calculated time of green is then
compared to the current actual time the green light is on (this data is saved is a database on the cloud server).
The server then comes up with a decision: if the current actual green time is less that the calculated time
the decision is to increase the green time, else the decision is to decrease the green time. This decision is
sent back to the local server and then forwarded to the controller which adjusts the green time accordingly.

Figure 3: Functional Blocks


This architecture is a general design, some of the blocks, like the local or cloud servers can be removed in
the future depending on the requirements of the client.
Salam Zantout ID: 14761707 June 15, 2017

Car Counting Sensor


To be able to detect a passing car, two set of experiments were conducted assuming the presence of only
one lane. In the first experiment, only one car passed the sensor and the range of distances when a car passes
by was extracted. While in the second experiment, 34 cars passed back to back in order to extract the
minimum time elapsed between two consecutive cars. The rule is that if the sensor reading is within an
acceptable range of distances over an acceptable period of time, then a car is detected and hence the counter
is incremented. The circuit setup for these experiments is presented in figure 4, all the additional
components (other than the ultrasonic sensor) were used for experimental purposes and will not be present
in the actual project circuit.
Ultrasonic sensor

SD Card RTC
Module Clock
Arduino Nano
Switch Buttons

LED Indicators

Figure 4: Car Counting Experiment's Circuit Setup


Experiment 1
This experiment had only one car passing in front of the ultrasonic sensor at different speeds and the
distances measured by the sensor over time were recorded and then plotted to obtain figure 5.

SPEED: 25MPH Speed: 12.5 mph


67 96 Max Threshold
Max Threshold
95
Distance (cm)
DISCANCE (CM)

66
94
65 93
64 92
63 91
Min Threshold Min Threshold
90
62
422
341
349
358
367
376
385
394
403
412

430
441
456
471
485
499
514
529
543
6 13 21 28 37 51 64 78 91 104 120
TIME (MS) Time (ms)

Speed: 6mph Car approached, stopped, took off


130 Max Threshold Max Threshold
70
Distance (cm)
Distance (cm)

120 68
66
110 64
100 62
60 Min Threshold
90 Min Threshold
138 157 175 194 212 231 254 283 313 341 712
Time (ms) Time (ms)
Figure 5: One Car Passing at Different Speeds
Salam Zantout ID: 14761707 June 15, 2017

The distance values detected are not constant, however, they lie within a certain range and minimum and
maximum thresholds were then extracted. If the sensor reads a value within that distance range, a car is
passing by, hence a car is detected.

Experiment 2
Next, a total of 34 cars passed the car counting sensor and for each car, several distance values were
recorded by the ultrasonic sensor. The plot in figure 6 was generated by plotting, for each car the distances
recorded by the sensor over time (milliseconds). Each car’s distance values are labeled with a specific color
in order to be able to identify the different cars. As shown in the upper graph, 22 out of the 34 cars entered
the street back to back and hence, a second graph was plotted to have a clearer view of the data.

Car Detection/Counting
Car 1
13090
Dsitance (x58.8 cm)

Car 2
12090
11090 Car 3
10090 Car 4
9090 Car 5
8090
Car 6
7090
Car 7
6090
0 500000 1000000 1500000 2000000 Car 8
Time (ms) Car 9

Car Detection/Counting Car 13


Car 14
Car 15
Car 16
13090 Car 17
Car 18
12090 Car 19
Car 20
11090 Car 21
Car 22
10090
Car 23
9090 Car 24
Car 25
8090 Car 26
Car 27
7090 Car 28
Car 29
6090 Car 30
2202802 2252802 2302802 2352802 2402802 Car 31

Figure 6: Detection of Cars Passing by

The minimum time elapsed between two consecutive cars passing by is 1.472 seconds. This number was
determined after plotting the time it took between two consecutive cars to pass by. The results are shown
in figure 7.
Salam Zantout ID: 14761707 June 15, 2017

TIME BETWEEN CARS


PASSING(MS)

360
360

300

300
240

240
120

120

34.604
34.339

32.569

23.191
17.318

15.808
15.647
14.164
60
60
8.463

7.917

7.351
7.041
6.259
5.903

5.299

3.642
2.732

2.732
2.284
1.831
1.526

1.472
12.1
1 2 3 4 5 6 7 8 9 1 01 11 21 31 41 51 61 71 81 92 02 12 22 32 42 52 62 72 82 93 03 13 23 3

34.604
32.569

23.191
17.318

15.808
15.647
14.164

12.1

Min value
7.917

7.351
7.041
6.259
5.903

5.299

3.642
2.732

2.732
2.284
1.831
1.526

1.472

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

Figure 7: Plot of Time between Two Consecutive Passing Cars

Hence, to detect a car, there should be a period of minimum 1.472 seconds where the distances read are out
of range. After that, if the sensor reads a value within the distance range, a car is detected and the car counter
is incremented. Those two rules were implemented in the car counting sensor block’s code.
This data can be used in future work to train machine learning algorithms and have more precise predictions
for the green light intervals

Machine Learning (Cloud Server)


To simulate the benefits of the machine learning algorithm, experiments were conducted on an intersection
in Irvine to count the needed time of green light based on the number of cars present. Data was collected
for different lanes for one traffic light: one going straight and another turning left. After plotting the data
collected, a logarithmic equation was extracted for both types of lanes as shown in figure 8. These
logarithmic equations were then used by the cloud server to decide whether to increase or decrease the time
of green. If the predicted number of seconds needed is higher than the actual current green time, the decision
would be to increase the green time stored in the Arduino controller.
Salam Zantout ID: 14761707 June 15, 2017

Direction of Traffic: Straight Direction of Traffic: Left


25 30
y = 8.2119ln(x) + 0.1826
25

Seconds of Green
Seconds of Green

20
20 y = 8.4805ln(x) + 2.108
15
15
10
10
5 5

0 0
0 2 4 6 8 10 12 14 0 2 4 6 8 10
Number of Cars Number of Cars
Figure 8: Seconds of Green for a Specific Number of Cars

Software Setup
The software responsible for the functionality described previously is provided along with the book.
Figure 9 explains the relation and order of the code files.

Figure 9: Software Architecture


Salam Zantout ID: 14761707 June 15, 2017

Hardware List and Cost


Only the following two components were used in this proof of concept’s final circuit design and they were
purchased from Amazon as shown in figure 10 and 11.
1- Arduino Uno: $16

Figure 10: Arduino Package Purchase

2- Ultrasonic Sensor HC: $3.19

Figure 11: Ultrasonic Sensor Purchase

It is assumed that the client requesting the product would already have a local server that has a Wi-Fi
connection because for this project a personal laptop was used and hence an estimated cost doesn’t apply
to that component.

Real Time Evaluation


The processing time limit can be determined by the time needed to detect a fast passing car. At 200 Km/h,
a car needs about 54 milliseconds to pass the sensor and hence be detected. The Arduino is working at 16
MHz with very small data, the machine learning algorithm used would maybe take time for training (offline)
but not for prediction, and the communication is dependent on the network congestion but should not exceed
a few milliseconds for data exchange. Since, the sum of every module’s performance results in an overall
time which is still less that the limit (54 ms), the system is expected to have real time performance.
Salam Zantout ID: 14761707 June 15, 2017

Cost issues and Market Survey


The ultrasonic sensor I am currently using for this project (HC-SR04) is a cheap and commonly used
sensor. This sensor would have to be placed on the side of the street on some kind of a pole. This is why a
weather proof sensor is needed (SEN0207), this would increase the price from $3 to $16. Also, this
project utilizes Wi-Fi as the communication technology between the local and the cloud servers and serial
communication between the controller and the local server. This may present some cost issues if the
model was to be commercialized and further research may be needed to select the best technology that
would fit the market.
The competing systems are
1- Siemens Intelligent Traffic Systems in Tyler, Texas which are reducing traffic delays by 22% [4].

2- SCATS (Sydney Coordinative Adaptive Traffic System) in Factoria Boulevard in Bellevue,


Washington which was first developed and used in Sydney, Australia [5].

3- Surtrac’s smart traffic-management system. A startup project by Carnegie Mellon University


professor of robotics Stephen Smith in Pittsburgh’s East Liberty neighborhood. The Surtrac
system uses radar sensors and cameras at each traffic light then AI algorithms to build a timing
plan and finally communicates with traffic intersections downstream so they can plan ahead [6].

4- Adaptive Control Decision Support System (ACDSS) in New York which is a joint project
between KLD, traffic management company Transcore and the New York Department of
Transportation. It utilizes field sensors, RFID readers (to scan E-Zpasses) and cameras [7].

Challenges and Solutions


Several challenges were faced during the implementation of the project:
1. Limited budget:
As a graduate student my ability to test different technologies to see which is best is very limited.
Solution:
Off-the-shelf components were used to make proof of concept. Then other technologies were
theoretically evaluated once their cost is available.

2. Lack of time:
Time limitations and taking other courses with projects impeded my ability to do a thorough survey
of the market to get quotes on real cost of parts and communication technologies.
Solution:
A theoretical evaluation of different technologies was included so that once costs are known
numbers could be plugged in and cost determined.

3. Data Collection:
Placing sensors on intersections is time consuming and needs permits.
Solution:
Only consider one intersection and collect as much data as possible, future work should expand the
surveyed intersections.
Salam Zantout ID: 14761707 June 15, 2017

Conclusion
Using an intelligent traffic light system has many advantages. Using smart traffic light controllers reduced
travel times by 36% during peak rush hour in Bellevue, Washington [4]. It also lead to the decrease of
heavy traffic by 43% from 2 p.m. to 6 p.m. Those reductions can be translated into real savings for drivers
by estimating that a driver’s time is worth $15 an hour, Bellevue officials estimate that the system saves
drivers $9 million to $12 million annually.
It is important to note that although studies show high success rates when installing adaptive signals, this
solution is not a magic potion for clogged roadways. “while smart lights can be particularly beneficial for
some cities, others are so congested that only a drastic reduction in the number of cars on the road will
make a meaningful difference” [8].
In this report, the solution of having smarter streets, particularly smart traffic light systems was proposed.
A proof of concept design was created then tested and the results validated the feasibility of this solution.
The design described in this report has a lot of room for growth and future work.

Future Work
Since this is a quarter course project, cheaper and less reliable sensors (HC-SR04 ultrasonic sensor) were
used and more known communication technologies (Wi-Fi and serial) were implemented. In the future,
more reliable and precise sensors can be integrated into the design and wireless technology can be
implemented for communication. Also, the lack of precise and detailed knowledge in machine learning
(ML) resulted in the use of basic ML algorithms in this project. Future extensions to the project could be to
collect enough data so that the ML algorithms can be more accurate, and more sophisticated algorithms can
be used. Finally, for this project, a one lane street in an intersection was considered. When expanding this
project, more complex features can be considered such as: larger streets with more lanes, all the streets in
an intersection, communication between the networks of intersections, and finally the integration of
pedestrian scenarios to the project. Also, an interesting extension to this project would be to analyze data
from neighboring intersections and determine its effect on the intersection being controlled. Moreover, this
system could utilize image processing algorithms along with the cameras that are already being used on
traffic lights for validation of the number of cars present. In conclusion, this project is just a proof of concept
and hence includes the very initial steps in a project that has the potential to be expanded in the future.

References
[1] U. Saiidi, "How smart cities are building the future," CNBC | Tech, 9 Feb 2017. [Online]. Available:
http://www.cnbc.com/2017/02/09/how-smart-cities-are-building-the-future.html. [Accessed 2017].
[2] MIT, "Design a sequential circuit (FSM) and implement using the labkit," 2006. [Online]. Available:
http://web.mit.edu/6.111/www/f2006/handouts/labs/lab3.html. [Accessed 2017].
[3] D. Z. Morris, "Smart Cities: Smart cars, meet smart signals," Fortune | Tech, 20 Aug 2015. [Online].
Available: http://fortune.com/2015/08/20/smart-traffic-signals/. [Accessed 2017].
[4] D. Z. Morris, "Smart cars, meet smart signals," Fortune | Tech, 20 Aug 2015. [Online]. Available:
http://fortune.com/2015/08/20/smart-traffic-signals/. [Accessed 2017].
[5] J. Sanburn, "How Smart Traffic Lights Could Transform Your Commute," Time, 05 May 2015.
[Online]. Available: http://time.com/3845445/commuting-times-adaptive-traffic-lights/. [Accessed
2017].
[6] P. Patel, "Pittsburgh's AI Traffic Signals Will Make Driving Less Boring," IEEE Spectrum, 17 Oct
2016. [Online]. Available: http://spectrum.ieee.org/cars-that-think/robotics/artificial-
Salam Zantout ID: 14761707 June 15, 2017

intelligence/pittsburgh-smart-traffic-signals-will-make-driving-less-boring. [Accessed 2017].


[7] L. DRELL, "4 Cities Using Tech to Alleviate Traffic," Mashable, 16 Nov 2011. [Online]. Available:
http://mashable.com/2011/11/16/traffic-tech/#gIL2OWWRIqqI. [Accessed 2017].
[8] J. Sanburn, "How Smart Traffic Lights Could Transform Your Commute," Time U.S |
Transportation, 05 May 2015. [Online]. Available: http://time.com/3845445/commuting-times-
adaptive-traffic-lights/. [Accessed 2017].
[9] Office of Operations, US Department of Transportation, "Traffic Signal Timing Manual," 2017.
[Online].

You might also like