Traffic IOT Final Form 2
Traffic IOT Final Form 2
Faculty of Engineering
Electronics Engineering
Title:
Supervisor:
October 2020
اآليـــــة
قال تعالى:
اعلا ْمتَ نَا ِإ َّنكَ أ َ ْنتَ ْال َع ِلي ُم ْال َح ِكي ُم﴾ ِ
ْم لَنَا إِال َم َ
﴿قَالُوا ُس ْب َحانَك َل عل َ
Table of Contents
List of figures…………………………………………………………………….III
Abstract…………………………………………………………………………..IV
Chapter One: Background of the study
1. Introduction ......................................................................................................... 1
2.3 Comparison…………………………………………………………………..16
3.2.1 Potentiometer…………………………………………………………….20
3.2.8 Capacitor…………………………………………………………………24
4.2 Testing……………………………………………………………………….31
4.3 Discussion…………………………………………………………………....31
Reference………………………………………………………………………...33
List of figures:
Figure 3.1: System Block Diagram……………………………...……….17
Figure 3.1: Shows a Typical Single-turn Potentiometer……..…..……...20
Abstract
Recent development of technology has leads to IoT, which provides an
efficient method to address these issues. The difficulties faced by emergency
vehicles can be avoided using Automated Traffic Control System. One of the
widely affected services due to traffic jams is that of an ambulance. Many a times,
ambulance consist of emergency or critical patients which needs to be taken to the
hospital in minimum amount of time providing proper treatment to the patient so
that chances of surviving increases in critical condition in order to solve this
problem to some extent have apparently come up with “Traffic Control System
(ITCS) for ambulance”. The proposed system clears the traffic congestion by
turning all the red lights to green on the path of the ambulance, hence helping in
clearing the traffic and providing way towards its destination. The project based
on IoT and GSM network.
Chapter One
1. Introduction
In today’s world traffic being the main issue in concern, is creating
innumerable problems to the general life. Apart from the common issues of
congestion, it poses serious hindrance to the normal functioning of emergency
vehicles. Emergency vehicles have to be prioritized in comparison with all other
vehicles, but either due to unavoidable situations or due to self-centered motorists
emergency vehicles do not reach their destinations on time [1]. Delayed arrival of
emergency vehicles may pose threats to life. Apparently, there has to be a system
which detects the emergency vehicle prior to its arrival at the junction and clear
the traffic ahead of it before-hand. This may minimize the delays and facilitate the
needy during their emergency. Unfortunately, there are no efficient measures
taken to deal with this problem in most of the countries including India. And thus
either emergency vehicles may remain statutory or may override the signal. In
case the emergency vehicles override the traffic signal, there are high possibilities
of encountering accidents. Recent development of technology has leads to IoT,
which provides an efficient method to address these issues. The difficulties faced
by emergency vehicles can be avoided using Automated Traffic Control System.
A Patient may lose his life if there is delay in reaching of ambulance to the
hospital. According to the surveys 95% of the heart attacks cases can be treated, if
the ambulance can reach the hospital at current time without stuck into the traffic.
For this, it is needed that the vehicles on the road to make way for the ambulance.
But sometimes, the ambulance gets stuck in the traffic which in turn wastes a lot
of time waiting for the traffic to get clear. The proposed solution can overcome
these limitations by the emerging technology such as IoT i.e. Internet of Things
[2].
are connected and controlled by the internet. Thus, the impact of IoT in today’s
era is significant as it helps to represent the object digitally and makes itself
something greater than the object by itself. In this paper, we have come up with
the ‘Intelligent Traffic Control System for Smart Ambulance’ [3].
The main objective of this system is to make it possible for the ambulance
to reach a particular location without having it to stop anywhere until the
destination is reached. The proposed solution offers a monitoring of traffic lights
and its controlling by the driver of the ambulance.
Basic information of the patient is taken along with the status of the
patient such as critical or non-critical. This information is further used to send it
to the hospital. Depending upon the emergency, the driver sends the direction
towards which it wants to travel.
1.2 Objectives
To design a device that can solve this problem to some extent have apparently
come up with “Traffic Control System (ITCS) for ambulance”. The proposed
system clears the traffic congestion by turning all the red lights to green on the
path of the ambulance, hence helping in clearing the traffic and providing way
towards its destination. The project based on IoT and GSM network.
‘Smart Home’ is the most application that is based on IoT, through IoT the
user can switch on air conditioning before reaching home or switch off lights even
after you have left home, or unlock the doors to friends for temporary access even
when you are not at home.
2. Wearable’s
3. Connected Cars
Most large auto makers as well as some brave startups are working on
connected car solutions. Major brands like Tesla, BMW, Apple, and Google are
working on bringing the next revolution in automobiles.
4. Industrial Internet
Industrial Internet is the new buzz in the industrial sector, also termed as
Industrial Internet of Things (IIoT). It is empowering industrial engineering with
sensors, software and big data analytics to create brilliant machines.
5. Smart Cities
IoT will solve major problems faced by the people living in cities like
pollution, traffic congestion and shortage of energy supplies etc. Products like
cellular communication enabled Smart Belly trash will send alerts to municipal
services when a bin needs to be emptied.
6. IoT in agriculture
Farmers are using meaningful insights from the data to yield better return
on investment. Sensing for soil moisture and nutrients, controlling water usage for
plant growth and determining custom fertilizer are some simple uses of IoT.
7. Smart Retail
Smart phones will be the way for retailers to remain connected with their
consumers even out of store. Interacting through Smart phones and using Beacon
technology can help retailers serve their consumers better. They can also track
consumers’ path through a store and improve store layout and place premium
products in high traffic areas.
8. Energy Engagement
Power grids of the future will not only be smart enough but also highly
reliable. Smart grid concept is becoming very popular all over world.
7
The basic idea behind the smart grids is to collect data in an automated
fashion and analyze the behavior or electricity consumers and suppliers for
improving efficiency as well as economics of electricity use.
Smart Grids will also be able to detect sources of power outages more
quickly and at individual household levels like nearby solar panel, making
possible distributed energy system.
9. IOT in Healthcare
a) Communication
c) Information
D) Monitor
E) Time
F) Money
The biggest advantage of IoT is saving money. If the price of the tagging
and monitoring equipment is less than the amount of money saved, then the
Internet of Things will be very widely adopted. IoT fundamentally proves to be
very helpful to people in their daily routines by making the appliances
communicate to each other in an effective manner thereby saving and conserving
energy and cost. Allowing the data to be communicated and shared between
devices and then translating it into our required way, it makes our systems
efficient [5].
The IoT allows you to automate and control the tasks that are done on a
daily basis, avoiding human intervention. Machine-to-machine communication
helps to maintain transparency in the processes. It also leads to uniformity in the
tasks. It can also maintain the quality of service. We can also take necessary
action in case of emergencies [5].
i) Saves Money
2.1.4 Disadvantages
Privacy/Security: With all of this IoT data being transmitted, the risk of
losing privacy increases. For instance, how well encrypted will the data be kept
and transmitted with? Do you want your neighbors or employers to know what
medications that you are taking or your financial situation? [5].
the central server (e.g. the cloud server). This article discusses the factors to
consider when choosing a protocol and looks at some of the more popular ones
used when connecting remote devices to a server [5].
Data analytics tools take data from the Traffic Management System and
using GIS mapping under real time support, they provide useful information to the
drivers in the vehicles and help reduce the traffic congestion. Additionally, basic
tourist information such as visiting places, parking area and distance are also
projected on a real time basis on large digital screens installed at city centers
entrance points to guide the drivers toward their destination. This helps to save fuel
and finally to save a lot of time spent in searching various visiting places. The smart
living style in metro cities is also fulfilled as the environment becomes pollution
free and more hygienic [6].
and route information can be directed to the smart vehicles in transit and intelligent
decisions can be made before any problem occurs [6].
IR sensor and GSM system to provide users who wish to obtain the latest status of
traffic on congested roads [7].
System for Mobile Communication based information device that alerts the
doctors about the patient’s condition and informs the doctors to report to the
nearest hospital for patient’s quick recovery. There could be a case where two
Ambulances are exactly at equal distance from traffic light, in this case the traffic
light receiver will give chance to the transmitter of any one Ambulance randomly
without considering any fact.
The large amount of data that is generated by these devices can be handled
by cloud computing and it can also be used to send command to those devices to
perform a task. This project is based on the IoT and cloud. 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. The application
needs a required bandwidth for the instantaneous communication between the
ambulance and the traffic signal.
2.3 Comparison
The usage of hardware implementation circuit inside the vehicle is the interest
of all of the developers which may lead to an increasing on the cost of the
solution also the complexity. In this project the usage of the open source
ambulance tracking and requesting system help on implementing the system
without the need of external interface to GPS or other components. Also the
system provides the ambulance driver with information about the shortest path.
Chapter Three
Methodology
17
Start
Numerical Values
No Request Yes
Received
Start
Numerical Values
Return to
No
Normal
Received
Yes
3.2.1 Potentiometer
relays DC motors, filament lamps, LED displays, printer hammers and high
power buffers.
The Arduino MEGA 2560 is designed for projects that require more I/O
lines, more sketch memory and more RAM. With 54 digital I/O pins, 16 analog
inputs and a larger space for your sketch it is the recommended board for 3D
printers and robotics projects. This gives your projects plenty of room and
opportunities maintaining the simplicity and effectiveness of the Arduino
platform. This document explains how to connect your Mega2560 board to the
computer and upload your first sketch. The Arduino Mega 2560 is programmed
using the Arduino Software (IDE), our Integrated Development Environment
common to all our boards and running both online and offline.
23
A GSM modem is one of the wireless modem that is devised to work with
a GSM wireless network. It works with the same frequency of GSM wireless
network. It is an important part of the GSM network. Now a day’s GSM based
cell phones are more preferred than CDMA phones, hence let us see its operation
and its features.
The GSM wireless modem works in the way like a dial-up modem. The
main difference between the GSM modem and dial up modem is that a dial-up
modem sends and receives data through a fixed telephone line, while a GSM
wireless modem sends and receives data through radio wave-propagation.
24
Equation (2.1)
Resistors are common elements of electrical networks and electronic circuits and
are ubiquitous in most electronic equipment. Practical resistors can be made of
various compounds and films, as well as resistance wire (wire made of a high-
resistivity alloy, such as nickel-chrome). Resistors are also implemented within
integrated circuits, particularly analog devices, and can also be integrated into
hybrid and printed circuits.
3.2.8 Capacitor
The Arduino project started in 2003 as a program for students at the Interaction
Design Institute Ivrea in Ivrea, Italy,[2] aiming to provide a low-cost and easy way
for novices and professionals to create devices that interact with their
environment using sensors and actuators. Common examples of such devices
intended for beginner hobbyists include simple robots, thermostats, and motion
detectors.
The name Arduino comes from a bar in Ivrea, Italy, where some of the founders
of the project used to meet. The bar was named after Arduin of Ivrea, who was
the margrave of the March of Ivrea and King of Italy from 1002 to 1014.[3]7
Chapter Four
4.1 interfacing
The Wi-Fi module has enable pin and supply pin 3.3 volt its connected
together to the 3.3v on Arduino Mega, the TX and RX are connected to pin
19, 18 TX,RX.
The LCD was supplied with 5 volt and ground from Arduino Mega, then
the Enable pin to be 2, W/R Grounded, Reset to pin 3, D4,D5,D6,D7 to pins
4-5-6-7 on Arduino, and the backlight pins 15 and 16 to the VCC and Ground
of Arduino.
4.2 Testing
4.3 Discussion
The first idea came up in this project is, using GPS to detect nearest hospital, and
the shortest path that the ambulance can pass through in reduce time, best routing
provided by navigation system, but there are some problems that face the project
including in which direction the ambulance will take, so the problem was solved
by using a manual transmission to the direction required by the ambulance using
GSM modem and Wi-Fi, this solution improve the connectivity between the
ambulance and the traffic light.
In example, if there was more than one ambulance coming from different
directions at the same time. The system will give priority to the first ambulance that send
message to the traffic control system
Chapter Five
5.1 Conclusion
In this project IoT, provides an efficient method to address the solution of
the thesis issues. The difficulties faced by emergency vehicles can be avoided
using Automated Traffic Control System was solved. To solve this problem to
some extent have apparently come up with “Traffic Control System (ITCS) for
ambulance”. The proposed system clears the traffic congestion by turning all the
red lights to green on the path of the ambulance, hence helping in clearing the
traffic and providing way towards its destination. The project based on IoT and
GSM network.
5.2 Recommendation
1- Use GPS for navigation.
Reference
Appendix
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
LiquidCrystallcd(2, 3, 4, 5, 6, 7);
SoftwareSerialmygsm(10, 11);
int mos_value;
int r1=23;
int y1=25;
int g1=27;
int r2=29;
int y2=31;
int g2=33;
int r3=35;
int y3=37;
int g3=39;
int r4=41;
int y4=43;
int g4=45;
A-2
void setup() {
Serial.begin(9600);
mygsm.begin(9600);
pinMode(r1,OUTPUT);
pinMode(y1,OUTPUT);
pinMode(g1,OUTPUT);
pinMode(r2,OUTPUT);
pinMode(y2,OUTPUT);
pinMode(g2,OUTPUT);
pinMode(r3,OUTPUT);
pinMode(y3,OUTPUT);
pinMode(g3,OUTPUT);
pinMode(r4,OUTPUT);
pinMode(y4,OUTPUT);
pinMode(g4,OUTPUT);
// put your setup code here, to run once:
lcd.begin(16, 2);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
while (!mygsm) {
; // wait for serial port to connect. Needed for native USB port only
}
A-3
void loop() {
lcd.setCursor(0, 1);
lcd.print("Normal Mode");
// all Red
digitalWrite(r1,HIGH);
digitalWrite(r2,HIGH);
digitalWrite(r3,HIGH);
digitalWrite(r4,HIGH);
digitalWrite(y1,LOW);
digitalWrite(y2,LOW);
digitalWrite(y3,LOW);
digitalWrite(y4,LOW);
digitalWrite(g1,LOW);
digitalWrite(g2,LOW);
digitalWrite(g3,LOW);
A-4
digitalWrite(g4,LOW);
//
delay(10);
// yellow1
digitalWrite(r1,LOW);
digitalWrite(y1,HIGH);
digitalWrite(g1,LOW);
delay(10);
// green 1
digitalWrite(r1,LOW);
digitalWrite(y1,LOW);
digitalWrite(g1,HIGH);
// RETURN TO RED 1
delay(1000);
digitalWrite(r1,HIGH);
digitalWrite(y1,LOW);
digitalWrite(g1,LOW);
// STAGE 2
// yellow1
digitalWrite(r2,LOW);
digitalWrite(y2,HIGH);
digitalWrite(g2,LOW);
delay(10);
A-5
// green 1
digitalWrite(r2,LOW);
digitalWrite(y2,LOW);
digitalWrite(g2,HIGH);
// RETURN TO RED 1
delay(10);
digitalWrite(r2,HIGH);
digitalWrite(y2,LOW);
digitalWrite(g2,LOW);
// STAGE 3
// yellow1
digitalWrite(r3,LOW);
digitalWrite(y3,HIGH);
digitalWrite(g3,LOW);
delay(10);
// green 1
digitalWrite(r3,LOW);
digitalWrite(y3,LOW);
digitalWrite(g3,HIGH);
// RETURN TO RED 1
delay(10);
A-6
digitalWrite(r3,HIGH);
digitalWrite(y3,LOW);
digitalWrite(g3,LOW);
// Stage 4
// yellow1
digitalWrite(r4,LOW);
digitalWrite(y4,HIGH);
digitalWrite(g4,LOW);
delay(10);
// green 1
digitalWrite(r4,LOW);
digitalWrite(y4,LOW);
digitalWrite(g4,HIGH);
// RETURN TO RED 1
delay(10);
digitalWrite(r4,HIGH);
digitalWrite(y4,LOW);
digitalWrite(g4,LOW);
Serial.println(".");
while(mygsm.available()){
if (mygsm.find("NNN"))
{
Serial.println("*** NNN FOUND ***");
A-7
lcd.setCursor(0, 1);
lcd.print("North OPEN ");
digitalWrite(g4,HIGH);
digitalWrite(y4,LOW);
digitalWrite(r4,LOW);
digitalWrite(r3,HIGH);
digitalWrite(g3,LOW);
digitalWrite(y3,LOW);
digitalWrite(r2,HIGH);
digitalWrite(y2,LOW);
digitalWrite(g2,LOW);
digitalWrite(r1,HIGH);
digitalWrite(y1,LOW);
digitalWrite(g1,LOW);
delay(5000);
break;
}
if (mygsm.find("SSS"))
{
Serial.println("*** SSS FOUND ***");
lcd.setCursor(0, 1);
lcd.print("South OPEN ");
digitalWrite(g4,LOW);
digitalWrite(y4,LOW);
digitalWrite(r4,HIGH);
digitalWrite(r3,LOW);
digitalWrite(g3,HIGH);
digitalWrite(y3,LOW);
digitalWrite(r2,HIGH);
digitalWrite(y2,LOW);
A-8
digitalWrite(g2,LOW);
digitalWrite(r1,HIGH);
digitalWrite(y1,LOW);
digitalWrite(g1,LOW);
delay(5000);
break;
}
if (mygsm.find("EEE"))
{
Serial.println("*** EEE FOUND ***");
lcd.setCursor(0, 1);
lcd.print("East OPEN ");
digitalWrite(g4,LOW);
digitalWrite(y4,LOW);
digitalWrite(r4,HIGH);
digitalWrite(r3,HIGH);
digitalWrite(g3,LOW);
digitalWrite(y3,LOW);
digitalWrite(r2,LOW);
digitalWrite(y2,LOW);
digitalWrite(g2,HIGH);
digitalWrite(r1,HIGH);
digitalWrite(y1,LOW);
digitalWrite(g1,LOW);
delay(5000);
break;
}
if (mygsm.find("WWW"))
{
Serial.println("*** WWW FOUND ***");
A-9
lcd.setCursor(0, 1);
lcd.print("West OPEN ");
digitalWrite(g4,LOW);
digitalWrite(y4,LOW);
digitalWrite(r4,HIGH);
digitalWrite(r3,HIGH);
digitalWrite(g3,LOW);
digitalWrite(y3,LOW);
digitalWrite(r2,HIGH);
digitalWrite(y2,LOW);
digitalWrite(g2,LOW);
digitalWrite(r1,LOW);
digitalWrite(y1,LOW);
digitalWrite(g1,HIGH);
delay(5000);
break;
}
}
}
void gsm_init()
{
Serial.println("Finding GSM.");
booleanat_flag=1;
while(at_flag)
{
mygsm.println("AT");
while(mygsm.available()>0)
{
if(mygsm.find("OK"))
A-10
at_flag=0;
}
delay(1000);
}
Serial.println("Module Connected..");
delay(1000);
Serial.println("Disabling ECHO");
booleanecho_flag=1;
while(echo_flag)
{
mygsm.println("ATE0");
while(mygsm.available()>0)
{
if(mygsm.find("OK"))
echo_flag=0;
}
delay(1000);
}
Serial.println("Echo OFF");
delay(1000);
Serial.println("Finding Network..");
booleannet_flag=1;
while(net_flag)
{
mygsm.println("AT+CPIN?");
while(mygsm.available()>0)
{
if(mygsm.find("+CPIN: READY"))
net_flag=0;
}
A-11
delay(1000);
}
Serial.println("GSM is Ready");
delay(1000);
}
void init_sms()
{
mygsm.println("AT+CMGF=1");
delay(1000);
mygsm.println("AT+CMGS=\"+249918814188\""); // use your 10 digit cell
no. here
delay(1000);
}
void send_sms()
{
mygsm.write(26);
delay(1000);
}
void configure()
{
Serial.println("Configure GSM.");
boolean at_flag2=1;
A-12
while(at_flag2)
{
mygsm.println("AT+CMGF=1");
while(mygsm.available()>0)
{
if(mygsm.find("OK"))
at_flag2=0;
}
delay(1000);
}
booleanat_flag=1;
while(at_flag)
{
mygsm.println("AT+CNMI=2,2,0,0,0");
while(mygsm.available()>0)
{
if(mygsm.find("OK"))
at_flag=0;
}
delay(1000);
}
Serial.println("Module Configured..");
delay(1000);
}
String readMessages()
{
String buffer;
while (mygsm.available())
{
A-13
char c = mygsm.read();
buffer.concat(c);
delay(10);
}
return buffer;
}
B-1
Datasheet
ESP8266-01 Features
ESP8266 Equivalents
ESP-12 (Has more GPIO pins that support ADC, PWM, SPI etc)
The ESP8266 is a very user friendly and low cost device to provide internet
connectivity to your projects. The module can work both as a Access point (can
create hotspot) and as a station (can connect to Wi-Fi), hence it can easily fetch
data and upload it to the internet making Internet of Things as easy as possible. It
can also fetch data from internet using API’s hence your project could access any
information that is available in the internet, thus making it smarter. Another
exciting feature of this module is that it can be programmed using the Arduino
IDE which makes it a lot more user friendly. However this version of the module
has only 2 GPIO pins (you can hack it to use up to 4) so you have to use it along
B-4
with another microcontroller like Arduino, else you can look onto the more
standalone ESP-12 or ESP-32 versions. So if you are looking for a module to get
started with IOT or to provide internet connectivity to your project then this
module is the right choice for you.
There are so many methods and IDEs available to with ESP modules, but the
most commonly used on is the Arduino IDE. So let us discuss only about that
further below.
The ESP8266 module works with 3.3V only, anything more than 3.7V would kill
the module hence be cautions with your circuits. The best way to program
an ESP-01 is by using the FTDI board that supports 3.3V programming. If you
don’t have one it is recommended to buy one or for time being you can also use
an Arduino board. One commonly problem that every one faces with ESP-01 is
the powering up problem. The module is a bit power hungry while programming
and hence you can power it with a 3.3V pin on Arduino or just use a potential
divider. So it is important to make a small voltage regulator for 3.31v that could
supply a minimum of 500mA. One recommended regulator is the LM317 which
could handle the job easily. A simplified circuit diagram for using the ESP8266-
01 module is given below
The switch SW2 (Programming Switch) should be held pressed to hold the GPIO-
0 pin to ground. This way we can enter into the programming mode and upload
the code. Once the code is released the switch can be released.
B-5
interface]
46,53,54,58,59,
61,62,63,64,65
Similar Modules
Applications
• Cellular Communication
• Robotics
• Mobile Phone Accessories
• Servers
• Computer Peripherals
• Automobile
• USB Dongles