Professional Documents
Culture Documents
LPG Sensor Reference PDF
LPG Sensor Reference PDF
GAS DETECTOR
Date of birth
20 JULAI 1989
Title
Academic Session:
2010/2011
CONFIDENTIAL
RESTRICTED
OPEN ACCESS
Certified by:
SIGNATURE
SIGNATURE OF SUPERVISOR
890720-06-5310
(NEW IC NO. /PASSPORT NO.)
NOTES :*If the thesis is CONFIDENTAL or RESTRICTED, please attach with the letter from
the organization with period and reasons for confidentiality or restriction
Signature : ...
Name
Date
JUNE 2012
ii
Signature
: ....................................................
Name
Date
27 JUNE 2012
: ...................................................
iii
To my beloved
parents
siblings,
Siti Norfazlin, Siti Norazelah, Farrahana, Syamimi Waznah, Nabihah and Iskandar Fitri
Dedicated in thankful appreciation for your supporting, encouragement and best wishes.
iv
ACKNOWLEDGEMENT
In preparing this thesis, I dealt with many people and they have a great
contribution towards my understanding and thoughts.
My appreciation also goes to my family who has been so tolerant and supports
me all these years. Thanks for their encouragement, love and emotional supports that
they had given to me.
ABSTRACT
The purpose of this project is to develop data monitoring system of alarm system
for gas detector. The gas sensor used in this project is MQ3 and MQ9 which are detect
the present of alcohol and Liquefied Petroleum Gas (LPG). These sensors will detect the
concentration of the gas according the voltage output of the sensor. To make the sensors
operate in the alarm system and data monitoring system, Arduino Uno was used as the
microcontroller for the whole system. The circuit also includes LEDs, buzzer, exhaust
fan and Zigbee. Zigbee will send the data reading from gas sensor to data monitoring
system that display on LABVIEW by wireless. A graphical user interface (GUI) was
created using LABVIEW for end user monitoring purpose.
vi
ABSTRAK
Tujuan projek ini adalah untuk membangunkan sistem pemantauan data sistem
penggera untuk pengesan gas. Sensor gas yang digunakan dalam projek ini adalah MQ3
dan MQ9 yang akan mengesan kehadiran gas alkohol dan Gas Petroleum Cecair (LPG).
Sensor ini juga akan mengesan kepekatan gas mengikut output voltan sensor yang
ditunjukkan. Untuk membuat sensor beroperasi dalam sistem penggera dan data sistem
pemantauan, Arduino Uno yang bertindak sebagai mikropengawal bagi seluruh sistem
digunakan dan disambungkan bersama-sama sensor gas dan juga sistem penggera. Litar
ini juga termasuk LED, buzzer, kipas ekzos dan ZigBee. ZigBee akan menghantar data
dari sensor gas kepada sistem pemantauan data paparan pada LabVIEW secara tidak
berwayar. Antara muka pengguna grafik (GUI) telah dicipta menggunakan LabView
untuk tujuan pemantauan pengguna akhir.
vii
TABLE OF CONTENTS
CHAPTER
TITLE
PAGE
TITLE PAGE
DECLARATION OF THESIS
ii
DEDICATION
iii
ACKNOWLEDGEMENT
iv
ABSTRACT
ABSTRAK
vi
TABLE OF CONTENTS
vii
LIST OF TABLES
LIST OF FIGURES
xi
LIST OF SYMBOLS
xiv
LIST OF APPENDICES
xvi
INTRODUCTION
1.1
Background
1.2
Problem Statement
1.3
Objectives
1.4
1.5
Thesis Outlines
LITERATURE REVIEW
viii
2.1
Introduction
2.2
10
2.3
10
11
2.3.2 Zigbee
12
2.4
2.5
Programming Tools
13
2.4.1 LABVIEW
13
2.4.2 Arduino
14
Indicator
15
2.5.1 Buzzer
16
2.5.2 LED
17
18
METHODOLOGY
3.1
Introduction
19
3.2
Hardware Implementation
23
23
25
28
29
29
35
40
3.3.4 LABVIEW
43
Introduction
50
4.2
Project Description
50
4.3
Project Result
51
ix
5.1
Introduction
56
5.2
Conclusion
56
5.3
Recommendation
57
REFERENCES
58
APPENDICES
60
LIST OF TABLES
TABLE NO.
3.1
TITLE
Threshold Value for Gas Concentration MQ3
PAGE
26
and MQ9
3.2
29
3.3
34
xi
LIST OF FIGURES
FIGURE NO.
2.1
TITLE
The overall system of Carbon Monoxide
PAGE
7
2.3
sensor replacement
2.6
11
2.7
Zigbee module
12
2.8
13
2.9
Arduino board
15
2.10
Buzzer model
16
2.11
LEDs images
17
2.12
18
xii
3.1
20
3.2
21
3.3
22
3.4
22
3.5
23
3.6
24
3.7
25
3.8
26
3.9
27
3.10
28
3.11
30
32
for MQ9
3.13
36
MQ9
3.14
37
3.15
38
3.16
40
3.17
40
3.18
41
xiii
3.19
40
3.20
42
3.21
42
3.22
43
3.23
44
3.24
44
3.25
Converter Process
45
3.25
46
3.27
Step 1
47
3.28
Step 2
48
3.29
Step 3
49
4.1
51
4.2
52
4.3
53
4.4
53
4.5
54
4.6
55
xiv
LIST OF SYMBOLS
CO
Carbon Monoxide
LPG
CO2
Carbon Dioxide
CH4
Ammonia
GSM
LED
GUI
WSN
PIR
Pyroelectric Infrared
LCD
OSHA
SNO2
Tin Oxide
xv
Resistance (Ohm)
RF
Radio Frequency
Vo
PPM
xvi
LIST OF APPENDICES
APPENDIX
TITLE
PAGE
63
64
65
66
CHAPTER 1
INTRODUCTION
1.1
Background
In humans daily life, environment gives the most significant impact to their
health issues. Therefore, environment and industry air quality issues are critically
discussed to increase the awareness and responsibility regarding the threat on the
environment towards public and workers health. Most of the dangerous gas such as
carbon monoxide (CO), refrigerant gas and liquefied petroleum gas (LPG) are colorless
and odorless compound that are produced by incomplete combustion. Therefore, gas
detector device is needed in order to inform the safety situation continuously.
min, and death within 30 min. Very high concentrations (e.g. 12800 ppm) causes
unconsciousness after a couple of breaths, followed by death in less than 3 min. [2] The
indoor dangerous sources are the leak source of CO, CO2 and CH4, which may be gas
tank or the fire site. The essential component of coal gas or nature gas is CO or alkanes
gas. The burning of chemical materials or decorative materials will emanate CO, CO2
and alkanes gas. The danger of these gases arising is from two aspects, one is the
toxicity of these gases themselves, the other side is that the accumulation of these gases
will easy be ignited. The position of gas tank or pipeline is usually fixed, so it is easy to
inspect, yet the fire site is random, and it will be difficult for inspection. [3] The danger
of the CO gas is the same as the LPG and others dangerous gas in the environment.
Gas detector is a gas detecting device. It only can detect if there is a gas leakage
or the leaking concentration. Meanwhile, the monitoring system is a system that is used
for displaying how much concentration of gas is in that place but viewing take place in
another remote computer, GSM networking or internet server. Therefore, monitoring
system give the advantages to users such that they can monitor the situation of the room
or the place where leakage occurrence may happened at safe distance continuously. .
1.2
Problem Statements
There are so many health issues related to dangerous gas in industrial area. Thus,
the atmosphere of a workplace should be regularly monitored and controlled in order to
maintain clean air environment. However, efforts in industrial air quality control have
been impeded by the lack of science-based approaches to identify and assess atmosphere
air quality and level of dangerous gas.
1.3
Objectives of Project
To analyze gas sensor in detecting the LPG and alcohol gas based on the
two gas sensor.
1.4
ii.
To design gas control system that shows the indicator alarm to the user.
iii.
Scopes of Project
This project are divided into software programming and hardware. For the
hardware, it can be categorized into four systems:
iv. Zigbee
The software design are divided into three parts that are:
i.
Arduino programming
ii.
Zigbee programming
iii.
LABVIEW design
Arduino software is used to write the programming for the Arduino board
microcontroller. On the other hand, X-CTU is used to program zigbee in order for the
data to be transferred. Meanwhile, the LABVIEW Graphical User Interface (GUI) is
used to monitor the level of gas concentration.
1.5
Thesis Outlines
There are five chapters in this thesis which are introduction, literature review,
methodology, result and discussion and finally conclusion and recommendation. Each
chapter will discuss its own aspects related to the project.
Chapter one is the introduction for the project. Problem statement, object and
scope of the project along with the summary of works have been discussed in this
chapter. Then, chapter two discusses more on the theory and literature reviews that has
been done before by another person or group. Besides that, this chapter also discusses
the type of Arduino used for the project, the sensor chosen, and also the software involve
in programming the zigbee and Arduino.
CHAPTER 2
LITERATURE REVIEW
2.1
Introduction
This chapter will discuss in details on the components and instruments used for
this project in general. Besides that, there are couple more of past related project or
paper work that is related to this project.
Figure 2.1: The overall system of Carbon Monoxide Detection and Autonomous
Countermeasure System for a mill use Wireless sensor and Actuator Network [4]
Figure 2.1 show the overall system for the project[4]. The main system is the
computer which is called as the base station. This is because, the computer will receive
the signal from the sensor by TelosB, then send the command to the alarm system and
internet server. Actuator will control siren and exhaust fan as the alarm system for the
gas detector. In the final result, when the CO concentration crosses the threshold value
(which is 300ppm), the actuator circuit comes into action and the siren and exhaust fan
are autonomously turned on through relay[].
Figure 2.3: Result of the gas concentration based on the sensor replacement [5]
Figure 2.3 above shows the result of the system operation. The concentrations of
CO are depending on the time of sensor senses the gasses. Between 1300 and 1400,
kitchen room gave the highest reading of CO concentration from the analysis of the
graph. Meanwhile, bedroom with door closed mostly detect zero percent of CO gas.
The third paper that is related to this project is Toxic Gas Release Alarm
System Using PIC Microcontroller by Zarith Sofia Suraya Bt Hj Bakeri from Universiti
Teknologi Malaysia[6]. This project was created to detect carbon monoxide using TGS
2442 gas sensor and generate an alarm signal when the detected gas reaches its
hazardous level. Powered by Microchips PIC18F2550, this project alarmed when the
carbon monoxide gas reach a hazardous level and be aware of the gas concentration
level displayed on the LCD system.
10
2.2
2.3
The initial data receiver came from the gas sensor. Study on the working
principle of gas sensor needs to be done in order to understand where the voltage output
came from. Besides that, zigbee will also be an important component that needs to be
analyzed for data transferring by wireless. Therefore, the following subsection explained
the gas sensor and zigbee working principle working.
11
2.3.1
Figure 3.6 illustrates the working principle of the gas sensor such that when a
metal oxide crystal such as SnO2 is heated gas is adsorbed on the crystal surface with a
negative charge. Then donor electrons in the crystal surface are transferred to the
adsorbed oxygen, resulting in leaving positive charges in a space charge layer. Thus,
surface potential is formed to serve as a potential barrier against electron flow. Inside the
sensor, electric current flows through the conjunction parts (grain boundary)[]. At grain
boundaries, absorbed oxygen forms a potential barrier which prevents carriers from
moving freely. The reduced barrier height decreases sensor resistance.
V = IR
------------(2.1)
resistance (ohm)
12
From Ohms Law in equation 2.1, voltage value is directly proportional to the
current and resistance value in the circuit. Therefore, as the sensor detect higher of
concentration gas level, resistance value in the grain boundary will increase. As the
resistance increase, the output voltage will also be increase.
2.3.2
Zigbee
Zigbee wireless protocol as shown in Figure 2.7 provides means to network a set
of autonomous devices with standard radio frequency transceiver to perform some
networked task. In the proposed system a vehicular RF takes the role of a Zigbee end
devices while tas reader and writer module takes the role of Zigbee coordinates[9].
Zigbee series 1 is used in this projet. To ensure the data are succesfully transfered with
the other Zigbee receiver, some programming needs to be installed for both the zigbee
using X-CTU software. This is will be explained further in the chapter 3.
13
2.4
Programming Tools
LabVIEW and Arduino are the programming tools used for this project. But, the
writing programming is mostly used in Arduino. Meanwhile, LabVIEW use
programming type of block diagram.
2.4.1
LABVIEW
scientists to develop sophisticated measurement, test, and control systems using intuitive
graphical icons and wires that resemble a block diagram. It offers unrivaled integration
with thousands of hardware devices and provides hundreds of built-in libraries for
14
advanced analysis and data visualization all for creating virtual instrumentation. The
LabVIEW platform is scalable across multiple targets and functions, and, since its
introduction in 1986, it has become an industry leader [10].
2.4.2
Arduino
The Arduino Uno as shown in Figure 2.9 is a microcontroller board based on the
ATMEL microcontroller ATmega328. It has 14 digital input or 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 [11]. 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 Arduino Uno can be
15
powered via the USB connection or with an external power supply. The power source is
selected automatically.
The focus of this project is on the programming of Arduino. Arduino is the open
source software used to create the language programming in order to run the system.
2.5
Indicator
Some indicators have been installed with the system in the project. There are
including buzzer, LED and exhaust fan. The information details on the devices use
explained in the following subsections.
16
2.5.1
Buzzer
Buzzer as shown in Figure 2.11 is an audio signaling device. The typical uses of
buzzers are for alarms, timers and confirmation of user input such as a mouse click or
keystroke. The project used an electronic type of buzzer which is a piezoelectric element
that driven by an Arduino microcontroller signals.
17
2.5.2
LED
When a diode is forward biased which is switch on, electron are able to
recombine with holes within the devices, releasing energy in the form of photon. This
effect is called electroluminescence and the colour of the light is determined by the
energy gap of the semiconductor. LED are usually integrated optical components are
used to shape its radiation pattern and assist in the reflection.
18
2.5.3
Exhaust Fan
19
CHAPTER 3
METHODOLOGY
3.1
Introduction
Figure 3.1 shows the basic flow of methodology and approach for the project.
The the project is divided into two parts which are hardware and software. For the
software implementation, it involves writing code and programming the Arduino and
zigbee. Meanwhile, hardware implementation involves designing the circuit of the
project and PCB development. After both parts was completethe next was the testing
and debugging proces. Each part of the project will be discussed in details in this
chapter.
20
Start
PCB development
Programming the
zigbee connection
Yes
Error
No
Display
data
Interfacing with
LABVIEW
Interface with
internet server
End
21
DC power
supply
Alarm
Indicator
Arduino
Board
Gas Sensor
LABVIEW
(GUI)
As shown in Figure 3.2, the block diagram is about the connection of the gas
detector implementation. In this project, output voltage from the gas sensor will be
delivered to the Arduino board. The heart of the system is the Arduino board. All the
inputs and the outputs will be connected to the Arduino. When the gas sensor MQ6 or
MQ3 detect the presence of gas, it will send analogue signal to an analog digital
converter (ADC) inside the Arduino. An Arduino will process this signal and transfer to
the LABVIEW using zigbee. In the same time, Arduino also will analyze the signal
according the threshold value of gas concentration. The gas concentration value will
determine which LEDs will be lit up and if the red LED light up, this will also triggers
the buzzer to warn the users of gas concentration in the dangerous level. On the other
hand, as the yellow LED light up, this will also triggers the relay for switching on the
exhaust fan to suck out all the dangerous gas in the room and as the precaution before
dangerous level.
22
Figure 3.3 shows the image of the hardware built and Figure 3.4 is an illustration
of the circuit diagram of the hardware. Xbee in the circuit diagram act as the transmitter
for transfer the data wirelessly.
BUZZER
RED LED
1S
VCC
GND
A0
5V
5V
13
3.3V
5V
GND
GREEN LED
12
relay
11
ARDUINO
BOARD
YELLOW
LED
TX
RX
XBEE
3.3V
Vout
Vin
GND
exhoust
fan
23
3.2
Hardware implementation
In the wireless monitoring system of gas detector, there are a few parts of
hardware involved. This section will discuss on the design and function of each
component that are connected to the Arduino in order to build the project. Along with
that this section also explains how the circuitry connection between the components and
microcontroller is made. This includes the sensor circuit and also the output circuit
which comprises of LEDs, exhaust fan and a buzzer.
3.2.1
24
The circuit diagram for both the sensor is the same as shown in Figure 3.6.There
are three output pins from this sensor which are reference voltage (VCC), ground pin
(GND) and the output voltage pin. RL shown in the Figure 3.5 is the adjustable
resistance. The connection between protection resistor in the sensor circuit and
adjustable resistor are in serial which form a load resistor (RL). The sensors resistance
between Rs and RL form a voltage divider. Based on the chart provided in the MQ3 and
MQ6 data sheet, Rs in the clean air under given temperature and humidity constant.
Figure 3.6 also shows the sensor come out with 6pins. Pin H act as the coil of the gas
sensor. Meanwhile, pin A and B are connected in pairing and was connected as in the
circuit diagram above. The calculation for gas concentration is described in detailed in
section 3.3.1.
GAS SENSOR
1S
VCC
GND
A0
5V
GND
25
Figure 3.7 above shown gas sensor connection to the Arduino pins. The A0 pin
connected at the Arduino will read the output voltage from the sensor.
3.2.2
Output circuit
ii.
Buzzer
iii.
Exhaust Fan
iv.
Zigbee
All of four components have their own purpose for the project in order to inform
the users that the level of dangerous gas in the surrounding areas continuously. There are
three LEDs used namely as red LED, yellow LED and green LED. All of these LED
indicate three different level of gas concentration in the atmosphere as listed in Table
3.1.
26
Table 3.1: Threshold Value for Gas Concentration MQ3 and MQ9
LED
Alcohol (MQ3)
Green
< 500
< 0.4
Yellow
> 1000
>1
Red
When the red LED is light up, buzzer will also be trigged to inform user that the
surrounding areas have reached a dangerous level and emergency evacuation is needed.
Meanwhile, exhaust fan will turn on along with the yellow LED to show the level
concentration in the warning stage and exhaust fan is used to suck out the dangerous gas
as the precaution before entering the dangerous level.
BUZZER
RED LED
330k ohm
12
11
330k ohm
5V
5V
13
GREEN LED
relay
330k ohm
YELLOW
LED
2N22
exhaust
fan
27
Figure 3.8 show the output circuit diagram which act as the alarm system to the
system. Red LED and buzzer are connected in the same pin from the Arduino, 13. Same
as the yellow LED and exhaust fan at the pin 11. At the same time, pin 11 includes the
relay circuit act as a switch tothe exhaust fan. All the LEDs are covered with a light
transparents casing in previously shown in Figure 3.3 to give visibility to the brightness
when the LEDs light up. The output for pin 12 from Arduino is green LED only.
9V
5V
4
normally open
exzos
fan
2
1
RELAY
normally closed
5
R
11
Transistor
Figure 3.9 show the relay connection circuit diagram from the Arduino to the
exhaust fan.Relay is need in this project because exhaust fan require a 9V battery. Relay
is an electromagnetic device that works on the magnetic field interfacing. Relay should
be checked first before making the connection circuit to test whether the connection in
the normally open or closed by using multimeter. If the multimeter sounds up with a
bit thats mean the pin in the normally closed. Meanwhile, if the connection pin 2 and
4 are tested, no sound will be heard at the multimeter. Exhaust fan is connected at the
normally open pin because it will be turned on when it gets the information from
Arduino pin only.
28
Last but not least, the output circuit from the Arduino is zigbee. Zigbee from the
output pin RX and TX in the Arduino acts as the transmitter. All the data from the
sensor reading will be transferred to another zigbee receiver to interface with
LABVIEW in the computer by wireless. Figure 3.10 below shows the circuit output
diagram for zigbee from the Arduino.
TX
RX
3.3V
XBEE
VCC
DOUT
DIN
GND
3.2.3
PCB development
For the PCB development, donut board is used in this project. Before soldering
all the components on the board, bread board was first used to ensure that the connection
between each component is functional for this project. Donut board does not have
connection to each hole like the strip board. In order to make the connection, solder
method is used to connect all components. Besides that, female holders are uses to
connect the jumper wires from Arduino to the board circuit. The PCB development
circuit diagram is shown in Figure 3.4.
29
3.3
Software Implementation
This section will specifically discuss the methodology to interface the sensor and
hardware module. The most important part is to enable the analog sensor to send analog
data to Arduino then transfer to the LABVIEW. The first technique to interface the
analog output to Arduino is to produce the relation between the sensor analog range and
Arduino analog to digital converter (ADC) specification. This relation is based on gas
concentration calculation and will be explained in details the following section.
3.3.1
Gas sensor
MQ 9
MQ 3
DC 5.0 0.2 V
DC 5.0 0.2 V
DC 0 5.0 V
DC 0 5.0 V
30
i.
Step 1:
Since the binary for Arduino is 10-bit, it is equal to 2^10= 1024 steps or levels of the
resolution. The maximum output from the gas sensor, 5V is then divided into 1024.
From the calculation above, 1-bip output is equal to 4.88mV in the real voltage output.
Figure 3.12 below shows the relation between voltage output from gas sensor and
Arduino reading more clearly.
1
digital ouput (bit)
204.8
409.6
614.4
819.2
1024
31
ii.
Step 2:
The value of gas concentration can be obtained by calculating the value of sensor
resistor (Rs). The value of Rs is calculated using voltage divider in the gas sensor circuit
diagram as the the equation below:
From the Rs value, we can compute the gas concentration. Vo represents the voltage
output from the gas sensor. Equation 3.2 is obtained from the gas sensor calibration
datasheet. Once the Rs value is calculated, it will proceed to the next step.
32
iii.
Step 3:
(200, 2)
(1000, 1)
Figure 3.13 shows the graph of sensor resistance ratio (Rs/Ro) versus concentration gas
in ppm for MQ9. Ro is the sensor resistance (Rs) value at 1000ppm. Therefore, based on
the graph above, Ro is equal to 1 (Rs/ Ro). From graph, we can get the relationship
between Rs and LPG concentration in ppm. Equation 3.3 shows the relationship between
Rs and LPG concentration value.
33
Alpha () in the equation 3.3 shows the graph in Figure 3.13 is slope value. The slope
value can be obtained using the equation 3.4.
By taking the two points from the linear graph, we can calculate the slope of the LPG
concentration gas which is equal to -1. Therefore, with the slope value equal to -1,
equation 3.3 can be simplified into equation 3.5 by substitute the value of slope value of
graph.
The same methods are applied to the gas sensor MQ3 in the step 3 from the beginning to
obtain and calculate the concentration of alcohol gas. The equation for alcohol gas
concentration is in equation 3.6 below.
34
iv.
Step 4:
Since Arduino only read in the 10-bit numbering, the threshold value for alarm system to
be functional as well as the project set up, concentration value need to convert into 10bit data to programmed the Arduino programmer. The threshold values are based on the
OSHA organization standard value. By using the equation 3.5 and 3.6 in step 3, value of
gas concentration can be obtain. Table 3.3 below shows all the threshold value for the
both gas sensor which are taken from OSHA.. The calculation for converting the value
of voltage output to digital output is based on the equation 3.7 below.
Mode
Gas sensor
MQ 9
MQ 3
Vo
10-bit reading
Vo
10-bit reading
Green
< 1.67
<342
< 1.24V
< 254
Yellow
Vo < = 1.67V
Vo < = 342
Vo < = 1.24V
Vo < = 254
Vo > = 2.5V
Vo > = 512
Vo > = 2.5V
Vo > = 512
> 2.5V
> 512
> 2.5V
> 512
Red
35
3.3.2
Arduino Programming
Arduino programming is the heart of this project. This is because, all the data
from sensor to LABVIEW monitoring system and alarm system controlled by Arduino.
Besides that, Arduino also trigger alarm system when detect the threshold value that
have been set up. Moreover, Arduino will send the data to the computer in LABVIEW
by wireless with zigbee device.
Figure 3.13 show the whole process includes in the gas sensor MQ 9 for
detecting the LPG concentration level.
36
start
send data to
LabView using xbee
MQ6
Vo > 1.67v ?
no
turn on the
green led
yes
MQ6
Vo > 2.5v ?
no
yes
end
Figure 3.13: Flow Chart for The Arduino Programming for MQ9
Firstly, all the input and output pin in Arduino must be declare. Then, initial
sensor value must be set as 0. The data receive from sensor can calculate in the decimal
37
place as the float sensor declare in line 6 below. Analog input pin that the potentiometer
of gas sensor is attached to pin A0. The declaration programming for this step shows as
Figure 3.14.
constintanalogInPin = A0;
constintledred = 13;
constintledgreen = 12;
constintledyellow = 11;
intsensorValue = 0;
float sensor;
figure 3.14: Arduino input and output port initialization
After that, loop is very important which represent all the data will continuously
repeat by time. In this project, there are 2 loop include. First loop is to initialize serial
communication at the bound rate 9600. This is also sets the digital pin as the output as
shown in Figure 3.15.
38
void setup()
{
Serial.begin(9600);
pinMode(ledgreen, OUTPUT);
pinMode(ledred,OUTPUT);
pinMode(ledyellow,OUTPUT);
}
Meanwhile, the second loop is mostly the main process for the alarm system
trigger. All the threshold value is declared in this loop. First of all, the system read the
sensor value as shown in Figure 3.16. If the sensor value is over or under the limitation
of threshold value, some indicator as the output system will be turning on. Finally, the
result from the sensor value will be print to the serial monitor. The flow chart of the
programming show in the Figure 3.13.
39
void loop() {
sensorValue = analogRead(analogInPin);
if (sensorValue>= 512)
{
digitalWrite(ledgreen, LOW);
digitalWrite(ledyellow, LOW);
digitalWrite(ledred, HIGH);
delay(50);
digitalWrite(ledred, LOW);
delay(50);
}
else if (sensorValue> 342 &&sensorValue< 512)
{
digitalWrite(ledgreen, LOW); // sets the LED on
digitalWrite(ledyellow, HIGH);
digitalWrite(ledred, LOW);
}
else if (sensorValue<= 342)
{
digitalWrite(ledgreen, HIGH); // sets the LED on
40
digitalWrite(ledyellow, LOW);
digitalWrite(ledred, LOW);
}
Serial.print(sensorValue);
delay(500);
}
Figure 3.16: Programming Process in Arduino
210x
3.3V
RX
TX
5V
GND
XBEE
VCC
DOUT
DIN
GND
Figure 3.17 shows the connection diagram for Zigbee receiver. Both of the
zigbee receiver and transmitter must be set up with the programming in order to transfer
41
data from Arduino successfully. Therefore, the Zigbee must be connected as of Figure
3.17.
Driver microchip 210x for USB port must be installed in the computer in order to
read the port. After that, XCTU software is needed to run the programming with Zigbee.
Once the XCTU software is installed and executed in the computer, each COM for each
zigbee must be tested by clicking on the button Test/Query as shown in Figure
3.18.XCTU software is support for programming and configuring Zigbee, WIFI
modules. After that a dialog box will popped up to inform that the COM connection is
successful. Figure 3.19 shows the result output for Com test.
42
The set up for the Zigbe data transfer is done by opening the modem
configuration at the up right corner of the window XCTU. This step is very important to
make sure that the data has been transfer to the exact location. There were four items
that need to be considered. First is PAN ID. This is to show the location number of the
port. The value of the ID must be the same. As shown in figure 3.20, the ID for this
zigbee is 111. Then set the destination address high as 0 and the destination address low
as FFFF. Serial interfacing will also be the most important things in this step. As we set
the bound rate at the Arduino at 9600, the interfacing data rate also must be 9600. Figure
3.21 shows the interfacing data rate at 3 which is equal to 9600.
43
The last step is to test the connection between two zigbee. Figure 3.22 shows the
data transfer between two zigbee is succesful. As shown in figure 3.22, the writing in
blue colour is the data transfer at COM40. Meanwhile, the red colour in COM44 is the
receiver and vice versa. Therefore, both of the Zigbee can be used as the receiver and
transmiter terminal.
3.3.4
LABVIEW
44
The first level visa configure serial port is for initializes the serial ports specified
by visa resources name to a specified settings. Wire data to the visa resources name
input to determine the polymorphic instance to use or manually sellect the instance. In
this project, COM 40 has been chosed as the zigbee port in that location. Besides that,
the value of 9600 in the Figure 3.23 shows the bound rate of the project system from
arduino and zigbee. From the Figure 3.23 also, the grey line in the figure shows the
while loop for repeating the subdiagram inside it untill conditional terminal, an input
terminal receives a particular Boolean value. The Boolean value depends on the
continuation behaviour of the loop.
45
After interfacing the data transfer and LABVIEW was done, the next process is
to read the data transfer. From the figure 3.24, decimal string to number is needed for
converting the numeris characters in string thats starting at offset to a decimal interger
and return it in number. Once the string number from visa has been changed, the output
number needs to convert back into the original of voltage value. The converter process is
shown in Figure 3.25. As mentioned before, Arduino will read the data in the 10-bit data
only. Therefore, to convert the value in the original voltage is by the equation in 3.7.
The next step in LABVIEW process is to show the LED indicators for user
monitoring. The range will conduct the voltage value according to the threshold value
that has been set before.
Finally, the last step is to monitor the concentration value of the gas. In this step,
the concentration value is calculate based on the graph analysis as mentioned before.
Therefore, to calculate the gas concentration for LPG and alcohol gas are using the
equation 3.8 and 3.9 as below.
46
The last stage in the data monitoring system is interface the system with internet
server. There are very easy step in this project because LABVIEW software already
provide built-in function process. To start turning data into internet server, first at all
find the web publishing tool at at menu tools as show in Figure 3.26.
47
The the window of web publishing tool will be come out as show in Figure 3.27.
From Figure 3.27, the first step browse the VI name of the project and set it as
embedded viewing mode.
The second step is shown in Figure 3.28. Document title and summary of this
project need to be add in this step for the data monitoring in the internet server.
48
Then, the final step is save the new web page as show in Figure 3.29. by saving
the data of web page, this system can automatically running in the internet server at the
web address(URL) given by LABVIEW.
49
50
CHAPTER 4
4.1
Introduction
This chapter explains about the results achived in the project and a few
discussions on problem solving during process and experiment of completing this
project. The data collection is using types of gas sensor MQ3 and MQ9 for Alcohol and
LPG gas exposes. Then the data analyzed and compared with information obtain from
the several reference sources from OSHA.
4.2
Project Description
Project done is based on the objectives started before whichis analyzing a sensor
circuit for the gas sensor. This sensor node will detect the level of concentration of the
gas exposed and convert it into analog voltage and directly sending it into Arduino.
After transferring the data, Arduino will read the data into the digital format. Arduino
51
processes analog to digital converter (ADC) from 0 to 1024 which are in 10 bits.
Voltage output from the gas sensor (0-5)V will be read as (0-1024) decimal output in
Arduino. Furthermore, this system will enable data transfer in LABVIEW by wireless
using zigbee device and complete with the alarm system.
4.3
Project Result
Figure 4.1 show the output result of the alarm system when Arduino threshold in
the warning mode. Yellow LED and exhaust fan will be turn on as the initially system
set up in order to control the air quality in the building. Yellow LED means warning in
the system.
52
The overall project set up shown in the Figure 4.2. the system are divided into
two part. First part is on the alarm system. The second part is on the software system
which is monitoring system.
An experimented was carried out using two type of gas sensor with two different
kinds of gasses. The first experiment was done with MQ9 gas sensor. This sensor detects
the concentration of the LPG gas. The result for monitoring system of MQ9 gas sensor is
shown in the Figure 4.3 below. The second experiment is to detect the level of
concentration alcohol gas by using MQ3 gas sensor. Figure 4.4 shows the outcome result
for second gas sensor, MQ3.
53
Back in normal
54
After that, the system of gas monitoring sensor has been transferred to the
internet server. Figure 4.5 shows the data monitoring system in the internet browser. The
interface of the data monitoring with internet server will give an advantages to user for
monitoring the building or industrial air environment quality in the long distance
continuously.
Figure 4.6 shows the packaging of the hardware and the wireless gas monitoring
system. This system is smell and portable that can be continuously installed in the
building. The size of suitable building is depends on the type of the Zigbee used. The
room size that suitable in this project is 100m x 100m.
55
56
CHAPTER 5
5.1
Introduction
This section will conclude the whole project and future recommendations for
students or individual who is interested in continuing this project as their research.
5.2
Conclusion
As a conclusion, reading of the output voltage from the gas sensor shows the
value of concentration and level of dangerousness in red LED. Control system that
reacts as the alarm system has been design based on the indicator for user. Data
reading from the gas sensor was successfully transferred to LABVIEW using Zigbee
and easily monitored without wire and displayed in the internet.
57
This system is built to help user to feel comfortable in a work place and easy
to monitor the range of air quality in the environment from their own figure via
LEDs, exhaust fan and buzzer. This system device also gives an advantage to the
user to easily get the information about the air quality in their building or industrial
area by monitoring the system by using PC via Zigbee wireless.
5.3
Recommendation
For further improvement, the research can add some features that enables the
master controller to control the sensing element. This is to guarantee there is a
reliable back-up system for this project if any emergency occurs. In addition, this
system was able to monitor and control air condition for various implementations
with some system alterations.
The toxic gas release alarm system safety features can also be improved by
adding another function to check the sensors condition in case the sensor is not
working properly or if the sensors calibration has been displaced.
58
REFERENCES
[1]
[2]
[4]
[4]
[5]
Somov, A., Baranov, A., Savkin, A., Spirjakin, D., Spirjakin, A., &
Passerone, R. (2011). Development of wireless sensor network for
combustible gas monitoring. Sensors & Actuators: A. Physical, 1-8.
[6]
[8]
[9]
]Jeli, V., Magno, M., Paci, G., Brunelli, D., & Benini, L. (2011). Design
Characterization and Management of a Wireless Sensor Network for Smart
Gas Monitoring. Sciences-New York, 4, pg 115-120.
[10]
59
[12]
[13]
60
APPENDIX
61
62
63