Final Project - Report - Batch-11
Final Project - Report - Batch-11
K. RAGHUNADH (122010401011)
J. PRAVEEN (122010401015)
S. MOHAN REDDY (122010401059)
Dr. A. GAYATRI
Assistant Professor
VISAKHAPATNAM-530045
(2020-2024)
1
DEPARTMENT OF ELECTRICAL, ELECTRONICS AND COMMUNICATION
ENGINEERING
GITAM
(Deemed to be University)
CERTIFICATE
This is to certify that the project work entitled “INTELLIGENT TRAFFIC SIGNAL
CONTROL SYSTEM FOR AMBULANCE USING IOT ”is a bonafide work carried out
by K.RAGHUNADH (122010401011), J.PRAVEEN (122010401015), S.MOHAN REDDY
(122010401059), submitted in partial fulfillment of the requirements for the award of the
degree of Bachelor of Technology in Electronics and Communication Engineering,
GITAM School of Technology, GITAM (Deemed to be University), Visakhapatnam during
the academic year 2023-2024.
2
DEPARTMENT OF ELECTRICAL, ELECTRONICS AND COMMUNICATION
ENGINEERING
GITAM
(Deemed to be University)
DECLARATION
122010401011 K.RAGHUNADH
122010401015 J.PRAVEEN
3
ACKNOWLEDGEMENT
We would like to thank our project guide Dr. A. Gayatri, Assistant Professor, Dept. of
EECE for her stimulating guidance and profuse assistance. We shall always cherish our
association with her for her guidance, encouragement, and valuable suggestions
throughout the progress of this work. We consider it a great privilege to work under
her guidance and constant support.
We would like to thank our Project Coordinators Dr. K. Sridevi, Professor, Dept. of
EECE and Dr. N. Jyothi, Associate Professor Dept. of EECE in helping to complete
the project by taking frequent reviews and for their valuable suggestions throughout
the progress of this work.
Our sincere thanks to Prof. K. Nagendra Prasad, Director, GST, GITAM (Deemed to
be University) for inspiring us to learn new technologies and tools.
Finally, we deem it a great pleasure to thank one and all who helped us directly and
indirectly throughout this project.
K. RAGHUNADH (122010401011)
J. PRAVEEN (122010401015)
4
ABSTRACT
Traffic in metropolitan cities has increased enormously. Due to increase in population and the
increased use of automobiles it has become a huge challenge for emergency vehicles like
ambulance to pass through in emergency situations. The Proposed system electronic device to
communicate between themselves to serve the purpose of the human. The one of the major fields
that concentrate on the automation is Internet of Things creatively called as IoT. This project is
based on the IoT and cloud to save the human life at critical situation. This project is to establish
the communication between the traffic signals and the ambulance so that the traffic signal can
respond to the arrival of the ambulance and respond according to that. When the traffic signals
are changes its states according to the position of the ambulance it can able to make a free way
for the ambulance. Thus, this project will act as a life saver. In this way it acts like a lifesaver
project as it saves time during emergency by controlling the traffic lights.
5
CONTENTS
Chapter No. Description Page No.
3.6 LED 22
3.7 LCD 24
3.8 Buzzer 33
4.3 BLYNK 47
6
5.1 Code 48
5.2 Output 56
Conclusion 57
References 58
7
List of Figures
3.5 LED 23
3.10 Buzzer 33
5.1 Output 57
8
CHAPTER 1
INTRODUCTION
Since the embedded system is dedicated to specific tasks, design engineers can optimize it,
reducing the size and cost of the product, or increasing the reliability and performance. Some
embedded systems are mass-produced, benefiting from economies of scale.
Physically embedded systems range from portable devices such as digital watches and MP3
players, to large stationary installations like traffic lights, factory controllers, or the systems
controlling nuclear power plants. Complexity varies from low, with a single microcontroller
chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or
enclosure.
In general, “embedded system” is not an exactly defined term, as many systems have some
element of programmability. For example, Handheld computers share some elements with
embedded systems — such as the operating systems and microprocessors which power them —
but are not truly embedded systems, because they allow different applications to be load and
peripherals to be connected.
9
1.2 CHARACTERISTIC OF EMBEDDED SYSTEM
We are living in the Embedded World. You are surrounded with many embedded products and
your daily life largely depends on the proper functioning of these gadgets. Television, Radio, CD
player of your living room, Washing Machine or Microwave Oven in your kitchen, Card readers,
Access Controllers, Palm devices of your work space enable you to do many of your tasks very
effectively. Apart from all these, many controllers embedded in your car take care of car
operations between the bumpers and most of the times you tend to ignore all these controllers.
10
CHAPTER 2
LITERATURE SURVEY
1. B.Janani Saradha et al. proposed a system using cloud network to connect both
ambulance and traffic controlling unit. Intelligent traffic signal control is achieved using
RFID technology. The idea is whenever the ambulance is detected near the signal, RFID
reader tracks the ambulance attached with RFID tag and sends the data to the cloud. After
sending the data through mobile app, acknowledgment will be sent to user, then system
will automatically change the signal to green in the path of ambulance. In this, it provides
uninterrupted services to emergency vehicle. Accuracy of RFID is more compared to
other alternative technologies like camera.
2. Jay Lohokare et al. proposed an idea of capturing live location of the emergency services.
Using these locations, people who are in need of emergency services can connect to the
officials. The main contribution of this paper is that, it provides a solution that can be
extended to an entire city where there can be huge number of users using this system.
Prerequisites for this application according to the author is the need of Internet and GPS
(Global Positioning System) enabled device such a smart phone through which real-time
location can be sent to the server. This paper gives a brief back-end Architecture that will
help to handle huge number of users.
3. Omkar Udawant et al. proposed a smart ambulance system. The basic idea is whenever
the ambulance is within the range of 100m, the signal changes to green for some time.
They make use of cloud and GPRS technology. Ambulance contains sensors like heart
rate sensor, blood pressure, ECG. These sensors data will be sent to hospital’s database
simultaneously. Treatment will be planned by the hospital authorities according to patient
condition. So, it saves so much time.
11
CHAPTER 3
PROPOSED WORK
The Project is designed to check the density of traffic in particular place and the information is
conveyed to traffic control station. The main purpose here is to make the ambulance to move
faster even in heavy dense traffic to save the life. This project is designed with AT89S52
microcontroller. Three pairs of IR Tx-Rx are used here to indicate the density of the traffic. The
module consists of an IR emitter and TSOP receiver pair. The high precision TSOP receiver
always detects a signal of fixed frequency.
Drawbacks:
► Due to this, errors due to false detection of ambient light are significantly reduced.
In this proposed system we are using Arduino which is connected with RFID reader used to
control the lights when any ambulance is on the way. IOT server used to control the traffic
signals. Whenever light is controlled by app then the corresponding green light will be ON until
it is switched OFF again in server.
12
3.3 Block Diagram:
Power supply
LCD
Node MCU
Buzzer
Arduino
mega Red led
IR sensors
Green led
RFID Tag RFID
Reader
Yellow led
13
3.4 HARDWARE REQUIREMENTS
Arduino Mega:
14
Fig. 3.3 Arduino Mega 2560
Programming
The Mega 2560 board can be programmed with the Arduino Software (IDE). For details, see
the reference and tutorials.
The Atmega2560 on the Mega 2560 comes preprogrammed with a bootloader that allows you to
upload new code to it without the use of an external hardware programmer. It communicates
using the original STK500 protocol (reference, C header files).
You can also bypass the bootloader and program the microcontroller through the ICSP (In-
Circuit Serial Programming) header using Arduino ISP or similar; see these instructions for
details.
The Atmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is available in
the Arduino repository. The Atmega16U2/8U2 is loaded with a DFU bootloader, which can be
activated by:
● On Rev1 boards: connecting the solder jumper on the back of the board (near the map of
Italy) and then resetting the 8U2.
● On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line to
ground, making it easier to put into DFU mode. You can then use Atmel’s FLIP
software (Windows) or the DFU programmer (Mac OS X and Linux) to load a new firmware. Or
15
you can use the ISP header with an external programmer (overwriting the DFU bootloader).
See this user-contributed tutorial for more information.
Warnings
The Mega 2560 has a resettable 16polyfused that protects your computer’s USB ports from
shorts and overcurrent. Although most computers provide their own internal protection, the fuse
provides an extra layer of protection. If more than 500 Ma is applied to the USB port, the fuse
will automatically break the connection until the short or overload is removed.
Power
The Mega 2560 can be powered via the USB connection or with an external power supply. The
power source is selected automatically.
External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery.
The adapter can be connected by plugging a 2.1mm center-positive plug into the board’s power
jack. Leads from a battery can be inserted in the GND and Vin pin headers of the POWER
connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V,
however, the 5V pin may supply less than five volts and the board may become unstable. If using
more than 12V, the voltage regulator may overheat and damage the board. The recommended
range is 7 to 12 volts.
● VIN. The input voltage to the board when it’s using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You can supply
voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.
● 5V. this pin outputs a regulated 5V from the regulator on the board. The board can be
supplied with power either from the DC power jack (7 – 12V), the USB connector (5V), or the
VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator,
and can damage your board. We don’t advise it.
16
● 3.3V. A 3.3-volt supply generated by the on-board regulator. Maximum current draw is
50 Ma.
● GND. Ground pins.
● IOREF. This pin on the board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin voltage and
select the appropriate power source or enable voltage translators on the outputs for working with
the 5V or 3.3V.
Memory
The Atmega2560 has 256 KB of flash memory for storing code (of which 8 KB is used for the
bootloader), 8 KB of SRAM and 4 KB of EEPROM (which can be read and written with
the EEPROM library).
Below is the pin mapping for the Atmega2560. The chip used in Arduino 2560. There are pin
mappings to Atmega8 and Atmega 168/328 as well.
17
Fig.3.4 Pin diagram of MEGA 2560w
Each of the 54 digital pins on the Mega can be used as an input or output,
using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin
can provide or receive 20 Ma as recommended operating condition and has an internal pull-up
resistor (disconnected by default) of 20-50 k ohm. A maximum of 40Ma is the value that must
not be exceeded to avoid permanent damage to the microcontroller.
● Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16
(TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
Pins 0 and 1 are also connected to the corresponding pins of the Atmega16U2 USB-to-TTL
Serial chip.
18
● External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20
(interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an interrupt on a low
level, a rising or falling edge, or a change in level. See the attachInterrupt() function for details.
● PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with the analogWrite() function.
● SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication
using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically
compatible with the Arduino /Genuino Uno and the old Duemilanove and Diecimila Arduino
boards.
● LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it’s off.
● TWI: 20 (SDA) and 21 (SCL). Support TWI communication using the Wire library.
Note that these pins are not in the same location as the TWI pins on the old Duemilanove or
Diecimila Arduino boards.
The Mega 2560 has 16 analog inputs, each of which provide 10 bits of resolution (i.e. 1024
different values). By default they measure from ground to 5 volts, though is it possible to change
the upper end of their range using the AREF pin and analogReference() function.
There are a couple of other pins on the board:
● AREF. Reference voltage for the analog inputs. Used with analogReference().
● Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.
Communication
The Mega 2560 board has a number of facilities for communicating with a computer, another
board, or other microcontrollers. The Atmega2560 provides four hardware UARTs for TTL (5V)
serial communication. An Atmega16U2 (Atmega 8U2 on the revision 1 and revision 2 boards)
on the board channels one of these over USB and provides a virtual com port to software on the
computer (Windows machines will need a .inf file, but OSX and Linux machines will recognize
the board as a COM port automatically. The Arduino Software (IDE) includes a serial monitor
which allows simple textual data to be sent to and from the board. The RX and TX LEDs on the
19
board will flash when data is being transmitted via the Atmega8U2/Atmega16U2 chip and USB
connection to the computer (but not for serial communication on pins 0 and 1).
A Software Serial library allows for serial communication on any of the Mega 2560’s digital
pins.
The Mega 2560 also supports TWI and SPI communication. The Arduino Software (IDE)
includes a Wire library to simplify use of the TWI bus; see the documentation for details. For
SPI communication, use the SPI library.
The Mega 2560 is designed to be compatible with most shields designed for the Uno and the
older Diecimila or Duemilanove Arduino boards. Digital pins 0 to 13 (and the adjacent AREF
and GND pins), analog inputs 0 to 5, the power header, and ICSP header are all in equivalent
locations. Furthermore, the main UART (serial port) is located on the same pins (0 and 1), as are
external interrupts 0 and 1 (pins 2 and 3 respectively). SPI is available through the ICSP header
on both the Mega 2560 and Duemilanove / Diecimila boards. Please note that I2C is not located
on the same pins on the Mega 2560 board (20 and 21) as the Duemilanove / Diecimila boards
(analog inputs 4 and 5).
This setup has other implications. When the Mega 2560 board is connected to either a computer
running Mac OS X or Linux, it resets each time a connection is made to it from software (via
USB). For the following half-second or so, the bootloader is running on the ATMega2560. While
it is programmed to ignore malformed data (i.e, anything besides an upload of new code), it will
intercept the first few bytes of data sent to the board after a connection is opened. If a sketch
running on the board receives one-time configuration or other data when it first starts, make sure
that the software with which it communicates waits a second after opening the connection and
before sending this data.
The Mega 2560 board contains a trace that can be cut to disable the auto-reset. The pads on
either side of the trace can be soldered together to re-enable it. It’s labeled “RESET-EN”. You
may also be able to disable the auto-reset by connecting a 110-ohm resistor from 5V to the reset
line.
Revisions
The Mega 2560 does not use the FTDI USB-to-serial driver chip used in past designs. Instead, it
features the Atmega16U2 (Atmega8U2 in the revision 1 and revision 2 Arduino boards)
programmed as a USB-to-serial converter.
Revision 2 of the Mega 2560 board has a resistor pulling the 8U2 HWB line to ground, making it
easier to put into DFU mode.
Revision 3 of the Arduino board and the current Genuino Mega 2560 have the following
improved features:
● Pin out: SDA and SCL pins – near to the AREF pin – and two other new pins placed near
to the RESET pin, the IOREF that allow the shields to adapt to the voltage provided from
the board. In future, shields will be compatible both with the board that use the AVR,
which operate with 5V and with the board that uses ATSAM3X8E, that operate with
3.3V. The second one is a not connected pin, which is reserved for future purposes.
● Stronger RESET circuit.
● Atmega 16U2 replace the 8U2
21
3.6 LED:
Light-emitting diodes, or LEDs, are widely used as a standard source of light in electrical
equipment. It has a wide array of applications ranging from your mobile phone to large
advertising billboards. They find applications in devices for showing what the time is and for
displaying different types of data. In this post, the main focus would be on learning a lot about
LEDs, such as its operations and functions.
Table of Contents
A light releasing diode is an electric component that emits light when the electric current flows
through it. It is a light source based on semiconductors. When current passes through the LED,
the electrons recombine with holes emitting light in the process. It is a specific type of diode
having similar characteristics as the p-n junction diode. This means that an LED allows the flow
of current in its forward direction while it blocks the flow in the reverse direction. Light-emitting
diodes are built using a weak layer of heavily doped semiconductor material. Based on the
semiconductor material used and the amount of doping, an LED will emit a colored light at a
particular spectral wavelength when forward biased.
LED Symbol
Below is the demonstration of the LED symbol. The symbol is similar to that of the p-n
junction diode. The difference between these two symbols is that the two arrows indicate that the
diode is emitting the light.
22
Fig. 3.5 LED light
The LEDs also have a specific drop in voltage forward in cases where it is used typical circuits
like a conventional diode. The drop in voltage depends on the current of the LED, the color of
the produced light, etc. There are different values in the drop of voltage that would vary from
1.5V to 2.5 V current for 10 to 50 Ma current.
23
Fig. 3.6 LED circuit
The holes lie in the valence band, while the free electrons are in the conduction band. When
there is a forward bias in the p-n junction, the electron which is a part of the n-type
semiconductor material would overrun the p-n junction and join with the holes in the p-type
semiconductor material. Therefore, regarding the holes, the free electrons would be at the
higher energy bands.
3.7 LCD:
LCD (Liquid Crystal Display) is the innovation utilized in scratch pad shows and other littler
PCs. Like innovation for light-producing diode (LED) and gas-plasma, LCDs permit
presentations to be a lot slenderer than innovation for cathode beam tube (CRT). LCDs expend
considerably less power than LED shows and gas shows since they work as opposed to
emanating it on the guideline of blocking light.
An lcd is either made with an uninvolved lattice or a showcase network for dynamic framework
show. Likewise alluded to as a meager film transistor (TFT) show is the dynamic framework
LCD. The uninvolved LCD lattice has a matrix of conductors at every crossing point of the
network with pixels. Two conductors on the lattice send a current to control the light for any
24
pixel. A functioning framework has a transistor situated at every pixel crossing point, requiring
less current to control the luminance of a pixel.
Some aloof network LCD’s have double filtering, which implies they examine the matrix twice
with current in the meantime as the first innovation took one sweep. Dynamic lattice, be that as it
may, is as yet a higher innovation.
A 16x2 LCD show is an essential module that is generally utilized in various gadgets and
circuits. These modules more than seven sections and other multi fragment LEDs are liked. The
reasons being: LCDs are affordable; effectively programmable; have no restriction of showing
exceptional and even custom characters (not at all like in seven fragments), movements, etc.
A 16x2 LCD implies 16 characters can be shown per line and 2 such lines exist. Each character
is shown in a lattice of 5x7 pixels in this LCD. There are two registers in this LCD, in particular
Command and Data.
The directions given to the LCD are put away by the order register. An order is a direction given
to LCD to play out a predefined assignment, for example, introducing it, clearing its screen,
setting the situation of the cursor, controlling presentation, and so forth. The information register
will store the information that will be shown on the LCD. The information is the character’s
ASCII incentive to show on the LCD.
Data/Signals/Execution of LCD
Now that was all about the signals and the hardware. Let us come to data, signals and execution.
Two types of signals are accepted by LCD, one is data and one is control. The LCD module
recognizes these signals from the RS pin status. By pulling the R / W pin high, data can now also
be read from the LCD display. Once the E pin has been pulsed, the LCD display reads and
executes data at the falling edge of the pulse, the same for the transmission case.
It takes 39-43Μs for the LCD display to place a character or execute a command. It takes 1.53ms
to 1.64ms except for clearing display and searching for cursor to the home position.
25
Any attempt to send data before this interval may result in failure in some devices to read data or
execute the current data. Some devices compensate for the speed by storing some temporary
registers with incoming data.
There are two RAMs for LCD displays, namely DDRAM and CGRAM. DDRAM registers the
position in which the character would be displayed in the ASCII chart. Each DDRAM byte
represents every single position on the display of the LCD.
The DDRAM information is read by the LCD controller and displayed on the LCD screen.
CGRAM enables users to define their personalized characters. Address space is reserved for
users for the first 16 ASCII characters.
Users can easily display their custom characters on the LCD screen after CGRAM has been set
up to display characters.
26
Pin Diagram:
Pin Description:
Pin
Function Name
No
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) Vcc
3 Contrast adjustment; through a variable resistor VEE
4 Selects command register when low; and data register when high Register Select
5 Low to write to the register; High to read from the register Read/write
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
27
RS (Register select)
A 16X2 LCD has two order and information registers. The determination of the register is
utilized to change starting with one register then onto the next. RS=0 for the register of
directions, while RS=1 for the register of information.
Command Register
The guidelines given to the LCD are put away by the direction register. An order is a direction
given to LCD to play out a predefined assignment, for example, instating it, clearing its screen,
setting the situation of the cursor, controlling showcase, and so on. Order preparing happens in
the direction register.
Data Register:
The information register will store the information that will be shown on the LCD. The
information is the character’s ASCII incentive to show on the LCD. It goes to the information
register and is prepared there when we send information to the LCD. While choosing RS=1, the
information register.
As stated, the LCD itself comprises of an interface IC. This interface IC can be perused or
composed by the MCU. A large portion of the occasions we’re simply going to keep in touch
with the IC since perusing will make it increasingly perplexing and situations like that are
exceptionally uncommon. Information such as cursor position, status completion interrupts, etc.
can be read if necessary.
LCD Commands:
There are some preset commands in the LCD that we need to send to the LCD via some
microcontroller. The following are some important command instructions:
28
Sr. No. Hex Code Command to LCD instruction Register
2 02 Return home
29
Block Diagram of LCD Display: -
30
AM)
31
Display 0 0 0 0 0 0 1 D C B Set Display(D), 39 µs
& Cursor(C) and
Cursor cursor blink(B)
On/Off on/off control
32
3.8 Buzzer:
33
Buzzer Features and Specifications
● Rated Voltage: 6V DC
● Operating Voltage: 4-8V DC
● Rated current: <30Ma
● Sound Type: Continuous Beep
● Resonant Frequency: ~2300 Hz
● Small and neat sealed package
● Breadboard and Perf board friendly
A buzzer is a small yet efficient component to add sound features to our project/system. It is
very small and compact 2-pin structure hence can be easily used on breadboard, Perf Board and
even on PCBs which makes this a widely used component in most electronic applications.
There are two types are buzzers that are commonly available. The one shown here is a simple
buzzer which when powered will make a Continuous Beeeeeeppp.... sound, the other type is
called a readymade buzzer which will look bulkier than this and will produce a Beep. Beep.
Beep. Sound due to the internal oscillating circuit present inside it. But the one shown here is
most widely used because it can be customized with help of other circuits to fit easily in our
application.
This buzzer can be used by simply powering it using a DC power supply ranging from 4V to 9V.
A simple 9V battery can also be used, but it is recommended to use a regulated +5V or +6V DC
supply. The buzzer is normally associated with a switching circuit to turn ON or turn OFF the
buzzer at required time and require interval.
Applications of Buzzer
34
CHAPTER 4
EXPERIMENTATION
Arduino IDE where IDE stands for Integrated Development Environment – An official software
introduced by Arduino.cc, that is mainly used for writing, compiling and uploading the code in
the Arduino Device. Almost all Arduino modules are compatible with this software that is an
open source and is readily available to install and start compiling the code on the go.
● Arduino IDE is an open-source software that is mainly used for writing and compiling the
code into the Arduino Module.
● It is an official Arduino software, making code compilation too easy that even a common
person with no prior technical knowledge can get their feet wet with the learning process.
● It is easily available for operating systems like MAC, Windows, and Linux and runs on the
Java Platform that comes with inbuilt functions and commands that play a vital role for
debugging, editing and compiling the code in the environment.
● A range of Arduino modules available including Arduino Uno, Arduino Mega, Arduino
Leonardo, Arduino Micro and many more.
● Each of them contains a microcontroller on the board that is actually programmed and accepts
the information in the form of code.
● The main code, also known as a sketch, created on the IDE platform will ultimately generate
a Hex File which is then transferred and uploaded in the controller on the board.
35
You can download the Software from Arduino main website. As I said earlier, the software is
available for common operating systems like Linux, Windows, and MAX, so make sure you are
downloading the correct software version that is easily compatible with your operating system.
● If you aim to download Windows app version, make sure you have Windows 8.1 or Windows
10, as app version is not compatible with Windows 7 or older version of this operating
● system.
● 1. Menu Bar
● 2. Text Editor
● 3. Output Pane
As you download and open the IDE software, it will appear like an image below.
The bar appearing on the top is called Menu Bar that comes with five different options as
follow
● File – You can open a new window for writing the code or open an existing one. Following
table shows the number of further subdivisions the file option is categorized into.
36
Fig. 4.1.1 Arduino IDE software
As you go to the preference section and check the compilation section, the Output Pane will
show the code compilation as you click the upload button.
37
Fig. 4.1.2 Arduino IDE software
And at the end of compilation, it will show you the hex file it has generated for the recent
sketch that will send to the Arduino Board for the specific task you aim to achieve.
38
● Edit – Used for copying and pasting the code with further modification for font
● Sketch – For compiling and programming
● Tools – Mainly used for testing projects. The Programmer section in this panel is used for
burning a bootloader to the new microcontroller.
● Help – In case you are feeling skeptical about software, complete help is available from
getting started to troubleshooting.
The Six Buttons appearing under the Menu tab are connected with the running program as
follow.
● The check mark appearing in the circular button is used to verify the code. Click this once
you have written your code.
● The arrow key will upload and transfer the required code to the Arduino board.
● The button appearing on the top right corner is a Serial Monitor – A separate pop-up
window that acts as an independent terminal and plays a vital role for sending and receiving
the Serial Data. You can also go to the Tools panel and select Serial Monitor, or pressing
Ctrl+Shift+M all at once will open it instantly. The Serial Monitor will actually help to debug
the written Sketches where you can get a hold of how your program is operating. Your
39
Arduino Module should be connected to your computer by USB cable in order to activate
the Serial Monitor.
● You need to select the baud rate of the Arduino Board you are using right now. For my
Arduino Uno Baud Rate is 9600, as you write the following code and click the Serial Monitor,
the output will show as the image below.
The main screen below the Menu bard is known as a simple text editor used for writing the
required code.
40
Fig. 4.1.6 Arduino IDE software
The bottom of the main screen is described as an Output Pane that mainly highlights the
compilation status of the running code: the memory used by the code, and errors occurred in
the program. You need to fix those errors before you intend to upload the hex file into your
Arduino Module.
41
More or less, Arduino C language works similar to the regular C language used for any
embedded system microcontroller, however, there are some dedicated libraries used for calling
and executing specific functions on the board.
Libraries:
Libraries are very useful for adding the extra functionality into the Arduino Module. There is a
list of libraries you can add by clicking the Sketch button in the menu bar and going to Include
Library.
As you click the Include Library and Add the respective library it will on the top of the sketch
with a #include sign. Suppose, I Include the EEPROM library, it will appear on the text editor as
#include <EEPROM.h>.
42
Most of the libraries are preinstalled and come with the Arduino software. However, you can
also download them from the external sources.
The digitalRead and digitalWrite commands are used for addressing and making the Arduino
pins as an input and output respectively.
These commands are text sensitive i.e, you need to write them down the exact way they are
given like digitalWrite starting with small “d” and write with capital “W”. Writing it down with
Digitalwrite or digitalwrite won’t be calling or addressing any function.
In order to upload the sketch, you need to select the relevant board you are using and the ports
for that operating system. As you click the Tools on the Menu, it will open like the figure below.
43
Fig. 4.1.9 Arduino IDE software
● Just go to the “Board” section and select the board you aim to work on. Similarly, COM1,
COM2, COM4, COM5, COM7 or higher are reserved for the serial and USB board. You can
look for the USB serial device in the ports section of the Windows Device Manager.
Following figure shows the COM4 that I have used for my project, indicating the Arduino Uno
with COM4 port at the right bottom corner of the screen.
44
Fig. 4.1.10 Arduino IDE software
● After correct selection of both Board and Serial Port, click the verify and then upload button
appearing in the upper left corner of the six-button section or you can go to the Sketch
section and press verify/compile and then upload.
● The sketch is written in the text editor and is then saved with the file extension. Ino.
It is important to note that the recent Arduino Modules will reset automatically as you compile
and press the upload button the IDE software, however, older version may require the physical
reset on the board.
● Once you upload the code, TX and RX LEDs will blink on the board, indicating the desired
program is running successfully.
Note: The port selection criteria mentioned above is dedicated for Windows operating system
only, you can check this Guide if you are using MAC or Linux.
● The amazing thing about this software is that no prior arrangement or bulk of mess is
required to install this software, you will be writing your first program within 2 minutes after
the installation of the IDE environment.
45
Boot Loader:
As you go to the Tools section, you will find a bootloader at the end. It is very helpful to burn
the code directly into the controller, setting you free from buying the external burner to burn
the required code.
When you buy the new Arduino Module, the bootloader is already installed inside the
controller. However, if you intend to buy a controller and put in the Arduino module, you need
to burn the bootloader again inside the controller by going to the Tools section and selecting
the burn bootloader.
PYTHON:
Python is a general purpose, dynamic, high level and interpreted programming language.
It supports Object Oriented programming approach to develop applications. It is simple and easy
46
to learn and provides lots of high-level data structures. It is easy to learn yet powerful and
versatile scripting language which makes it attractive for Application Development. It’s syntax
and dynamic typing with its interpreted nature, makes it an ideal language for scripting and rapid
application development. It supports multiple programming patterns, including object oriented,
imperative and functional or procedural programming styles. It is not intended to work on special
area such as web programming. That is why it is known as multipurpose because it can be used
with web, enterprise, 3D CAD etc. We don’t need to use data types to declare variable because it
is dynamically typed so we can write a=10 to assign an integer value in an integer variable. It
makes the development and debugging fast because there is no compilation step included in
python development and edit-test-debug cycle is very fast.
4.3 BLYNK:
Blynk is a Platform with IOS and Android apps to control Arduino, Raspberry Pi and the likes
over the Internet. It’s a digital dashboard where you can build a graphic interface for your
project by simply dragging and dropping widgets.
47
CHAPTER 5
RESULTS
5.1 CODE:
#define APP_DEBUG
#include <ESP8266WiFi.h>
#include “BlynkSimpleEsp8266.h”
int pinValue0;
int pinValue1;
int pinValue2;
int pinValue3;
int pinValue4;
#define red1 D0
#define red2 D1
48
#define red3 D2
#define red4 D3
#define green1 D4
#define green2 D5
#define green3 D6
#define green4 D7
BLYNK_WRITE(V0)
pinValue0 = param.asInt();
if (pinValue0 == 1)
digitalWrite(green1, HIGH);
digitalWrite(red1, LOW);
digitalWrite(red2, HIGH);
digitalWrite(red3, HIGH);
digitalWrite(red4, HIGH);
digitalWrite(green2, LOW);
digitalWrite(green3, LOW);
digitalWrite(green4, LOW);
49
Serial.println(“green1 high”);
BLYNK_WRITE(V1)
pinValue1 = param.asInt();
if (pinValue1 == 1)
digitalWrite(green2, HIGH);
digitalWrite(red1, HIGH);
digitalWrite(red2, LOW);
digitalWrite(red3, HIGH);
digitalWrite(red4, HIGH);
digitalWrite(green1, LOW);
digitalWrite(green3, LOW);
digitalWrite(green4, LOW);
Serial.println(“green2 high”);
BLYNK_WRITE(V4)
50
pinValue4 = param.asInt();
if (pinValue4 == 1)
digitalWrite(green4, HIGH);
digitalWrite(red1, HIGH);
digitalWrite(red2, HIGH);
digitalWrite(red3, HIGH);
digitalWrite(red4, LOW);
digitalWrite(green2, LOW);
digitalWrite(green3, LOW);
digitalWrite(green1, LOW);
digitalWrite(green1, LOW);
Serial.println(“green4 high”);
BLYNK_WRITE(V3)
pinValue3 = param.asInt();
if (pinValue3 == 1)
51
digitalWrite(red1, HIGH);
digitalWrite(green2, LOW);
digitalWrite(red2, HIGH);
digitalWrite(green3, HIGH);
digitalWrite(red3, LOW);
digitalWrite(green4, LOW);
digitalWrite(red4, HIGH);
Serial.println(“green3 high”);
void setup()
Serial.begin(9600);
pinMode(red1, OUTPUT);
pinMode(red2, OUTPUT);
pinMode(red3, OUTPUT);
pinMode(red4, OUTPUT);
pinMode(green1, OUTPUT);
pinMode(green2, OUTPUT);
52
pinMode(green3, OUTPUT);
pinMode(green4, OUTPUT);
digitalWrite(green1, HIGH);
digitalWrite(red1, LOW);
digitalWrite(green2, LOW);
digitalWrite(red2, HIGH);
digitalWrite(green3, LOW);
digitalWrite(red3, HIGH);
digitalWrite(green4, LOW);
digitalWrite(red4, HIGH);
delay(2000);
digitalWrite(green1, LOW);
digitalWrite(red1, HIGH);
digitalWrite(green2, HIGH);
digitalWrite(red2, LOW);
digitalWrite(green3, LOW);
digitalWrite(red3, HIGH);
digitalWrite(green4, LOW);
53
digitalWrite(red4, HIGH);
delay(2000);
digitalWrite(green1, LOW);
digitalWrite(red1, HIGH);
digitalWrite(green2, LOW);
digitalWrite(red2, HIGH);
digitalWrite(green3, HIGH);
digitalWrite(red3, LOW);
digitalWrite(green4, LOW);
digitalWrite(red4, HIGH);
delay(2000);
digitalWrite(green1, LOW);
digitalWrite(red1, HIGH);
digitalWrite(green2, LOW);
digitalWrite(red2, HIGH);
digitalWrite(green3, LOW);
digitalWrite(red3, HIGH);
digitalWrite(green4, HIGH);
digitalWrite(red4, LOW);
54
delay(2000);
void loop()
// BlynkEdgent.run();
// timer.run();
Blynk.run();
55
5.2 OUTPUT:
SEMI OUTPUT:
56
CONCLUSION
As human life is very valuable, people should be conscious and follow the security measures. In
this paper, we have presented an efficient traffic signal system by which, we will manage the
ambulance to succeed in the destination by avoiding much traffic. Our system is meant to realize
lower vehicular waiting time than the prevailing ones. The most contribution of our proposed
system is that, it is often used to select the simplest possible options for changing the green light
and control the traffic system, such that the waiting time is minimized. Moreover, the
implementation cost is reduced, because it does not involve any complex hardware installation.
57
REFERENCE
[1]. Rita Cucchiara, Massimo Piccardi, and Paola Mello, "Image analysis and rule-based
reasoning for a traffic monitoring system," IEEE Transaction on Intelligent Transportation
System, Vol 1, no. 2, June 2000.
[2] M Fathy, and MY Siyal, "Real-time image processing approach to measure traffic queue
parameters," IEE Proc.-Vis. Image Signal Process, Vol 142, no. 5, pp. 297-303,October 1995.
[3] Yoichiro Iwasaki, "An image processing system to measure vehicular queues and an adaptive
traffic signal control by using the information of the queues," in IEEE conference on Intelligent
Transportation System, pp. 195-200, November 1997.
[4] 1.M. Blosseville, C Krafft,F . Lenoir,V. Motyka, and S. Beucher, 'TIT AN: a traffic
measurement system using image processing techniques,"in Second International Conference on
Road Traffic Monitoring,pp. 84-88,February 1989.
[5] C P. Pappis and Ebrahim H. Mamdani, "A fuzzy logic controller for a traffic junction," IEEE
Transactions on Systems, Man, and Cybernetics, Vol 7, pp.707-717, October 1977.
[6] Van Li and Xiaoping FAN," Design of signal controllers for urban intersections based on
fuzzy logic and weightings," in 6th IEEE Conference on Intelligent Transportation Systems, Vol
1, pp. 867- 871, October 2003.
[7] G. Nakamiti and F. Gomide, "Fuzzy sets in distributed traffic control," in Proc. 5th IEEE Int
Conf Fuzzy Systems, Vol 3, pp. 1617- 1623, September 1996.
58