Sei sulla pagina 1di 14

GAS LEAKAGE DETECTOR

Gas leakages have become one of the important concerns in our


day to day lives. It is necessary to make some system that helps
us to identify gas leakages so that necessary action can be taken.
Gas leakages have taken a toll on the number of deaths, injuries
losses and so on. Thus this project gives a basic idea on have to
implement a gas sensor using one of the most commonly used
microcontrollers, the Arduino along with the help of labVIEW.
Labview is one of the most commonly used virtual instrument
platform that has seen a growing demand and is of particular
instruments to scientists and engineers of the present era. This
project will show how to implement a gas sensor with the help of
Arduino and labVIEW. We use the G programming of the labVIEW
along with necessary packages to link the Arduino and labVIEW.
First a brief introduction about Arduino is given and how the
Arduino was linked with the labVIEW. Next we discuss about the
the G code and the components that have been used. Finally we
discuss about how the entire circuit works
THE ARDUINO
Arduino is an open-source prototyping platform based on easy-touse hardware and software. Arduino boards are able to read
inputs - light on a sensor, a finger on a button, or a Twitter
message - and turn it into an output - activating a motor, turning
on an LED, publishing something online. You can tell your board
what to do by sending a set of instructions to the microcontroller
on the board. To do so you use the Arduino programming
language (based on Wiring), and the Arduino Software (IDE),
based on Processing.
Over the years Arduino has been the brain of thousands of
projects, from everyday objects to complex scientific instruments.
A worldwide community of makers - students, hobbyists, artists,
programmers, and professionals - has gathered around this opensource platform, their contributions have added up to an

incredible amount of accessible knowledge that can be of great


help to novices and experts alike.
Arduino was born at the Ivrea Interaction Design Institute as an
easy tool for fast prototyping, aimed at students without a
background in electronics and programming. As soon as it
reached a wider community, the Arduino board started changing
to adapt to new needs and challenges, differentiating its offer
from simple 8-bit boards to products for IoT applications,
wearable, 3D printing, and embedded environments. All Arduino
boards are completely open-source, empowering users to build
them independently and eventually adapt them to their particular
needs. The software, too, is open-source, and it is growing
through the contributions of users worldwide.
Why Arduino?
Thanks to its simple and accessible user experience, Arduino has
been used in thousands of different projects and applications. The
Arduino software is easy-to-use for beginners, yet flexible enough
for advanced users. It runs on Mac, Windows, and Linux. Teachers
and students use it to build low cost scientific instruments, to
prove chemistry and physics principles, or to get started with
programming and robotics. Designers and architects build
interactive prototypes, musicians and artists use it for
installations and to experiment with new musical instruments.
Makers, of course, use it to build many of the projects exhibited at
the Maker Faire, for example. Arduino is a key tool to learn new
things. Anyone - children, hobbyists, artists, programmers - can
start tinkering just following the step by step instructions of a kit,
or sharing ideas online with other members of the Arduino
community.
There are many other microcontrollers and microcontroller
platforms available for physical computing. Parallax Basic Stamp,
Netmedia's BX-24, Phidgets, MIT's Handyboard, and many others
offer similar functionality. All of these tools take the messy details
of microcontroller programming and wrap it up in an easy-to-use

package. Arduino also simplifies the process of working with


microcontrollers, but it offers some advantage for teachers,
students, and interested amateurs over other systems:
Inexpensive - Arduino boards are relatively inexpensive
compared to other microcontroller platforms. The least
expensive version of the Arduino module can be assembled
by hand, and even the pre-assembled Arduino modules cost
less than $50
Cross-platform - The Arduino Software (IDE) runs on
Windows, Macintosh OSX, and Linux operating systems. Most
microcontroller systems are limited to Windows.
Simple, clear programming environment - The Arduino
Software (IDE) is easy-to-use for beginners, yet flexible
enough for advanced users to take advantage of as well. For
teachers, it's conveniently based on the Processing
programming environment, so students learning to program
in that environment will be familiar with how the Arduino IDE
works.
Open source and extensible software - The Arduino software
is published as open source tools, available for extension by
experienced programmers. The language can be expanded
through C++ libraries, and people wanting to understand the
technical details can make the leap from Arduino to the AVR
C programming language on which it's based. Similarly, you
can add AVR-C code directly into your Arduino programs if
you want to.
Open source and extensible hardware - The plans of the
Arduino boards are published under a Creative Commons
license, so experienced circuit designers can make their own
version of the module, extending it and improving it. Even
relatively inexperienced users can build the breadboard
version of the module in order to understand how it works
and save money.
Here in particular we have

used the Arduino MEGA 2560.We have discussed a few


details about the Arduino MEGA 2560.
Arduino MEGA 2560
The MEGA 2560 is designed for more complex projects. With
54 digital I/O pins, 16 analog inputs and a larger space for
your sketch it is the recommended board for 3D printers and
robotics projects. This gives your projects plenty of room and
opportunity.

Each of the 54 digital pins on the Mega can be used as an input or


output, using pinMode(), digitalWrite(), and digitalRead()
functions. They operate at 5 volts. Each pin can provide or receive
a maximum of 40 mA and has an
internal pull-up resistor (disconnected by default) of 20-50
kOhms. In addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2:
17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive
(RX) and transmit (TX) TTL serial data. Pins 0 and 1 are also
connected to the corresponding pins of the ATmega8U2 USB-toTTL Serial chip .
External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt
5), 19 (interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These
pins can be configured to trigger an interrupt on a low value, a
rising or falling edge, or a change in value. See the
attachInterrupt() function for details.

PWM: 0 to 13. Provide 8-bit PWM output with the analogWrite()


function.
SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support
SPI communication, which, although provided by the underlying
hardware, is not currently included in the Arduino language. The
SPI pins are also broken out on the ICSP header, which is
physically compatible with the Duemilanove and Diecimila.

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.
I2C: 20 (SDA) and 21 (SCL). Support I2C (TWI) communication
using the Wire library (documentation on the Wiring website).
Note that these pins are not in the same location as the I2C pins
on the Duemilanove. The Mega2560 has 16 analog inputs, each of
which provide 10 bits of resolution (i.e. 1024 different values). By
default they measure from ground to 5 volts, though is it possible
to change the upper end of their range using the AREF pin and
analogReference() function.There are a couple of other pins on
the board:
AREF: Reference voltage for the analog inputs. Used with
analogReference().
Reset: Bring this line LOW to reset the microcontroller. Typically
used to add a reset button to shields which block the one on the
board.
The Arduino Mega2560 has a number of facilities for
communicating with a computer, another Arduino, or other
microcontrollers. The ATmega2560 provides four hardware UARTs
for TTL (5V) serial communication. An ATmega8U2 on the board
channels one of these over USB and provides a virtual com port to
software on the computer (Windows machines will need a .inf file,
but OSX and Linux machines will recognize the board as a COM
port automatically. The Arduino software includes a serial monitor
which allows simple textual data to be sent to and from the board.
The RX and TX LEDs on the board will flash when data is being
transmitted via the ATmega8U2 chip and USB connection to the

computer (but not for serial communication on pins 0 and 1). A


SoftwareSerial library allows for serial communication on any of
the Mega's digital pins. The ATmega2560 also supports I2C (TWI)
and SPI communication. The Arduino software includes a Wire
library to simplify use of the I2C bus; see the documentation on
the Wiring website for details. To use the SPI communication,
please see the ATmega2560 datasheet.
How to interface Arduino with LABVIEW??
The Arduino can be interfaced with the labVIEW using NI-VISA and
LINX. The NI-VISA and LINX packages and drivers have to be
downloaded and installed to interface the Arduino with labVIEW.
The Arduino can be programmed using the Arduino cc software as
per the requirement with the help of Arduino codes.
NI-VISA The Virtual Instrument Software Architecture (VISA) is a
standard for configuring, programming, and troubleshooting
instrumentation systems comprising GPIB, VXI, PXI, Serial,
Ethernet, and/or USB interfaces. VISA provides the programming
interface between the hardware and development environments
such as LabVIEW, LabWindows/CVI, and Measurement Studio for
Microsoft Visual Studio. NI-VISA is the National Instruments
implementation of the VISA I/O standard. NI-VISA includes
software libraries, interactive utilities such as NI I/O Trace and the
VISA Interactive Control, and configuration programs through
Measurement & Automation Explorer for all your development
needs. NI-VISA is standard across the National Instruments
product line. With NI-VISA, you can feel confident that your
software development will not become obsolete as your
instrumentation interface hardware needs evolve into the future.
A typical VISA application would go through the following steps.
1. Open a Session to a given Resource.
2. Do any configuration on the given resource (setting baud
rates, termination character, etc...).
3. Perform writes and reads to the device.

4. Close the Session to the Resource.


5. Handle any errors that may have occurred.
The following is a LabVIEW application that opens a session to a
GPIB Instrument, performs a write of "*IDN?\n" and then queries
the device for its response.

This exact same format would be used in a text based language


like C++ or Basic. You would also follow this exact same format if
the instrument was Serial, USB, Ethernet, IEEE-1394, or any of the
other buses VISA supports. All you would have to change is the
Instrument Descriptor connected to the VISA Open. This code
would run on any operating system that supports LabVIEW and NIVISA.
LINX by LabVIEW MakerHub
The LINX by LabVIEW MakerHub makes it easy to interface with
common embedded platforms such as chipKIT, Arduino, and NI
myRIO as well as common sensors including accelerometers,
temperature sensors, and ultrasonic distance sensors.
With this toolkit and NI LabVIEW software, you can control or
acquire data from common embedded platforms. Once the
information is in LabVIEW, you can analyze it using the hundreds
of built-in LabVIEW libraries, develop algorithms to control
supported hardware, and present your findings on a polished UI.
LINX provides firmware for common embedded platforms that
acts as an I/O engine and interfaces with LabVIEW VIs through a
serial, USB, wireless, or Ethernet connection. This helps you
quickly move information from an embedded device such as a
chipKIT to LabVIEW without adjusting the communication,
synchronization, or even a single line of C code. Using the

common Open, Read/Write, Close convention in LabVIEW, you can


access the digital, analog, PWM, I2C, and SPI signals of many
common embedded platforms or use higher level VIs to directly
control sensors and actuators. LINX is open source so you can dig
in and see how LINX works, or even contribute to the LINX
project.
So we have seen how the Arduino can be linked with
LabVIEW.Next we will move onto the G code that has been used to
implement the gas sensor.Before that a brief introduction about
the MQ-6 gas sensor is given
THE MQ-6 GAS SENSOR
MQ-6 gas sensor modules are used in gas leakage detecting
equipments in family and industry, are suitable for detecting of
LPG, iso-butane, propane, LNG, avoid the noise of alcohol and
cooking fumes and cigarette smoke.
Features :
High sensitivity to CH4Natural gas
Small sensitivity to alcohol, smoke
Fast response
Stable and long life
Simple drive circuit
The MQ-6 sensor is shown below along with
its configuration.

How to connect the Arduino with gas sensor????


The circuit connection for connecting the Arduino with the gas
sensor is shown below.The analog input pin of the gas sensor can
be connected to any one of the analog pins of the
Arduino.Correspondingly the Arduino code has to be changed for
using different analog pins of the Arduino.

The G code used


The G code that has been used here is shown below.First the
front panel is shown
below. Later the block diagram is
shown.

THE FRONT PANEL

The front panel consists of input and output controls and


indicators.This front panel consists of features like Serial Port,
Interface, Platform and Analog Channel to interface with the
Arduino.
Serial port is the port of the computer to which Arduino is
connected .
Platform tells us which software we are using to connect the
Arduino to labview.
The pin from which we are getting analog values is
determined by the analog channel.
Led indicates whether there is LPG gas leakage or not.
The waveform graph gives the voltage across the mq 6 gas
sensor at various instant of time.

THE BLOCK DIAGRAM

Block diagram is the place where actual processing of data takes


place.
We have used Makerhub Linx driver to interface with the Arduino
Mega 2560. Using Linx, certain parameters are initialized. They
include setting up of Serial port, Platform of the software and the
interface. Analog values from the gas sensor are read from the
Analog pin of the Arduino Mega. To set this up, Analog Read
function is used and the analog pin number of the Arduino is
initialized. Since, Analog values from the gas sensor are to be
read, Analog Read function is inserted inside For loop running n
times. The Analog values are compared with the threshold voltage
required for the Led and beep to trigger. If the condition is True,
Led and Beep starts working until the condition becomes False.
Waveform Graph is used to plot the voltage change with respect
to time. The code is terminated by the Linx tool.
How to complete the circuit ?
The circuit can be completed by connecting the Arduino to the
gas sensor as shown above and connecting the Arduino to the
USB port of the PC or the laptop. The above shown could be run
and the gas sensor senses any gas leakages and if a gas leakage

is detected, then the LED glows and a beep tone is produced


alerting the user of a gas leakage.
Applications:
1. Protection from any gas leakage in cars.
2. For safety from gas leakage in heating gas fired appliances
like boilers, domestic water heaters
3. For safety from gas leakage in Cooking gas fired appliances
like ovens, stoves etc
4. Large industries which uses gas as their production.
5. They are used in gas leakage detecting equipments in
family, Car and industry, are suitable for detecting of LPG,
iso-butane, propane, LNG, avoid the noise of alcohol and
cooking fumes and cigarette smoke.

Advantages:
1. Fast response
2. Wide detection range
3. Stable performance and long life
4. Simple drive circuit
5. The sensor has excellent sensitivity combined with a quick
response time.

Disadvantages:
1. If this system is used in a place where there is smoke, then
the sensor is not that much effective.
2. Its sensitivity depends on Humidity and temperature.

CONCLUSION:
The gas sensor was successfully designed with the help of the
LabVIEW software and the Arduino. It is found to be a more
efficient system. The program that was used here is indeed
simple and hence such systems can be used where such need
is required. The use of Arduino has also indeed made the
software made much more simpler. The gas sensor used here
that is the MQ-6, is also cheap and also stable and can be used
in the gas detection system. It is able to work significantly well
in different conditions and is also stable. The use of such
systems can significantly reduce accidents due to gas leakages
and alert the user of gas leakages so that he can necessary
action.

Potrebbero piacerti anche