Sei sulla pagina 1di 6

13th International Conference on Electronics Computer and Computation (ICECCO 2017 1

An Intelligent Traffic Control System


Aneesa Saleh 1∗ Steve A. Adeshina 2∗ Ahmad Galadima 3∗ & Okechukwu Ugweje 4∗
1,2,3,4
Department of Electrical/Electronic Engr., Nile University of Nigeria, Abuja,
E-mail : aneesa.saleh@gmail.com
E-mail : steve.adeshina@nileuniiversity.edu.ng
E-mail : ahmad.galadima@nileuniversity.edu.ng
E-mail : o.ugweje@nileuniversity.edu.ng

Abstract - The design and construction of an intelligent Several studies on intelligent traffic control models have
traffic light control system is presented in this work. The sys- also been conducted. Video image processing is used in
tem controls traffic lights based on the density of traffic on [2], [3] and [4] to determine traffic density. Infrared sensors
each side of the intersection. Infrared sensors and Cameras, to detect traffic density using passive or active infrared
combined with an image processing algorithms were used technology [5][6]. Fuzzy logic [7][8] and Genetic algorithms
to detect traffic density. Red-light runners were detected [9] are used to determine traffic density. Video analysis can
using a metal detector as a trigger, and images of offenders be used to detect red light runners by analyzing real-time
are captured. A scaled-down model of a traffic intersection videos of traffic [10] or from cameras within vehicles [11].
is used to demonstrate the efficiency of the system. Results RFID-based detection was used in [12] for detection of red
are comparable to what obtains in the literature. light violations.
Whereas most of the above approaches attempted to
Index Terms—Intelligent traffic control,computer vision, digital image
processing, infrared sensor, red-light camera, metal detector, Canny
solve specific problems using specific technology, such as
Edge detection. traffic control, red-light violation detection, etc., we have
integrated several of these functionality into a single system
and intelligently controlling a plethora of activities. The
approach we have taken allows high quality images to
1 I NTRODUCTION
be stored for further processing. Our system can easily be
Traffic light systems that use fixed-time controls do not extended to Vehicle number detection especially of red-light
respond to traffic conditions causing time and fuel wastage. violators. We are not aware of such an integrated approach
Though a lot work had gone into intelligent traffic control, to traffic control in the literature.
many countries still depend on the fixed time or pro- This paper presents a density-based system of traffic con-
grammable traffic control systems. Fuel wastage from fixed trol using infrared sensors and cameras to estimate traffic
time and programmable traffic control systems increase the volume. Timing for each cycle was estimated dynamically
level of pollution being experienced in the world today. The to reduce time wasted at traffic lights. Both methods were
psychological frustration experienced by drivers who are in implemented to compare the efficiency and limitations of
a hurry and suddenly being stopped by a traffic light with each. Red light cameras were also implemented to detect
no other vehicles on the other sides of the intersection can running of red lights and capture images of offenders. A
only be imagined. model of a 4-way intersection was used to demonstrate how
This work seek to solve these problems by taking advan- the system operates.
tage of advancement in technology to design a workable
prototype using vehicle detection algorithms, single board
micro-controller (Arduino), infra-red sensors and metal de- 2 METHODOLOGY
tectors. In doing the foregoing, our intelligent traffic con- The intelligent traffic light control system consisted of traffic
trol systems compute the timing of each cycle dynamically light control and the red-light camera. Figure 1 shows a
based on traffic density. block diagram of Traffic Light Control (TLC) and Red Light
Various technologies have been used to estimate traffic Camera (RLC). TLC was coordinated by an Arduino Mega.
density, these include inductive-loop detectors, video image Density for two sides of the intersection was detected using
processors, infrared sensors, radar sensors and ultrasonic infrared sensors, and transmitted to a computer. The com-
sensors [1]. These systems may also implement other traffic puter system uses a MATLAB algorithm to activate cameras
monitoring and control methods such as detection of red- and process images captured to find the density for the other
light runners, speed limit detection, collision avoidance two sides of the intersection. The computer system stored
systems, automatic number plate recognition and synchro- the density for all sides in a database using MySQL. The
nization with databases to store information. density information was sent back to the Arduino, which

978-1-5386-2501-9/17/$31.00 
c 2017 IEEE
2

calculates the time for the next side of the intersection and one second apart and finding the absolute difference
changes the lights accordingly. The RLC is controlled by between them.
an Arduino Uno connected to a metal detector circuit, an  The absolute value was compared with a threshold
SD Card Module and a camera. Another Arduino Uno is value. Metal object detection was registered when the
used to detect frequency in the metal detector circuit and absolute value
recalibrate the circuit after a car has been detected. When  When a car was detected, the camera captured an
a car is detected, an image is captured and stored in an image of the offender and saved it to a memory card.
SD card. The RLC Arduino takes an input from the TLC
Arduino to determine when the side of the intersection with
the RLC has a red light. 2.3 Canny Edge Detection Algorithm [19]
Canny edge detection algorithm was used in the imple-
mentation of vehicle detection algorithm. We discuss this
algorithm below.

1) A Gaussian filter is applied to smoothen the image


and reduce noise. The operation is represented by

g(m, n) = Gσ (m, n) ∗ f (m, n) (1)

where f (m, n) is the image, and G(m, n) is the


Gaussian filter given by
 
1 m2 + n 2
Gσ = √ exp − (2)
2πσ 2 2σ 2
2) The intensity gradients of the image g(m,n) are
Fig. 1: Overall system block diagram computed using any gradient operator such as Sobel
or Prewitt to get M (n, n) and (m, n)
2.1 Traffic Light Control 
M (n, n) = gm 2 (m, n) + g 2 (m, n) (3)
m
The traffic lights were controlled using logic circuits. The
density of traffic on each side of the intersection was esti- and
mated to determine the length of time for each cycle. Two
sides of the intersection used infrared detectors, and the θ(n, n) = tan−1 [gn (m, n)/gm (m, n)] (4)
other two used cameras. Both methods were implemented
to determine their efficiency. 3) Threshold T is applied to M to get MT (m, n), where
Infrared sensors: The infrared sensors detect the dis- T is chosen to suppress noise without eliminating
tance of an object in their field of view. To determine the edges:
value each sensor would produce with a car present, a 
threshold value for each sensor was chosen. This value was M (m, n) if M (m, n) > T
MT (m, n) = (5)
high enough to prevent a high signal for an empty road and 0 otherwise
low enough to produce a high value when there was a car
in the outermost lane. An output voltage higher than the 4) Non-maximum suppression is applied to MT to
threshold signaled that a vehicle had been detected. thin edges. Each non-zero MT (m, n) is checked to
Cameras: The number of cars was found by capturing see if it is greater than its two neighbours in the
an image of the road and processing it with MATLAB. The (m, n) direction. All MT (m, n) that do not meet this
value of interest was the maximum value of the number of condition are set to 0.
cars in each lane found as follows: 5) A double threshold is applied to the resulting image
 An image of the empty road was captured and used using t1 and t2 (wheret1 < t1 ) to obtain two binary
as the background image. images T 1 and T 2. The edges in T 2 represent the
 An image of the road with cars present was captured. strong edges, while those present in T 1 but not in
 The absolute difference of the two images was found T 2 represent weak edges. The edges removed by t1
and processed to find the number of cars in each lane. represent noise and are suppressed.
The maximum value was used as the output value for 6) Edges are tracked by hysteresis. All strong edges
traffic density are used in the final image. Weak edges with at
least one strong neighbour will be preserved, while
others will be suppressed as noise.
2.2 Red light Camera
7) 7. The edge segments in T 2 are linked to form
A metal detector was used as the trigger used to activate the continuous edges. Each segment is traced in T 2 to
red-light camera. To detect and capture an image: its end and its neighbours in T 1 are searched to find
 The differential frequency of the metal detector cir- any edge segments to bridge the gap until reaching
cuit was measured by taking the two readings spaced another edge segment in T 2.
3

TABLE 1: State table for traffic light control in one lane respectively (for the model used). To measure
State N E W S Q3 Q2 Q1 Q0 the density and determine time, the highest number of
0 R R R R 0 0 0 0 cars out of the three lanes was determined. Four seconds
1 G R R R 0 0 0 1 was assumed to be enough time for each car to cross the
2 Y R R R 0 0 1 0 intersection. The density was multiplied by four seconds to
4 R G R R 0 1 0 0
5 R Y R R 0 1 0 1
determine the time for the green light.
7 R R R G 0 1 1 1 Infrared sensors : The infrared sensors used are prox-
8 R R R Y 1 0 0 0 imity sensors that produce output analogue voltage propor-
10 R R G R 1 0 1 0 tional to the distance of objects in their field of view [13].
11 R R Y R 1 0 1 1
Each infrared sensor consists of a position sensitive detector,
an infrared light emitting diode and a signal-processing
unit. The detector and emitter have a fixed distance and
3 IMPLEMENTATION
orientation relative to each other, thus the sensor calculates
The model of the intelligent traffic control system is shown the distance of the object by looking at the angle at which
in Figure 2 the emitted light hits the detector and calculating the angle
of the reflected light [14]. A threshold value was chosen to
determine when a car was present. To find the threshold
value for each sensor, the following steps were taken:

x The road was cleared of all cars and the output volt-
age of each sensor was recorded. These values were
recorded over a period of time (five minutes) and the
maximum value used, to increase the accuracy of the
reading.
y A car was placed in front of each sensor at the
outermost lane relative to the sensor. The output
voltages were recorded over a period of time and
the minimum value was used.
z For each sensor, a value that was high enough to
prevent a high signal for an empty road, but low
Fig. 2: Model of traffic light intersection enough to produce a high value when there was a
car in the outermost lane was chosen. The threshold
value for each sensor was chosen as halfway between
The model represented a four-way (+) intersection, with the values in (1) and (2) above.
each side of the intersection having three lanes. It had the For an output voltage higher than the threshold, the Ar-
following components (as numbered in the image): duino registered the presence of a car. To improve accuracy,
 Traffic density cameras the output voltage was measured five times a second at 200
 Red-light camera millisecond intervals, and the average value was used as the
 Red-light camera sensor (inductor) output.
 Infrared proximity sensors Cameras : On two sides of the intersection, cameras were
 Traffic lights used to acquire images, which were processed with MAT-
The model had four sets of traffic lights, which operated LAB to determine traffic density. The computer transmitted
as standard traffic lights, that is, red-yellow-green-red. Each density information serially from MATLAB to an Arduino
set consisted of three individual traffic lights: one for each Mega. The maximum number of cars in each lane was found
lane. Light Emitting Diodes (LEDs) were used to represent as follows:
the traffic lights. The intelligent traffic light control system
1) An image of the empty road was captured and used
consisted of two parts: Traffic light control and a Red-light
as the background image.
camera.
2) Regions of interest were identified and used to
form masks. The regions of interest were the areas
3.1 Traffic light control occupied by each of the lanes. Steps (1) and (2) were
The traffic lights were controlled using logic circuits pro- performed only once when the program was first
grammed into an Arduino Mega. The inputs Q0, Q1, Q2 and run.
Q3 were used to change the lights, as shown in Table I. The 3) An image of the road with cars present was cap-
required Q inputs were determined using Karnaugh-map tured.
reduction. The letters N, E, S and W represent the North, 4) The absolute difference of the two images was
East, South and West sides of the intersection respectively, found.
and Y, G and R represent yellow, red and green lights 5) The difference image was converted to gray-scale.
respectively. 6) The gray-scale image was converted to a binary im-
Traffic density was measured on a scale from 0 to 3, age. In this image, all pixels with luminance greater
which were the minimum and maximum number of cars than the specified level were replaced with the value
4

1 (white), and all other pixels were replaced with the intersection, saved the density information for all
value 0 (black). The binary image was padded with sides to a database and sent it to the Arduino as a
zeros so that any cars on the border of the image formatted string.
would be detected. 5) The Arduino used the density information to cal-
7) Canny edge detection (Section 2.3) was used to culate the time for the next green light. For the
detect the edges of the cars. This detection method sides of the intersection with cameras, the scale was
finds edges by smoothing the image with a Gaus- divided by 3 to convert it to a scale from 0 to 1. For
sian filter, computing the gradient magnitude and the sides of the intersection with infrared detectors,
orientation using finite-difference approximations there were two conditions: The density was 0 or
for the partial derivatives, and applying non- 2 (neither or both detectors activated respectively)
maxima suppression to the gradient magnitude. The and the value was divided by 2 to convert it to a
technique is especially effective on noisy images scale from 0 to 1; or the density was 1 (one detector
using a double-thresholding algorithm to detect and activated) and the density was taken to be halfway
link edges [15]. between one-car and three-car density. The value
8) The lines of the edges were dilated to make them returned in this case was 2/3.
more prominent and close any gaps present. 6) The scaled density values were multiplied by 12
9) All holes in the image were filled. This produced a (maximum density time) to find the amount of time
solid output for all cars present on the road. for the green light. The time found was sent to the
10) The image at this stage still had noise due to shad- computer to be displayed. If the time was not zero,
ows and other background noise. Blobs (collections the green light was given to the next side of the
of pixels) smaller than a threshold value were re- intersection. Any side of the intersection where no
moved from the image. cars were detected was skipped.
11) The number of blobs in each lane was counted. 7) Once the cycle was completes, steps (3) to (6) were
This was done by applying the mask for each lane repeated.
individually and counting the blobs in the resulting
image. The highest value was used as the estimate
3.2 Red-light Cameras
of traffic density.
The red light camera had two parts: the metal detector and
Figure 3 shows sample the output of the program. camera and SD card control. The metal detector circuit is
The detected vehicles have yellow bounding boxes drawn shown in figure 4
around.
3.2.1 Metal detector Circuit

Fig. 3: Sample output image of vehicle detection

The Arduino and the computer system communicate Fig. 4: Metal detector circuit [16]
serially to determine traffic density. The following steps
were taken to control the traffic lights:
1) The Arduino transmitted the character ’a’ to the Figure 4 shows the Metal detector circuit. The circuit
computer. was calibrated by taking three measurements one second
2) The computer acknowledged by sending back the apart, and checking whether they were within 200Hz of
character ’a’. This marked the start of serial commu- each other. This was done to prevent false readings due
nication. to the initial instability of the circuit. An NE555 timer was
3) The density for the west and south sides of the inter- used as an Astable Multivibrator to continuously produce
section were determined using infrared sensors as a rectangular wave without any external trigger. An RLC
explained above, and transmitted to the computer. circuit was connected between the output and the trigger-
4) When MATLAB received the string, it determined threshold connection point. When a metal object is brought
the density for the north and east sides of the near an inductor, its inductance changes. The impedance
5

between the two terminals depends on the values of the


inductor and capacitor when the applied signal frequency
is constant. Differential frequency was measured using an
Arduino Uno by taking the two readings spaced one second
apart and finding the absolute difference between them. A
metal object was detected when the differential value was
greater than the threshold (500Hz was used). After detection
of a metal object, the circuit was recalibrated to reduce
occurrence false detections. When a car was detected during
a red light, the camera captured an image of the offender.
The code to capture an image was originally developed by
LinkSprite [17] and was modified for this project. A JPEG
camera transmitter and receiver were connected to the dig- Fig. 6: Camera and SD Card circuit
ital pins of the Arduino and communicated with it serially.
Once an image was captured, the camera transmitted it to
the Arduino. As the image data was being read from the
camera, it was written to a JPEG file in the SD card. A red
LED was used to indicate when a red-light violation was 4 R ESULTS
detected. A sample of an image taken using the red-light Infrared sensors and cameras combined with image process-
camera is shown in Figure 5 ing were used to find density for the traffic control system.
To compare the two methods, the program was run 130
times, and their rates of false detection were compared. The
rates for the cameras were 13.1% for the north side of the
intersection and 2.3% for the east side of the intersection.
For the infrared detectors, the rates were 0.8% for the south
side of the intersection and 15.4% for the west side of the
intersection.
To determine the average efficiency of vehicle detection
for the red light camera, the metal detector was tested by
passing a metal vehicle across it 50 times. The percentage
of instant vehicle detections was 38%; the percentage of
delayed vehicle detection was 40%; while the percentage
for no detections was 22%. In theory, the cameras are more
accurate than the infrared sensors, as they count the actual
number of cars and don’t have any blind spots. In practice,
however, the limitations of both methods caused a similar
number of false detections.
Fig. 5: Image captured by red-light camera
5 D ISCUSSION
Traffic control needs to be made more efficient to avoid time
and fuel wastage associated with fixed-time traffic lights.
Providing a means of persecuting red-light runners is critical
to deterring drivers from running red lights. The aim of
this work is to develop a traffic light control system that
3.2.2 Camera and SD Card circuit alters time based on traffic density, and detects and captures
images of red-light runners.
The infrared sensors had reduced accuracy due to the
presence of blind spots between sensors where cars could
Figure 6 show The Arduino Uno coordinates the circuit. not be detected. Cars in the outer lanes sometimes did not
The JPEG camera transmitter and receiver are connected to produce a high enough signal to be detected. Reflection of
the digital pins of the Arduino. They communicate serially the emitted light by objects that were not cars also caused
using the Software Serial library. Once an image is captured, false detections. Adjusting the threshold value, using more
it sends it in hexadecimal format through the serial connec- sensors or placing them at a different orientation relative to
tion. The ports CIN and MIN are as discussed above. The the road would improve accuracy.
SD card module has four ports: SS (Slave Select), SCK (Slave The cameras were sensitive to presence of non-vehicular
Clock input), MISO (Master In, Slave Out), MOSI (Master objects and changes in light intensity. Increasing the thresh-
Out, Slave In). As the image data is being read from the old level for converting images to binary and removing
camera, it is written to a JPEG file in the SD card. The LED small blobs reduced background noise. A potential solution
connected to digital pin 9 is used to signify when a red-light to the sensitivity to light intensity is capturing a large
violation is detected. number of background images at different light intensities.
6

A background image can be selected based on the light of this project will not only increase the effectiveness and
intensity at the time of image acquisition. efficiency of traffic regulating bodies such as the Federal
The metal detector circuit for the red-light camera had Road Safety Corps (FRSC) and the Vehicle Inspection Office
delayed detections caused by the low baud rate used for (VIO), it also has potential to generate revenue.
measuring frequency. When a metal object passed the sensor
at the exact instant the circuit frequency was measured, a
R EFERENCES
delayed response occurred. Using a device with a higher
baud rate and a more stable circuit that does not need [1] U.S. Department of Transportation - Federal Highway Administra-
tion,. ” Traffic Detector Handbook”. 3rd ed., vol. 1. 2006
calibration could solve this problem. [2] M. S. Uddin, A. K. Das, and M. Abu Taleb ”Real-time area based traffic
Improvements can be made to the system to enhance density estimation by image processing for traffic signal control system:
overall speed and accuracy. The traffic control system took Bangladesh perspective”. ”presented at the Electrical Engineering and
approximately two seconds to calculate time based on den- Information Communication Technology (ICEEICT), 2015 International
Conference” Dhaka, 2015.
sity. This was mainly due to the relatively slow processing [3] J.M. Blosseville; C. Krafft; F. Lenoir; V. Motyka; S. Beucher ”TI-
speed of MATLAB and the serial communication between TAN: a traffic measurement system using image processing techniques”
the Arduino and MATLAB. This problem can be solved by ”presented at the Second International Conference on Road Traffic Moni-
toring”. 1989
using a faster computer vision tool such as OpenCV [18] [4] R. Cucchiara; M. Piccardi; P. Mello, Image analysis and rule-based
with C++. In a real-life implementation of the system, an reasoning for a traffic monitoring system Trans. Intell.
integrated, specialized computer (with Graphic Processing Transp. Syst. vol. 1, no. 2, Jun. 2000..
Units (GPUs)) designed specifically for density based traffic [5] T.M. Hussain; A.M. Baig; T.N. Saadawi; S.A. Ahmed, ”Infrared
pyroelectric sensor for detection of vehicular traffic using digital signal
control would make the system much faster and more effi- processing techniques,” IEEE Trans. Veh. Technol, vol. 44, no. 3, Aug.
cient. The red light camera took approximately 27 seconds 1995.
to capture an image and store it in the SD card. In a practical [6] S.A. Ahmed; T.M. Hussain; T.N. Saadawi, ”Active and passive
infrared sensors for vehicular traffic control”. presented at the Vehicular
implementation of the system, this speed is too slow. A Technology Conference, 1994.
high-speed camera and memory system designed for this [7] U. Chinyere Osigwe, O. Francisca Oladipo, and E. Onibere, ”Design
purpose would be an efficient solution to this problem. The and Simulation of an Intelligent Traffic Control System”. Int. J. Adv.
traffic density records stored in the database have many Eng. Technol., vol. 1, no. 5, pp. 4757, Nov. 2011.
[8] Javed Alam and M. K. Pandey Development of Intelligent Traffic Light
applications. They can be used to estimate timing when System Based On Congestion Estimation Using Fuzzy Logic IOSR J.
density information is not available; for planning new road Comput. Eng., vol. 16, no. 3, pp. 3644, Jun. 2014.
networks; and for GPS and navigation applications. Crucial [9] Suhail M. Odeh ”Hybrid algorithm: Fuzzy Logic-Genetic Algorithm on
traffic light intelligent system,” presented at the 2015 IEEE Interna-
information such as frequency and details of accidents for tional Conference on Fuzzy Systems (FUZZ-IEEE), 2015.
each intersection can also be stored in the database. Images [10] Nelson H. C. Yung and H. S. Lai ”An Effective Video Analysis
of red-light runners can be processed to detect their number Method for Detecting Red Light Runners,”. IEEE Trans. Veh. Technol.,
plates, making the process more efficient and less error vol. 50, no. 4, Jul. 2001.
[11] Rafael Henrique Brasil; Alexei Manso Correa Machado ”Automatic
prone than manually reading characters of plate numbers Detection of Red Light Running Using Vehicular Cameras”. IEEE Lat.
from the images. Records of offenders can be stored in a Am. Trans., vol. 15, no. 1, Jan. 2017.
database and the process of prosecution can be automated. [12] Iswanjono, B. Budiardjo, and K. Ramli ”Simulation for RFID-Based
Red Light Violation Detection: Violation Detection and Flow Prediction”.
A renewable power source independent of the national
presented at the 2010 Second International Conference on Com-
grid such as wind or solar power can be integrated into puter Research and Development, 2010.
the system to reduce down time. This would make it more [13] Sharp ”Distance Measuring Sensor”. Sharp
sustainable in countries like Nigeria with unstable power [14] Carnegie Mellon Robotics Academy ”What is different aboutt Sharp
IR Sensor?”.Carnegie Mellon Robotics Academy - Electronics.
supplies. [15] G.T. Shrivakshan; C. Chandrasekar, ”A Comparison of various Edge
As a proof of concept, this work shows that a vision Detection Techniques used in Image Processing”.IJCSI Int. J. Comput.
based Traffic Control system is plausible. We are confident Sci., vol. 9, no. 5, Sep. 2012.
[16] Dilip Raja, ”Metal Detector”.Circuit Digest.
that these results will be improved by using C++ and asso-
[17] LinkSprite ”Tutorial of Using LinkSpritr 2MP UART JPEG Camera
ciated computer vision tools. A faster memory and graphic with Arduino”. LinkSprite, 03-Nov-2014.
(GPUs) systems will facilitate faster access and much better [18] Satya Mallick ”OpenCV (C++ vs Python) vs MATLAB for Computer
results. That we are able to achieve a 2.3% at one intersection Vision”. Learn OpenCV, 2015.
[19] R. Wang, ”Canny Edge Detection,” [Online]. Available:
means that we can achieve similar or lower results in other http://fourier.eng.hmc.edu/e161/lectures/canny/node1.html.
intersections if parameters like lighting and background
thresholds are improved.

6 C ONCLUSION
This work has demonstrated the principle of density-based
timing of traffic light control systems, and the operation of
red-light cameras to capture red light runners. Potentially,
it could be scaled up to develop intelligent traffic control
systems that meet the specific needs of the Nigerian trans-
portation sector. The fully functional system would con-
trol traffic, generate vehicular movement data for decision
making and document traffic offenses. A scaled-up version

Potrebbero piacerti anche