Arduino Mega Based Smart Traffic Control
Arduino Mega Based Smart Traffic Control
Arduino Mega Based Smart Traffic Control
Authors’ contributions
This work was carried out in collaboration among five authors. Author YSAS is designed the study,
create program codes, managed the analyses of the study, author HMIA wrote the protocol and wrote
flow chart of the system, author TRSAA Work on the design of the circuit, authors IME and MAOI
wrote the first draft of the manuscript. All authors read and approved the final manuscript managed
the literature searches.
Article Information
DOI: 10.9734/AJARR/2021/v15i1230449
ABSTRACT
Aim: The main aim of this paper is design smart traffic system to develop a dynamic road signal
based on density.
Study Design: The conventional traffic signal system is based on constant traffic management
time, so we proposed a smart system using Arduino Mega and ultrasonic sensors where green
signal times change automatically according to traffic density.
Methodology: The performance of the proposed system is tested using Proteus simulator and a
real model was designed.
Resolute and conclusion: the simulation and experimental test rig have shown that this system can
be implemented, as it has been able to change the green signal time according to congestion
density while developing this system.
Keywords: Traffic signal system; Arduino mega; ultrasonic sensor; Bluetooth module.
_____________________________________________________________________________________________________
44
Shaheen et al.; AJARR, 15(12): 43-52, 2021; Article no.AJARR.84793
2.2 Arduino Mega Bluetooth serial modules allow all serial enabled
devices to communicate with each other using
The Arduino Mega (Fig.2) is the muscle car of Bluetooth.
Arduino boards. It boasts a huge collection of
input output ports, but cleverly adds these as 2.4 LCD Display
extra connectors at one end of the board, It uses
a processor with more input output pins, the Liquid Crystal Display (LCD):16x2 LCD used in
ATmega1280, which is a surface mount chip that the implemented to display data over 2 lines,
is fixed permanently to the board. So, unlike with each of 16 characters. Actually, two types of
the Uno and similar boards, you cannot replace registers are used to configure the LCD; the
the processor if you accidentally damage it. command registers and control registers. Other
The extra connectors are arranged at the end of aspects are LCD initialization, clearing the
the board. Extra features provided by the Mega screen, setting the cursor position, and
include the following: controlling display. While the data register holds
the ASCII code of the characters that are
• 54 input/output pins appeared on the display.
• 128KB of flash memory for storing
sketches and fixed data 2.5 Proposed System Design and
• 8KB of RAM and 4KB of EEPROM Methodology
2.3 Bluetooth Module
In this paper, we utilized (Arduino Mega), that
HC-05 is a Bluetooth module which is designed has a many pins, causing it exceptionally
for wireless communication. This module can be valuable in projects that to have a convenient
used in a master or slave configuration. number of sensors and gadgets to control.
45
Shaheen et al.; AJARR, 15(12): 43-52, 2021; Article no.AJARR.84793
Side 4 RV2(2)
g4
y4
r4
71% 43%
SONAR1 SONAR2
Bluetoot Module ULTRASONIC SENSOR ULTRASONIC SENSOR
Key
Vcc
HC-05 GND
Bluetooth
Trigger
Trigger
TXD Txb
Echo
Echo
RXD Rxb
Gnd
Gnd
+5V
+5V
State
www.TheEngineeringProjects.com
NAME=BLUETOOTH HC-05
SDA
SCL
Rxb
Txb
t1
e4
e1
t4
t2
e3
e2
t3
t1
e1
t2
e2
21
20
19
18
17
16
15
14
10
11
12
13
0
1
2
3
4
5
6
7
8
9
MEGA1
PE1/TXD0/PDO
AREF
PH5/OC4C
PD0/SCL/INT0
PD1/SDA/INT1
PD2/RXD1/INT2
PH0/RXD2
PH1/TXD2
PJ0/RXD3/PCINT9
PJ1/TXD3/PCINT10
PE0/RXD0/PCINT8
PE4/OC3B/INT4
PE3/OC3A/AIN1
PB4/OC2A/PCINT4
PB5/OC1A/PCINT5
PB6/OC1B/PCINT6
PB7/OC0A/OC1C/PCINT7
PG5/OC0B
PH3/OC4A
PH4/OC4B
PH6/OC2B
PD3/TXD1/INT3
PE5/OC3C/INT5
PA4/AD4 y1
g1
SDA
26
SCL
PA5/AD5
RX1
TX1
TX0
r2
www.TheEngineeringProjects.com
27
PA6/AD6
RX3
RX0
y2
Side 1
28
TX3
PA7/AD7 g1
g2
Arduino Mega 2560
29
r3 PC7/A15
30
PC6/A14
COMUNICATION PWM
y3 31
DIGITAL
g3 PC5/A13
32
r4 PC4/A12
33
y4 PC3/A11
34
g4 PC2/A10
35
PC1/A9
36
PC0/A8
37 ATMEGA2560
PD7/T0
38
PG2/ALE 16AU 1126
39
PG1/RD
40 Reset BTN
PG0/WR
41
PL7
42
PL6
43
PL5/OC5C ANALOG IN
44
PL4/OC5B
r3 45
PL3/OC5A
PK7/ADC15/PCINT23
PK6/ADC14/PCINT22
PK5/ADC13/PCINT21
PK4/ADC12/PCINT20
PK3/ADC11/PCINT19
PK2/ADC10/PCINT18
46
PK1/ADC9/PCINT17
PK0/ADC8/PCINT16
Side 3
PL2/T5
47
PL1/ICP5
PF6/ADC6/TDO
PF5/ADC5/TMS
PF4/ADC4/TCK
y3 48
PF7/ADC7/TDI
PL0/ICP4
49
PB3/MISO/PCINT3
PF3/ADC3
PF2/ADC2
PF1/ADC1
PF0/ADC0
50
PB2/MOSI/PCINT2
RESET
g3 51
PB1/SCK/PCINT1
GND
52
VCC
PB0/SS/PCINT0
53
A15
A14
A13
A12
A11
A10
A9
A8
A4
A5
A6
A7
A3
A2
A1
A0
SONAR4 SONAR3
ULTRASONIC SENSOR ULTRASONIC SENSOR U1 LCD1
14 4 LM016L
TestPin www.TheEngineeringProjects.com SCL SCL P0 p0 MODDLL=LCDALPHA
TestPin www.TheEngineeringProjects.com SDA
15
SDA P1
5
p1
6
P2 p2
13 7
INT P3 p3
9
P4 p4
1 10
vcc A0 P5 p5
2 11
vcc A1 P6 p6
Trigger
Trigger
3 12
Echo
vcc A2 P7 p7
VDD
VSS
VEE
Gnd
Echo
+5V
RW
RS
Gnd
D0
D1
D2
D3
D4
D5
D6
D7
+5V
PCF8574
vcc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
4%
Side 2
p0
p1
p2
p3
p4
p5
p6
p7
RV4
t4
e4
r2
y2
g2
t3
e3
8%
vcc
RV4(2) 1k
RV3
RV3(2) 1k
46
Shaheen et al.; AJARR, 15(12): 43-52, 2021; Article no.AJARR.84793
47
Shaheen et al.; AJARR, 15(12): 43-52, 2021; Article no.AJARR.84793
48
Shaheen et al.; AJARR, 15(12): 43-52, 2021; Article no.AJARR.84793
49
Shaheen et al.; AJARR, 15(12): 43-52, 2021; Article no.AJARR.84793
We first implemented the project circuit using Proteus 8 as simulator and then a practical system was
implemented using Arduino Mega 2560, with three LED’s (red, yellow and green light) were
connected in parallel, connected in series with resistors 220 Ohm to each LED where the cathodes
connected together with the GND of Adduino , the positive end of each led is connected to the
Urduino board and repeats this for each side as shown the order below:
50
Shaheen et al.; AJARR, 15(12): 43-52, 2021; Article no.AJARR.84793
Ultrasound sensor (US) pins was connected to the Urduino board as described below:
Ultrasound sensors (US) are responsible for giving information’s about the crowd to the controller for
making a decision to operate the traffic light on side1 and Side3 according to the table .
The number and location of sensors depends on the length of the street, increasing the sensors gives
more accuracy in determining the level of crowd , but the cost will increase.
The system provided with an LCD screen to display crowd level also waiting time.
Finally, Bluetooth Module (HC- 05) has been linked to the RX and Tx of arduino.
4. CONCLUSION DISCLAIMER
An intelligent traffic light control system was The products used for this research are
designed for a four-way intersection. The circuit commonly and predominantly use products in our
was simulated and a practical model was made area of research and country. There is absolutely
to test the circuit and ensure its correct no conflict of interest between the authors and
operation. The system is effective and has low producers of the products because we do not
cost and helps reduce congestion and reduce intend to use these products as an avenue for
waiting time at intersections, and with the use of any litigation but for the advancement of
Arduino controllers and the integrated knowledge. Also, the research was not funded by
development environment Arduino C gives this the producing company rather it was funded by
the system is flexible and highly adjustable personal efforts of the authors.
51
Shaheen et al.; AJARR, 15(12): 43-52, 2021; Article no.AJARR.84793
© 2021 Shaheen et al.; This is an Open Access article distributed under the terms of the Creative Commons Attribution License
(http://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium,
provided the original work is properly cited.
Peer-review history:
The peer review history for this paper can be accessed here:
https://www.sdiarticle5.com/review-history/84793
52