You are on page 1of 54

ABSTRACT:

Liquefied Petroleum Gas (LPG) is an inevitable on in day-to- day life.LPG is used in


many range of applications like cooking appliances, industrial appliances, in vehicles and as a
propellant and refrigerator. Due to leakage of LPG, it produces hazardous and toxic impact on
human begins and also other living creatures. To over this predicament, we need quittance. There
by, we speculate some solution to detect the LPG gas leakage and make alert to users of it. Here
we are using MQ2gas sensor for sensing the leakage and produce the sound alarm by buzzer
sound when it crosses the threshold value of >400ppm.It switch on the fan to spread out
compressed gas. Once again it recheck the value if it crosses >700ppm it will setup a SMS based
alert mechanism by GSM module SIM900A. The controller used here is Arduino. The sensor has
excellent sensitivity combined with a quick requital time. This paper provides design approach
on both software and hardware. Here for this purpose an embedded system comprising of
“Arduino controllers”, “Embedded C”, Gas sensor, “GSM MODULE SIM900A”.
CHAPTER 1

1.1 INTRODUCTION
LPG consists of mixture of propane and butane which is highly flammable chemical. It is
odorless gas, due to which Ethanate oil is added as powerful odorant,
So that leakage can be easily detected. There are other international standards like EN589, amyl
Mercaptane and tetrahydrothiophene which are most commonly used as odorants. LPG is one of
the alternate fuels used now days. LPG is also used as an alternate fuel in vehicles due to soaring
in the prices of petrol and diesel.
Some people have low sense of smell, may or may not respond on low concentration of
gas leakage. In such a case, some high security systems become an essential and help to protect
from gas leakage accidents. Bhopal, Chernobyl, Okishima gas tragedy was an example of gas
leakage accident in India, Russia and Japan. This was world’s worst gas leakage industrial
accident. Gas leakage detection is not only important but stopping leakage is equally essential.
We designed a system which sniffs LPG leakage and emphraxis by the measures such as
spinning the Exhaust fan, SMS, Buzzer sound, LED Blink.

1.2 LITERATURE REVIEW:


The presence of dangerous LPG leakage in the cars, service station or in the storage tank
environment can be detected using the Ideal Gas Sensor. This LPG gas leakage detector unit can
be easily integrated into a unit that can sound an alarm or give a visual suggestion of the LPG
concentration. The sensor has both admirable sensitivity and rapid response time. This sensor can
also be used to sense other gases like iso-butane, propane, LNG and even cigarette smoke.

“Design and Implementation of an Economic Gas Leakage Detector”, this project is


developed to detect the gas leakage and providing immediate alarm or intimation to the user.
Developed the design proposed for home safety. This system detects the leakage of the LPG and
alerts the consumer about the leak by buzzer. This project was developed using microcontroller
ARM version7 processor and simulated using Keil software. Controller based LPG gas
Monitoring & Automatic Cylinder booking with Alert System [1].

This paper consists same like previous paper but here arduino controller is used and
detects the lpg gas leakage by gas sensor mq2 and within a few minutes automatically switch on
the exhaust fan and buzzer to provide the alertness to the people. Here GSM SIM900A module is
used to send the message to the predefined number so information can be sent and can prevent
fire accidents [2].

1
This paper involves like previous paper but involves, they provided security issues
against thieves, leakage and fire accidents. In those cases their system sends SMS to the
emergency number provided to it. In the proposed system we have designed “LPG gas
monitoring and automatic cylinder booking with alert system”. These report focus on detection
of economic fuels like petroleum, liquid petroleum gas, alcohol etc., and alert the surrounding
people about the leakage through SMS. It also sense surrounding temperature, so that no fire
accidents occurs. The one more important feature is automatic cylinder booking by noticing the
current expenditure of LPG gas in our daily life. These projects alert the user by sending message
to mobile through SMS in three conditions. They are

When LPG gas weight reaches to maximum threshold value.

 When the LPG gas exceed its peak value.

 When the temperature exceed more than room temperature.

 This project gives alert message by buzzing the buzzer and through SMS to the house holders.

We also provide automatic doors and windows opening, so that the compressed gas can spread in
to air freely. Hence a fire accident does not occur [3].

1.3 PROBLEM FORMULATION:


This is the major problem now a day which causes a very dangerous to the users of
LPG .The detection of LPG leakage automatically by gas sensor if it crosses the threshold value.
Here it can be prevented by detecting before it becomes an accident by gas sensor module and
providing immediate alert by buzzing the sound and sending the message to the predefined
number. To avoid leakage accidents in the industries, homes, hotels, restaurants and in where the
lpg gas cylinders are used. It will detect the gas leakage and alerts the users before so immediate
precaution can be taken to prevent the accident.

1.4 OBJECTIVES OF THE THESIS


The objective of the thesis is to investigate about the requirements of the project and thus
deriving the specifications of the project which includes both hardware and software, i.e.
gathering various hardware components and software products and integrate them to form
required embedded system. And after forming the required system the objective is to test the
system to confirm whether the system is up to required objective or not in various environments,
and making a record of the results. Thus concluding the project and declaring the future scope if
any of the project.

2
1.5 ORGANISATION OF THE THESIS
CHAPTER 1:
- It is about the introduction and problem formulation of the LPG gas leakage detector
using arduino with SMS alert.

CHAPTER 2:

- It is about the hardware used in the project and writing the information about the
specifications of the each module is been used to make in a systematic format.

CHAPTER 3:

- It specifies about the description of the software tools used in the project, thus giving the
clear view of the design procedure.

CHAPTER 4:

- Is all about test report. The project is tested and results are noted.

CHAPTER 5:

- Conclusion and future scope.

CHAPTER 2

2.1 BLOCK DIAGRAM&HARDWARE REQUIREMENTS:

3
1. Arduino Uno Atmega 328
2. LPG Gas sensor Module MQ-2

3. Buzzer

4. Exhaust Fan

5. GSM MODULE SIM 900A

2.2 SPECIFICATIONS OF COMPONENTS:

ARDUINO UNO

• Microcontroller ATmega328

• Operating Voltage 5V

• Input Voltage (recommended) 7-12V

• Input Voltage (limits) 6-20V

• Digital I/O Pins 14 (of which 6 provide PWM output)

• Analog Input Pins 6

• DC Current per I/O Pin 40 mA

• DC Current for 3.3V Pin 50 mA

• Flash Memory 32 KB of which 0.5 KB used by boot loader

• SRAM 2 KB

• EEPROM 1 KB

• Clock Speed 16 MHz

GSM MOULE SPECIFICATIONS:

4
 High Quality Product (Not hobby grade)
 Dual-Band GSM/GPRS 900/ 1800 MHz

 RS232 interface for direct communication with computer or MCU kit

 Configurable baud rate

 Wire Antenna ( SMA connector with GSM Antenna Optional )

 SIM Card holder.

 Built in Network Status LED

 Inbuilt Powerful TCP/IP protocol stack for internet data transfer over GPRS.

 Normal operation temperature: -20 °C to +55 °C

 Input Voltage: 12V DC

GAS SENSOR MQ2 MODULE SPECIFICATIONS:

1. Concentration level for LPG is 400-1000ppm.


2. Circuit voltage is 5V.
3. Heating consumption less than 800m W.
4. Load resistance adjustable.
5. Wide detecting scope.
6. High sensitivity to combustible gas in wide range.
7. Fast response.
8. Stable and long life.

5
BLOCK DIADRAM:

6
2.4 ARDUINO UNO

2.4.1 Introduction:

The Arduino Uno is a microcontroller board based on the ATmega328. 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 an AC-to-DC adapter or battery to get started. The
Uno differs from all preceding boards in that it does not use the FTDIUSB-to-serial driver chip.
Instead, it features the 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 version1.0 will be the reference versions of Arduino, moving forward. The Uno is
the latest in a series of USB Arduino boards, and the reference model for the Arduino platform;
for a comparison with previous versions.

7
2.4.2 TECHNICAL SPECIFICATIONS:
Microcontroller: ATmega328
Operating Voltage: 5V
Input Voltage: 7-12V
Input Voltage (limits): 6-20V
Digital I/O Pins: 14 (of which 6 provide PWM output)
Analog Input Pins: 6
DC Current per I/O Pin 40: mA
DC Current for 3.3V Pin 50 mA
Flash Memory: 32 KB of which 0.5 KB used by boot loader
SRAM: 2 KB
EEPROM: 1 KB
Clock Speed: 16 MHz
THE BOARD:

Figure 2.2 Arduino board.

8
2.4.3 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 centre-
positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and
Vin pin headers of the POWER connector. The board can operate on an external supply of 6 to
20 volts. If supplied with less than 7V, however, the 5Vpin 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 to5 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.

2.4.4 MEMORY:

The Atmega328 has 32 KB of flash memory for storing code (of which 0,5 KB is used for the
boot loader); It has also 2 KB of SRAM and 1 KB of EEPROM (which can be read and written
with the EEPROM library).
2.4.5 INPUT AND OUTPUT:
Each of the 14 digital pins on the Uno can be used as an input or output, using pin Mode (),
digital Write (), and digital Read () functions. They operate at 5 volts. Each pin can provide or
receive a maximum of 40mA and has an internal pull-up resistor (disconnected by default) of 20-
50K ohms’. In addition, some pins have specialized functions:

9
· Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins
are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.
· 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.
· PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analog Write() 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 provide10 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 analog Reference() function. Additionally,
some pins have specialized functionality:
· I2C: 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 analog Reference ().
· 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.
2.4.6 COMMUNICATIONS:
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 USBCOM 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
transmitted via the USB-to serial chip and USB connection to the computer (but not for serial

10
communication on pins 0 and 1). A Software Serial library allows for serial communication on
any of the Uno's digital pins. The ATmega328 also support I2C (TWI) and SPI communication.

2.4.7 PROGRAMMING:
The Arduino Uno can be programmed with the Arduino software (download). Select
"Arduino Uno w/ATmega328" from the Tools > Board menu (according to the microcontroller
on your board).
The ATmega328 on the Arduino Uno provides pre burned with a boot loader that allows
you to upload new code to it without the use of an external hardware programmer. It
communicates using the original STK500 protocol (reference, C header files).
You can also bypass the boot loader and program the microcontroller through the ICSP (In-
Circuit Serial Programming) header.
The ATmega8U2 firmware source code is available. The ATmega8U2 is loaded with a
DFU boot loader, which can be activated by connecting the solder jumper on the back of the
board (near the map of Italy) and then resetting the 8U2. You can then use Atmel's FLIP software
(Windows) or the DFU programmer (Mac OS X and Linux) to load a new firmware. Or you can
use the ISP header with an external programmer (overwriting the DFU boot loader).

2.4.8 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 allow it to be reset by software running on a connected computer.
One of the hardware flow control lines (DTR) of the ATmega8U2 is connected to the reset line of
the ATmega328 via a 100 nano farad 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 boot loader can have a shorter timeout, as the lowering of DTR can be well-coordinated
with the start of the upload.
This setup has other implications. When the Uno is connected to either a computer
running Mac OS X or Linux, it resets each time a connection is made to it from software (via

11
USB). For the following half-second or so, the boot loader is running on the Uno. While it is
programmed to ignore malformed data (i.e. anything besides an upload of new code), it will
intercept the first few bytes of data sent to the board after a connection is opened. If a sketch
running on the board receives one-time configuration or other data when it first starts, make sure
that the software with which it communicates waits a second after opening the connection and
before sending this data. The 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 labelled "RESET-
EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to
the reset line.
2.4.9 USB OVER CURRENT PROTECTION:
The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from
shorts and over current. Although most computers provide their own internal protection, the fuse
provides an extra layer of protection. If more than 500mA is applied to the USB port, the fuse
will automatically break the connection until the short or overload is removed.
2.4.10 PHYSICAL CHARACTERSITICS:
The maximum length and width of the Uno PCB are 2.7 and 2.1 inches respectively, with
the USB connector and power jack extending beyond the former dimension. Three screw holes
allow the board to be attached to a surface or case. Note that the distance between digital pins 7
and 8 is 160 mil (0.16"), not an even multiple of the 100 mil spacing of the other pins.

12
2.4.10 ATMEGA328P

The ATmega328 is a single chip micro-controller created by Atmel and belongs to the
mega AVR series.

2.4.11 SPECIFICATIONS:

The Atmel 8-bitAVRRISC-based microcontroller combines 32 KB ISP flash memory


with read-while-write capabilities, 1 KB EEPROM, 2 KB SRAM, 23 general purpose I/O lines,
32 general purpose working registers, three flexible timer/counters with compare modes, internal
and external interrupts, serial programmable USART, a byte-oriented 2-wire serial interface, SPI
serial port, 6-channel 10-bit A/D converter (8-channels in TQFP and QFN/MLF packages),
programmable watchdog timer with internal oscillator, and five software selectable power saving
modes. The device operates between 1.8-5.5 volts. The device achieves throughputs approaching
1 MIPS per MHz

13
Fig 2.3 ATMEGA328P

2.4.12 Key parameters

PARAMETERS VALUE
Flash 32Kbytes
RAM 2 Kbytes
Pin Count 28
Max. Operating Frequency 20 MHz
8-bit
CPU
AVR
# of Touch Channels 16

Max I/O Pins 26


Ext Interrupts 24
USB Interface No
USB Speed No

Series alternatives

A common alternative to the ATmega328 is the "pico Power" ATmega328P. A


comprehensive list of all other member of the mega AVR series can be found on the Atmel
website.

14
15
Figure 2.4: BLOCK DIAGRAM OF ATMEGA328

The AVR core combines a rich instruction set with 32 general purpose working registers.
All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two
independent registers to be accessed in one single instruction executed in one clock cycle. The
resulting architecture is more code efficient while achieving throughputs up to ten times faster
than conventional CISC microcontrollers. The ATmega32 provides the following features: 32K
bytes of In-System Programmable Flash Program memory with Read-While-Write capabilities,
1024 bytes EEPROM, 2K byte SRAM, 32 general purpose I/O lines, 32 general purpose working
registers, a JTAG interface for Boundary-scan, On-chip Debugging support and programming,

16
three flexible Timer/Counters with compare modes, Internal and External Interrupts, a serial
programmable USART, a byte oriented Two-wire Serial Interface, an 8-channel, 10-bit ADC
with optional differential input stage with programmable gain (TQFP package only), a
programmable Watchdog Timer with Internal Oscillator, an SPI serial port, and six software
selectable power saving modes. The Idle mode stops the CPU while allowing the USART, Two-
wire interface, A/D Converter, SRAM, Timer/Counters, SPI port, and interrupt system to
continue functioning.

The Power-down mode saves the register contents but freezes the Oscillator, disabling all
other chip functions until the next External Interrupt or Hardware Reset. In Power-save mode,
the Asynchronous Timer continues to run, allowing the user to maintain a timer base while the
rest of the device is sleeping. The ADC Noise Reduction mode stops the CPU and all I/O
modules except Asynchronous Timer and ADC, to minimize switching noise during ADC
conversions. In Standby mode, the crystal/resonator Oscillator is running while the rest of the
device is sleeping. This allows very fast start-up combined with low-power consumption. In
Extended Standby mode, both the main Oscillator and the Asynchronous Timer continue to run.
The device is manufactured using Atmel’s high density nonvolatile memory technology. The On-
chip ISP Flash allows the program memory to be reprogrammed in-system through an SPI serial
interface, by a conventional nonvolatile memory programmer, or by an On-chip Boot program
running on the AVR core.

The boot program can use any interface to download the application program in the
Application Flash memory. Software in the Boot Flash section will continue to run while the
Application Flash section is updated, providing true Read-While-Write operation. By combining
an 8-bit RISC CPU with In-System Self-Programmable Flash on a monolithic chip, the Atmel
ATmega32 is a powerful microcontroller that provides a highly-flexible and cost-effective
solution to many embedded control applications. The ATmega32 AVR is supported with a full
suite of program and system development tools including: C compilers, macro assemblers,
program debugger/simulators, in-circuit emulators, and evaluation kits.

17
2.4.13 PIN DESCRIPTION:
VCC:

Digital supply voltage.

GND:

Ground.

Port A (PA7:PA0):

Port A serves as the analog inputs to the A/D Converter. Port A also serves as an 8-bit bi-
directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up
resistors (selected for each bit). The Port A output buffers have symmetrical drive characteristics
with both high sink and source capability. When pins PA0 to PA7 are used as inputs and are
externally pulled low, they will source current if the internal pull-up resistors are activated. The
Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running.

Port B (PB7:PB0):

Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each
bit). The Port B output buffers have symmetrical drive characteristics with both high sink and
source capability. As inputs, Port B pins that are externally pulled low will source current if the
pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes
active, even if the clock is not running.

Port C (PC7:PC0):

Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each
bit). The Port C output buffers have symmetrical drive characteristics with both high sink and
source capability. As inputs, Port C pins that are externally pulled low will source current if the
pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes
active, even if the clock is not running. If the JTAG interface is enabled, the pull-up resistors on
pins PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a reset occurs.

18
The TD0 pin is tri-stated unless TAP states that shift out data are entered.

Port D (PD7:PD0):

Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each
bit). The Port D output buffers have symmetrical drive characteristics with both high sink and
source capability. As inputs, Port D pins that are externally pulled low will source current if the
pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes
active, even if the clock is not running.

RESET:

A low level on this pin for longer than the minimum pulse length will generate a reset,
even if the clock is not running. Shorter pulses are not guaranteed to generate a reset.

XTAL1:

Input to the inverting Oscillator amplifier and input to the internal clock operating
circuit.

XTAL2:

Output from the inverting Oscillator amplifier.

AVCC:

It is the supply voltage pin for Port A and the A/D Converter. It should be externally
connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to
VCC through a low-pass filter.

AREF:

It is the analog reference pin for the A/D Converter.

19
2.4.14 APPLICATIONS OF ARDUINO:
Today the ATmega328 is commonly used in many projects and autonomous systems
where a simple, low-powered, low-cost micro-controller is needed. Perhaps the most common
implementation of this chip is on the popular Arduino development platform, namely the
Arduino Uno and Arduino Nano models.

2.5 MQ-2 GAS SENSOR:

MQ2 is a semiconductor type gas sensor which detects the gas leakage. The sensitive
material of MQ-2 is tin dioxide (SnO2). It has very low conductivity in clean air. MQ-2 gas
sensor has high sensitivity to LPG, concentration level of it is from 400 – 1000ppm and it also
detects the following flammable gases:
1. Propane
2. Hydrogen
3. Methane
4. Butane.
Different concentration level for different gases:

400-1000ppm – LPG and Propane


300-5000ppm - Butane
5000-2000ppm- Methane
300-5000ppm-H2
100-2000ppm -Alcohol

20
2.5.1 FEATURES OF MQ2 GAS SENSOR:
1. Wide detecting scope
2. High sensitivity to combustible gas in wide range
3. Fast response
4. Stable and long life
5. Simple drive circuit
6. Low cost and compact size.
The gas sensor senses the analog value according to the concentration of the gas level in
the environment. The concentration range of MQ2 gas sensor is 400-1000ppm for LPG and use
value of Load resistance (RL) about 20 KO (10KO to47KO). When accurately measuring, the
proper alarm point for the gas detector should be determined after considering the temperature
and humidity influence. The voltage that the sensor outputs changes accordingly to the
smoke/gas level that exists in the atmosphere. The sensor outputs a voltage that is proportional to
the concentration of smoke/gas. The resistance of the sensor is different depending on the type of
the gas.

MQ2 sensor senses the flammable gases by the increase in temperature when they are
oxidized by the heating element. Consider the figure given above. If there is any flammable gas
present in the sample, the oxidization of the same gas results in increased temperature and the
resistance of the sensor resistor will drop. That means more current will flow through the load
resistor and so the voltage across it will shoot up.

21
2.5.2 MQ2 GAS SENSOR PIN DESCRIPTION:

1. DO (digital pin)
2. AO (analog pin)
3. VCC (5V)
4. GROUND

Standard Working Condition:

Symbol Parameter Name Technical Condition Remarks

VC Circuit voltage 5V±0.1 AC or DC

VH Heating voltage 5V±0.1 AC or DC

RL Load resistance adjustable

RH Heater resistance 33Kohm±5% Room temperature

PH Heating consumption Less than 800mW

22
2.5.3 SENSITIVE CHARACTERISTICS OF MQ-2 GAS SENSOR:

2.5.4 SENSITIVITY ADJUSTMENT:

23
Resistance value of MQ-2 is difference to various kinds and various concentration gases.
So, when using these components, sensitivity adjustment is very necessary. Recommended that
you calibrate the detects for 1000ppm liquefied petroleum gas<LPG>, or 1000ppm iso-butane
concentration in air and use value of load resistance that about 20Kilo ohms.

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

2.5.5APPLICATION OF MQ2 GAS SENSOR:


 Domestic gas leakage detector.

 Industrial combustible gas leakage detector.

 Portable gas leakage detector.

2.6 GSM MODULE SIM900A

24
GSM SIM 900 Quad-band GSM/GPRS engine, works on frequencies 850MHz, 900MHz,
1800MHz. It is very compact in size and designed with RS 232 level converter circuitry, which
allows you to directly interface PC Serial port. GSM uses a combination of Time Division
Multiplexing and Frequency Division Multiplexing. The baud rate can be configurable from
9600-115200 MHz through AT command. Initially Module is in Auto band mode. This
GSM/GPRS RS232 Module is having internal TCP/IP stack to enable you to connect with
internet via GPRS. Using this module, we will be able to make audio call, send & read SMS and
attend the incoming calls through connecting to internet via GPRS through simple AT
commands. SIM900A is an ultra compact and reliable wireless module. This is a very powerful
single-chip processor integrating AMR926EJ-S core, allowing you to benefit from small
dimensions and cost-effective solutions.

2.6.1 GENERAL FEATURES OF GSM MODULE SIM900A:


 High Quality Product (Not hobby grade)
 Dual-Band GSM/GPRS 900/ 1800 MHz

 RS232 interface for direct communication with computer or MCU kit

 Configurable baud rate

 Wire Antenna ( SMA connector with GSM Antenna Optional )

 SIM Card holder.

25
 Built in Network Status LED

 Inbuilt Powerful TCP/IP protocol stack for internet data transfer over GPRS.

 Normal operation temperature: -20 °C to +55 °C

 Input Voltage: 12V DC

 Low power consumption: 1.5mA(sleep mode)

 Class 4(2W @900Mhz)

 Class 1(1W @1800Mhz)

 Control via AT command

SPECIFICATIONS FOR GPRS DATA:

 GPRS class 10
 Maximum range 85.6 Kbps(downlink)
 Maximum range 42.8Kbps(uplink)
 Coding schemes CS 1,2,3,4

SPECIFICATIONS FOR SMS VIA GSM/GPRS:

 Point to point MO and MT


 SMS cell broadcast
 Text and PDU mode

SIM900A RS232 + TTL BOARD FEATURES:

 Input voltage :12V


 On board power LED
 On board network LED
 RS232 serial control (TX and RX)
 Modem reset PIN OUT
 Default baud rate :9600, data bits:8

SOFTWARE SPECIFICATIONS:

 Embedded TCP/UDP protocol


 FTP/HTTP
 Embedded AT

26
INTERFACES:

 I2C
 GPIO
 PWM
 ADC
 Antenna pad
 Two serial interface
 SPI interface
 RTC back up
 Interface to external SIM 3V/1.8V

Compatibility: AT cellular command interface.

2.6.2 INTERFACING GSM MODULE TO ARDUINO

1) Insert the SIM card to the GSM module:

Open the SIM cardholder by sliding it as per the arrow mark and lift up. Insert the SIM
card, so as to align the chamfered corner suits in card holder .After inserting the SIM card, lock
the holder by sliding it to the opposite direction of arrow mark.

27
2). Connect the antenna:

Fix the Supplied RF antenna to the SMA Antennae connector and tighten it by Rotating
the Nut (Never rotate the antennae for tightening).

3). Connect the pins:

Connect the TX of arduino to RX of GSM module and RX of arduino to TX of GSM


module.

4). Power the modem:

Give the power supply 12V DC and >1A. And wait for sometime (10 minutes) for
initializing the SIM card for network.

5). Check the status of LEDs:

PWR LED - Red LED will lit immediately

STS LED - Green LED will lit after 1-2 seconds

NET LED -Blue LED will starts to blink in fast for few seconds (Searching for Network) and
becomes slow blinking once the Modem registers with the Network.

6). Network LED:

The Network LED indicates the various status of GSM module eg. Power on, Network
registration & GPRS connectivity. When the modem is powered up, the status LED will blink
every second. After the Modem registers in the network (takes between 10-60 seconds), LED
will blink in step of 3 seconds. At this stage you can start using Modem for your application.

7). Baud rate:

The Baud rate supported by the modem is between 9600 and 115200. Make sure the host
system is set to the supported baud rate.

28
2.6.3 PIN DESCRIPTION:

29
2.6.4 WORKING PRINCIPLE:

Connect TX of arduino to RX to GSM module and RX of arduino to TX of GSM


module. Wait for few minutes for connectivity to network of SIM card. Then communication
can be established to send the SMS or receive SMS and call by using suitable AT commands.

30
Following are the commands:

2.6.5 CHECKING THE OPERATION AND CONNECTION OF GSM SHIELD:

AT Press ENTER
This would print OK which signifies of working connection and operation of the GSM
shield.

MAKING A VOICE CALL:


ATD+ (country code) mobile number; Press ENTER.

DISCONNECTING THE ACTIVE CALL:


ATH Press ENTER.

RECEIVING THE CALL:


ATA Press ENTER.

SENDING A MESSAGE: For sending SMS in text Mode:


AT+CMGF=1 Press ENTER
AT+CMGS=”mobile number” Press ENTER
Once the AT commands is given’ >’ prompt will be displayed on the screen. Type the message to
be sent via SMS. After this, Press CTRL+Z to send the SMS. If the SMS sending is successful,
“OK” will be displayed along with the message number.

31
RECEIVING A MESSAGE:
For reading SMS in the text mode:
AT+CMGF = 1 Press ENTER
AT+CMGR = num.
Number (num.) is the message index number stored in the SIM card. For new SMS, URC will be
received on the screen as + CMTI: SIM ‘num’.
After this AT+CMGR=1 Press ENTER this displays the message on the screen along with sender
details, number and timing too.

2.6.6APPLICATIONS:
 For phone communication like text SMS send and read, voice calls.

 Attend the audio calls.

 By GSM/GPRS RSS 232 modem is having internal TCP/IP stack enables to connect
internet via GPRS.

 Data transfer application by M2M interface.

3. SOFTWARE DESCRIPTION
Software tools that are used in the project

1) Arduino IDE (v1.0.6)

32
3.1 Arduino IDE (v1.0.6):

Figure 3.1 ARDUINO IDE LOOKOUT


The Arduino integrated development environment (IDE) is a cross-platform application
written in Java, and derives from the IDE for the Processing programming language and
the Wiring projects. It is designed to introduce programming to artists and other newcomers
unfamiliar with software development. It includes a code editor with features such as syntax
highlighting, brace matching, and automatic indentation, and is also capable of compiling and
uploading programs to the board with a single click. A program or code written for Arduino is
called a "sketch".

Arduino programs are written in C or C++. The Arduino IDE comes with a software
library called "Wiring" from the original Wiring project, which makes many common
input/output operations much easier. The users need only to define two functions to make an
executable cyclic executive program:

 setup(): a function run once at the start of a program that can initialize settings

 loop(): a function called repeatedly until the board powers off

A typical first program for a microcontroller simply blinks an LED on and off. In the
Arduino environment, the user might write a program like this.

A typical first program for a microcontroller simply blinks an LED on and off. In the
Arduino environment, the user might write a program like this:

33
#define LED_PIN 13

void setup() {
pinMode(LED_PIN, OUTPUT); // Enable pin 13 for digital output
}

void loop() {
digitalWrite(LED_PIN, HIGH); // Turn on the LED
delay(1000); // Wait one second (1000 milliseconds)
digitalWrite(LED_PIN, LOW); // Turn off the LED
delay(1000); // Wait one second
}

It is a feature of most Arduino boards that they have an LED and load resistor connected
between pin 13 and ground; a convenient feature for many simple tests. The previous code would
not be seen by a standard C++ compiler as a valid program, so when the user clicks the "Upload
to I/O board" button in the IDE, a copy of the code is written to a temporary file with an extra
include header at the top and a very simple main() function at the bottom, to make it a valid C++
program.

The Arduino IDE uses the GNU tool chain and AVR Libc to compile programs, and uses
avrdude to upload programs to the board.

As the Arduino platform uses Atmel microcontrollers, Atmel's development environment, AVR
Studio or the newer Atmel Studio, may also be used to develop software for the Arduino.

34
3.2PROCEDURE FOR THE ARDUINO SOFTWARE:

Open the arduino software. Select new file.

Write the program code.

35
Select the appropriate arduino boards. by browsing TOOLS -boards.

Select the appropriate COM port by browsing Tools - Serial port -COM port.

36
Verify or compile the program code. From sketch verify/compile or “CTRL+R” short cut
command.

Compiling process.

37
It displays any syntax errors after done compiling. If so check the code once again and correct it.

Now for dumping into the processor, connect the Arduino kit using USB cable and go for upload.
From sketch, upload. Or “CTRL+U”.

38
Wait for complete uploading process until it display done uploading.

Can view the results in the serial monitor by browsing from TOOLS-Serial Monitor –
“CTRL+SHIFT+M”.

39
4. PROJECT TEST PLAN AND RESULTS
4.1 TEST PLAN:
This project deals with the detection of LPG leakage and alert by giving buzzer
sound, switching on the exhaust fan and sending an alert message to the person for the
precaution to be taken further. For this purpose gas leakage is sensed by gas sensor MQ2 and
sends the information to arduino by that firstly it switch ON the fan and buzzer to give the
alertness in the industry or home. If it continues it again check the threshold gas value and sends
the message to the user. To prevent the gas leakage accidents.

4.2 TEST RESULTS:

40
THE BELOW SCREEN SHOT SHOWS TESTING BEFORE APPLYING GAS LEAK:

Before applying the gas leakage, MQ2 captures atmospheric air concentration only.

BELOW SCREEN SHOT SHOWS AFTER APPLYING GAS LEAKAGE:

41
After applying the gas leak, the heating element in the gas sensor will starts heating and varies its
concentration value from 1 to its concentration level by pressing the cigar’s lightly.

SENDING MESSAGE TO PHONE NUMBER USING GSM MODULE:

42
It alerts the fan and buzzer and after again checking if it continues further it sends the message
through GSM module.

43
AT command to alert the GSM

AT+CMGF=1 by this command the GSM module will in the text mode.

AT+CMGS=” 7801003629” this command is used to send the message to the particular number.

CTRL+Z is to send the SMS.

Serial.print(“text message”) // SMS body the message to be send to the phone number.

Serial.write(0x1A) // sends ctrl+z end of the message.

Serial.write(0x0D) // carriage return in Hex

Serial.write(0x0A) // line feed in Hex.

CHAPTER 5

44
CONCLUSION AND FUTURE SCOPE
CONCLUSION:
Project uses arduino controller at the gas sensor to sense the leakage of the gas, detects it
and send the information to the users by SMS. GSM module is used as the communication
purpose for sending the information to predefined number which can alert to prevent the
accident. Gas sensor is used to detect the gas leakage. Exhaust fan is used to spread the
compressed gas out into the air. Buzzer is used to buzzing the sound which can also alert the
people nearby.

FUTURE SCOPE:

In future we will add automatic door opening application when LPG leakage has sensed.
Using DC motor control automatically turns off the knob of the cylinder. To continuously
monitoring the level of the LPG present in the cylinder using weight sensor and automatically
books the cylinder using a GSM module.

APPENDIX
CLASS ROOM CODE:
int gas;

45
int x;

int prash=0,baba=0;

#define sensor 7

#define RELAY 12

#define buzzer 11

#define fan 9

void setup() {

pinMode(13, OUTPUT);

pinMode(10, OUTPUT);

pinMode(4, OUTPUT);

pinMode(RELAY,OUTPUT);

pinMode(sensor,INPUT);

pinMode(buzzer,OUTPUT);

pinMode(fan,OUTPUT);

Serial.begin(9600);

delay(2000);

Serial.println("AT+CMGF=1");

delay(2000);

// put your setup code here, to run once

void loop() {

int gas;

delay(1000);

46
digitalWrite(buzzer,LOW);

gas=analogRead(A0);

Serial.println("gas");

Serial.println(analogRead(gas));

if(gas >= 300 )

Serial.println("baba");

Serial.println(baba);

Serial.println("prash");

Serial.println(prash);

if(baba ==0 && prash==0)

loop1();

if(baba ==1 && prash==1)

loop2();

if(baba ==2 && prash==2)

loop3();

if(baba ==3 && prash==3)

47
{

loop4();

baba++;

void loop1(){

for(x=0;x<=6;x++)

digitalWrite(10, HIGH); // turn the LED on (HIGH is the voltage level)

delay(10); // wait for a second

digitalWrite(10, LOW); // turn the LED off by making the voltage LOW

delay(10);

delay(1000);

Serial.println(x);

prash=1;

void loop2(){

digitalWrite(buzzer,HIGH);

digitalWrite(fan,HIGH);

prash=2;

for(x=0;x<=12;x++)

48
delay(1000);

Serial.println(x);

void loop3(){

Serial.println("AT");

delay(1000);

Serial.println("AT+CMGF=1");

delay(1000);

Serial.println("AT+CMGS=\"9912681100\"");

delay(1000);

Serial.println("Gas Leakage alert: please check ");

Serial.write(26);

delay(1000); // delay in between reads for stability

for(x=0;x<=1;x++)

delay(1000);

Serial.println(x);

digitalWrite(13,HIGH);

prash=3;

void loop4(){

Serial.println("AT");

49
delay(1000);

Serial.println("AT+CMGF=1");

delay(1000);

Serial.println("AT+CMGS=\"9912681100\"");

delay(1000);

Serial.println("Gas Leakage alert: High alert non controllable leakage ");

Serial.write(26);

delay(1000); // delay in between reads for stability

digitalWrite(4, HIGH);

prash=0;

baba=0;

REFERENCES:
[1]. In the year 2011, A. MAHALINGAM, R. T. NAAYAGI,1, N. E. MASTORAKIS, “Design
and Implementation of an Economic Gas Leakage Detector”.

[2]. For Arduino Programming :forum.arduino.cc

[3]. “Design and Implementation of an Economic Gas Leakage Detector” A. MAHALINGAM,


R. T. NAAYAGI,1, N. E. MASTORAKIS§ Department of Engineering Systemsschool of
Engineering, University of Greenwich (Medway Campus)Chatham Maritime, Kent ME4
4TBUNITED KINGDOM, article in Recent Researches in Applications of Electrical and
Computer Engineering

50
[4]. Johansson, A.; Birk, W.; Medvedev, A., “Model-based gas leakage detection and isolation in
a pressurized system via Laguerre spectrum analysis”, Proc. of IEEE International Conference on
Control Applications, pp. 212-216, 1998.

[5]. Lopes dos Santos, P.; Azevedo-Perdicoúlis,T,P.Ramos,J.A.; Martins de Carvalho, J.L.; Jank,
G.; Milhinhos, “An LPV modeling and identification approach to leakage detection in high
pressure natural gas transportation networks”, IEEE Transactions on Control Systems
Technology, vol. 19, pp. 77-92, 2011.

CONTENTS

1.1 INTRODUCTION.....................................................................................................................1

1.5 ORGANISATION OF THE THESIS........................................................................................3

2.2 SPECIFICATIONS OF COMPONENTS..................................................................................4

BLOCK DIADRAM:.......................................................................................................................6

2.4 ARDUINO UNO.......................................................................................................................7

2.4.10 ATMEGA328P....................................................................................................................13

51
2.4.11 SPECIFICATIONS:............................................................................................................13

Fig 2.3 ATMEGA328P...............................................................................................................14

2.4.12 Key parameters...............................................................................................................14

Series alternatives......................................................................................................................15

Figure 2.4: BLOCK DIAGRAM OF ATMEGA328......................................................................16

2.4.13PIN DESCRIPTION:...........................................................................................................18

2.4.14 APPLICATIONS OF ARDUINO:......................................................................................20

2.5 MQ-2 GAS SENSOR..............................................................................................................20

2.5.1FEATURES OF MQ2 GAS SENSOR:..................................................................................21

2.5.2 MQ2 GAS SENSOR PIN DESCRIPTION:.........................................................................22

Standard Working Condition:.................................................................................................22

2.5.3 SENSITIVE CHARACTERISTICS OF MQ-2 GAS SENSOR:.........................................23

2.5.4SENSITIVITYADJUSTMENT....................................................................................................24

2.5.5APPLICATION OF MQ2 GAS SENSOR:............................................................................24

2.6 GSM MODULE SIM900A......................................................................................................25

2.6.1 GENERAL FEATURES OF GSM MODULE SIM900A....................................................25

2.6.2 INTERFACING GSM MODULE TO ARDUINO...............................................................27

2.6.3 PIN DESCRIPTION:............................................................................................................29

2.6.4 WORKING PRINCIPLE......................................................................................................31

2.6.6 APPLICATIONS:.................................................................................................................32

3. SOFTWARE DESCRIPTION...................................................................................................33

3.2 PROCEDURE FOR THE ARDUINO SOFTWARE...............................................................35

4. PROJECT TEST PLAN AND RESULTS.................................................................................41

5. CONCLUSION AND FUTURE SCOPE..................................................................................47

52
APPENDIX....................................................................................................................................48

REFERENCES:.............................................................................................................................52

53

You might also like