Vous êtes sur la page 1sur 71

ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

CHAPTER 1
INTRODUCTION

1.1 INTRODUCTION

Air is one of the essential elements of man’s surroundings. The earth atmosphere is
full of air which contains gases such as Nitrogen, Oxygen, Carbon Monoxide and traces of
some rare elements. Humans need an atmosphere of air that is free from contaminants. This is
very crucial for human life and health. Any change in the natural composition of air may
cause grave harm to life forms on earth. Air pollution is the presence of one or more
contaminants in the atmosphere such as gases in a quantity that can harm humans, animals
and plant.

Air pollutants are measured in Parts per Million (ppm) or ug/m3. Primary pollutants
are released directly into the atmosphere. Secondary pollutants are produced when the
primary pollutant reacts with other atmospheric chemicals. Air quality affects public health.
The effect of air pollution ranges from difficulty in breathing, coughing, aggravation of
asthma and emphysema. Polluted air can also impair visibility. Air pollution is accountable
for the death of 7 million persons worldwide each year or one in eight premature deaths
yearly. Almost 570,000 children under the age of five die every year from respiratory
infection linked to indoor/outdoor pollution and second-hand smoke. Children exposed to air
pollution have an elevated risk of developing chronic respiratory problems such as asthma. In
the monitoring of air pollution, several researchers worldwide have developed models to
monitor many of the pollution gases such as Sulphur Dioxide (SO2), Carbon Monoxide (CO),
Carbon Dioxide (CO2), Nitrogen Oxides (NO) etc. This paper focuses on the design and
implementation of a smart air pollutant monitoring system. It discusses how the level of
pollutants in the air can be monitored using a gas sensor, smoke sensor and Raspberry pi. .

The main aim of this project is the utilization of Raspberry Pi 3 connected with s
smoke sensor (MQ135) and gas sensor (MQ5) to depict a pollution tracking framework
utilizing low power chips with Internet of things. The level of pollutants are sent
straightforwardly stored into a cloud server and also locally on the Raspberry Pi and sent
when the association resumes. When an increase in pollution level is identified the equipment

KIET Page 1
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

sends notifications to the officials concerned and the owner of the vehicle with the help of a
cloud server. Moreover, with the presence of GPS module, the Internet of things (IoT) based
application can be utilized remotely to see the movement and get warnings when movement
is identified. Therefore, advantages like these make this application perfect for smart tracking
and monitoring wherever the manual checking is a big concern and required alert system
with instant notifications for personal vehicles and to the officials this system can be best
utilized.

The components are connected in a circuit arrangement. Later, cloud is set by


matching API key of the GPS Module through programming language python, Html and
cloud software named ThinkSpeak. The sensors read the data of amount of gases released
into the environment by exhaust pipe and amount of carbon dioxide present inside the car.
The read values of composition of dangerous emissions are sent to a private cloud
Thinkspeak. It is an open-source Internet of Things application and API to store and retrieve
data from things using the HTTP and MQTT protocol over the Internet or via a Local Area
Network with the Graphs obtained from the data uploaded in the cloud, the systems gives
alerts when huge levels of dangerous gas values are recorded.When the cloud is not
accessible then the information is stored locally on the Raspberry Pi and sent when the
association resumes.
1.2 Advantages
 Pollutants Measurement
 Accident Detection
 Location Tracking
 Graphs of pollutants over a period of time
 Vehicle Indoor Air Quality(VIAQ).
1.3 APPLICATIONS
 Urban cities vehicles of all types with dangerous emissions
 Metros
 Industries

KIET Page 2
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

1.4 CONCLUSION:
Hence by this project we can control the amount of pollution emitting from a vehicle and
make changes to the vehicle or impose fines if the rules are violated

KIET Page 3
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

CHAPTER-2
EMBEDDED SYSTEMS AND INTERNET OF
THINGS
The whole report is centered on the field of embedded systems and Internet of Things.
Hence an introduction to Embedded Systems and Internet of Things (IoT) provided
.
2.1 INTRODUCTION TO EMBEDDED SYSTEMS
Each day, our lives become more dependent on 'embedded systems', digital
information technology that is embedded in our environment. More than 98% of processors
applied today are in embedded systems, and are no longer visible to the customer as
'computers' in the ordinary sense. An Embedded System is a special-purpose system in which
the computer is completely encapsulated by or dedicated to the device or system it controls.
Unlike a general-purpose computer, such as a personal computer, an embedded system
performs one or a few pre-defined tasks, usually with very specific requirements. Since the
system is dedicated to specific tasks, design engineers can optimize it, reducing the size and
cost of the product.
.
Typically, an embedded system is housed on a single microprocessor board with the
programs stored in ROM. Virtually all appliances that have a digital interface watches,
microwaves, VCRs, cars utilize embedded systems. Some embedded systems include an
operating system, but many are so specialized that the entire logic can be implemented as a
single program. 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. In terms of complexity
embedded systems can range from very simple with a single microcontroller chip, to very
complex with multiple units, peripherals and networks mounted inside a large chassis or
enclosure.
2.1.1 DEFINITION OF AN EMBEDDED SYSTEM
Embedded system is defined as specific application implementing the software code
to interact directly with that particular hardware what we built. Software is used for providing
features and flexibility, Hardware which includes Processors, ASICs, Memory used for
Performance and sometimes Security.

KIET Page 4
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

There are many definitions of embedded system but all of these can be combined into
a single concept. An embedded system is a special purpose computer system that is used for
particular task.

2.1.2 FEATURES OF EMBEDDED SYSTEMS


The versatility of the embedded computer system lends itself to utility in all kinds of
enterprises, from the simplification of deliverable products to a reduction in costs in their
development and manufacture. Complex systems with rich functionality employ special
operating systems that take into account major characteristics of embedded systems.
Embedded operating systems have minimized footprint and may follow real-time operating
system specifics.
Many embedded systems use very small operating systems most of these provide very
limited operating system capabilities. 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. Some embedded systems have to operate in extreme
environment conditions such as very high temperature & humidity.
For high volume systems such as portable music players or mobile phones,
minimizing cost is usually the primary design consideration. Engineers typically select
hardware that is just “good enough” to implement the necessary functions. For low volume
or prototype embedded systems, general purpose computers may be adapted by limiting the
programs or by replacing the operating system with a real-time operating system.
2.1.3 CHARACTERISTICS OF EMBEDDED SYSTEMS
Embedded computing systems generally exhibit rich functionality—complex
functionality is usually the reason for introducing CPUs into the design. However, they also
exhibit many non-functional requirements that make the task especially challenging:
 Real-time deadlines that will cause system failure if not met

 Multi-rate operation

 In many cases, low power consumption

 Low manufacturing cost, which often means limited code size Workstation 

programmers often concentrate on functionality.


2.1.4 EMBEDDED SYSTEM ARCHITECTURE OVERVIEW

KIET Page 5
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Every Embedded system consists of a custom-built hardware built around a central


processing unit. This hardware also contains memory chips onto which the software is
loaded.

Below figure shows the layer architecture of Embedded Systems.

Fig2.1. Architecture of embedded systems

The operating system runs above the hardware and the application software runs above the
operating system. It is not compulsory to have an operating system in every embedded
system. For small applications such as remote control units, air conditioners, toys etc.
2.1.5 TYPES OF EMBEDDED SYSTEMS
Based on functionality and performance embedded systems categorized as 4
types
1. Stand alone embedded systems

2. Real time embedded systems

3. Networked information appliances


4. Mobile devices

1. Stand alone embedded systems


As the name implies, stand alone systems work in standalone mode. They take input,
process them and produce the desire output. The input can be an electrical signal from
transducer or temperature signal or commands from human being. The output can be
electrical signal to drive another system an led or LCD display
ex digital camera, microwave oven, CD player, Air conditioner etc

KIET Page 6
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

2. Real time embedded systems


In this type of an embedded system a specific work has to be complete in a particular
period of time.
Hard real time systems: - embedded real time used in missiles

Soft real time systems: - DVD players

3. Networked information appliances


Embedded systems that are provided with n/w interfaces and accessed by n/w
such as local area n/w or internet are called Network Information Appliances. Ex A
web camera is connected to the internet. Camera can send pictures in real time to any
computers connected to the internet

4. Mobile devices
Actually it is a combination of both VLSI and Embedded System. Mobile devices
such as Mobile phone, Personal digital assistants, smart phones etc are special category of
embedded systems

2.1.6 APPLICATIONS OF EMBEDDED SYSTEMS


 Home Appliances, intercom, telephones, security systems, garage door openers,
answering machines, fax machines, home computers, TVs, cable TV tuner, VCR,
camcorder, remote controls, video games, cellular phones, musical instruments, sewing
machines, lighting control, paging, camera, pinball machines, toys, exercise equipment
 Office Telephones, computers, security systems, fax machines, microwave, copier, laser
printer, colour printer, paging
 Auto Trip computer, engine control, air bag, ABS, instrumentation, security system,
transmission control, entertainment, climate control, cellular phone, keyless entry

2.2 INTERNET OF THINGS


The Internet of things refers to a type of network to connect anything with the Internet
based on stipulated protocols through information sensing equipments to conduct information
exchange and communications in order to achieve smart recognitions, positioning, tracing,
monitoring, and administration. Here we briefly discuss about what IOT is, how IOT enables

KIET Page 7
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

different technologies, about its architecture, characteristics & applications, IOT functional
view & what are the future challenges for IOT.

2.2.1 INTRODUCTION:
The IOT concept was coined by a member of the Radio Frequency Identification
(RFID) development community in 1999, and it has recently become more relevant to the
practical world largely because of the growth of mobile devices, embedded and ubiquitous
communication, cloud computing and data analytics.

Imagine a world where billions of objects can sense, communicate and share
information, all interconnected over public or private Internet Protocol (IP) networks. These
interconnected objects have data regularly collected, analyzed and used to initiate action,
providing a wealth of intelligence for planning, management and decision making. This is the
world of the Internet of Things (IOT).

Internet of things (IOT) is a network of physical objects. The internet is not only a
network of computers, but it has evolved into a network of device of all type and sizes,
vehicles , smart phones, home appliances, toys, cameras, medical instruments and industrial
systems, animals, people, buildings, all connected ,all communicating & sharing information
based on stipulated protocols in order to achieve smart reorganizations, positioning, tracing,
safe & control & even personal real time online monitoring , online upgrade, process control
& administration

Internet of things is an internet of three things:

 People to people.
 People to machine/things.
 Things /machine to things /machine, interacting through internet.

Internet of Things Vision: Internet of Things (IoT) is a concept and a paradigm that
considers pervasive presence in the environment of a variety of things/objects that through
wireless and wired connections and unique addressing schemes are able to interact with each
other and cooperate with other things/objects to create new servers or applications and reach
common goals. In this context the research and development challenges to create a smart

KIET Page 8
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

world are enormous. A world where the real, digital and the virtual are converging to create
smart environments that make energy, transport, cities and many other areas more intelligent.

IOT uses technology to connect physical objects to the Internet.


2.2.2 Internet of things
Internet of Things is refer to the general idea of things, especially everyday objects,
that are readable, recognizable, locatable, addressable through information sensing device
and/or controllable via the Internet, irrespective of the communication means (whether via
RFID, wireless LAN, wide area networks, or other means). Everyday objects include not only
electronic devices we encounter or the products of higher technological development such as
vehicles .Internet of Things is a new revolution of the Internet. Objects make themselves
recognizable and they obtain intelligence by making or enabling context related decisions
thanks to the fact that they can communicate information about themselves.

2.2.3 ENABLING TECHNOLOGIES FOR IOT


Internet of things (IoT) is a global infrastructure for the information society, enabling
advanced services by interconnecting (physical and virtual) things based on existing and
evolving interoperable information and communication technologies

KIET Page 9
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

With the Internet of Things the communication is extended via Internet to all the
things that surround us. The Internet of Things is much more than machine to machine
communication, wireless, sensor networks, sensor networks 2G/3G/4G, GSM, GPRS,
RFID,WI-FI, GPS, microcontroller, microprocessor etc. These are considered as being
the enabling technologies that make “Internet of Things” applications possible

Enabling technologies for the Internet of Things can be grouped into three categories:
 Technologies that enable “things” to acquire contextual information
 Technologies that enable “things” to process contextual information
 Technologies to improve security and privacy.
The first two categories can be jointly understood as functional building blocks
required building “intelligence” into “things”, which are indeed the features that
differentiate the IoT from the usual Internet.

KIET Page 10
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

The Internet of Things is not a single technology, but it is a mixture of different


hardware & software technology. The Internet of Things provides solutions based on the
integration of information technology, which refers to hardware and software used to store,
retrieve, and process data and communications technology which includes electronic systems
used for communication between individuals or groups.

2.2.4 CHARACTERISTICS:
The fundamental characteristics of the IoT are as follows:

Interconnectivity:

With regard to the IoT, anything can be interconnected with the global information and
communication infrastructure.

Things-related services:

The IoT is capable of providing thing-related services within the constraints of things,
such as privacy protection and semantic consistency between physical things and their
associated virtual things. In order to provide thing-related services within the constraints of
things, both the technologies in physical world and information world will change.

KIET Page 11
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Heterogeneity:

The devices in the IoT are heterogeneous as based on different hardware platforms
and networks. They can interact with other devices or service platforms through different
networks.

Dynamic changes:

The state of devices change dynamically, e.g., sleeping and waking up, connected
and/or disconnected as well as the context of devices including location and speed. Moreover,
the number of devices can change dynamically.

Enormous scale:

The number of devices that need to be managed and that communicate with each
other will be at least an order of magnitude larger than the devices connected to the current
Internet. Even more critical will be the management of the data generated and their
interpretation for application purposes. This relates to semantics of data, as well as efficient
data handling.

Safety:

As we gain benefits from the IoT, we must not forget about safety. As both the
creators and recipients of the IoT, we must design for safety. This includes the safety of our
personal data and the safety of our physical well-being. Securing the endpoints, the networks,
and the data moving across all of it means creating a security paradigm that will scale.

Connectivity:

Connectivity enables network accessibility and compatibility. Accessibility is getting


on a network while compatibility provides the common ability to consume and produce data

2.2.5 IOT ARCHITECTURE:


IOT architecture consists of different layers of technologies supporting IOT. It serves
to illustrate how various technologies relate to each other and to communicate the scalability,
modularity and configuration of IOT deployments in different scenarios

KIET Page 12
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Smart device/Sensor Layer:

The lowest layer is made up of smart objects integrated with sensors. The sensors
enable the interconnection of the physical and digital worlds allowing real-time information
to be collected and processed. The sensors have the capacity to take measurements such as
temperature, air quality, speed, humidity, pressure, flow, movement and electricity etc. In
some cases, they may also have a degree of memory, enabling them to record a certain
number of measurements. Sensors are grouped according to their unique purpose such as
environmental sensors, body sensors, home appliance sensors and vehicle telematics sensors,
etc.

Most sensors require connectivity to the sensor gateways. This can be in the form of a
Local Area Network (LAN) such as Ethernet and Wi-Fi connections or Personal Area
Network (PAN) such as ZigBee, Bluetooth and Ultra Wide band (UWB). For sensors that do
not require connectivity to sensor aggregators, their connectivity to backend
servers/applications can be provided using Wide Area Network (WAN) such as GSM, GPRS
and LTE. WSNs are gaining popularity as they can accommodate far more sensor nodes
while retaining adequate battery life and covering large areas.
Gateways and Network:
Massive volume of data will be produced by these tiny sensors and this requires a
robust and high performance wired or wireless network infrastructure as a transport medium.
Current networks, often tied with very different protocols, have been used to support
machine-to-machine (M2M) networks and their applications. With demand needed to serve a
wider range of IOT services and applications such as high speed transactional services,
context-aware applications, etc, multiple networks with various technologies and access
protocols are needed to work with each other in a heterogeneous configuration
Management Service Layer:

The management service renders the processing of information possible through


analytics, security controls, process modeling and management of devices .One of the
important features of the management service layer is the business and process rule engines.
Some of these events require filtering or routing to post-processing systems such as capturing
of periodic sensory data, while others require response to the immediate situations such as
reacting to emergencies on patient’s health conditions. The rule engines support the

KIET Page 13
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

formulation of decision logics and trigger interactive and automated processes to enable a
more responsive IOT system.

In the area of analytics, various analytics tools are used to extract relevant information
from massive amount of raw data and to be processed at a much faster rate. Analytics such as
in-memory analytics allows large volumes of data to be cached in random access memory
(RAM) rather than stored in physical disks.

Data management is the ability to manage data information flow. With data
management in the management service layer, information can be accessed, integrated and
controlled. Higher layer applications can be shielded from the need to process unnecessary
data and reduce the risk of privacy disclosure of the data source. Data filtering techniques
such as data anonymisation, data integration and data synchronization, are used to hide the
details of the information while providing only essential information that is usable for the
relevant applications.

Application Layer:
The IoT application covers “smart” environments/spaces in domains such as:
Transportation, Building, City, Lifestyle, Retail, Agriculture, Factory, Supply chain,
Emergency, Healthcare, User interaction, Culture and tourism, Environment and Energy.

2.2.6 IOT FUNCTIONAL VIEW:


The Internet of Things concept refers to uniquely identifiable things with their virtual
representations in an Internet-like structure and IoT solutions comprising a number of
components such as:

 Module for interaction with local IoT devices. This module is responsible for
acquisition of observations and their forwarding to remote servers for analysis and
permanent storage.
 Module for local analysis and processing of observations acquired by IoT devices.
 Module for interaction with remote IoT devices, directly over the Internet. This
module is responsible for acquisition of observations and their forwarding to
remote servers for analysis and permanent storage.

KIET Page 14
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

2.2.7 FUTURE SCOPE FOR IOT:


The development of enabling technologies such as semiconductor electronics,
communications, sensors, smart phones, embedded systems, cloud networking, network
virtualization and software will be essential to allow physical devices to operate in changing
environments & to be connected all the time everywhere.
While IOT is architected into layers, the technologies have been categorized into three
groups.

 The first group of technologies impacts the devices, microprocessor chips


.
 The second group comprises technologies that support network sharing and
address capacity and latency issues.

 The third group impacts the management services that support the IOT
applications.

2.2.8 INTEROPERABILITY IN THE IOT:


IoT aims for integrating the physical world with the virtual world by using the
Internet as the medium to communicate and exchange information.. As for the IoT, future
networks will continue to be heterogeneous, multi-vendors, multi-services and largely
distributed. Consequently, the risk of non-interoperability will increase.

Interoperability is a key challenge in the realms of the Internet of Things (IoT).


This is due to the intrinsic fabric of the IoT .
Interoperability is: “the ability of two or more systems or components to exchange
data and use information”. This definition is interesting as provide many challenges on
how to:

 Get the information


 Exchange data, and
 Use the information in understanding it and being able to process it.
Different types of interoperability are
Technical Interoperability is usually associated with hardware/ software
components, systems and platforms that enable machine-to-machine communication to take

KIET Page 15
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

place. This kind of interoperability is often centered on (communication) protocols and the
infrastructure needed for those protocols to operate.
Syntactical Interoperability is usually associated with data for -mats. Certainly, the
messages transferred by the communication protocols need to have a well-defined syntax and
encoding, even if it is only in the form of bit-tables. However, many protocols carry data or
content, and this can be represented using high-level transfer syntaxes such as HTML, XML
or ASN.1.
Semantic Interoperability is usually associated with the meaning of content and
concerns the human rather than machine interpretation of content. Thus interoperability on
this level means that there is a common understanding between people of the meaning of the
content (information) being exchanged.

Organizational Interoperability, as the name implies, is the ability of organizations


to effectively communicate and transfer (meaningful) data (information) even though they
may be using a variety of different information systems over widely different infrastructures,
possibly across different geographic regions and cultures. Organizational interoperability
depends on successful technical, syntactical and semantic interoperability.

In a fully interoperable environment, any IoT device would be to connect to any other
device or system and exchange information as desired. In practicality, interoperability is more
complex. Interoperability among IoT devices and systems happens in varying degrees at
different layers within the communications protocol stack between the devices. Technical
interoperability ensures basic connectivity: mechanism to established physical& logical
connection between systems, network interoperability: to exchange data between multiple
systems across variety of networks. Syntactic interoperability ensures understanding of data
structure in data exchanged between systems. While semantic ensures understanding of
concept contained in data structure.

2.2.9 FUTURE CHALLENGES FOR IOT:


There are key challenges and implications today that need to be addressed before
mass adoption of IOT can occur.
Privacy and Security:

As the IoT become a key element of the Future Internet and the usage of the Internet
of Things for large-scale, partially mission-critical systems creates the need to address trust

KIET Page 16
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

and security functions adequately. New challenges identified for privacy, trust and reliability
are:
 Providing trust and quality-of-information in shared information models to
enable re-use across many applications
 Providing secure exchange of data between IoT devices and consumers of their
information.
 Providing protection mechanisms for vulnerable devices.

Cost versus Usability:

An option to grow, the cost of components that are needed to support capabilities such
as sensing, tracking and control mechanisms need to be relatively inexpensive in the coming
years.

Interoperability:

In the traditional Internet, interoperability is the most basic core value;the first
requirement of Internet connectivity is that “connected” systems be able to “talk the same
language” of protocols and encodings. Different industries today use different standards to
support their applications. With numerous sources of data and heterogeneous devices, the use
of standard interfaces between these diverse entities becomes important. This is especially so
for applications that supports cross organizational and various system boundaries. Thus the
IOT systems need to handle high degree of interoperability.

Data Management:

Data management is a crucial aspect in the Internet of Things. When considering a


world of objects interconnected and constantly exchanging all types of information, the
volume of the generated data and the processes involved in the handling of those data become
critical.

Device Level Energy Issues:

One of the essential challenges in IoT is how to interconnect “things” in an


interoperable way while taking into account the energy constraints, knowing that the
communication is the most energy consuming task on devices.

KIET Page 17
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

CHAPTER-3
HARDWARE IMPLEMENTATION
This chapter briefly explains about the Hardware Implementation of the project. It
discusses the design and working of the design with the help of block diagram in detail. It
explains the features, timer programming, serial communication, interrupts of processor. It
also explains the various modules used in this project. Hardware implementation deals in
drawing the schematic on the plane paper according to the application, testing the schematic
design over the breadboard using
the various IC’s to find if the design meets the objective, carrying out the PCB layout
of the schematic tested on breadboard, finally preparing the board and testing the
designed hardware.

The project design and principle are explained in this chapter using the block
diagram. The block diagram discusses about the required components of the design and
working condition.
BLOCK DIAGRAM OF THE SYSTEM
Below shown block diagram of proposed system depicts various components used in the
proposed system and their interconnections.

Fig 3.1 Block diagram of proposed system

The Block diagram of the proposed system consists of Raspberry Pi board (Model 3)
which is a low cost, credit-card sized computer that plugs into a computer monitor or TV,
and uses a standard keyboard and mouse. GPS sensors which are receivers with antennas

KIET Page 18
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

that use a satellite-based navigation system with a network of 24 satellites in orbit around
the earth to provide position, velocity, and timing information. The MQ5 gas sensor that
detects the presence of various gases such as hydrogen, carbon monoxide, methane and
LPG ranging from 100ppm to 3,000ppm and finally MQ135 gas sensor which has high
sensitivity to Ammonia, Sulfide and Benzene steam, also sensitive to smoke and other
harmful gases.

3.1 WORKING PROCEDURE


The project aim is to simplify pollution tracking and monitoring. The interface is user
friendly, using Raspberry Pi with advent of smoke sensor and gas sensor depict an alert
framework utilizing Internet of things.
POWER
SUPPLY

Vin
GAS
GPS SENSOR
RASPBERY
MODULE PI3

SMOKE
SENSOR

CLOUD
MONITORING

Fig 3.2: Circuit Diagram


The components are connected in above circuit arrangement. Later, cloud is set by
matching API key of the GPS Module through programming language python, Html and
cloud software named ThinkSpeak. The sensors read the data of amount of gases released
into the environment by exhaust pipe and amount of carbon dioxide present inside the car.
The read values of composition of dangerous emissions are sent to a private cloud
Thinkspeak. It is an open-source Internet of Things application and API to store and retrieve
data from things using the HTTP and MQTT protocol over the Internet or via a Local Area
Network with the Graphs obtained from the data uploaded in the cloud, the systems gives
alerts when huge levels of dangerous gas values are recorded.

KIET Page 19
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

When the cloud is not accessible then the information is stored locally on the
Raspberry Pi and sent when the association resumes. The primary functions of the project are
 Pollutants Measurement: emissions from a vehicle like hydrogen, carbon
monoxide, methane and LPG ranging from 100ppm to 3,000ppm is measured.
 Accident Detection: accident detection systems rely on the high speed of
the vehicle (extracted from the GPS receiver) and can also be detected using G-
Force value (extracted from accelerometer sensor) to detect an accident.
 location tracking: with the presence of GPS , location of the vehicle can be easily
traced round the clock
 Graph of pollutants over a period of time: The thinkspeak platform uses the data
uploaded and graphs of different pollutants over a period are drawn Officials and
Owner of vehicle gets an alert, when there is a increase in emissions than the
prescribed value.
 Air quality monitoring inside vehicle: Vehicle Indoor Air Quality (VIAQ) is a
very important parameter that we often tend to ignore in our daily driving
Prolonged use of air recirculation inside the vehicle cabin can lead to a gradual
accumulation of carbon dioxide (CO2) which may occur the symptoms such as
fatigue, headaches, and dizziness even deleterious effects on cognitive function
towards the occupants. Vehicle cabin is an enclosed environment to prevent the
outdoor air directly flow inside the vehicle cabin. So, the amount of carbon dioxide
present inside the chamber is measured and alert is sent when the gas is in higher
amounts.

HARDWARE COMPONENTS:
 Raspberry Pi 3
 Smoke sensor (MQ5)
 Gas Sensor(MQ37)
 GPS
 Power Supply

3.1 Raspberry Pi 3:
The Raspberry Pi Compute Module 3+ is a range of DDR2-SODIMM-mechanically-
compatible System on Modules (SoMs) containing processor, memory, embedded Multi-

KIET Page 20
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Media Controller i,e, eMMC Flash (on non-Lite variants) and supporting power circuitry.
These modules allow a designer to leverage the Raspberry Pi hardware and software stack in
their own custom systems and form factors.

Fig3.3 : Side top view of Raspberry Pi

Fig3.4: Bottom view of Raspberry Pi

Features
3.1.1 Hardware
_ Low cost
_ Low power

KIET Page 21
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

_ High availability
_ High reliability
– Tested over millions of Raspberry Pis Produced to date
– Module IO pins have 15 micro-inch hard gold plating over 2.5 micron Nickel
3.1.2 Specification

 Quad Core 1.2GHz Broadcom BCM2837 64bit CPU


 1GB RAM
 BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
 100 Base Ethernet
 40-pin extended GPIO
 4 USB 2 ports
 4 Pole stereo output and composite video port
 Full size HDMI
 CSI camera port for connecting a Raspberry Pi camera
 DSI display port for connecting a Raspberry Pi touchscreen display
 Micro SD port for loading your operating system and storing data
 Upgraded switched Micro USB power source up to 2.5A

3.1.3 Software
_ ARMv8 Instruction Set
_ Mature and stable Linux software stack
– Latest Linux Kernel support
– Many drivers upstreamed
– Stable and well supported userland
– Full availability of GPU functions using standard APIs

KIET Page 22
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

 Figure 3.5: CM3+ Block Diagram


KIET Page 23
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

3.1.4 Electrical Specification


Functional operation of the device under these or any other conditions above those
listed in the operational sections of this specification is not implied. Exposure to absolute
maximum rating conditions for extended periods may affect device reliability.

Table: Absolute Maximum Ratings

DC Characteristics are defined in Table below


where,a = Hysteresis enabled

b = Default drive strength (8mA)

c = Maximum drive strength (16mA)

KIET Page 24
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Table : DC characteristics

AC characteristics are defined in the following tables

Table: Digital I/O Pin AC Characteristic

KIET Page 25
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Fig 3.6: Digital IO Characteristics


3.1.5 Power Supplies:
The Compute Module 3+ has six separate supplies that must be present and
powered at all times; you cannot leave any of them unpowered, even if a specific interface
or GPIO bank is unused. The six supplies are as follows:
1. VBAT is used to power the BCM2837 processor core. It feeds the SMPS that generates
the chip core voltage.
2. 3V3 powers various BCM2837 PHYs, IO and the eMMC Flash.
3. 1V8 powers various BCM2837 PHYs, IO and SDRAM.
4. VDAC powers the composite (TV-out) DAC.
5. GPIO0-27 VREF powers the GPIO 0-27 IO bank.
6. GPIO28-45 VREF powers the GPIO 28-45 IO bank.

Table: Power Supply Operating Ranges


3.1.6 Power Requirements
Exact power requirements will be heavily dependent upon the individual use case. If
an on-chip subsystem is unused, it is usually in a low power state or completely turned off.
For instance, if your application does not use 3D graphics then a large part of the core digital
logic will never turn on and need power.

KIET Page 26
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

This is also the case for camera and display interfaces, HDMI, USB interfaces, video
encoders and decoders, and so on. Power chain design is critical for stable and reliable
operation of the Compute Module 3+. We strongly recommend that designers spend time
measuring and verifying power requirements for their particular use case and application, as
well as paying careful attention to power supply sequencing and maximum supply voltage
tolerance
3.1.7 Booting

The eMMC Flash device on CM3+ is directly connected to the primary BCM2837
SD/eMMC interface. These connections are not accessible on the module pins. On CM3+
Lite this SD interface is available on the SDX pins When initially powered on, or after the
RUN pin has been held low and then released, the BCM2837 will try to access the primary
SD/eMMC interface. It will then look for a file called bootcode.bin on the primary partition
(which must be FAT) to start booting the system. If it cannot access the SD/eMMC device or
the boot code cannot be found, it will fall back to waiting for boot code to be written to it
over USB;
3.1.8 Peripherals :

1. GPIO

BCM2837 has in total 54 GPIO lines in 3 separate voltage banks. All GPIO pins have
at least two alternative functions within the SoC. When not used for the alternate peripheral
function, each GPIO pin may be set as an input (optionally as an interrupt) or an output. The
alternate functions are usually peripheral I/Os, and most peripherals appear twice to allow
flexibility on the choice of I/O voltage.

GPIO bank2 is used on the module to connect to the eMMC device and for an on-
board I2C bus (to talk to the core SMPS and control the special function pins). On CM3+
Lite most of bank2 is exposed to allow a user to connect their choice of SD card or eMMC
device (if required).

Bank0 and 1 GPIOs are available for general use. GPIO0 to GPIO27 are bank0 and
GPIO28-45 make up bank1. GPIO0-27 VDD is the power supply for bank0 and GPIO28-45
VDD is the power supply for bank1. SDX VDD is the supply for bank2 on CM3+ Lite. These

KIET Page 27
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

supplies can be in the range 1.8V-3.3V each bank must be powered, even when none of the
GPIOs for that bank are used.

Note that the HDMI HPD N 1V8 and EMMC EN N 1V8 pins are 1.8V IO and are used for
special functions (HDMI hot plug detect and boot control respectively). Please do not use
these pins for any other purpose, as the software for the module will always expect these pins
to have these special functions. If they are unused please leave them unconnected.

All GPIOs except GPIO28, 29, 44 and 45 have weak in-pad pull-ups or pull-downs
enabled when the device is powered on. It is recommended to add off-chip pulls to GPIO28,
29, 44 and 45 to make sure they never float during power on and initial boot.

KIET Page 28
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Table : GPIO Bank0 Alternate Functions

Table : GPIO Bank1 Alternate Functions

Both of the tables detail the default pin pull state and available alternate GPIO
functions. Most of these alternate peripheral functions are described in detail in the Broadcom
Peripherals Specification document and have Linux drivers available.

2. Secondary Memory Interface (SMI)

The SMI peripheral is an asynchronous NAND type bus supporting Intel mode80 type
transfers at 8 or 16 bit widths and available in the ALT1 positions on GPIO banks 0 and 1

KIET Page 29
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

(see Table 9 and Table 10). It is not publicly documented in the Broadcom Peripherals
Specification but a Linux driver is available in the Raspberry Pi Github Linux repository
(bcm2835 smi.c in linux/drivers/misc).
3. Display Parallel Interface (DPI)

A standard parallel RGB (DPI) interface is available on bank 0 GPIOs. This up-to-24-
bit parallel interface can support a secondary display. Again this interface is not documented
in the Broadcom Peripherals Specification but documentation can be found here.
4. SD/SDIO Interface

The BCM283x supports two SD card interfaces, SD0 and SD1.The first (SD0) is a
proprietary Broadcom controller that does not support SDIO and is the primary interface used
to boot and talk to the eMMC or SDX x signals. The second interface (SD1) is standards
compliant and can interface to SD, SDIO and eMMC devices;
for example on a Raspberry Pi 3 B+ it is used to talk to the on-board CYW43455 WiFi device
in SDIO mode. Both interfaces can support speeds up to 50MHz single ended (SD High
Speed Mode).
5. CSI (MIPI Serial Camera)

Currently the CSI interface is not openly documented and only CSI camera sensors
supported by the official Raspberry Pi firmware will work with this interface. Supported
sensors are the OmniVision OV5647 and Sony IMX219. It is recommended to attach other
cameras via USB.
6. DSI (MIPI Serial Display)

Currently the DSI interface is not openly documented and only DSI displays
supported by the official Raspberry Pi firmware will work with this interface. Displays can
also be added via the parallel DPI interface which is available as a GPIO alternate function.
7. USB

The BCM2837 USB port is On-The-Go (OTG) capable. If using either as a fixed
slave or fixed master, please tie the USB OTGID pin to ground. The USB port (Pins USB DP
and USB DM) must be routed as 90 ohm differential PCB traces. Note that the port is capable
of being used as a true OTG port however there is no official documentation. Some users
have had success making this work.

KIET Page 30
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

8.HDMI

BCM283x supports HDMI V1.3a. It is recommended that users follow a similar


arrangement to the Compute Module IO Board circuitry for HDMI output. The HDMI CK
P/N (clock) and D0-D2 P/N (data) pins must each be routed as matched length 100 ohm
differential PCB traces. It is also important to make sure that each differential pair is closely
phase matched. Finally, keep HDMI traces well away from other noise sources and as short
as possible. Failure to observe these design rules is likely to result in EMC failure.

9. Composite (TV Out)

The TVDAC pin can be used to output composite video (PAL or NTSC). Please route
this signal away from noise sources and use a 75 ohm PCB trace. Note that the TV DAC is
powered from the VDAC supply which must be a clean supply of 2.5-2.8V. It is
recommended users generate this supply from 3V3 using a low noise LDO.
If the TVDAC output is not used VDAC can be connected to 3V3, but it must be powered
even if the TV-out functionality is unused.
10. Thermals

The BCM2837 SoC employs DVFS (Dynamic Voltage and Frequency Scaling) on the
core voltage. When the processor is idle (low CPU utilisation), it will reduce the core
frequency and voltage to reduce current draw and heat output. When the core utilisation
exceeds a certain threshold the core voltage is increased and the core frequency is boosted to
the maximum working frerquency of 1.2GHz.

The voltage and frequency are throttled back when the CPU load reduces back to an
’idle’ level OR when the silicon temperature as mesured by the on-chip temperature sensor
exceeds 80C (thermal throttling). A designer must pay careful attention to the thermal design
of products using the CM3+ so that performance is not artificially curtailed due to the
processor thermal throttling, as the Quad ARM complex in the BCM2837 can generate
significant heat output under load.

11. Temperature Range

The operating temperature range of the module is set by the lowest maximum and
highest minimum of any of the components used. The eMMC and LPDDR2 have the

KIET Page 31
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

narrowest range, these are rated for -25 to +80 degrees Celsius. Therefore the nominal range
for the CM3+ and CM3+ Lite is -25C to +80C. However, this range is the maximum for the
silicon die; therefore, users would have to take into account the heat generated when in use
and make sure this does not cause the temperature to exceed 80 degrees Celsius.

3.2 Gas sensor (MQ135):


A gas sensor is a device which detects the presence of gas in an area.This sensor
interacts with a gas to measure its concentration. Each gas has a unique breakdown voltage
i.e. the electric field at which it is ionized. Sensor identifies gases by measuring these
voltages. The concentration of the gas can be determined by measuring the current discharge
in the device. The MQ135 gas sensor detects the presence of various gases such
as hydrogen, carbon monoxide, methane and LPG ranging from 100ppm to 3,000ppm

Fig 3.7:mq135 sensor

3.8 Fig: Pin configuration

KIET Page 32
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

3.2.3 Working principle of smoke sensor:

When a gas interacts with this sensor, it is first ionized into its constituents and is then
adsorbed by the sensing element. This adsorption creates a potential difference on the
element which is conveyed to the processor unit through output pins in form of current. The
gas sensor module consists of a steel exoskeleton under which a sensing element is housed.
This sensing element is subjected to current through connecting leads. This current is known
as heating current through it, the gases coming close to the sensing element get ionized and
are absorbed by the sensing element. This changes the resistance of the sensing element
which alters the value of the current going out of it.

3.2.4 Specifications:

 Supply Voltage: 5V
 Detecting concentration :200-10000ppm LPG,LNG,Natural gas,Iso-butane
 Analog and Digital Output
 Digital Out is High or Low based on a adjustable preset threshold.

A. Standard work condition


Symbol Parameter name Technical condition Remarks
VH Heating voltage 5V±0.1 AC OR DC
Vc Circuit voltage 5V±0.1 AC OR DC
PL Load resistance 20KΩ

RH Heater resistance 31±10% Room Tem


PH Heating consumption less than 800mw

B. Environment condition
Symbol Parameter name Technical condition Remarks

Tao Using Tem -10℃-45℃


Tas Storage Tem -20℃-70℃

RH Related humidity less than 95%Rh


O2 Oxygen concentration 21%(standard minimum value is
condition)Oxygen over 2%
concentration can
affect sensitivity

KIET Page 33
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

C. Sensitivity characteristic
Symbol Parameter name Technical parameter Remarks

Rs Sensing 30KΩ-200KΩ Detecting concentration


Resistance (100ppm NH3 ) scope:
10ppm-300ppm NH3
α Concentration ≤0.65 10ppm-1000ppm
(200/50) Slope rate Benzene
10ppm-300ppm
NH3 Alcohol

Standard Temp: 20℃±2℃ Vc:5V±0.1


Detecting
Humidity: 65%±5% Vh: 5V±0.1
Condition

Preheat time Over 24 hour

D. Structure and configuration, basic measuring circuit


Parts Materials

1 Gas sensing layer SnO2

2 Electrode Au

3 Electrode line Pt

4 Heater coil Ni-Cr alloy

5 Tubular ceramic Al2O3

6 Anti-explosion Stainless steel gauze


network (SUS316 100-mesh)
7 Clamp ring Copper plating Ni

8 Resin base Bakelite

9 Tube Pin Copper plating Ni

Fig3.9: Configuration B

KIET Page 34
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Fig3.10: Configuration A

Fig : Structure and configuration of MQ-135 gas sensor

Fig2: Electric parameter measurement circuit


Structure and configuration of MQ-135 gas sensor is shown as Fig. 1 (Configuration A
or B), sensor composed by micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive layer,
measuring electrode and heater are fixed into a crust made by plastic and stainless steel net.
The heater provides necessary work conditions for work of sensitive components. The
enveloped MQ-135 have 6 pin ,4 of them are used to fetch signals, and other 2 are used for
providing heating current.Electric parameter measurement circuit is shown as Fig.2
3.2.5 SENSITIVITY ADJUSTMENT

Resistance value of MQ-135 is difference to various kinds and various concentration gases.
So, using this components, sensitivity adjustment is very necessary. we recommend that you
calibrate the detector for 100ppm NH3 or 50ppm Alcohol concentration in air and use value
of Load resistance that( RL) about 20 KΩ(10KΩ to 47 KΩ). When accurately measuring, the

KIET Page 35
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

proper alarm point for the gas detector should be determined after considering the
temperature and humidity influence

E. Sensitivity characteristic curve

Fig.3 shows the typical sensitivity characteristics of the MQ-135 for several gases. in
their: Temp: 20℃、 Humidity: 65%、 O2 concentration 21% RL=20kΩ Ro: sensor
resistance at 100ppm of NH3 in the clean air. Rs:sensor resistance at various
concentrations of gases.

Fig.4 shows the typical dependence of the MQ-135 on temperature and humidity. Ro: sensor
resistance at 100ppm of NH3 in air at 33%RH and 20 degree. Rs: sensor resistance at
100ppm of NH3 at different temperatures and humidities.
3.2.6 Following conditions must be prohibited

KIET Page 36
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

1. Expose to organic silicon steam Organic silicon steam cause sensors invalid, sensors
must be avoid exposing to silicon bond, fixature, silicon latex, putty or plastic contain
silicon environment
2. High Corrosive gas : If the sensors exposed to high concentration corrosive gas (such
as H2Sz, SOX,Cl2,HCl etc), it will not only result in corrosion of sensors
structure, also it cause sincere sensitivity attenuation.
3. Alkali, Alkali metals salt, halogen pollution: The sensors performance will be
changed badly if sensors be sprayed polluted by alkali metals salt especially brine, or
be exposed to halogen such as fluorine.
4. Touch water: Sensitivity of the sensors will be reduced when spattered or dipped in
water.
5. Freezing: Do avoid icing on sensor’surface, otherwise sensor would lose sensitivity.
6. Applied voltage: higher Applied voltage on sensor should not be higher than
stipulated value, otherwise it cause down-line or heater damaged, and bring on
sensors’ sensitivity characteristic changed badly.
7. Voltage on wrong pins: For 6 pins sensor, if apply voltage on 1、3 pins or 4、6
pins, it will make lead broken, and without signal when apply on 2、4 pins

Following conditions must be avoided

1.Water Condensation
Indoor conditions, slight water condensation will effect sensors performance lightly.
However, if water condensation on sensors surface and keep a certain period, sensor’
sensitivity will be decreased.
2. Long time storage
The sensors resistance produce reversible drift if it’s stored for long time without electrify,
this drift is related with storage conditions. Sensors should be stored in airproof without
silicon gel bag with clean air.
3. Long time exposed to adverse environment
No matter the sensors electrified or not, if exposed to adverse environment for long time,
such as high humidity, high temperature, or high pollution etc, it will effect the sensors
performance badly.
4. Vibration

KIET Page 37
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Continual vibration will result in sensors down-lead response then repture. In transportation
or assembling line, pneumatic screwdriver/ultrasonic welding machine can lead this
vibration.
5. Concussion
If sensors meet strong concussion, it may lead its lead wire disconnected.
3.2.7 Usage
For sensor, handmade welding is optimal way. If use wave crest welding should meet the
following conditions:
Soldering flux: Rosin soldering flux contains least chlorine
Speed: 1-2 Meter/ Minute
Warm-up temperature:100±20℃
Welding temperature:250±10℃
1 time pass wave crest welding machine
If disobey the above using terms, sensors sensitivity will be reduced.

3.2.8 FEATURES
 Wide detecting scope
 Fast response and High sensitivity
 Stable and long life
 Simple drive circuit

3.2.9 APPLICATION

They are used in gas leakage detecting equipments in family and industry, are
suitable for detecting of LPG, natural gas , town gas, avoid the noise of alcohol and cooking
fumes and cigarette smoke.

3.3 Gas Sensor (MQ5):


A gas sensor is a device which detects the presence of gas in an area. This sensor interacts
with a gas to measure its concentration. Each gas has a unique breakdown voltage i.e. the
electric field at which it is ionized. Sensor identifies gases by measuring these voltages. The
concentration of the gas can be determined by measuring the current discharge in the device.
The MQ5 gas sensor detects the presence of various gases such as hydrogen, carbon
monoxide, methane and LPG ranging from 100ppm to 3,000ppm.

KIET Page 38
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

3.11 Fig: mq5 sensor

3.12 Fig: Pin Configuration

3.3.3 Working Principle of Gas Sensor


When a gas interacts with this sensor, it is first ionized into its constituents and is then
adsorbed by the sensing element. This adsorption creates a potential difference on the
element which is conveyed to the processor unit through output pins in form of current. The
gas sensor module consists of a steel exoskeleton under which a sensing element is housed.
This sensing element is subjected to current through connecting leads. This current is known
as heating current through it, the gases coming close to the sensing element get ionized and
are absorbed by the sensing element. This changes the resistance of the sensing element
which alters the value of the current going out of it.

3.3.4 Features

 High sensitivity to LPG, natural gas , town gas


 Small sensitivity to alcohol, smoke.
 Fast response

KIET Page 39
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

 Stable and long life


 Simple drive circuit
3.3.5 Specifications:

 Supply Voltage: 5V
 Detecting concentration :200-10000ppm LPG,LNG,Natural gas,Iso-butane
 Analog and Digital Output
 Digital Out is High or Low based on a adjustable preset threshold.

A. Standard work condition


Symbol Parameter name Technical condition Remarks
VH Heating voltage 5V±0.1 AC OR DC
Vc Circuit voltage 5V±0.1 AC OR DC
PL Load resistance 20KΩ

RH Heater resistance 31±10% Room Tem


PH Heating consumption less than 800mw

B. Environment condition
Symbol Parameter name Technical condition Remarks

Tao Using Tem -10℃-45℃


Tas Storage Tem -20℃-70℃

RH Related humidity less than 95%Rh


O2 Oxygen concentration 21%(standard minimum value is
condition)Oxygen over 2%
concentration can
affect sensitivity

C. Sensitivity characteristic
Symbol Parameter name Technical parameter Remarks

Rs Sensing 30KΩ-200KΩ Detecting


Resistance (100ppm NH3 ) concentration
scope:
α Concentration ≤0.65 10ppm-300ppm
(200/50) Slope rate NH3
10ppm-1000ppm
NH3 Benzene
10ppm-300ppm
Standard Temp: 20℃±2℃ Vc:5V±0.1 Alcohol
Detecting Humidity: 65%±5% Vh: 5V±0.1

KIET Page 40
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Condition
Preheat time Over 24 hour

D. Structure and configuration, basic measuring circuit


Parts Materials

1 Gas sensing layer SnO2

2 Electrode Au

3 Electrode line Pt

4 Heater coil Ni-Cr alloy

5 Tubular ceramic Al2O3

6 Anti-explosion network Stainless steel gauze


(SUS316 100-mesh)
7 Clamp ring Copper plating Ni

8 Resin base Bakelite

9 Tube Pin Copper plating Ni

Fig 3.13: Structure and configuration of MQ-135 gas sensor

Fig: Electric parameter measurement circuit

KIET Page 41
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Structure and configuration of MQ-5 gas sensor is shown as Fig. 1 (Configuration A or B),
sensor composed by micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive layer,
measuring electrode and heater are fixed into a crust made by plastic and stainless steel net.
The heater provides necessary work conditions for work of sensitive components. The
enveloped MQ-5 have 6 pin ,4 of them are used to fetch signals, and other 2 are used for
providing heating current. Electric parameter measurement circuit is shown as Fig.2
E. Sensitivity characteristic curve

Fig.3 is shows the typical dependence of the MQ-5 on temperature and humidity. Ro: sensor
resistance at 1000ppm of H2 in air at 33%RH and 20 degree. Rs: sensor resistance at
different temperatures and humidities.

KIET Page 42
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Fig.4 is shows the typical sensitivity characteristics of the MQ-5 for several gases. in
their: Temp: 20℃,Humidity: 65%、 O2 concentration 21% RL=20Kω Ro: sensor resistance
at 1000ppm of H2 in the clean air. Rs:sensor resistance at various concentrations of gases.
3.3.6 SENSITIVITY ADJUSTMENT
Resistance value of MQ-5 is difference to various kinds and various concentration
gases. So, When using this components, sensitivity adjustment is very necessary. we
recommend that you calibrate the detector for 1000ppm H2 or LPG concentration in air and
use value of Load resistance ( RL) about 20 KΩ(10KΩ to 47KΩ). When accurately
measuring, the proper alarm point for the gas detector should be determined after considering
the temperature and humidity influence.
3.3.7 Application
They are used in gas leakage detecting equipments in family and industry, are suitable for
detecting of LPG, natural gas , town gas, avoid the noise of alcohol and cooking fumes and
cigarette smoke.

3.4 GPS (SKM58)


The SkyNav SKM58 Series with embedded GPS antenna enables high performance
navigation in the most stringent applications and solid fix even in harsh GPS visibility

KIET Page 43
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

environments. It is based on the high performance features of the MediaTek 3329 single-chip
architecture, Its –165dBm tracking sensitivity extends positioning coverage into place like
urban canyons and dense foliage environment where the GPS was not possible before. The 6-
pin UART connector design is the easiest and convenient solution to be embedded in a
portable device and receiver like PND, GPS mouse, car holder, personal locator, speed
camera detector and vehicle locator.
GPS or Global Positioning System is a satellite navigation system that furnishes
location and time information in all climate conditions to the user. GPS is used for navigation
in planes, ships, cars, and trucks also. The system gives critical abilities to military and
civilian users around the globe. GPS provides continuous real-time, 3-dimensional
positioning, navigation and timing worldwide.

3.14 Fig: SKM558 module

3.15 Fig: Pin Assignment of SKM58

Pin Pin name I/O Description Remark


No.
UART Port
1 VCC P Module Power Supply VCC: 3.0~4.2V
2 GND G Module Power Ground Reference Ground
3 VBAT O RTC and backup SRAM power (2.0- May be connect to Battery
4.2V)
KIET Page 44
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

4 TXD O TTL:3.1V≥VOH≥2.4V - Strap pin, default MUST pull


5 RXD I TTL: 3.6V≥VIH ≥2.0V -0.3V≤VIL
0.3V≤VOL≤0.4V up
Leave Open if not used
6 PPS O ≤0.8V
Time pulse Signal (Default 100ms Leave Open if not used
pulse/sec)
3.4.4 WORKING PRINCIPLE:
The working/operation of the Global positioning system is based on the ‘trilateration’
mathematical principle. The position is determined from the distance measurements to
satellites. From the figure, the four satellites are used to determine the position of the
receiver on the earth. The target location is confirmed by the 4th satellite. And three
satellites are used to trace the location place. A fourth satellite is used to confirm the target
location of each of those space vehicles. The global positioning system consists of satellite,
control station and monitor station and receiver. The GPS receiver takes the information
from the satellite and uses the method of triangulation to determine a user’s exact position.
3.4.5 Features
 Ultra high sensitivity: -165dBm
 22 tracking/66 acquisition-channel receiver
 WAAS/EGNOS/MSAS/GAGAN support
 AGPS support
 NMEA protocols (default speed: 9600bps)
 One serial port
 Embedded patch antenna 12*12*4 mm
 Operating temperature range: -40 to 85℃
 RoHS compliant (Lead-free)
 Tiny form factor :20.5mm x12.8mm x 7.8mm
Parameter Specification
GPS receiver
Receiver Type L1 frequency band, C/A code, 22 Tracking / 66 Acquisition-
Sensitivity Channel
Tracking -165dBm
Acquisition -148dBm
Accuracy Position 3.0m CEP50 without SA(Typical Open
Velocity Sky)0.1m/s without SA
Timing (PPS) 60ns RMS

KIET Page 45
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Acquisition Time Cold 36s


Start 33s
Warm 1s
Start Hot <1s
Power Consumption Tracking 40mA @3.3V Typical
Start 45mA
Acquisition
Re-Acquisition
Sleep/Standby @3.3V
Navigation Data Update Rate 1Hz TBD

Operational Limits Altitude Max 18,000m


Velocity Max 515m/s
Acceleration Less than 4g
Antenna Specifications
Outline Dimension 12 x 12 x 4.0 mm
Center Frequency 1575 ± 3 MHz
Bandwidth 10 MHz min
Impedance 50 Ω
Axial Ratio 3 dB max
Polarization RHCP
Mechanical requirements
Dimension 20.5mm x12.8mm x 7.8mm
Weight 6g
Power consumption
VCC 3.0~4.2V
Current 45mA(typical)
Environment
Operating temperature -40 ~ +85℃
Storage temperature -40 ~ +125℃

3.4.6 Hardware Interfaces Configuration


Power Supply:
Regulated power for the SKM58 series is required. The input voltage Vcc should
be 3.0V~4.2V, current is no less than 150mA. Suitable decoupling must be provided by
external decoupling circuitry(10uF and 1uF). It can reduce the Noise from power supply
and increase power stability.
UART Ports:
The module supports one full duplex serial channels UART. The serial
connections are at2.85V LVTTL logic levels, if need different voltage levels, use

KIET Page 46
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

appropriate level shifters. the data format is however fixed: X, N, 8, 1, i.e. X baud rate,
no parity, eight data bits and one stop bit, no other data formats are supported, LSB is
sent first. The modules default baud rate is set up 9600bps. The RXD0 & TXD0
recommended to pull up (10KΩ). It can increase the stability of serial data.
Mechanical Specification

Figure3.16 : SKM58 Series Dimensions


Software Protocol
NMEA 0183 Protocol
The NMEA protocol is an ASCII-based protocol, Records start with a $ and with
carriage return/line feed. GPS specific messages all start with $GPxxx where xxx is a three-
letter identifier of the message data that follows. NMEA messages have a checksum, which
allows detection of corrupted data transfers. The SkyNav SKG12A supports the following
NMEA-0183 messages: GGA, GLL, GSA, GSV, RMC VTG, ZDA. The module default
NMEA-0183 output is set up GGA、GSA、RMC、GSV , and default baud rateis set up
9600bps.

Table : NMEA-0183 Output Messages

NMEA Description Default


GGARecord Global positioning system fixed data Y
GLL Geographic position—latitude/longitude N
GSA GNSS DOP and active satellites Y
GSV GNSS satellites in view Y
RMC Recommended minimum specific GNSS Y
data

KIET Page 47
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

VTG Course over ground and ground speed N


ZDA Date and Time N

GGA-Global Positioning System Fixed Data


Table : GGA Data Format

Name Example Units Description


Message ID $GPGGA GGA protocol header
UTC Position 021514.000 hhmmss.sss
Latitude 2232.1799 ddmm.mmmm
N/S indicator N N=north or S=south
Longitude 11401.1823 dddmm.mmmm
E/W Indicator E E=east or W=west
Position Fix Indicator 1 See Table 2-1
Satellites Used 6 Range 0 to 12
HDOP 1.25 Horizontal Dilution of Precision
MSL Altitude 84.0 meters Altitude (referenced to the
AltUnit M meters Ellipsoid)Unit
Altitude
GeoSep -2.2 meters Geoidal Separation
GeoSepUnit M meters Geoidal Separation Unit
Age of Diff.Corr. <Null> second Null fields when it is not Used
Diff.Ref.Station ID <Null> Null fields when it is not Used
Checksum *74
EOL <CR> <LF> End of message termination

Table : Position Fix Indicators


Value Description
0 Fix not available or invalid
1 GPS SPS Mode, fix valid
2 Differential GPS, SPS Mode, fix valid
3 GPS PPS Mode, fix valid

Table : GSV Data Format


Name Example Units Description
Message ID $GPGSV GSV protocol header
Number of Message 3 Total number of GSV sentences
Message Number 1 (Range 1 number
Sentence to 3) of the total
Satellites in View 12 (Range 1oftosatellites
Number 3) in view
Satellite ID 15 Channel 1(Range 01 to 32)
Elevation 79 degrees Channel 1(Range 00 to 90)
Azinmuth 333 degrees Channel 1(Range 000 to 359)
SNR(C/NO) 42 dB-Hz Channel 1(Range 00 to 99, null
… … not tracking)
when

KIET Page 48
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Satellite ID 02 Channel 4(Range 01 to 32)


Elevation 36 degrees Channel 4(Range 00 to 90)
Azimuth 124 degrees Channel 4(Range 000 to 359)
SNR(C/NO) 30 dB-Hz Channel 4(Range 00 to 99, null
Checksum *7E when not tracking)
EOL <CR> <LF> End of message termination

Depending on the number of satellites tracked multiple messages of GSV data may be
required

3.4.7 Applications
 LBS (Location Based Service)
 Vehicle navigation system
 PND (Portable Navigation Device)
 GPS mouse and Bluetooth GPS receiver
 Timing application

3.5 POWER SUPPLY

3.17 Fig :Battery Supply


The easiest way to provide a voltage source for an electronic circuit is to include
a battery. It is used to provide voltage supply to start any electronic circuit.

KIET Page 49
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

CHAPTER 4
SOFTWARE TOOLS

In the current project used some important software tools that are embedded with
hardware to perform particular task. Some of the tools used to interface the physical modules
of the circuit and some of the tools used to perform the tasks with respect to given commands
with collaboration of the hardware. The tools details and their usage details in our project are
given bellow.
FIRMWARE TOOLS USED FOR DEVELOPMENT
In our project surveillance and security using Raspberry pi software tools plays a
vital role and the software modules used are:

 Raspbian Os
 Win32 Diskimager Software
 Python IDE
 Thinkspeak

The Raspberry Pi gets the first half of its name from a long-standing tradition of
using fruit to name new computing systems from classic microcomputers like the Acorn,
Apricot and Tangerine to more recognisably modern brands including Apple and
BlackBerry but the second half comes courtesy of the Python programming language. The
majority of modern Linux distributions are user-friendly, with a graphical user interface
(GUI) that provides an easy way to perform common tasks. It is, however, quite different
from Windows, so we are going to get the most of the Raspberry Pi with Linux OS.

KIET Page 50
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI


4.1 To set up your Raspberry Pi you will need:
1. SD card:
Minimum size 4Gb; class 4 (the class indicates how fast the card is). We
recommend using branded SD cards as they are more reliable.
2. HDMI to HDMI / DVI lead:
HDMI to HDMI lead (for HD TVs and monitors with HDMI input).OR HDMI
to DVI lead (for monitors with DVI input).Leads and adapters are available for few
pounds .there is no need to buy expensive ones.
3. RCA video lead:
A standard RCA composite video lead to connect to your analogue display if
you are not using the HDMI output.
4. Keyboard and mouse:
Any standard USB keyboard and mouse should work. Keyboards or mice that
take a lot of power from the USB ports, however, may need a powered USB hub. This
may include some wireless devices.
5. Ethernet (network) cable [optional]:
Networking is optional, although it makes updating and getting new software
for your Raspberry Pi much easier.
6. Power adapter:
A good quality, micro USB power supply that can provide at least 700mA at
5V is essential. Many mobile phone chargers are suitable check the label on the plug.

KIET Page 51
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

If your supply provides less than 5V then your Raspberry Pi may not work at all, or it
may behave erratically. Be wary of very cheap chargers: some are not what they claim
to be. It does not matter if your supply is rated at more than 700mA.
7. Audio lead [optional]:
If you are using HDMI then you will get digital audio via this. • If you are
using the analogue RCA connection, stereo audio is available from the 3.5mm jack
next to the RCA connector.

4.1.2 Preparing your SD card for the Raspberry Pi:


The SD card contains the Raspberry Pi’s operating system (the OS is the software
that makes it work, like Windows on a PC or OSX on a Mac). This is very different from
most computers and it is what many people find the most daunting part of setting up their
Raspberry Pi. It is actually very straightforward— just different! The following instructions
are for Windows users. Linux and Mac users can find instructions at
www.raspberrypi.org/downloads
1. Download the Raspberry Pi operating system The recommended OS is
called Raspbian. Download it here:
http://downloads.raspberrypi.org/images/raspbian/2012-12-16-wheezy-
raspbian/2012-12-16-wheezy-raspbian.zip
2. Unzip the file that you just downloaded
a) Right click on the file and choose “Extract all”.
b) Follow the instructions—you will end up with a file ending in .img.
This .img file can only be written to your SD card by special disk imaging
software.
3. Download the Win32DiskImager software
a) Download win32diskimager-binary.zip (currently version 0.6) from:
https://launchpad.net/win32-image-writer/+download
b) Unzip it in the same way you did the Raspbian .zip file
c) You now have a new folder called win32diskimager-binary You are
now ready to write the Raspbian image to your SD card.
4. Writing Raspbian to the SD card
a) Plug your SD card into your PC
b) In the folder you made in step 3(b), run the file named
Win32DiskImager.exe (in Windows Vista, 7 and 8 we recommend that you

KIET Page 52
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

right-click this file and choose “Run as administrator”). You will see
something like this:

c) If the SD card (Device) you are using isn’t found automatically then
click on the drop down box and select it
d) In the Image File box, choose the Raspbian .img file that you
downloaded

e) Click Write
f) After a few minutes you will have an SD card that you can use in
your Raspberry Pi.
5. Booting your Raspberry Pi for the first time
 Follow the Quick start guide on page 1
 On first boot you will come to the Raspi-config window
 Change settings such as timezone and locale if you want
 Finally, select the second choice: expand_rootfs and say ‘yes’ to a
reboot
 The Raspberry Pi will reboot and you will see raspberrypi login:
 Type: pi
 You will be asked for your Password
 Type: raspberry
 You will then see the prompt: pi@raspberry ~ $
 Start the desktop by typing: startx
 You will find yourself in a familiar-but-different desktop environment.

KIET Page 53
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Python is a fantastic language for programming the Pi, thanks to its ease of use and a ccess
to hardware, including GPIO. In this how-to article, we will look at how to run Python
programs on the Pi.
Things You Will Need

 Raspberry Pi
 Raspbian OS on SD card
 HDMI monitor
 Keyboard and mouse
4.1.3 Notes About Python Libraries

It appears that, on Raspbian, a Python program that needs external libraries may
not work using all the methods listed below. Installing additional libraries can be done
using PIP, but these seem to only install libraries for programs running in the terminal
window. This may be due to the fact that the Python IDE programs have their own local
copy of Python. Therefore, it is recommended that you use the terminal window to run
Python programs that require external libraries installed using PIP.

4.1.4 Running Program via Terminal

Python programs can be executed using a terminal window, but before we


open the terminal, we need to know the full path to the Python program. For this
example, my Python program is located in Documents > Python > Main.py.

KIET Page 54
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Fig4.18: opening linux terminal

Fig4.19: Running code through terminal

Open a terminal window and use the “cd” command to change the working
directory to the directory that contains your Python program. I used the following
command:

cd Documents/Python

KIET Page 55
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

To confirm that your Python program resides in this directory, you can use the command
“dir”, and this will list all files and folders in that directory. If your Python program is
not listed in the list of files, you will need to go back and find where your Python
program resides.

At this point, we can now execute the Python program by using the “python” command.
This command will execute the Python file that is stated after the command, as shown
here:

python yourfilename.py

Or, if your file contains spaces, it will be:

python “your file name.py”

4.1.5 Running Programs via Python IDE

Raspbian comes with a number of IDEs for programming, and one of these IDEs is the
official Python IDE. To open this, click the Raspbian logo and then navigat e to
Programming > Python 3 (IDLE).

With the IDE loaded, click File > Open and then navigate to your Python program.

When the file opens, you can run the program by clicking Run > Run Module or by
pressing F5 on the keyboard.

Fig4.20: open python shell

KIET Page 56
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Fig4.21: create a python file and code

Fig4.22:run code

KIET Page 57
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Fig4.23: result in python shell

4.1.6 Running Program via Thonny

Thonny is another Python IDE that boasts a number of features, including a powerful
debugger that can be used to step through code and watch variables. This IDE can also be
used to run Python programs. First, click the Raspbian logo and then navigate to
Programming > Thonny Python IDE.

In the IDE, click File > Open and then navigate to your Python program. With the
program loaded, click Run > Run current script.

4.1.7 Conclusion

There are a number of ways to run Python programs on the Raspberry Pi. As stated
before, some of these other methods may have issues with missing libraries, which is why
it is recommended to run Python programs using the terminal window. Executing Python
programs can also be done using SSH, and this method is identical to the terminal
method.

4.2 THINGSPEAK
ThingSpeak is an IoT analytics platform service from MathWorks, the makers of
MATLAB and Simulink. ThingSpeak allows you to aggregate, visualize, and analyze live
data streams in the cloud. It provides instant visualizations of data posted by your devices or
equipment. Execute MATLAB code in ThingSpeak, and perform online analysis and

KIET Page 58
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

processing of the data as it comes in. ThingSpeak accelerates the development of proof-of-
concept IoT systems, especially those that require analytics. You can build IoT systems
without setting up servers or developing web software. For small- to medium-sized IoT
systems, ThingSpeak provides a hosted solution that can be used in production.

Fig4.24: Working of ThingSpeak

4.2.1ThingSpeak Key Capabilities

It allows you to aggregate, visualize and analyze live data streams in the cloud. With
ThingSpeak, your data is stored in channels. Each channel stores up to 8 fields of data. You
can create as many channels as you need for your application.

4.2.2 Connect your hardware to Thing Speak:

Any internet connected device can be used for thingspeak .When sending data from
our devices or equipment, we can use native libraries for common embedded hardware
prototyping platforms like Arduino, ESP-8266,Particle and Raspberry Pi. You can also send
data to Thing Speak from machines or local gateways using a REST API or an MQTT API.
In addition, the following vendors have built integrations to Thing speak to make setup
much easier. LoRaWAN, Things Network, Senet, Libelium, Beckhoff, Particle

4.2.3 Access Your Data Both Online and Offline

ThingSpeak stores all the information you send it in one central location in the cloud,
so you can easily access your data for online or offline analysis. Your private data is

KIET Page 59
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

protected with an API key that you control. When you are logged in to your ThingSpeak
account, you can use the web to securely download the data stored in the cloud. You can also
programmatically read your data in CSV or JSON formats using a REST API call and the
appropriate API key. Your devices can also read data from a ThingSpeak channel by
subscribing to an MQTT topic. Import data from third-party web services including climate
data from NOAA, public utility data from local utility providers, and stock and pricing data
from financial providers. You can use that data together with the data you are collecting from
your devices and equipment to investigate correlations and develop predictive algorithms.

MATLAB users can import data stored in ThingSpeak into the MATLAB desktop
environment using the thingSpeak read function.

4.2.4 Remotely Visualize Sensor Data in Real Time

Thing Speak automatically charts the data that you send it, so you can remotely
monitor your devices or equipment from anywhere.View your data from any web browser or
mobile device. Share read only views of your data with the clients and colleagues that you
specify. Alternatively, you can use thingspeak to manage your data, and you can build your
front end for your clients and customers to log in to.

4.2.5 Control Devices Online with One Second Update Rates

With a commercial ThingSpeak license, you can send data to ThingSpeak as fast as
once every second. This not only enables near-real time monitoring of your devices, but it
allows you to set up control loops from the cloud. For example, you could configure
ThingSpeak to turn a light on when your motion sensor detects a person has walked into a
room. For applications that require faster response times, the best practice is to have the
control loop at the edge closer to the hardware.

4.2.6 Perform computations and build custom visualizations:

With the matlab engine built into thingspeak, you can perform calibrations, develop
analytics and transform your Iot data. You can also use the MATLAB engine built into
Thingspeak license, you can run Matlab calculations that last upto 60 seconds. A commercial
Thingspeak license also enables you to use MATLAB tooboxes for machine learning, signal
processing, system identification, and more with Thingspeak provided you have a license for
the toolbox.

KIET Page 60
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

4.2.7 Create Streaming Analytics, and Integrate with Your Systems


Operationalize your analytics using the Time Control and React apps. With the Time
Control App, you can schedule a computation to run once a day, once an hour, or as quickly
as once every 5 minutes. It is used for condition monitoring. You can monitor the data
coming in from your devices and set up an alert when the data indicates something may need
attention. For example, you could configure ThingSpeak to send an email when the humidity
on your plant floor exceeds a certain value. More broadly, your analyses can trigger events
that push data from ThingSpeak to other web applications like Salesforce via REST APIs.

4.3 MAIN PROGRAM :


import sys
import http.client, urllib.request, urllib.parse, urllib.error
import time
from GPS_API import *
import serial
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN) #Read output from Sensor 1
GPIO.setup(12, GPIO.IN) #Read output from Sensor 2

ser = serial.Serial("/dev/serial0") # Select your Serial Port


ser.baudrate = 9600 # Baud rate
ser.timeout = 0.5
sleep = 2 # how many seconds to sleep between posts to the channel

key = '<YOUR WRITE API KEY>' # Thingspeak Write API Key


msgdata = Message() # Creates a Message Instance

def upload_cloud():
temp = get_latitude(msgdata)
temp1 = get_longitude(msgdata)
sensor1 = get_sensor1();
sensor2 = get_sensor2();
params = urllib.parse.urlencode({'field1': temp,'field2': temp1,
'field3':sensor1,'field4':sensor2,'key':key })
headers = {"Content-typZZe": "application/x-www-form-urlencoded","Accept" :
"text/plain"}
conn = http.client.HTTPConnection("api.thingspeak.com:80")
try:
conn.request("POST", "/update", params, headers)
response = conn.getresponse()
print(("Lat:",temp))

KIET Page 61
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

print(("Long:",temp1))
print(("Sensor1:",sensor1))
print(("Sensor2:",sensor2))

print((response.status, response.reason))
conn.close()
except KeyboardInterrupt:
print("Connection Failed")

def get_sensor1():
status=GPIO.input(11)
return status

def get_sensor2():
status=GPIO.input(12)
return status

if __name__ == "__main__":
start_gps_receiver(ser, msgdata)
time.sleep(2)
ready_gps_receiver(msgdata)
while True:
upload_cloud()
time.sleep(sleep)

4.4 GPS-API KEY:

import threading
import pynmea2
import sys

class Message:
def __init__(self):
self.msg =''

# Gps Receiver thread funcion, check gps value for infinte times
def get_gps_data(serial, dmesg):
print("Initializing GPS\n")
while True:
strRead = serial.readline()
if sys.version_info[0] == 3:
strRead = strRead.decode("utf-8","ignore")
if strRead[0:6] == '$GPGGA':
dmesg.msg = pynmea2.parse(strRead)
else:
if strRead.find('GGA') > 0:
dmesg.msg = pynmea2.parse(strRead)

# API to call start the GPS Receiver

KIET Page 62
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

def start_gps_receiver(serial, dmesg):


t2 = threading.Thread(target=get_gps_data, args=(serial, dmesg))
t2.start()
print("GPS Receiver started")

# API to fix the GPS Receiver


def ready_gps_receiver(msg):
print("Please wait fixing GPS .....")
dmesg = msg.msg
while(dmesg.gps_qual != 1):
pass
print("GPS Fix available")

# API to get latitude from the GPS Receiver


def get_latitude(msg):
dmesg = msg.msg
return dmesg.latitude

# API to get longitude from the GPS Receiver


def get_longitude(msg):
dmesg = msg.msg
return dmesg.longitude

4.5 CLOUD TO WEBPAGE:

<!DOCTYPE html>
<html>
<head>
<title>shiyaztech</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script
src="https://maps.googleapis.com/maps/api/js?key=YOUR_Google_MAPS_API_KE
Y"></script>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

KIET Page 63
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

<script>

var map;
var x;
function loadmaps(){

$.getJSON("https://api.thingspeak.com/channels/THINKSPEAK_CHANNEL_ID/fiel
ds/1/last.json?api_key=THINKSPEAK_API_KEY", function(result){

var m = result;
x=Number(m.field1);
//alert(x);

});

$.getJSON("https://api.thingspeak.com/channels/THINKSPEAK_CHANNEL_ID/fiel
ds/2/last.json?api_key=THINKSPEAK_API_KEY", function(result){

var m = result;
y=Number(m.field2);

}).done(function() {

initialize();
});

}
window.setInterval(function(){
loadmaps();
}, 9000);
function initialize() {
//alert(y);
var mapOptions = {
zoom: 18,
center: {lat: x, lng: y}
};
map = new google.maps.Map(document.getElementById('map'),
mapOptions);

var marker = new google.maps.Marker({


position: {lat: x, lng: y},
map: map
});

var infowindow = new google.maps.InfoWindow({


content: '<p>Marker Location:' + marker.getPosition() + '</p>'
});

google.maps.event.addListener(marker, 'click', function() {

KIET Page 64
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

infowindow.open(map, marker);
});
}

google.maps.event.addDomListener(window, 'load', initialize);


</script>
</head>
<body>
<div id="map"></div>
</body>
</html>

KIET Page 65
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

CHAPTER-5
RESULTS

It is now important to monitor air pollution in real time in most of the urban areas.
This project is aimed at developing an IOT device which can monitor air pollution in real
time and log data to a remote server. Remote monitoring was facilitated using classical motes
in the past, which has some pitfalls like limited memory, processing speed and complex
programming strategies. By using Internet of Things and recording sensor data to a remote
server, the limitations of memory in the monitoring devices and manual collection of data
from the installed devices can be overcome. The IOT also helps monitoring the data in real
time.

Fig5.26: Proposed system

The air pollution monitoring device developed in this project is based on Raspberry
Pi. The Raspberry board connects with ThingSpeak platform using API key matching. As the
cities usually have Wi-Fi hotspots at most of the places, so the device can be easily installed
near any hotspot for its operation. The ThingSpeak is a popular IOT platform which is easy to
use and program. The sensor used for monitoring the air pollution is MQ-135 smoke sensor
and MQ5 gas sensor. The sensing of data and sending it to the ThingSpeak server using
interent connection is managed by the raspberry pi code. The Python code is written,
compiled and loaded to the Pi board.

KIET Page 66
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Fig 5.27:Initial analysis of Gas sensor

Fig5.28: Analysis of harmful gas

KIET Page 67
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

Fig5.29: vehicle position coordinates latitude and longitude

Fig5.30: location of vehicle in Google maps

KIET Page 68
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

CHAPTER 6
ADVANTAGES AND APPLICATIONS
6.1 ADVANTAGES
The advantages of the proposed system is
 Accessing the location of the vehicle round the clock

 Instant alerts to user and authorities concerned regarding the gases emitted
out to track pollution levels

 Low power consumption with high accuracy

 Cost-effective compared to other pollution tracking devices

 Efficient accident detection

 Alert the Users when harmful gases composition increase inside the
vehicle which is tough to track because of the air circulation 

 Easy setup and maintenance

 Easy to customize

6.2 APPLICATIONS
The location of the vehicle and graphs of different pollutants recorded are sent
straightforwardly to a cloud server, sent as Notifications with data and SMS alerts and
when the cloud is not accessible then the information is stored locally on the
Raspberry Pi and sent when the association resumes. Therefore, advantages like these
make this application perfect for smart security surveillance, tracking and monitoring
pollutants inside the car and from the vehicle where ever the manual checking is a big
concern and required security an alert system with instant notifications such as in
huge vehicle like Trucks, trains and cars. This system can be best utilized. Some of
the application areas of this system is given below.
1. Industrial pollutants tracking
2. Gaseous compositions present inside the home
3. Heavy air conditioned rooms gases tracking
4. Light motor vehicles which use fossil fuel

5. Vehicle Indoor Air Quality (VIAQ)

KIET Page 69
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

CHAPTER 7
CONCLUSION

Hence IoT based smart surveillance system using Raspberry pi has been successfully
designed and implemented which is capable of recording the level of pollutants emitted
inside and outside of the Vehicles and the same has been uploading to cloud service
ThingSpeak if it is not available then stores locally on Raspberry Pi storage. At the same
time, notifications and alerts are send to the user of the vehicle and Authorities of the
pollution control board.

Live data calculating is also provided to monitor continuously. It is advantageous as it


offers reliability and privacy on both sides. It is authenticated and encrypted on the receiver
side hence it offers only the person concerned to view the details. Necessary action can be
taken in a short period in the case of emergency conditions such as industrial areas, offices,
mining areas, homes and huge air-conditioned environment.

KIET Page 70
ADVANCED VEHICLE TRACKING AND MONITORING USING RASPBERRY PI

CHAPTER 8
FUTURE SCOPE

Further extensions and feature enhancements are always inevitable in the present
generation trending technologies. As the future scope this system can be extended further by
adding the huge data sets collected can undergo through Big Data operations and huge
changes in pollution levels of cities can be brought under control, pollution-free spaces
around us can be known easily via a website or through a smart device. This further
decreases the health concerns of humans and improve the safe environment by adopting to
activities like Afforestation and using solar-powered transport system, for shorter distance
going for a walk,.By adding this additional system. Apart from this, we can interface
sensors like MEMS sensor, different Smoke sensors, and Fire sensors to give alerts
respectively.

KIET Page 71

Vous aimerez peut-être aussi