Final Report-TrafficLightController
Final Report-TrafficLightController
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
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.
SD Card RTC
Module Clock
Arduino Nano
Switch Buttons
LED Indicators
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)
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
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
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
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
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.
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.
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].
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