You are on page 1of 83

Arduino Based Smart LPG Gas Leakage Detector System

CHAPTER 1

INTRODUCTION

1.1 BACKGROUND

Gas is a leading source of energy used for cooking and heating in our homes. It provide an
economical and clean source of energy compared to other source of energy like firewood. It is also
used as a source of energy in industry and fueling our cars. The two major type of gas used are
Natural Gas and Liquefied Petroleum Gas(LPG) both of which are hydrocarbons gas. Natural Gas
is basically methane gas while LPG gas is a mixture of butane and propane gas or purely butane
or propane gas. Natural gas is extracted from underground while LPG gas is a by-product of
Natural Gas and crude oil processing. These gases have a characteristic of being highly flammable
and can cause suffocation in high concentration. It is because of this, the usage of gases should be
done with great care and safety standards are put in place to ensure everyone using the gas is safe.
Gas used for cooking is supplied in gas cylinders which have a regulating valve. After using the
gas you are supposed to turn off the gas. The supplier of the gas should make sure the valve are
working well and not leaking the gas. Observation of the safety standards would avoid the dangers
posed by the gas. However, systems made by human being are bound to fail at one point due to
wearing out, accident or by intention. Also by accident, we might forget to turn off the gas. This
poses an immediate danger to life and property due to the flammable and intoxicating nature of
the gas. As an engineer, it is a lifesaving task to design a LPG gas detector capable of raising an
alarm and showing the concentration of the gas leakage and also intimating the fire station about
the gas leakage when gas leakage concentration reaches a dangerous level. Thus we are going to
design a project to avoid the accidents due to LPG gas leakage by using Arduino, GPS module,
GSM module.

1.2 NEED OF THE HOUR

Over the past decade, there is a substantial increase in our country’s LPG consumption. It
was reported that India’s total LPG consumption in 2002-03 is 8.157 million tons but now it is
estimated that the country’s LPG consumption to be at 23.5 million tons for fiscal 2018[1,2]. This
increment is attributed to its high calorific value and eco-friendliness. It doesn’t contain Sulphur

DVR & Dr. HS MIC College of Technology 1


Arduino Based Smart LPG Gas Leakage Detector System

like other energy resources making it a cleaner fuel. Being clean fuel, Government has also
encouraged each and every household to use LPG as the primary fuel.

Although LPG has many advantages compared to other energy resources it poses a serious threat
if leakage happens. LPG is stored in steel cylinders under a very high pressure in liquid form and
when leakage happens it transforms to a gaseous state. LPG is heavier than air, so when leakage
happens the gas settles at low points in the room making it difficult to disperse. Moreover, it
replaces oxygen causing suffocation. If an ignition happens due to any spark, it leads to an
explosion. According to National Crime Records Bureau (NCRB), 3700 people have died in 2014-
15 due to fire accidents from Cooking Gas Cylinder or Stove Burst. Many gas accidents also takes
place because of not providing information to the fire stations in time. There was a decrement in
fire accidents due to LPG leakage by 15% from 2010 to 2014 [3]. This decline is a good sign but
accidents can be reduced further if we can employ some protection mechanism for fire accidents.

1.3 PROBLEM STATEMENT

To design and implement a Arduino based Smart LPG gas detector system capable of
giving an Buzzer alarm and tripping MCB to avoid accidents due to sparking of switches and also
sends the message alert and GPS location during LPG gas leakage. There will always be a risk of
gas leakage whenever we are using the gas. If the leakage of the gas goes undetected it leads to
undesirable consequences. I have witnessed one case of a neighbor’s house being destroyed by fire
caused by gas leakage. Gas leakage also pollute the environment called greenhouse effect. In the
light of this, a LPG gas leakage detector can help so much in alleviating this problem. LPG gas is
odorless and a small amounts of a pungent gas such as Ethanethiol is added to help people smell a
gas leakage. However this is not reliable as you may not smell the gas hence the need for a gas
leakage detector.

One such kind of system is our Arduino based smart LPG Gas Detector system. This
system also consists of light indicator and also fan to send out the gas leaked and MCB tripping
Mechanism to avoid sparking of switches. It is also capable of sending the GSM alert and GPS
location to the fire station. The success of designing this Arduino based smart LPG gas leakage
detector system will help to efficiently detect the leakage of LPG gas and avoid risk of fire and
pollution, saving life and property.

DVR & Dr. HS MIC College of Technology 2


Arduino Based Smart LPG Gas Leakage Detector System

1.4 PROJECT OBJECTIVES

1.4.1 OVERALL OBJECTIVE

To design a Arduino Based Smart LPG gas detector system capable of giving audio visual
alarm and providing Protection mechanism for avoiding the fire accidents during LPG gas leakage.

1.4.2 SPECIFIC OBJECTIVES


 To detect LPG gas leakage using a LPG gas sensor MQ-6.
 To switch on the light indicator and Exhaust fan if the gas leakage is detected.
 To switch on the buzzer alarm indicating the LPG leakage.
 To trip the MCB when LPG leakage happens for avoiding electric spark from the switches.
 To send an SMS alert to the owner about the leakage when the LPG is leaked.
 To send the GPS location to the fire station when the concentration of leaked gas reaches
the dangerous value.

DVR & Dr. HS MIC College of Technology 3


Arduino Based Smart LPG Gas Leakage Detector System

CHAPTER 2

LITERATURE REVIEW

2.1 INTRODUCTION

LPG gas is the main gas fuel used for cooking and other heating appliances. This is because
it is a stable, high energy content, relatively low Sulphur, clean burning fuel which can be
transported economically as a liquid[1].It is a by-product of crude oil and Natural Gas
processing[2].

LPG is primarily composed of propane, butane, isobutane or a mixtures of these gases[2].


It is stored in gas cylinders as liquid under relatively low pressure. It has low boiling point and it
will vaporize immediately it is released into the air. It is relatively heavier compared to air. When
it leaks, it will tend to flow close to the ground and settle in low lying places in the premises if
there is no adequate air ventilation. LPG gas is highly flammable gas with Lower Explosive Limits
of about 1.4% that is about 14,000PPM.This is the property of LPG that makes us worried when
using the gas.

2.2 GAS SENSOR

2.2.1 GAS SENSORS

They are used to detect the presence of hazardous gases in the air as a part of safety system
or air monitoring system. They are classified according to the operation mechanism:
Semiconductor gas sensor, Catalytic gas sensor, Electrochemical gas sensor, Solid electrolyte gas
sensor, Thermal conductor gas sensor, Infrared point gas sensors, etc. [5, 6].

The different types of gas sensors are available as MX series (X = Q, C, E, etc.) in the
market. These different series of gas sensors have different type of operation in detecting the target
gases and are used in various different applications. The different series of gas sensors are
mentioned in the below table fig-2.1, they are MQ,ME,MC,MG,MD,MP series of gas sensors.

DVR & Dr. HS MIC College of Technology 4


Arduino Based Smart LPG Gas Leakage Detector System

Series Type of Gas Sensor

MQ Semiconductor

MC Catalytic

ME Electrochemical

MG Solid Electrolyte

MD Thermal Conductor

MP Flat-surfaced

Table 2.1- Different series of Gas Sensors

2.2.2 SEMICONDUCTOR GAS SENSORS (MQ SERIES)

They are relatively inexpensive to manufacture due to their simplicity and scalability. For
example, there exists different sensor for low concentration and high concentration applications
[7]. Considering which, we have employed MQ series sensor in the project. These MQ series
sensors detect gases by a chemical reaction that takes place when the gas comes in direct contact
with the sensor.

A semiconductor gas sensor is made up of sensing element, sensor base, and sensor cap.
The sensor cap act as a filter for outside particle smoke and moisture. The sensing element contains
sensing material and heater to heat up the sensing element. The sensing element varies depending
on the target gas

Fig 2.1- Semiconductor Gas Sensor

DVR & Dr. HS MIC College of Technology 5


Arduino Based Smart LPG Gas Leakage Detector System

MQ Target Gas

Series

MQ-2 General combustible gas

MQ-3B Alcohol

MQ-4 Natural gas, Methane

MQ-5B LPG, Natural gas, Coal gas

MQ-6 LPG, Propane

MQ-7B Carbon Monoxide

MQ-8 Hydrogen

MQ-9B CO and Combustible Gas

MQ-131 Ozone

MQ-135 Ammonia, Benzene, Smoke

MQ-136 Sulphurated Hydrogen

MQ-137 Ammonia

MQ-138 Benzene, Aldehyde, Ketone, Ester

Table 2.2–Different Series Of Semiconductor Gas Sensor(MQ-series)

DVR & Dr. HS MIC College of Technology 6


Arduino Based Smart LPG Gas Leakage Detector System

2.2.3 OPERATING PRINCIPLE OF MQ-6 SENSOR

The Figure - shows a photo of MQ-6 sensor. In clean air, the sensor has a high resistance
and in presence of a gas the sensor conductivity increases. The sensor has a simple drive circuit
shown in Figure 2.2.The sensor is driven from a 5V supply. A voltage (heating voltage) is applied
between Pin 2 and 5 with a resistance of 26 ± 3Ω to heat the sensor to the working temperature[6].

When Tin Oxide is pre-heat in presence of oxygen, oxygen is adsorbed on the crystal
surface with negative charges. The donor electrons on the crystal are transferred to the absorbed
oxygen thus leaving positive charges in a space charge layer. This create a surface potential which
acts as potential barrier against electrons flow hence the high resistance of the sensor in clean
air[7].

In presence of reducing gas such as LPG, the gas molecules are adsorbed on the material
surface reducing the surface density of the negatively charged Oxygen ions thus increasing
concentrations of electrons and the conductivity of the sensor[7].[4]

Fig 2.2-MQ-6 sensor

Therefore, as the gas concentration increase the conductivity of the sensor will increase
and so does the sensor output voltage. However, this relationship is not linear and Figure 2.5
describe this relationship[6].

This sensor resistance is between pins 6&4 and 1&3 and a loop voltage is applied between
the series of the sensor resistance and the load resistanceıı. The sensor output voltage is the voltage
across the load resistance.

DVR & Dr. HS MIC College of Technology 7


Arduino Based Smart LPG Gas Leakage Detector System

The load resistance is used to change the sensitivity of the sensor. A very high resistance,
reduce the sensor sensitivity and small changes in the concentration of the gas would not be
noticed. MQ-6 sensor has a load resistance of 4.7K

Fig 2.3 MQ-6 Sensor Sensitivity Curve

The sensor detect the gas concentration from a range of 300-10,000PPM. The sensitivity
curve of the sensor form the basis for setting the alarm trigger level and the amount of gas
concentration for a given voltage. From the curve, the sensor has an output voltage of 2.0V at 300
PPM and thus the trigger level is 2.0V. When the input voltage to the MCU is equal to or more
than 2.0V, the MCU starts the audiovisual alarm. Although the relation between gas concentration
and sensor voltage is not linear, there are ranges of sensor output voltage with constant gradient
i.e. between 2.0V and 2.5V, for every increase of 20 PPM in gas concentration there is an increase
of 0.1V. Thus gas concentration for any other voltage is through extrapolation from the known
values of sensor voltage and gas concentration from Figure 2.3.

2.3 16X2 LCD DISPLAY-JHD 162A

The Hitachi HD44780 controlled 16*2 LCD will be used for display of the gas
concentration. This LCD displays alphanumeric characters (letters, numbers and symbols) which

DVR & Dr. HS MIC College of Technology 8


Arduino Based Smart LPG Gas Leakage Detector System

can be used to convey adequate information concerning the gas concentration status. The fact that
it is built around the JHD 162A controller makes the LCD a smart device. The LCD has controls
lines and data lines which makes it possible to send information for displaying on the LCD by
putting the controls lines and data lines high or low. Therefore, the LCD can be interfaced to the
microcontroller pins and information be sent to the LCD.

Fig 2.4- 16x2 LCD Module JHD 162A

Several different LC technologies exists. “supertwist” types, for example, offer Improved
contrast and viewing angle over the older “twisted neumatic” types. Some modules are available
with back lighting, so that they can be viewed in dimly-lit conditions. The back lighting may be
either “electro-luminescent”, requiring a high voltage inverter circuit, or simple LED illumination.

2.3.1 16×2 LCD MODULE PIN OUT DIAGRAM

The JHD162A LCD module has 16 pins and can be operated in 4-bit mode or 8-bit mode.
Here we are using the LCD module in 4-bit mode

Before going in to the details of the project, let’s have a look at the JHD162A LCD
module.The schematic of a JHD162A LCD pin diagram is given below.

Fig 2.5–pin diagram of 16x2 LCD module

DVR & Dr. HS MIC College of Technology 9


Arduino Based Smart LPG Gas Leakage Detector System

The name and functions of each pin of the 16×2 LCD module are as follows

 Pin1(Vss):Ground pin of the LCD module.


 Pin2(Vcc): Power to LCD module (+5V supply is given to this pin) .
 Pin3(VEE):Contrast adjustment pin. This is done by connecting the ends of a 10K
potentiometer to +5V and ground and then connecting the slider pin to the VEE pin.

The voltage at the VEE pin defines the contrast. The normal setting is between 0
and 0.9V.

 Pin4(RS):Register select pin. The JHD162A has two registers namely command
registerand data register. Logic HIGH at RS pin selects data register and logic LOW at RS
pin selects command register.

If we make the RS pin HIGH and feed an input to the data lines (DB0 to DB7), this
input will be treated as data to display on LCD screen. If we make the RS pin LOW and
feed an input to the data lines, then this will be treated as a command ( a command to be
written to LCD controller – like positioning cursor or clear screen or scroll).

 Pin5(R/W): Read/Write modes. This pin is used for selecting between read and write
modes. Logic HIGH at this pin activates read mode and logic LOW at this pin activates
write mode.
 Pin6(E): This pin is meant for enabling the LCD module. A HIGH to LOW signal at this
pin will enable the module.
 Pin7(DB0) to Pin14(DB7): These are data pins. The commands and data are fed to the
LCD module though these pins.
 Pin15(LED+): Anode of the back light LED. When operated on 5V, a 560 ohm resistor
should be connected in series to this pin. In arduino based projects the back light LED can
be powered from the 3.3V source on the arduino board.
 Pin16(LED-): Cathode of the back light LED.

DVR & Dr. HS MIC College of Technology 10


Arduino Based Smart LPG Gas Leakage Detector System

2.4 ATMEGA 328P MICRO CONTROLLER

The Atmega328 is a very popular microcontroller chip produced by Atmel. It is an 8-bit


microcontroller that has 32K of flash memory, 1K of EEPROM, and 2K of internal SRAM.

The Atmega328 is one of the microcontroller chips that are used with the popular Arduino
development boards. The Arduino development board comes with either 1 of 2 microcontroller
chips, the Atmega168 or the Atmega328. Of these 2, the Atmega328 is the upgraded, more
advanced chip. Unlike the Atmega168 which has 16K of flash program memory and 512 bytes of
internal SRAM, the Atmega328 has 32K of flash program memory and 2K of Internal SRAM.

The Atmega328 has 28 pins.It has 14 digital I/O pins, of which 6 can be used as PWM
outputs and 6 analog input pins. These I/O pins account for 20 of the pins.

Fig 2.6- pinout Diagram for Atmega328

 As stated before, 20 of the pins function as I/O ports. This means they can function as an
input to the circuit or as output. Whether they are input or output is set in the software. 14

DVR & Dr. HS MIC College of Technology 11


Arduino Based Smart LPG Gas Leakage Detector System

of the pins are digital pins, of which 6 can function to give PWM output. 6 of the pins are
for analog input/output.
 of the pins are for the crystal oscillator. This is to provide a clock pulse for the Atmega
chip. A clock pulse is needed for synchronization so that communication can occur in
synchrony between the Atmega chip and a device that it is connected to.
 The chip needs power so 2 of the pins, Vcc and GND, provide it power so that it can
operate. The Atmega328 is a low-power chip, so it only needs between 1.8-5.5V of power
to operate.
 The Atmega328 chip has an analog-to-digital converter (ADC) inside of it. This must be
or else the Atmega328 wouldn't be capable of interpreting analog signals. Because there is
an ADC, the chip can interpret analog input, which is why the chip has 6 pins for analog
input. The ADC has 3 pins set aside for it to function- AVCC, AREF, and GND. AVCC is
the power supply, positive voltage, that for the ADC.
 The ADC needs its own power supply in order to work. GND is the power supply ground.
AREF is the reference voltage that the ADC uses to convert an analog signal to its
corresponding digital value. Analog voltages higher than the reference voltage will be
assigned to a digital value of 1, while analog voltages below the reference voltage will be
assigned the digital value of 0.
 The Atmega328 chip has an analog-to-digital converter (ADC) inside of it. This must be
or else the Atmega328 wouldn't be capable of interpreting analog signals. Because there is
an ADC, the chip can interpret analog input, which is why the chip has 6 pins for analog
input.
 Since the ADC for the Atmega328 is a 10-bit ADC, meaning it produces a 10-bit digital
value, it converts an analog signal to its digital value, with the AREF value being a
reference for which digital values are high or low. Thus, a portrait of an analog signal is
shown by this digital value; thus, it is its digital correspondent value.
 The last pin is the RESET pin. This allows a program to be rerun and start over.
 The ATMEGA328P is used mainly for Arduino UNO which is the first version of Arduino
board.

DVR & Dr. HS MIC College of Technology 12


Arduino Based Smart LPG Gas Leakage Detector System

Pin Number Description Function

1 PC6 Reset
2 PD0 Digital Pin (RX)
3 PD1 Digital Pin (TX)
4 PD2 Digital Pin
5 PD3 Digital Pin (PWM)
6 PD4 Digital Pin
7 Vcc Positive Voltage (Power)
8 GND Ground
9 XTAL 1 Crystal Oscillator
10 XTAL 2 Crystal Oscillator
11 PD5 Digital Pin (PWM)
12 PD6 Digital Pin (PWM)
13 PD7 Digital Pin
14 PB0 Digital Pin
15 PB1 Digital Pin (PWM)
16 PB2 Digital Pin (PWM)
17 PB3 Digital Pin (PWM)
18 PB4 Digital Pin
19 PB5 Digital Pin
20 AVCC Positive voltage for ADC (power)
21 AREF Reference Voltage
22 GND Ground
23 PC0 Analog Input
24 PC1 Analog Input
25 PC2 Analog Input
26 PC3 Analog Input
27 PC4 Analog Input
28 PC5 Analog Input

Table 2.3- pin description and function of ATMEGA 328P

DVR & Dr. HS MIC College of Technology 13


Arduino Based Smart LPG Gas Leakage Detector System

2.5 GSM MODULE

2.5.1 INTRODUCTION

GSM (Global System for Mobile communications) is a cellular network, which means that
mobile phones connect to it by searching for cells in the immediate vicinity. GSM networks operate
in four different frequency ranges. Most GSM networks operate in the 900 MHz or 1800 MHz
bands. Some countries in the Americas use the 850 MHz and 1900 MHz bands because the 900
and 1800 MHz frequency bands were already allocated.

The rarer 400 and 450 MHz frequency bands are assigned in some countries, where these
frequencies were previously used for first-generation systems.

GSM-900 uses 890–915 MHz to send information from the mobile station to the base
station (uplink) and 935–960 MHz for the other direction (downlink), providing 124 RF channels
(channel numbers 1 to 124) spaced at 200 kHz. Duplex spacing of 45 MHz is used. In some
countries the GSM-900 band has been extended to cover a larger frequency range. This 'extended
GSM', E-GSM, uses 880–915 MHz (uplink) and 925–960 MHz (downlink), adding 50 channels
(channel numbers 975 to 1023 and 0) to the original GSM-900 band. Time division multiplexing
is used to allow eight full-rate or sixteen half-rate speech channels per radio frequency channel.
There are eight radio timeslots (giving eight burst periods) grouped into what is called a TDMA
frame. Half rate channels use alternate frames in the same timeslot. The channel data rate is
270.833k bit/s, and the frame duration is 4.615 ms.

2.5.2 GSM ADVANTAGES

GSM also pioneered a low-cost, to the network carrier, alternative to voice calls, the Short
message service (SMS, also called "text messaging"), which is now supported on other mobile
standards as well. Another advantage is that the standard includes one worldwide Emergency
telephone number, 112. This makes it easier for international travelers to connect to emergency
services without knowing the local emergency number.

DVR & Dr. HS MIC College of Technology 14


Arduino Based Smart LPG Gas Leakage Detector System

2.5.3 THE GSM NETWORK:

GSM provides recommendations, not requirements. The GSM specifications define the
functions and interface requirements in detail but do not address the hardware. The GSM network
is divided into three major systems: the switching system (SS), the base station system (BSS), and
the operation and support system (OSS).

The GSM network is wide and it consists of many levels or subsystems in it. The systems
present in the GSM network are shown in below figure.

Fig 2.7- GSM Network diagram

DVR & Dr. HS MIC College of Technology 15


Arduino Based Smart LPG Gas Leakage Detector System

2.5.3.1 THE SWITCHING SYSTEM:

The switching system (SS) is responsible for performing call processing and subscriber-
related functions. The switching system includes the following functional units.

 HOME LOCATION REGISTER (HLR): The HLR is a database used for storage and
management of subscriptions. The HLR is considered the most important database, as it
stores permanent data about subscribers, including a subscriber's service profile, location
information, and activity status. When an individual buys a subscription from one of the
PCS operators, he or she is registered in the HLR of that operator.
 MOBILE SERVICES SWITCHING CENTER (MSC): The MSC performs the
telephony switching functions of the system. It controls calls to and from other telephone
and data systems. It also performs such functions as toll ticketing, network interfacing,
common channel signaling, and others.
 VISITOR LOCATION REGISTER (VLR): The VLR is a database that contains
temporary information about subscribers that is needed by the MSC in order to service
visiting subscribers.
The VLR is always integrated with the MSC. When a mobile station roams into a
new MSC area, the VLR connected to that MSC will request data about the mobile station
from the HLR. Later, if the mobile station makes a call, the VLR will have the information
needed for call setup without having to interrogate the HLR each time.
 AUTHENTICATION CENTER (AUC): A unit called the AUC provides authentication
and encryption parameters that verify the user's identity and ensure the confidentiality of
each call. The AUC protects network operators from different types of fraud found in
today's cellular world.
 EQUIPMENT IDENTITY REGISTER (EIR): The EIR is a database that contains
information about the identity of mobile equipment that prevents calls from stolen,
unauthorized, or defective mobile stations. The AUC and EIR are implemented as stand-
alone nodes or as a combined AUC/EIR node.

DVR & Dr. HS MIC College of Technology 16


Arduino Based Smart LPG Gas Leakage Detector System

2.5.3.2 THE BASE STATION SYSTEM (BSS):

All radio-related functions are performed in the BSS, which consists of base station
controllers (BSCs) and the base transceiver stations (BTSs).

 BSC: The BSC provides all the control functions and physical links between the MSC and
BTS. It is a high-capacity switch that provides functions such as handover, cell
configuration data, and control of radio frequency (RF) power levels in base transceiver
stations. A number of BSCs are served by an MSC.
 BTS: The BTS handles the radio interface to the mobile station. The BTS is the radio
equipment (transceivers and antennas) needed to service each cell in the network. A group
of BTSs are controlled by a BSC.

2.5.3.3 THE OPERATION AND SUPPORT SYSTEM

The operations and maintenance center (OMC) is connected to all equipment in the
switching system and to the BSC. The implementation of OMC is called the operation and support
system (OSS). The OSS is the functional entity from which the network operator monitors and
controls the system. The purpose of OSS is to offer the customer cost-effective support for
centralized, regional and local operational and maintenance activities that are required for a GSM
network. An important function of OSS is to provide a network overview and support the
maintenance activities of different operation and maintenance organizations.

2.5.4 GSM SPECIFICATIONS

Specifications for different personal communication services (PCS) systems vary


among the different PCS networks. Listed below is a description of the specifications and
characteristics for GSM.

 FREQUENCY BAND: The frequency range specified for GSM is 1,850 to 1,990 MHz
(mobile station to base station).

DVR & Dr. HS MIC College of Technology 17


Arduino Based Smart LPG Gas Leakage Detector System

 DUPLEX DISTANCE: The duplex distance is 80 MHz. Duplex distance is the distance
between the uplink and downlink frequencies. A channel has two frequencies, 80 MHz
apart.
 CHANNEL SEPARATION: The separation between adjacent carrier frequencies. In
GSM, this is 200 kHz.
 MODULATION: Modulation is the process of sending a signal by changing the
characteristics of a carrier frequency. This is done in GSM via Gaussian minimum shift
keying (GMSK).
 TRANSMISSION RATE: GSM is a digital system with an over-the-air bit rate of 270
kbps.
 ACCESS METHOD: GSM utilizes the time division multiple access (TDMA) concept.
TDMA is a technique in which several different calls may share the same carrier. Each call
is assigned a particular time slot.
 SPEECH CODER: GSM uses linear predictive coding (LPC). The purpose of LPC is to
reduce the bit rate. The LPC provides parameters for a filter that mimics the vocal tract.
The signal passes through this filter, leaving behind a residual signal. Speech is encoded at
13 kbps.

2.5.5 GSM SUBSCRIBER SERVICES

 DUAL-TONE MULTIFREQUENCY (DTMF): DTMF is a tone signaling scheme often


used for various control purposes via the telephone network, such as remote control of an
answering machine. GSM supports full-originating DTMF.
 FACSIMILE GROUP III—GSM supports CCITT Group 3 facsimile. As standard fax
machines are designed to be connected to a telephone using analog signals, a special fax
converter connected to the exchange is used in the GSM system. This enables a GSM–
connected fax to communicate with any analog fax in the network.
 SHORT MESSAGE SERVICES: A convenient facility of the GSM network is the short
message service. A message consisting of a maximum of 160 alphanumeric characters can
be sent to or from a mobile station. This service can be viewed as an advanced form of
alphanumeric paging with a number of advantages. If the subscriber's mobile unit is
powered off or has left the coverage area, the message is stored and offered back to the

DVR & Dr. HS MIC College of Technology 18


Arduino Based Smart LPG Gas Leakage Detector System

subscriber when the mobile is powered on or has reentered the coverage area of the
network. This function ensures that the message will be received.
 CELL BROADCAST: A variation of the short message service is the cell broadcast
facility. A message of a maximum of 93 characters can be broadcast to all mobile
subscribers in a certain geographic area. Typical applications include traffic congestion
warnings and reports on accidents.
 VOICE MAIL: This service is actually an answering machine within the network, which
is controlled by the subscriber. Calls can be forwarded to the subscriber's voice-mail box
and the subscriber checks for messages via a personal security code.
 FAX MAIL: With this service, the subscriber can receive fax messages at any fax
machine. The messages are stored in a service center from which they can be retrieved by
the subscriber via a personal security code to the desired fax number

2.5.6 SUPPLEMENTARY SERVICES

GSM supports a comprehensive set of supplementary services that can complement and
support both telephony and data services.

 CALL FORWARDING: This service gives the subscriber the ability to forward
incoming calls to another number if the called mobile unit is not reachable, if it is busy, if
there is no reply, or if call forwarding is allowed unconditionally.

 BARRING OF OUTGOING CALLS: This service makes it possible for a mobile


subscriber to prevent all outgoing calls.
 BARRING OF INCOMING CALLS: This function allows the subscriber to prevent
incoming calls. The following two conditions for incoming call barring exist: baring of all
incoming calls and barring of incoming calls when roaming outside the home PLMN.
 ADVICE OF CHARGE (AOC): The AoC service provides the mobile subscriber with
an estimate of the call charges. There are two types of AoC information: one that provides
the subscriber with an estimate of the bill and one that can be used for immediate charging
purposes. AoC for data calls is provided on the basis of time measurements.

DVR & Dr. HS MIC College of Technology 19


Arduino Based Smart LPG Gas Leakage Detector System

 HOLD: This service enables the subscriber to interrupt an ongoing call and then
subsequently reestablish the call. The call hold service is only applicable to normal
telephony.
 CALL WAITING: This service enables the mobile subscriber to be notified of an
incoming call during a conversation. The subscriber can answer, reject, or ignore the
incoming call. Call waiting is applicable to all GSM telecommunications services using a
circuit-switched connection.
 MULTIPARTY SERVICE: The multiparty service enables a mobile subscriber to
establish a multiparty conversation—that is, a simultaneous conversation between three
and six subscribers. This service is only applicable to normal telephony.
 CALLING LINE IDENTIFICATION PRESENTATION/RESTRICTION: These
services supply the called party with the integrated services digital network (ISDN) number
of the calling party. The restriction service enables the calling party to restrict the
presentation. The restriction overrides the presentation.
 CLOSED USER GROUPS (CUGS): CUGs are generally comparable to a PBX. They
are a group of subscribers who are capable of only calling themselves and certain numbers

2.5.7 MAIN AT COMMANDS

AT commands are instructions used to control a modem. AT is the abbreviation of


Attention. Every command line starts with "AT" or "at". That's why modem commands are called
AT commands. Many of the commands that are used to control wired dial-up modems, such as
ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state), are also
supported by GSM/GPRS modems and mobile phones. Besides this common AT command set,
GSM/GPRS modems and mobile phones support an AT command set that is specific to the GSM
technology, which includes SMS-related commands like AT+CMGS (Send SMS message),
AT+CMSS (Send SMS message from storage), AT+CMGL (List SMS messages) and AT+CMGR
(Read SMS messages).

Note that the starting "AT" is the prefix that informs the modem about the start of a
command line. It is not part of the AT command name. For example, D is the actual AT command

DVR & Dr. HS MIC College of Technology 20


Arduino Based Smart LPG Gas Leakage Detector System

name in ATD and +CMGS is the actual AT command name in AT+CMGS. However, some books
and web sites use them interchangeably as the name of an AT command.

Here are some of the tasks that can be done using AT commands with a GSM/GPRS
modem or mobile phone:

 Get basic information about the mobile phone or GSM/GPRS modem. For example, name
of manufacturer (AT+CGMI), model number (AT+CGMM), IMEI number (International
Mobile Equipment Identity) (AT+CGSN) and software version (AT+CGMR).

 Get basic information about the subscriber. For example, MSISDN (AT+CNUM) and
IMSI number (International Mobile Subscriber Identity) (AT+CIMI).

 Get the current status of the mobile phone or GSM/GPRS modem. For example, mobile
phone activity status (AT+CPAS), mobile network registration status (AT+CREG), radio
signal strength (AT+CSQ), battery charge level and battery charging status (AT+CBC).

 Establish a data connection or voice connection to a remote modem (ATD, ATA, etc).

 Send and receive fax (ATD, ATA, AT+F*).

 Send (AT+CMGS, AT+CMSS), read (AT+CMGR, AT+CMGL), write (AT+CMGW) or


delete (AT+CMGD) SMS messages and obtain notifications of newly received SMS
messages (AT+CNMI).

 Read (AT+CPBR), write (AT+CPBW) or search (AT+CPBF) phonebook entries.

 Perform security-related tasks, such as opening or closing facility locks (AT+CLCK),


checking whether a facility is locked (AT+CLCK) and changing passwords (AT+CPWD).
(Facility lock examples: SIM lock [a password must be given to the SIM card every time
the mobile phone is switched on] and PH-SIM lock [a certain SIM card is associated with
the mobile phone. To use other SIM cards with the mobile phone, a password must be
entered.])

 Control the presentation of result codes / error messages of AT commands. For example,
you can control whether to enable certain error messages (AT+CMEE) and whether error

DVR & Dr. HS MIC College of Technology 21


Arduino Based Smart LPG Gas Leakage Detector System

messages should be displayed in numeric format or verbose format (AT+CMEE=1 or


AT+CMEE=2).

 Get or change the configurations of the mobile phone or GSM/GPRS modem. For example,
change the GSM network (AT+COPS), bearer service type (AT+CBST), radio link
protocol parameters (AT+CRLP), SMS center address (AT+CSCA) and storage of SMS
messages (AT+CPMS).

 Save and restore configurations of the mobile phone or GSM/GPRS modem. For example,
save (AT+CSAS) and restore (AT+CRES) settings related to SMS messaging such as the
SMS center address.

2.6 GPS(GLOBAL POSITIONING SYSTEM)

2.6.1 INTRODUCTION

The Global Positioning System (GPS) is the only fully functional Global Navigation
Satellite System (GNSS). The GPS uses a constellation of between 24 and 32 Medium Earth Orbit
satellites that transmit precise microwave signals, which enable GPS receivers to determine their
location, speed,. GPS was developed by the United States Department of Defense. Its official name
is NAVSTAR-GPS. Although NAVSTAR-GPS is not an acronym, a few backronyms have been
created for it. The GPS satellite constellation is managed by the United States Air Force 50th Space
Wing.

Global Positioning System is an earth-orbiting-satellite based system that provides signals


available anywhere on or above the earth, twenty-four hours a day, which can be used to determine
precise time and the position of a GPS receiver in three dimensions. GPS is increasingly used as
an input for Geographic Information Systems particularly for precise positioning of geospatial data
and the collection of data in the field. Precise positioning is possible using GPS receivers at
reference locations providing corrections and relative positioning data for remote receivers. Time
and frequency dissemination, based on the precise clocks on board the SVs and controlled by the
monitor stations, is another, use for GPS. Astronomical observatories telecommunications

DVR & Dr. HS MIC College of Technology 22


Arduino Based Smart LPG Gas Leakage Detector System

facilities and laboratory standards can be set to precise time signals or controlled to accurate
frequencies by special purpose GPS receivers.

Similar satellite navigation systems include the Russian GLONASS (incomplete as of


2008), the upcoming European Galileo positioning system, the proposed COMPASS navigation
system of China, and IRNSS of India.

Following the shooting down of Korean Air Lines Flight 007 in 1983, President Ronald
Reagan issued a directive making the system available free for civilian use as a common good.
Since then, GPS has become a widely used aid to navigation worldwide, and a useful tool for map-
making, land surveying, commerce, scientific uses, and hobbies such as geocaching. GPS also
provides a precise time reference used in many applications.

2.6.2 BASIC CONCEPT OF GPS OPERATION

A GPS receiver calculates its position by carefully timing the signals sent by the
constellation of GPS satellites high above the Earth. Each satellite continually transmits messages
containing the time the message was sent, a precise orbit for the satellite sending the message (the
ephemeris), and the general system health and rough orbits of all GPS satellites (the almanac).
These signals travel at the speed of light through outer space, and slightly slower through the
atmosphere. The receiver uses the arrival time of each message to measure the distance to each
satellite, from which it determines the position of the receiver (conceptually the intersection of
spheres - see trilateration ) The resulting coordinates are converted to more user-friendly forms
such as latitude and longitude, or location on a map, then displayed to the user.

It might seem that three satellites would be enough to solve for a position, since space has
three dimensions. However, a three satellite solution requires the time be known to a nanosecond
or so, far better than any non-laboratory clock can provide. Using four or more satellites allows
the receiver to solve for time as well as geographical position, eliminating the need for a super
accurate clock. In other words, the receiver uses four measurements to solve for four variables: x,
y, z, and t. While many GPS applications have no particular use for this (very accurate) time, it is
used in some GPS applications such as time transfer, and it is the only variable of interest in some
applications, such as traffic signal timing.

DVR & Dr. HS MIC College of Technology 23


Arduino Based Smart LPG Gas Leakage Detector System

Although four satellites are required for normal operation, fewer may be needed in some
special cases.. Also, in practice, receivers use additional clues (Doppler shift of satellite signals,
last known position, dead reckoning, inertiral navigation, and so on) to give degraded answers
when fewer than four satellites are visible.

2.6.3 POSITION CALCULATION

To provide an introductory description of how a GPS receiver works, errors will be ignored
in this section. Using messages received from a minimum of four visible satellites, a GPS receiver
is able to determine the satellite positions and time sent.

The x, y, and z components of position and the time sent are designated as
where the subscript i denotes the satellite number and has the value 1, 2, 3, or 4. Knowing the
indicated time the message was received , the GPS receiver can compute the indicated transit

time, . of the message.

Assuming the message traveled at the speed of light, c, the distance travelled, can be

computed as . Knowing the distance from GPS receiver to a satellite and the position
of a satellite implies that the GPS receiver is on the surface of a sphere centered at the position of
a satellite. Thus we know that the indicated position of the GPS receiver is at or near the
intersection of the surfaces of four spheres. In the ideal case of no errors, the GPS receiver will be
at an intersection of the surfaces of four spheres. The surfaces of two spheres if they intersect in
more than one point intersect in a circle. A figure, two sphere surfaces intersecting in a circle, is
shown below.

Fig 2.8-Two Sphere Surfaces Intersecting in a Circle

DVR & Dr. HS MIC College of Technology 24


Arduino Based Smart LPG Gas Leakage Detector System

The article, trilateration, shows mathematically that two spheres intersecting in more than
one point intersect in a circle.

Fig 2.9- Surface of Sphere Intersecting a Circle (not disk) at Two Points

A circle and sphere surface in most cases of practical interest intersects at two points,
although it is conceivable that they could intersect in 0 or 1 point. Another figure, Surface of
Sphere Intersecting a Circle (not disk) at Two Points, is shown to aid in visualizing this
intersection. Again trilateration clearly show this mathematically. The correct position of the GPS
receiver is the one that is closest to the fourth sphere.

2.6.4 SYSTEM SEGMENTATION

The current GPS consists of three major segments. These are the space segment (SS), a
control segment (CS), and a user segment (US).

2.6.4.1 SPACE SEGMENT

Fig 2.10-GPS satellite system visual diagram

DVR & Dr. HS MIC College of Technology 25


Arduino Based Smart LPG Gas Leakage Detector System

A visual example of the GPS constellation in motion with the Earth rotating. Notice how
the number of satellites in view from a given point on the Earth's surface, in this example at 45°N,
changes with time.

The space segment (SS) comprises the orbiting GPS satellites, or Space Vehicles (SV) in
GPS parlance. The GPS design originally called for 24 SVs, eight each in three circular orbital
planes, but this was modified to six planes with four satellites each. The orbital

Fig 2.11 – system segment diagram

Fig 2.12 – GPS SATELLITE

DVR & Dr. HS MIC College of Technology 26


Arduino Based Smart LPG Gas Leakage Detector System

planes are centered on the Earth, not rotating with respect to the distant stars. The six planes
have approximately 55° inclination (tilt relative to Earth's equator) and are separated by 60° right
ascension of the ascending node (angle along the equator from a reference point to the orbit's
intersection). The orbits are arranged so that at least six satellites are always within line of sight
from almost everywhere on Earth's surface.

Orbiting at an altitude of approximately 20,200 kilometers (12,600 miles or 10,900 nautical


miles; orbital radius of 26,600 km (16,500 mi or 14,400 NM)), each SV makes two complete orbits
each sidereal day. The ground track of each satellite therefore repeats each (sidereal) day. This was
very helpful during development, since even with just four satellites, correct alignment means all
four are visible from one spot for a few hours each day. For military operations, the ground track
repeat can be used to ensure good coverage in combat zones.

As of March 2008, there are 31 actively broadcasting satellites in the GPS constellation.
The additional satellites improve the precision of GPS receiver calculations by providing
redundant measurements. With the increased number of satellites, the constellation was changed
to a nonuniform arrangement. Such an arrangement was shown to improve reliability and
availability of the system, relative to a uniform system, when multiple satellites fail.

Some reports in 2008 indicated that the 32nd satellite was causing difficulties for some
GPS receivers.

2.6.4.2 CONTROL SEGMENT

The flight paths of the satellites are tracked by US Air Force monitoring stations in Hawaii,
Kwajalein, Ascension Island, Diego Garcia, and Colorado Springs, Colorado, along with monitor
stations operated by the National Geospatial-Intelligence Agency (NGA). The tracking
information is sent to the Air Force Space Command's master control station at Schriever Air Force
Base in Colorado Springs, which is operated by the 2nd Space Operations Squadron (2 SOPS) of
the United States Air Force (USAF). Then 2 SOPS contacts each GPS satellite regularly with a
navigational update (using the ground antennas at Ascension Island, Diego Garcia, Kwajalein, and
Colorado Springs). These updates synchronize the atomic clocks on board the satellites to within
a few nanoseconds of each other, and adjust the ephemeris of each satellite's internal orbital model.

DVR & Dr. HS MIC College of Technology 27


Arduino Based Smart LPG Gas Leakage Detector System

The updates are created by a Kalman filter which uses inputs from the ground monitoring stations,
space weather information, and various other inputs.

Satellite maneuvers are not precise by GPS standards. So to change the orbit of a satellite,
the satellite must be marked 'unhealthy', so receivers will not use it in their calculation. Then the
maneuver can be carried out, and the resulting orbit tracked from the ground. Then the new
ephemeris is uploaded and the satellite marked healthy again.

2.6.4.3 USER SEGMENT

Fig 2.13 -Types of GPS receivers in user segment

GPS receivers come in a variety of formats, from devices integrated into cars, phones, and
watches, to dedicated devices such as those shown here from manufacturers Trimble, Garmin and
Leica (left to right).

The user's GPS receiver is the user segment (US) of the GPS. In general, GPS receivers are
composed of an antenna, tuned to the frequencies transmitted by the satellites, receiver-processors,
and a highly-stable clock (often a crystal oscillator). They may also include a display for providing
location and speed information to the user.

A receiver is often described by its number of channels: this signifies how many satellites
it can monitor simultaneously. Originally limited to four or five, this has progressively increased
over the years so that, as of 2007, receivers typically have between 12 and 20 channels.

DVR & Dr. HS MIC College of Technology 28


Arduino Based Smart LPG Gas Leakage Detector System

2.6.5 Correcting GPS clock

The method of calculating position for the case of no errors has been explained. One of the
most important errors is the error in the GPS receiver clock. Because of the very large value of c,
the speed of light, the estimated distances from the GPS receiver to the satellites, the pseudo
ranges, are very sensitive to errors in the GPS receiver clock.

This seems to suggest that an extremely accurate and expensive clock is required for the
GPS receiver to work. On the other hand, manufacturers would like to make an inexpensive GPS
receiver which can be mass marketed. The manufacturers were thus faced with a difficult design
problem. The technique that solves this problem is based on the way sphere surfaces intersect in
the GPS problem.

It is likely the surfaces of the three spheres intersect since the circle of intersection of the
first two spheres is normally quite large and thus the third sphere surface is likely to intersect this
large circle. It is very unlikely that the surface of the sphere corresponding to the fourth satellite
will intersect either of the two points of intersection of the first three since any clock error could
cause it to miss intersecting a point. However the distance from the valid estimate of GPS receiver
position to the surface of the sphere corresponding to the fourth satellite can be used to compute a
clock correction.

Let denote the distance from the valid estimate of GPS receiver position to the fourth
satellite and let denote the pseudo range of the fourth satellite. Let . Note that
is the distance from the computed GPS receiver position to the surface of the sphere

corresponding to the fourth satellite. Thus the quotient, , provides an estimate of


(correct time)-(time indicated by the receivers onboard clock) and the GPS receiver clock can be
advanced if is positive or delayed if is negative.

Once if any error occurs in the GPS clock it creates a dangerous impact on the present
technology and all the satellites work with this GPS clock.

DVR & Dr. HS MIC College of Technology 29


Arduino Based Smart LPG Gas Leakage Detector System

2.6.6 APPLICATIONS

 ASTRONOMY: both positional and clock synchronization data is used


in astrometry and celestial mechanics. GPS is also used in both amateur
astronomy with small telescopes as well as by professional observatories for
finding extrasolar planets.
 Automated vehicle: applying location and routes for cars and trucks to function without a
human driver.
 Cartography: both civilian and military cartographers use GPS extensively.
 Clock synchronization: the accuracy of GPS time signals (±10 ns) is second only to the
atomic clocks they are based on, and is used in applications such as GPS disciplined
oscillators.
 GPS for mining: the use of RTK GPS has significantly improved several mining
operations such as drilling, shoveling, vehicle tracking, and surveying. RTK GPS provides
centimeter-level positioning accuracy.
 GPS data mining: It is possible to aggregate GPS data from multiple users to understand
movement patterns, common trajectories and interesting locations. [95]
 GPS tours: location determines what content to display; for instance, information about
an approaching point of interest.
 Navigation: navigators value digitally precise velocity and orientation measurements.
 Phasor measurements: GPS enables highly accurate timestamping of power system
measurements, making it possible to compute phasors.
 Recreation: for example, Geocaching, Geodashing, GPS drawing, waymarking, and other
kinds of location based mobile games.
 Robotics: self-navigating, autonomous robots using a GPS sensors, which calculate
latitude, longitude, time, speed, and heading.
 Sport: used in football and rugby for the control and analysis of the training load.
 Surveying: surveyors use absolute locations to make maps and determine property
boundaries.

DVR & Dr. HS MIC College of Technology 30


Arduino Based Smart LPG Gas Leakage Detector System

 Tectonics: GPS enables direct fault motion measurement of earthquakes. Between


earthquakes GPS can be used to measure crustal motion and deformation to estimate
seismic strain buildup for creating seismic hazard maps.
 Telematics: GPS technology integrated with computers and mobile communications
technology in automotive navigation systems.
 Missile and projectile guidance: GPS allows accurate targeting of various military
weapons including ICBMs, cruise missiles and precision-guided munitions. Artillery
projectiles with embedded GPS receivers able to withstand accelerations of 12,000G have
been developed for use in 155 mm howitzers.
 Nuclear Detonation Detection: The GPS satellites also carry a set of nuclear detonation
detectors consisting of an optical sensor (Y-sensor), an X-ray sensor, a dosimeter, and an
Electro-Magnetic Pulse (EMP) sensor (W-sensor) which form a major portion of the
United States Nuclear Detonation Detection System.
 Target tracking: Various military weapons systems use GPS to track potential ground and
air targets before they are flagged as hostile. These weapon systems pass GPS co-ordinates
of targets to precision-guided munitions to allow them to engage the targets accurately.
Military aircraft, particularly those used in air-to-ground roles use GPS to find targets (for
example, gun camera video from AH-1 Cobras in Iraq show GPS co-ordinates that can be
looked up in Google Earth).

 Civilian application: To help prevent civilian GPS guidance from being used in an
enemy's military or improvised weaponry, the US Government controls the export of
civilian receivers. A US-based manufacturer cannot generally export a GPS receiver unless
the receiver contains limits restricting it from functioning when it is simultaneously (1) at
an altitude above 18 kilometers (60,000 ft) and (2) traveling at over 515 m/s (1,000 knots).
These parameters are well above the operating characteristics of the typical cruise missile,
but would be characteristic of the reentry vehicle from a ballistic missile.

DVR & Dr. HS MIC College of Technology 31


Arduino Based Smart LPG Gas Leakage Detector System

CHAPTER 3

PROJECT DESIGN

3.1 BLOCK DIAGRAM

Fig 3.1- Block Diagram of Arduino Based Smart LPG Gas Leakage Detector System

3.2 DESCRIPTION OF BLOCK DIAGRAM

The project consists of many blocks as listed below and their functioning is
explained.

Gas sensor: It is used to detect the LPG gas leakage and can also display the concentration
of gas leakage. It provides a voltage signal output with respect to the concentration of gas to the
Arduino.

DVR & Dr. HS MIC College of Technology 32


Arduino Based Smart LPG Gas Leakage Detector System

Arduino Board: it consists of ATMEGA328P microcontroller and it receives the voltage


signal from the gas sensor and processes it to exhibit desired operations that are mentioned through
the code . It is responsible for the proper function of entire kit.

Relay module: Relay is an electronic switch that can be used to operate the large voltage
appliances or applications with a small voltage input. This relay module operates the fan, light,
MCB ,Buzzer based on the output of the Arduino.

GSM module: It is used to send the SMS to the owner and fire station that the gas is being
leaked in the house.it works on the AT commands and it also sends the GPS location to the desired
person and fire station

GPS Module: It used to get the GPS location from the GPS satellite. Later this location
will be sent to the fire station through GSM module.

MCB: It is a circuit breaker that can give protection from fault currents and short circuits.
When the gas is leaked, the MCB is tripped there by avoid the sparking of switches. As the MCB
cannot be disturbed or modified we are using an external relay in series with the MCB there by
performing the tripping operation.

Buzzer: It is an audio alarm that provides beep sound alerting the owner about the Gas
leakage in the house.it goes on sounding until the reset button is pressed.

Light indicator: It is an Visual alarm in this project that alerts the owner about the gas
leakage in the house.

Fan: it is a device that can be used to send the leaked gas out of the house, there reducing
the chances of fire accident.it is also connected to relay only, when the gas leak is detected it the
relay is switched on thereby switching on the fan.

DVR & Dr. HS MIC College of Technology 33


Arduino Based Smart LPG Gas Leakage Detector System

CHAPTER 4

HARDWARE DESCRIPTION

4.1 ARDUINO

4.1.1 INTRODUCTION TO ARDUINO

Arduino is open source physical processing which is based on a microcontroller board and
an incorporated development environment for the board to be programmed. Arduino gains a few
inputs, for example, switches or sensors and control a few multiple outputs, for example, lights,
engine and others. Arduino program can run on Windows, Macintosh and Linux operating systems
(OS) opposite to most microcontrollers’ frameworks which run only on Windows. Arduino
programming is easy to learn and apply to beginners and amateurs. Arduino is an instrument used
to build a better version of a computer which can control, interact and sense more than a normal
desktop computer. It's an open-source physical processing stage focused around a straightforward
microcontroller board, and an environment for composing programs for the board. Arduino can be
utilized to create interactive items, taking inputs from a diverse collection of switches or sensors,
and controlling an assortment of lights, engines, and other physical outputs. Arduino activities can
be remaining solitary, or they can be associated with programs running on your machine (e.g.
Flash, Processing and Maxmsp.) The board can be amassed by hand or bought preassembled; the
open-source IDE can be downloaded free of charge. Focused around the Processing media
programming environment, the Arduino programming language is an execution of Wiring, a
comparative physical computing platform.

4.1.2 WHY CHOOSING ARDUINO

There are numerous different microcontrollers and microcontroller platforms accessible


for physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard,
and numerous others offer comparative usefulness. These apparatuses take the chaotic subtle
elements of microcontroller programming and wrap it up in a simple to-utilize bundle. Arduino
additionally rearranges the methodology of working with microcontrollers; moreover it offers
some advantages for instructors, students, and intrigued individuals:

DVR & Dr. HS MIC College of Technology 34


Arduino Based Smart LPG Gas Leakage Detector System

 Inexpensive - Arduino boards are moderately cheap compared with other microcontroller
boards. The cheapest version of the Arduino module can be amassed by hand, and even the
preassembled Arduino modules cost short of what $50.
 Cross-platform - The Arduino programming runs multiple operating systems Windows,
Macintosh OSX, and Linux working frameworks. So we conclude that Arduino has an
advantage as most microcontroller frameworks are constrained to Windows.
 Straightforward, clear programming method - The Arduino programming environment is
easy to use for novices, yet sufficiently versatile for cutting edge customers to adventure
as well. For educators, it is favorably engaged around the Processing programming
environment, so Under studies finding ways to understand how to program in that
environment will be familiar with the nature of arduino.
 Open source and extensible programming. The Arduino program language is available as
open source, available for development by experienced engineers. The lingo can be reached
out through C++ libraries, and people expecting to understand the specific purposes of
different interests can make the leap from Arduino to the AVR C programming language
on which it is based. Basically, you can incorporate AVR-C code clearly into your Arduino
programs if you have to.
 Open source and extensible hardware - The Arduino is concentrated around Atmel's
Atmega8 and Atmega168 microcontrollers. The plans for the modules are circulated under
a Creative Commons license, so experienced circuit designers can make their own
particular interpretation of the module, extending it and improving it. slightly
inexperienced customers can build the breadboard variation of the module remembering
the finished objective to perceive how it capacities and save money.

4.1.3 ARDUINO UNO:

The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It


has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16
MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It
contains everything needed to support the microcontroller; simply connect it to a computer with a
USB cable or power it with a AC-to-DC adapter or battery to get started. The Uno differs from all
preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the

DVR & Dr. HS MIC College of Technology 35


Arduino Based Smart LPG Gas Leakage Detector System

Atmega8U2 programmed as a USB-to-serial converter. "Uno" means one in Italian and is named
to mark the upcoming release of Arduino 1.0. The Uno and version 1.0 will be the reference
versions of Arduno, moving forward. The Uno is the latest in a series of USB Arduino boards, and
the reference model for the Arduino platform;

Fig 4.1: ARDUINO UNO Board

4.1.4 TECHNICAL SPECIFICATIONS OF ARDUINO UNO

Microcontroller : ATmega328

Operating Voltage : 5V

Input Voltage (recommended) : 7-12V

Input Voltage (limits) : 6-20V

Digital I/O Pins : 14

Analog Input Pins :6

DC Current per I/O Pin : 40 mA

DC Current for 3.3V Pin : 50 mA

Flash Memory : 32 KB (ATmega328)

SRAM : 2 KB (ATmega328)

DVR & Dr. HS MIC College of Technology 36


Arduino Based Smart LPG Gas Leakage Detector System

EEPROM : 1 KB (ATmega328)

Clock Speed : 16 MHz

Length : 68.6 mm

Width : 53.4 mm

Fig 4.2 - description of Arduino UNO

4.1.5 POWER

The Arduino Uno can be powered via the USB connection or with an external power
supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or
battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's
power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER
connector.

DVR & Dr. HS MIC College of Technology 37


Arduino Based Smart LPG Gas Leakage Detector System

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V,
however, the 5V pin may supply less than five volts and the board may be unstable. If using more
than 12V, the voltage regulator may overheat and damage the board. The recommended range is
7 to 12 volts.

 The power pins are as follows:


 VIN. The input voltage to the Arduino board when it's using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You can
supply voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.
 5V. The regulated power supply used to power the microcontroller and other components
on the board. This can come either from VIN via an on-board regulator, or be supplied by
USB or another regulated 5V supply.
 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50
mA.
 GND. Ground pins.

4.1.6 MEMORY:

The Atmega328 has 32 KB of flash memory for storing code (of which 0,5 KB is used for
the bootloader); It has also 2 KB of SRAM and 1 KB of EEPROM (which can be read and written
with the EEPROM library).

4.1.7 INPUT/OUTPUT:

Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(),
digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive
a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50k
Ohms. In addition, some pins have specialized functions:

 Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. TThese
pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip
.

DVR & Dr. HS MIC College of Technology 38


Arduino Based Smart LPG Gas Leakage Detector System

 External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low
value, a rising or falling edge, or a change in value. See the attachInterrupt() function for
details.
 PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
 SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication,
which, although provided by the underlying hardware, is not currently included in the
Arduino language.
 LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value,
the LED is on, when the pin is LOW, it's off. The Uno has 6 analog inputs, each of which
provide 10 bits of resolution (i.e. 1024 different values). By default they measure from
ground to 5 volts, though is it possible to change the upper end of their range using the
AREF pin and the analogReference() function. Additionally, some pins have specialized
functionality:
 I 2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library.
There are a couple of other pins on the board:
 AREF. Reference voltage for the analog inputs. Used with analogReference().
 Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button
to shields which block the one on the board.

4.1.8 COMMUNICATION:

The Arduino Uno has a number of facilities for communicating with a computer, another
Arduino, or other microcontrollers.

The ATmega328 provides UART TTL (5V) serial communication, which is available on
digital pins 0 (RX) and 1 (TX). An ATmega8U2 on the board channels this serial communication
over USB and appears as a virtual com port to software on the computer. The '8U2 firmware uses
the standard USB COM drivers, and no external driver is needed. However, on Windows, an *.inf
file is required..

The Arduino software includes a serial monitor which allows simple textual data to be sent
to and from the Arduino board. The RX and TX LEDs on the board will flash when data is being

DVR & Dr. HS MIC College of Technology 39


Arduino Based Smart LPG Gas Leakage Detector System

transmitted via the USB-toserial chip and USB connection to the computer (but not for serial
communication on pins 0 and 1).

4.1.9 PROGRAMMING

The Arduino Uno can be programmed with the Arduino software. The ATmega328 on the
Arduino Uno comes preburned with a bootloader that allows you to upload new code to it without
the use of an external hardware programmer. It communicates using the original STK500 protocol
(reference, C headerfiles). You can also bypass the bootloader and program the microcontroller
through the ICSP (InCircuit Serial Programming) header; see these instructions for details. The
ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is available. The
ATmega16U2/8U2 is loaded with a DFU bootloader .

4.1.10 AUTOMATIC (SOFTWARE) RESET

Rather than requiring a physical press of the reset button before an upload, the Arduino
Uno is designed in a way that allows it to be reset by software running on a connected computer.
One of the hardware flow control lines (DTR) of theATmega8U2/16U2 is connected to the reset
line of the ATmega328 via a 100 nanofarad capacitor. When this line is asserted (taken low), the
reset line drops long enough to reset the chip.

The Arduino software uses this capability to allow you to upload code by simply pressing
the upload button in the Arduino environment. This means that the bootloader can have a shorter
timeout, as the lowering of DTR can be well-coordinated with the start of the upload. The Uno
contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can be
soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the
auto-reset by connecting a 110 ohm resistor from 5V to the reset line. 11

4.1.11 USB OVERCURRENT PROTECTION

The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from
shorts and overcurrent. Although most computers provide their own internal protection, the fuse
provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse will
automatically break the connection until the short or overload is removed.

DVR & Dr. HS MIC College of Technology 40


Arduino Based Smart LPG Gas Leakage Detector System

4.2 LPG GAS SENSOR(MQ-6)

4.2.1 WORKING OF MQ-6 GAS SENSOR (LPG)

For LPG gas detection, the sensing element is Tin Oxide (SnO2) with Platinum (Pt)
as a catalyst. When a metal oxide like SnO2 is heated in air, oxygen is adsorbed on the crystal
surface. The adsorbed oxygen attains negative charge due to the transfer of donor electrons from
SnO2, resulting in surface Sn+2 ions.

O2(gas) ↔ O2(adsorbed) (On material surface)

O2(adsorbed) + 2e(Sn+2)− ↔ 2O(adsorbed)−

Hydrocarbons (which is the major component of LPG) dissociate on metal oxide surface
before reacting with adsorbed oxygen. The Platinum catalyst makes this dissociation faster. The
dissociated molecules then interact with the adsorbed oxygen to produce trapped electrons.

CnH2n+2+ 2O(adsorbed)− ↔ H2O+ CnH2nO−+ e−

These trapped electrons increase the electron carrier concentration in the sensing SnO2
layer which accounts for the decrease in sensor resistance in the presence of LPG gas. Therefore,
the conductivity between the electrodes is directly proportional to the concentration of LPG gas.

The MQ-6 sensor which is used for LPG gas detection is connected in the following
manner:

Fig 4.3- MQ-6 connection for LPG Gas detection fig 4.4- MQ-6(LPG) sensor

DVR & Dr. HS MIC College of Technology 41


Arduino Based Smart LPG Gas Leakage Detector System

Both A pins of the sensor are connected together to the Vcc and both B pins are connected
to ground through a variable load resistance. The heater pins are connected directly to Vcc and
ground. If A and B pins are interconnected mistakenly, the sensor could get damaged.

4.2.4 INTERFACING LPG GAS SENSOR MQ-6 WITH ARDUINO

Fig 4.5 –Interfacing MQ-6 GAS Sensor with Arduino UNO

CONNECTIONS:

 Connect VCC of gas sensor to the 5V pin of Arduino.


 Connect GND pin of Gas sensor to the GND pin of Arduino.
 Connect AO(analog output ) of gas sensor with the A0 (analog input)pin of Arduino.

DVR & Dr. HS MIC College of Technology 42


Arduino Based Smart LPG Gas Leakage Detector System

4.3 RELAYS

4.3.1 RELAYS INTRODUCTION

A relay is an electrical switch that opens and closes under the control of another
electrical circuit. In the original form, the switch is operated by an electromagnet to open or close
one or many sets of contacts. A relay is able to control an output circuit of higher power than the
input circuit, it can be considered to be, in a broad sense, a form of an electrical amplifier.

Fig 4.6- illustration of a RELAY

Relays are usually SPDT (single pole double through switch)or DPDT (double pole double
through switch) but they can have many more sets of switch contacts, for example relays with 4
sets of changeover contacts are readily available.

Fig 4.7 –inner structure of Relay

DVR & Dr. HS MIC College of Technology 43


Arduino Based Smart LPG Gas Leakage Detector System

4.3.2 BASIC OPERATION OF A RELAY

An electric current through a conductor will produce a magnetic field at right angles
to the direction of electron flow. If that conductor is wrapped into a coil shape, the magnetic field
produced will be oriented along the length of the coil. The greater the current, the greater the
strength of the magnetic field, all other factors being equal.

Fig 4.8 - Relay circuit

Inductors react against changes in current because of the energy stored in this magnetic
field. When we construct a transformer from two inductor coils around a common iron core, we
use this field to transfer energy from one coil to the other. However, there are simpler and more
direct uses for electromagnetic fields than the applications we've seen with inductors and
transformers. The magnetic field produced by a coil of current-carrying wire can be used to exert
a mechanical force on any magnetic object, just as we can use a permanent magnet to attract
magnetic objects, except that this magnet (formed by the coil) can be turned on or off by switching
the current on or off through the coil.

If we place a magnetic object near such a coil for the purpose of making that object move
when we energize the coil with electric current, we have what is called a solenoid. The movable
magnetic object is called an armature, and most armatures can be moved with either direct current
(DC) or alternating current (AC) energizing the coil. The polarity of the magnetic field is irrelevant
for the purpose of attracting an iron armature. Solenoids can be used to electrically open door
latches, open or shut valves, move robotic limbs, and even actuate electric switch mechanisms and
is used to actuate a set of switch contacts

DVR & Dr. HS MIC College of Technology 44


Arduino Based Smart LPG Gas Leakage Detector System

4.3.3 TYPES OF RELAYS

4.3.3.1 NEUTRAL RELAYS

This is the most elementary type of relay. The neutral relays have a magnetic coil, which
operates the relay at a specified current, regardless of the polarity of the voltage applied.

4.3.3.2 BIASED RELAYS

Biased relays have a permanent magnet above the armature. The relay operates if the
current through the coil winding establishes a magneto-motive force that opposes the flux by the
permanent magnet. If the fluxes are in the same direction, the relay will not operate, even for a
greater current through the coil.

4.3.3.3 POLARIZED RELAYS

Like the biased relays, the polarized relays operate only when the current through the coil
in one direction. But there the principle is different. The relay coil has a diode connected in series
with it. This blocks the current in the reverse direction.

The major difference between biased relays and polarized relays is that the former allows
the current to pass through in the reverse direction, but does the not operate the relay and the later
blocks the current in reverse direction. You can imagine how critical these properties when relays
are connected in series to form logic circuits.

4.3.3.4 MAGNETIC STICK RELAYS OR PERM POLARIZED RELAYS

These relays have a magnetic circuit with high permanence. Two coils, one to operate
(pick up) and one to release (drop) are present. The relay is activated by a current in the operate
coil.

On the interruption of the current the armature remains in picked up position by the residual
magnetism. The relay is released by a current through the release coil.

DVR & Dr. HS MIC College of Technology 45


Arduino Based Smart LPG Gas Leakage Detector System

4.3.3.5 SLOW RELEASE RELAYS

These relays have a capacitor connected in parallel to their coil. When the operating current
is interrupted the release of relay is delayed by the stored charge in the capacitor. The relay releases
as the capacitor discharges through the coil.

4.3.3.6 RELAYS FOR AC

These are neutral relays and picked up for a.c. current through their coil. These are very
fast in action and used on power circuits of the point motors, where high current flows through the
contacts. A normal relay would be slow and make sparks which in turn may weld the contacts
together. All relays have two operating values (voltages), one pick-up and the other drop away.

4.3.4 APPLICATION OF RELAYS

 To control a high-voltage circuit with a low-voltage signal, as in some types of modems or


audio amplifiers.

 To control a high-current circuit with a low-current signal, as in the starter solenoid of an


automobile.

 To detect and isolate faults on transmission and distribution lines by opening and closing
circuit breakers (protection relays).

 To isolate the controlling circuit from the controlled circuit when the two are at different
potentials, for example when controlling a mains-powered device from a low-voltage
switch. The latter is often applied to control office lighting as the low voltage wires are
easily installed in partitions, which may be often moved as needs change. They may also
be controlled by room occupancy detectors in an effort to conserve energy.

 To perform logic functions. For example, the boolean AND function is realised by
connecting NO relay contacts in series, the OR function by connecting NO contacts in
parallel. The change-over or Form C contacts perform the XOR (exclusive or) function.
Similar functions for NAND and NOR are accomplished using NC contacts. The Ladder
programming language is often used for designing relay logic networks.

DVR & Dr. HS MIC College of Technology 46


Arduino Based Smart LPG Gas Leakage Detector System

 In Early computing. Before vacuum tubes and transistors, relays were used as logical
elements in digital computers. See ARRA (computer), Harvard Mark II, Zuse Z2, and Zuse
Z3.

 Safety-critical logic. Because relays are much more resistant than semiconductors to
nuclear radiation, they are widely used in safety-critical logic, such as the control panels of
radioactive waste-handling machinery

4.3.5 INTERFACING RELAY WITH A ARDUINO

Fig 4.9- interfacing a relay module with the Arduino

CONNECTIONS

 Connect the 5V and GND of Arduino to the VCC and GND terminals of the relay module.

 Connect the digital pin of Arduino to the input pin (IN1) of relay module and if second
relay is also used then connect another digital pin of Arduino to the IN2 pin of Relay
module.

DVR & Dr. HS MIC College of Technology 47


Arduino Based Smart LPG Gas Leakage Detector System

4.4 SIM800L GSM MODULE

4.4.1 INTRODUCTION

SIM800 is a quad-band GSM/GPRS module designed for the global market. It works on
frequencies GSM 850MHz, EGSM 900MHz, DCS 1800MHz and PCS 1900MHz. SIM800
features GPRS multi-slot class 12/ class 10 (optional) and supports the GPRS coding schemes CS-
1, CS-2, CS-3 and CS-4.

With a tiny configuration of 24*24*3mm, SIM800 can meet almost all the space
requirements in users’ applications, such as M2M, smart phone, PDA and other mobile devices.
SIM800 has 68 SMT pads, and provides all hardware interfaces between the module and
customers’ boards. SIM800 is designed with power saving technique so that the current
consumption is as low as 1.2mA in sleep mode. SIM800 integrates TCP/IP protocol and extended
TCP/IP AT commands which are very useful for data transfer applications .

This SIM800L is the latest version than the SIM900 GSM MODULE, but the AT
commands they support are same with SIM800L having some extra features.

Fig 4.10- SIM800L GSM MODULE

DVR & Dr. HS MIC College of Technology 48


Arduino Based Smart LPG Gas Leakage Detector System

4.4.2WHY SIM800 NOT SIM900

SIM800 series GSM modules have a inbuilt Bluetooth stack compliant with 3.0+EDR
& FM radio support, and the interface is accessible using AT commands.

Same AT commands used for simple call/sms functionality in SIM900,SIM900A can be


used with the SIM800,SIM800C modules, but SIM800 series have added AT command set for
supporting extra features like bluetooth, FM etc.

 Size is small and cost is less compared to SIM900

 SIM800 supports USB interface where as SIM900 doesn’t support it.

 Power consumption is less in sleep mode when compared to SIM900.

4.4.3 SIM800 FEATURES

 Support up to 5*5*2 Keypads.

 One full function UART port, and can be configured to two independent serial ports.

 One USB port can be used as debugging and firmware upgrading.


 Audio channels which include a microphone input and a receiver output.
 One SIM card interface.
 Support Bluetooth function.
 Support one PWM.
 PCM/SPI/SD card interface, only one function can be accessed synchronously.
 Power supply 3.4V ~ 4.4V
 Typical power consumption in sleep mode is 1.2mA
 Frequency bands GPRS multi-slot class 12
 Support SIM card: 1.8V, 3V
 Serial Port: Can be used for AT commands for data stream
 USB Port: Can be used as debugging and firmware upgrading

DVR & Dr. HS MIC College of Technology 49


Arduino Based Smart LPG Gas Leakage Detector System

4.4.4 SIM800 PINOUT

The SIM800L consists of 12 pins as shown in below figure and their functioning is also
explained.

Fig 4.11-SIM800L PINOUT

 NET is a pin where you can solder Helical Antenna provided along with the module.
 VCC supplies power for the module. This can be anywhere from 3.4V to 4.4 volts.
Remember connecting it to 5V pin will likely destroy your module! It doesn’t even run on
3.3 V! An external power source like Li-Po battery or DC-DC buck converters rated 3.7V
2A would work.
 RST (Reset) is a hard reset pin. If you absolutely got the module in a bad space, pull this
pin low for 100ms to perform a hard reset.
 RxD (Receiver) pin is used for serial communication.
 TxD (Transmitter) pin is used for serial communication.
 GND is the Ground Pin and needs to be connected to GND pin on the Arduino.
 RING pin acts as a Ring Indicator. It is basically the ‘interrupt’ out pin from the module.
It is by default high and will pulse low for 120ms when a call is received. It can also be
configured to pulse when an SMS is received.
 DTR pin activates/deactivates sleep mode. Pulling it HIGH will put module in sleep mode,
disabling serial communication. Pulling it LOW will wake the module up.
 MIC± is a differential microphone input. The two microphone pins can be connected
directly to these pins.
 SPK± is a differential speaker interface. The two pins of a speaker can be tied directly to
these two pins.

DVR & Dr. HS MIC College of Technology 50


Arduino Based Smart LPG Gas Leakage Detector System

4.4.5 AT COMMANDS

Here are some of the tasks that can be done using AT commands with a GSM/GPRS
modem or mobile phone:

 Get basic information about the mobile phone or GSM/GPRS modem. For example, name
of manufacturer (AT+CGMI), model number (AT+CGMM), IMEI number (International
Mobile Equipment Identity) (AT+CGSN) and software version (AT+CGMR).

 Get basic information about the subscriber. For example, MSISDN (AT+CNUM) and
IMSI number (International Mobile Subscriber Identity) (AT+CIMI).

 Get the current status of the mobile phone or GSM/GPRS modem. For example, mobile
phone activity status (AT+CPAS), mobile network registration status (AT+CREG), radio
signal strength (AT+CSQ), battery charge level and battery charging status (AT+CBC).

 Establish a data connection or voice connection to a remote modem (ATD, ATA, etc).

 Send and receive fax (ATD, ATA, AT+F*).

 Send (AT+CMGS, AT+CMSS), read (AT+CMGR, AT+CMGL), write (AT+CMGW) or


delete (AT+CMGD) SMS messages and obtain notifications of newly received SMS
messages (AT+CNMI).

 Read (AT+CPBR), write (AT+CPBW) or search (AT+CPBF) phonebook entries.

 Perform security-related tasks, such as opening or closing facility locks (AT+CLCK),


checking whether a facility is locked (AT+CLCK) and changing passwords (AT+CPWD).
(Facility lock examples: SIM lock [a password must be given to the SIM card every time
the mobile phone is switched on] and PH-SIM lock [a certain SIM card is associated with
the mobile phone. To use other SIM cards with the mobile phone, a password must be
entered.])

 Control the presentation of result codes / error messages of AT commands. For example,
you can control whether to enable certain error messages (AT+CMEE) and whether error

DVR & Dr. HS MIC College of Technology 51


Arduino Based Smart LPG Gas Leakage Detector System

messages should be displayed in numeric format or verbose format (AT+CMEE=1 or


AT+CMEE=2).

 Get or change the configurations of the mobile phone or GSM/GPRS modem. For example,
change the GSM network (AT+COPS), bearer service type (AT+CBST), radio link
protocol parameters (AT+CRLP), SMS center address (AT+CSCA) and storage of SMS
messages (AT+CPMS).

 Save and restore configurations of the mobile phone or GSM/GPRS modem. For example,
save (AT+CSAS) and restore (AT+CRES) settings related to SMS messaging such as the
SMS center address.

4.4.6 INTERFACING SIM800 GSM MODULE WITH ARDUINO

Fig 4.12 – Interfacing SIM800L with Arduino Using a DC-DC Converter

CONNECTIONS:

 Connect GND of Arduino with the Ground of SIM800


 Connect SIM_TXD with Digital pin 8 of Arduino
 Connect SIM_RXD with Digital pin 7 of Arduino

DVR & Dr. HS MIC College of Technology 52


Arduino Based Smart LPG Gas Leakage Detector System

4.5 SIM28ML GPS MODULE

4.5.1 SIM28ML

SIMCom presents a small, high performance and reliable assisted GPS module-SIM28ML.
This is a standalone L1 frequency GPS module with the MediaTek MT3337 high sensitivity
navigation engine, which allows you to achieves the industry’s highest levels of sensitivity,
accuracy, and Time-to-First-Fix (TTFF) with lowest power consumption

Fig 4.13- SIM28ML GPS Module

4.5.2 FEATURES OF SIM28ML

 5Hz position update rate


 Operating temperature range: -40 TO 85°C UART TTL socket
 Its high sensitivity allows it to be used for Indoor applications.
 Can work with either 5V or 3.3V power supply.
 The cold start time of 38 s and Hot start time of 1 s
 Configurable from 4800 Baud to 115200 Baud rates. (default 9600)
 SuperSense ® Indoor GPS: -165dBm tracking sensitivity
 Support SBAS (WAAS, EGNOS, MSAS, GAGAN)
 Separated 18X18mm GPS antenna

DVR & Dr. HS MIC College of Technology 53


Arduino Based Smart LPG Gas Leakage Detector System

4.5.3 WHAT IS GPS SIGNAL?

GPS satellites transmit at least 2 low-power radio signals. The signals travel by line of
sight, meaning they will pass through clouds, glass and plastic but will not go through most
solid objects, such as buildings and mountains. However, modern receivers are more sensitive
and can usually track through houses.

A GPS signal contains 3 different types of information:

 Pseudorandom code is an I.D. code that identifies which satellite is transmitting


information. You can see which satellites you are getting signals from on your device's
satellite page.
 Ephemeris data is needed to determine a satellite's position and gives important
information about the health of a satellite, current date and time.
 Almanac data tells the GPS receiver where each GPS satellite should be at any time
throughout the day and shows the orbital information for that satellite and every other
satellite in the system.

4.5.4 PIN DESCRIPTION OF SIM28ML

Fig 4.14-pinout description of SIM28ML

 VCC and GND are for power supply purpose


 TX,RX are for serial communication between GPS Module and microcontroller

DVR & Dr. HS MIC College of Technology 54


Arduino Based Smart LPG Gas Leakage Detector System

4.5.5 INTERFACING SIM28ML WITH ARDUINO

Fig 4.15- interfacing SIM28ML with Arduino

CONNECTIONS:

 Connect 5V pin of Arduino to the VCC pin of SIM28ML


 Connect the GND of Arduino the GND of GPS Module
 Connect Arduino pin 2(any digital pin) to the TX pin of the GPS Module

DVR & Dr. HS MIC College of Technology 55


Arduino Based Smart LPG Gas Leakage Detector System

4.6 JHD 162A LCD DISPLAY

4.6.1 INTRODUCTION

A Liquid Crystal Display commonly abbreviated as LCD is basically a display unit built
using Liquid Crystal technology. When we build real life/real world electronics based projects, we
need a medium/device to display output values and messages.

The most basic form of electronic display available is 7 Segment display – which has its
own limitations. The next best available option is Liquid Crystal Displays which comes in different
size specifications. Out of all available LCD modules in market, the most commonly used one
is 16×2 LCD Module which can display 32 ASCII characters in 2 lines (16 characters in 1 line).

Other commonly used LCD displays are 20×4 Character LCD, Nokia 5110 LCD module,
128×64 Graphical LCD Display and 2.4 inch TFT Touch screen LCD display.

Fig 4.16 -JHD 162A display

4.6.2 FEATURES

 Display Construction--16 character *2 lines


 Display mode--TN/STN
 Display type--Positive Transflective
 Backlight--LED(B/0.5v)
 Viewing direction--6 o’ clock
 Operating temperature-- indoor

DVR & Dr. HS MIC College of Technology 56


Arduino Based Smart LPG Gas Leakage Detector System

 Driving Voltage--single power


 Driving Method--1/16 duty,1/5 bias
 Type--COB (chip on board)
 Number of data lines--8 bit parallel
 Connector—pin

4.6.3 INTERFACING JHD 162A LCD DISPLAY WITH ARDUINO

Fig 4.17 - Interfacing LCD Display with Arduino

DVR & Dr. HS MIC College of Technology 57


Arduino Based Smart LPG Gas Leakage Detector System

CONNECTIONS:

 RS pin of the LCD module is connected to digital pin 12 of the Arduino.


 R/W pin of the LCD is grounded. Enable pin of the LCD module is connected to digital
pin 11 of the Arduino.
 In this project, the LCD module and arduino are interfaced in the 4-bit mode. This
means only four of the digital input lines( DB4 to DB7) of the LCD are used.
 This method is very simple, requires less connections and you can almost utilize the full
potential of the LCD module. Digital lines DB4, DB5, DB6 and DB7 are interfaced to
digital pins 5, 4, 3 and 2 of the Arduino.
 The 10K potentiometer is used for adjusting the contrast of the display. 560 ohm resistor
R1 limits the current through the back light LED.

The arduino can be powered through the external power jack provided on the board. +5V required
in some other parts of the circuit can be tapped from the 5V source on the Arduino board.

A liquid crystal display (LCD) is a thin, flat display device made up of any number of color or
monochrome pixels arrayed in front of a light source or reflector. Each pixel consists of a column
of liquid crystal molecules suspended between two transparent electrodes, and two polarizing
filters, the axes of polarity of which are perpendicular to each other.

Without the liquid crystals between them, light passing through one would be blocked by the other.
The liquid crystal twists the polarization of light entering one filter to allow it to pass through the
other.

DVR & Dr. HS MIC College of Technology 58


Arduino Based Smart LPG Gas Leakage Detector System

4.7 BUZZER

A buzzer or beeper is a signaling device, usually electronic, typically used in automobiles,


household appliances such as a microwave oven, or game shows.

It most commonly consists of a number of switches or sensors connected to a control unit


that determines if and which button was pushed or a preset time has lapsed, and usually illuminates
a light on the appropriate button or control panel, and sounds a warning in the form of a continuous
or intermittent buzzing or beeping sound. Initially this device was based on an electromechanical
system which was identical to an electric bell without the metal gong . Often these units were
anchored to a wall or ceiling and used the ceiling or wall as a sounding board. Another
implementation with some AC-connected devices was to implement a circuit to make the AC
current into a noise loud enough to drive a loudspeaker and hook this circuit up to a cheap 8-ohm
speaker. Nowadays, it is more popular to use a ceramic-based piezoelectric sounder like a Son
alert which makes a high-pitched tone. Usually these were hooked up to "driver" circuits which
varied the pitch of the sound or pulsed the sound on and off.

In game shows it is also known as a "lockout system," because when one person signals
("buzzes in"), all others are locked out from signaling. Several game shows have large buzzer
buttons which are identified as "plungers".

The word "buzzer" comes from the rasping noise that buzzers made when they were
electromechanical devices, operated from stepped-down AC line voltage at 50 or 60 cycles. Other
sounds commonly used to indicate that a button has been pressed are a ring or a beep.

Fig 4.18-buzzer

DVR & Dr. HS MIC College of Technology 59


Arduino Based Smart LPG Gas Leakage Detector System

4.8 MCB(MINIATURE CIRCUIT BREAKER)

4.8.1 CIRCUIT BREAKER

They are automatically operated electromechanical switches designed in such a way to


protect electric circuit or load from the damage caused by overcurrent. Overcurrent can be the
result of overload or short circuit or earth fault. Its basic function is to interrupt the current flow
when a fault is detected. There are different types of circuit breakers depending upon the fault
conditions they detect, the trip current they can sustain. Some of them are Miniature Circuit
Breaker(MCB), Molded Case Circuit Breaker(MCCB), Vacuum Circuit Breaker(VCB), Air
Circuit Breaker(ACB), Residual Current Circuit Breaker(RCCB), Earth Leakage Circuit
Breaker(ELCB), etc. In this project, an MCB and an RCCB are used.

4.8.2 MINIATURE CIRCUIT BREAKER

MCBs are primarily used for overload and short-circuit protection. They are manufactured
in different pole versions such as single, double, triple and four pole structures with different trip
current ratings. Majority of MCBs that are manufactured are of single pole construction used in
single-phase circuits. They are enclosed in a moulded insulating material which provides strong
and insulated housing. The current carrying parts are made of copper or silver alloy depending on
the rating of the MCB. MCBs are designed to handle electric arc formed during a trip by metallic
arc splitter plates (Arc-Chute Chamber).

Fig 4.19 –sagittal view of an MCB

DVR & Dr. HS MIC College of Technology 60


Arduino Based Smart LPG Gas Leakage Detector System

4.8.3 OPERATING MECHANISM OF MCB

The operating mechanism consists of both magnetic and thermal tripping.

The thermal tripping mechanism consists of a bimetallic strip around which a heater coil
is wounded to create heat depending on the flow of current. The tripping mechanism is activated
by the deflection of the bimetallic strip due to a continuous flow of overload current. So, the
characteristics of bimetallic strip provide the particular delays under overload or fault currents.

The magnetic tripping mechanism consists of a coil which is wounded around a tube. This
tube has a spring-loaded slug and the slug movement operates the tripping mechanism. The
magnetic field generated by the coil during the high short-circuit current overcomes the spring
force holding the slug in position. So, the movement of slug actuates the tripping mechanism. The
tripping mechanism is activated by the deflection of the bimetallic strip due to a continuous flow
of overload current. .

4.8.4 CLASSIFICATION OF MCB’s

MCBs are classified into three major types according to their instantaneous tripping times

MCB MINIMUM TRIP MAXIMUM TRIP


TYPE CURRENT CURRENT

B 3Ir 5Ir

C 5Ir 10Ir

D 10Ir 20Ir

Fig 4.1- Table of classification of MCB’s

Choosing a particular MCB for a specific application is very important. The following
condition must be considered while choosing the MCB.

Maximum full load current in system ≤ Current rating of MCB ≤ Cable or wire rating

DVR & Dr. HS MIC College of Technology 61


Arduino Based Smart LPG Gas Leakage Detector System

CHAPTER 5

SOFTWARE

5.1 FLOW CHART DESIGN

Fig 5.1-project flow chart

DVR & Dr. HS MIC College of Technology 62


Arduino Based Smart LPG Gas Leakage Detector System

5.2 STEPS TO PROGRAM ARDUINO

5.2.1 PREPARING AN ARDUINO BOARD

 PURCHASE PARTS: purchase the parts from any electronics store. The Serial version in
particular has been designed to use the most basic parts that can be found anywhere in the
world. The USB version on the other hand requires some advanced soldering skills because
of the FTDI chip that is an Smd part. Here is a list of parts for the serial board.
 ASSEMBLE THE BOARD: We put together a step by step guide on how to build an
arduino board. Newbies: never soldered before? afraid of trashing thousands of boards
before getting one properly soldered? fear not : learn to master the art of soldering.
 PROGRAM THE BOOTLOADER: In order for the development environment to be able
to program the chip, this has to be programmed with a piece of code called bootloader. See
the bootloader page on how to program it on your chip.

5.2.2 DOWNLOAD THE ARDUINO ENVIRONMENT

To program the Arduino board you need the Arduino environment.

Download Arduino: From the Arduino open source website

Mac OS X note: After downloading the IDE, run the macosx_setup.command. It corrects
permission on a few files for use with the serial port and will prompt you for your password. You
may need to reboot after running this script.

Fig 5.2- command for MAC OS to install Arduino IDE

DVR & Dr. HS MIC College of Technology 63


Arduino Based Smart LPG Gas Leakage Detector System

5.2.3 INSTALL THE USB DRIVERS

If you are using a USB Arduino, you will need to install the drivers for the FTDI chip on

the board. These can be found in the Drivers directory of the Arduino distribution.

On Windows, you will need to unzip FTDI USB Drivers.zip. Then, when you plug
in the Arduino board, point the Windows Add Hardware wizard to the FTDI USB

Drivers directory.

On the Mac, mount the FTDIUSBSerialDriver_v2_1_6.dmg (on PPC machines) or


the FTDIUSBSerialDriver_v2_2_6_Intel.dmg (on Intel machines) disk image and run the
included FTDIUSBSerialDriver.pkg.

Fig 5.3-setting USB Drivers

5.2.4 CONNECT THE BOARD

If you're using a serial board, power the board with an external power supply (6 to 25 volts
DC, with the core of the connector positive). Connect the board to a serial port on your computer.

On the USB boards, the power source is selected by the jumper between the USB and
power plugs. To power the board from the USB port (good for controlling low power devices
like LEDs), place the jumper on the two pins closest to the USB plug. To power the board from an
external power supply (needed for motors and other high current devices), place the jumper on the
two pins closest to the power plug. Either way, connect the board to a USB port on your computer.

DVR & Dr. HS MIC College of Technology 64


Arduino Based Smart LPG Gas Leakage Detector System

On Windows, the Add New Hardware wizard will open; tell it you want to specify the location to
search for drivers and point to the folder containing the USB drivers you unzipped in the previous
step.

The power LED should go on.

Fig 5.4-connecting ARDUINO board (power LED ON)

5.2.5 UPLOAD A PROGRAM

Open the LED blink example sketch: File > Sketchbook > Examples > led_blink.

Fig 5.5- selection of files for uploading

DVR & Dr. HS MIC College of Technology 65


Arduino Based Smart LPG Gas Leakage Detector System

Here's what the code for the LED blink example looks like.

Fig 5.6- snapshot of test code Led_blink

Select the serial device of the Arduino board from the Tools | Serial Port menu. On
Windows, this should be COM1 or COM2 for a serial Arduino board, or COM3, COM4,
or COM5 for a USB board. On the Mac, this should be something like /dev/cu.usbserial-

DVR & Dr. HS MIC College of Technology 66


Arduino Based Smart LPG Gas Leakage Detector System

1B1 for a USB board, or something like /dev/cu.USA19QW1b1P1.1 if using a Keyspan adapter
with a serial board (other USB-to-serial adapters use different names).

Fig 5.7-Snapshot of selecting ports

Push the reset button on the board then click the Upload button in the IDE. Wait a few
seconds. If successful, the message "Done uploading." will appear in the status bar.

Fig 5.8- resetting the Arduino

DVR & Dr. HS MIC College of Technology 67


Arduino Based Smart LPG Gas Leakage Detector System

If the Arduino board doesn't show up in the Tools | Serial Port menu, or you get an error
while uploading, please see the FAQ for troubleshooting suggestions.

A few seconds after the upload finishes, you should see the amber (yellow) LED on the
board start to blink.

To upload new code to the Arduino, either you'll need to have access to code you can paste
into the programmer, or you'll have to write it yourself, using the Arduino programming language
to create your own sketch.

An Arduino sketch usually has five parts:

 A header describing the sketch and its author

 A section defining variables

 A setup routine that sets the initial conditions of variables and runs preliminary code

 A loop routine, which is where you add the main code that will execute repeatedly until
you stop running the sketch and

 A section where you can list other functions that activate during the setup and loop routines.
All sketches must include the setup and loop routines.

DVR & Dr. HS MIC College of Technology 68


Arduino Based Smart LPG Gas Leakage Detector System

CHAPTER 6

RESULT

Gas Light exhaust Buzzer Alert message MCB GPS Location


indicator fan
concentration (GSM module) condition To fire station

90 ppm off off on none on none

250 ppm on on on none on none

310 ppm on on on Gas Leakage is off none


detected

340 ppm on on on Gas Leakage is off Location


detected
is sent

550 ppm on on on Gas Leakage is off Location


detected
is sent

Fig 6.1-Tabular form of Results

 When the kit is switched on 40sec will be taken for initialization of the kit and the gas
sensor to get heated up.

DVR & Dr. HS MIC College of Technology 69


Arduino Based Smart LPG Gas Leakage Detector System

Fig 6.1- Initialization stage

 After initialization the MCB is turned on, the LED light indicator and fan will be in off
state as shown in figure below

Fig 6.2- when Gas concentration is 25 PPM

DVR & Dr. HS MIC College of Technology 70


Arduino Based Smart LPG Gas Leakage Detector System

 when the gas leakage is detected the buzzer goes ON and when the concentration raises
above 250 ppm the appliances like fan and LED indicator are turned on and the MCB trips
OFF.
 And when the gas concentration raise above the 300 ppm the GSM message that the LPG
gas is detected is sent to the owner and the when gas concentration raises above 320 ppm
the location is indicated to the fire station through the app we designed.
 As seen in the below picture ,the light is off indicating that the MCB is tripped off and
appliances like exhaust fan, light indicator are turned ON and Buzzer is also on.

Fig 6.3- when Gas concentration is 821 PPM

DVR & Dr. HS MIC College of Technology 71


Arduino Based Smart LPG Gas Leakage Detector System

Fig 6.4 – GSM alert message sent

Fig 6.5- GPS location is sent Fig 6.6-Google maps view of location

DVR & Dr. HS MIC College of Technology 72


Arduino Based Smart LPG Gas Leakage Detector System

CHAPTER 7

CONCLUSION AND FUTURE SCOPE

7.1 CONCLUSION

The protection mechanism system for fire accidents was implemented. The value of
Concentration of gas is detected and operation of the appliances and working of project is assessed.
The LCD displayed the concentration of Gas and the light indicator are switched on when the gas
is detected and also the GPS location is sent to the fire station when the gas concentration reached
a dangerous level.

In the process of completing the project following points were inferred from the results
and mistakes:

 When we used the MQ-6 sensor for the first time, we didn’t get the desired output. Later it
was inferred from the datasheet that all semiconductor gas sensors must be heated for some
time (approximately 24 hours) namely the preheating time.
 We inferred from our experience that the semiconductor gas sensors will not work properly
under high humidity conditions.
 We also inferred from the datasheet (of MQ-6) that first, we should apply the supply
voltage to the heating pins and then only pins A & B must be connected to resistor and
ground otherwise the gas sensor may get damaged.
 The GPS module cannot receive the signal sometimes inside the home.so an external GPS
antenna can be used.
 Since the power will be MCB will tripped and power supply is off inside the house, an
external secondary power source like battery should be used for project.

7.2 FUTURE SCOPE

 A new type of MCB can be moulded with 3D printing, so that instead of using relay
externally it can be embedded inside the MCB.
 The desktop site can be created for receiving the GPS alert when the gas concentration
reaches a dangerous level in any house.

DVR & Dr. HS MIC College of Technology 73


Arduino Based Smart LPG Gas Leakage Detector System

CHAPTER 8

REFERENCES

1. Antonette D’Sa, and K V Narasimha Murthy, “Report on the use of LPG as a domestic
cooking fuel option in India,” in International Energy Initiative, Bangalore, 2004, pp. 17.

2. The Hindu. (2018, Jan.) Domestic LPG consumption set to grow 10% this fiscal.
[Online]. Available: http://www.thehindubusinessline.com/economy/domestic-lpg-consumption-
set-to-grow-10-this-fiscal/article9642347.ece

3. Business Standard. (2015, Sep.) Fire accidents kill 54 people daily in India, yet deaths
have declined. [Online]. Available: http://www.business-standard.com/article/specials/fire-
accidents-kill-54-people-daily-in-india-yet-deaths-have-declined-115092500584_1.html

4. The Hindu. (2013, Nov.) What sparks LPG accidents. [Online]. Available:
http://www.thehindu.com/news/national/tamil-nadu/what-sparks-lpg-
accidents/article5372757.ece

5. Wikipedia. (2018, Jan.) Gas Detector. [Online]. Available:


https://en.wikipedia.org/wiki/Gas_detector

6. www.china-total.com. Gas Sensor. [Online]. Available: http://www.china-


total.com/Product/meter/gas-sensor/Gas-sensor.htm

7. edaphic scientific. (2018) The Semiconductor gas sensing technique. [Online].


Available: http://www.edaphic.com.au/gas-detection-encyclopedia/semiconductor-sensors/

8. Tashika. (2010) Environmental Protection Instruments. [Online]. Available:


http://www.tashika.co.jp/products/environmental/gas_sensors/operating_principle.html

9. Electronicshub.org. (2015, Oct.) Miniature Circuit Breaker. [Online]. Available:


https://www.electronicshub.org/miniature-circuit-breaker

10. http://www.circuitstoday.com/gas-leakage-detector-using-arduino-with-sms-alert for


the interfacing connections of different devices with Arduino uno.

DVR & Dr. HS MIC College of Technology 74


Arduino Based Smart LPG Gas Leakage Detector System

ANNEXURE A

ARDUNO CODE FOR THE PROJECT

#include <LiquidCrystal.h>

const int rs = 10, en = 11, d4 = 4, d5 = 5, d6 = 6, d7 = 7;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

#include <SoftwareSerial.h>

SoftwareSerial gps(2, 3);

unsigned char sdata=0,rx[40],r,opm=1;

int la,lo,latt,lonn,gps_chk='0',i;

float lath,latl,lonh,lonl,lat,lon;

int ss=0;

const int gas=A0;

const int rl1=A1;

const int rl2=A2;

const int lt=12;

const int bz=13;

const int fn=9;

int gval=0;

void setup() {

// put your setup code here, to run once:

Serial.begin(9600);

DVR & Dr. HS MIC College of Technology 75


Arduino Based Smart LPG Gas Leakage Detector System

gps.begin(9600);

lcd.begin(16,2);

lcd.print(" WELCOME");

lcd.setCursor(0,1);

lcd.print("INITIALIZING..");

pinMode(lt,OUTPUT);

pinMode(bz,OUTPUT);

pinMode(rl1,OUTPUT);

pinMode(rl2,OUTPUT);

pinMode(fn,OUTPUT);

delay(40000);

digitalWrite(bz,0);

digitalWrite(lt,1);

digitalWrite(fn,1);

digitalWrite(rl1,0);

digitalWrite(rl2,0);

lcd.clear();

lcd.print("GAS: PPM");

lcd.setCursor(0,1);

lcd.print("MCB:ON ");

Serial.println("WELCOME");

DVR & Dr. HS MIC College of Technology 76


Arduino Based Smart LPG Gas Leakage Detector System

void loop() {

// put your main code here, to run repeatedly:

gval=a

nalogRead(gas);

int gval=analogRead(gas);

lcd.setCursor(4,0);

lcd.print(" ");

lcd.setCursor(4,0);

lcd.print(gval);

delay(500);

if(gval>250 && gval<300 )

digitalWrite(bz,1);

delay(300);

digitalWrite(bz,0);

delay(300);

ss=0;

else if(gval>300 && ss==0)

DVR & Dr. HS MIC College of Technology 77


Arduino Based Smart LPG Gas Leakage Detector System

ss=1;

lcd.setCursor(0,1);

lcd.print("MCB:OFF");

digitalWrite(rl1,1);

digitalWrite(rl2,1);

digitalWrite(bz,1);

digitalWrite(lt,0);

read_gps(3);

delay(1000);

if(gval>320)

ss=0;

lcd.setCursor(0,1);

lcd.print("MCB:OFF");

digitalWrite(bz,1);

digitalWrite(lt,0);

digitalWrite(rl1,1);

digitalWrite(rl2,1);

read_gps(2);

delay(1000);

DVR & Dr. HS MIC College of Technology 78


Arduino Based Smart LPG Gas Leakage Detector System

while(1);

unsigned char rxd (void)

while (gps.available()==0);

return(gps.read());

//return (sdata);

void read_gps(unsigned char vv)

gps_chk='0';

while(gps_chk=='0')

if(rxd()=='$')

if(rxd()=='G')

if(rxd()=='P')

if(rxd()=='G')

DVR & Dr. HS MIC College of Technology 79


Arduino Based Smart LPG Gas Leakage Detector System

if(rxd()=='G')

if(rxd()=='A')

gps_chk='1';

for(r=0;r<36;r++)

rx[r] = rxd();

/*for(r=12;r<36;r++)

Serial.write(rx[r]);//rx[r] = rxd();

}*/

//Serial.println();

la=(rx[12]&0x0f)*10+(rx[13]&0x0f);

lath=(rx[14]&0x0f)*10+(rx[15]&0x0f);

latl=(rx[17]&0x0f)*1000+(rx[18]&0x0f)*100+(rx[19]&0x0f)*10+(rx[20]&0x0f);

lo=(rx[25]&0x0f)*10+(rx[26]&0x0f);

lonh=(rx[27]&0x0f)*10+(rx[28]&0x0f);

DVR & Dr. HS MIC College of Technology 80


Arduino Based Smart LPG Gas Leakage Detector System

lonl=(rx[30]&0x0f)*1000+(rx[31]&0x0f)*100+(rx[32]&0x0f)*10+(rx[33]&0x0f);

//-----------------lat------------------------

lath=lath/60;

latl=(latl/60)/10000;

lat=lath+latl;

latt=lat*10000;

//------------------lon------------------------

lonh=lonh/60;

lonl=(lonl/60)/10000;

lon=lonh+lonl;

lonn=lon*10000;

gps.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode

delay(1000); // Delay of 1000 milli seconds or 1 second

gps.print("AT+CMGS=\"8919388863\"\r\n");// Replace x with mobile number

delay(1000);

gps.println("GAS:");

gps.write(gval/1000+48);

gps.write((gval/100)%10+48);

DVR & Dr. HS MIC College of Technology 81


Arduino Based Smart LPG Gas Leakage Detector System

gps.write((gval/10)%10+48);

gps.write((gval/1)%10+48);

gps.println(" PPM");

gps.println("GAS DETECTED IN HOME LOCATED AT:");

gps.print("http://maps.google.com/maps?q=");

gps.print(la);gps.print('.');gps.print(latt);gps.print(",");//Serial.println(latl);

gps.print(lo);gps.print('.');gps.println(lonn);//16.496390, 80.654752

delay(100);

gps.println((char)26);// ASCII code of CTRL+Z

delay(5000);

gps.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode

delay(1000); // Delay of 1000 milli seconds or 1 second

gps.print("AT+CMGS=\"9154158262\"\r\n");// Replace x with mobile number

delay(1000);

gps.println("GAS:");

gps.write(gval/1000+48);

gps.write((gval/100)%10+48);

gps.write((gval/10)%10+48);

gps.write((gval/1)%10+48);

DVR & Dr. HS MIC College of Technology 82


Arduino Based Smart LPG Gas Leakage Detector System

gps.println(" PPM");

gps.println("GAS DETECTED IN HOME");

delay(100);

gps.println((char)26);// ASCII code of CTRL+Z

Serial.print("http://maps.google.com/maps?q=");

Serial.print(la);Serial.print('.');Serial.print(latt);Serial.print(",");//Serial.println(latl);

Serial.print(lo);Serial.print('.');Serial.println(lonn);//16.496390, 80.654752

delay(4000);

//-------------------------------------------------------------

DVR & Dr. HS MIC College of Technology 83

You might also like