10.02.2015 Views

wireless monitoring system of gas detector - Faculty of Electrical ...

wireless monitoring system of gas detector - Faculty of Electrical ...

wireless monitoring system of gas detector - Faculty of Electrical ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

WIRELESS GAS MONITORING SYSTEM OF<br />

GAS DETECTOR<br />

ZULAIKA BINTI HAMDON<br />

UNIVERSITI TEKNOLOGI MALAYSIA


PSZ 19:16 (Pind. 1/07)<br />

UNIVERSITI TEKNOLOGI MALAYSIA<br />

DECLARATION OF THESIS / UNDERGRADUATE PROJECT PAPER AND COPYRIGHT<br />

Author’s full name :<br />

ZULAIKA BINTI HAMDON<br />

Date <strong>of</strong> birth : 20 JULAI 1989<br />

Title : WIRELESS GAS MONITORING SYSTEM OF GAS DETECTOR<br />

Academic Session: 2010/2011<br />

I declare that this thesis is classified as:<br />

CONFIDENTIAL<br />

RESTRICTED<br />

OPEN ACCESS<br />

(Contains confidential information under the<br />

Official Secret Act 1972)*<br />

(Contains restricted information as specified by<br />

the organization where research was done)*<br />

I agree that my thesis to be published as online<br />

open access (full text)<br />

I acknowledged that Universiti Teknologi Malaysia reserves the right as follows:<br />

1. The thesis is the property <strong>of</strong> Universiti Teknologi Malaysia.<br />

2. The Library <strong>of</strong> Universiti Teknologi Malaysia has the right to make copies for the<br />

purpose <strong>of</strong> research only.<br />

3. The Library has the right to make copies <strong>of</strong> the thesis for academic exchange.<br />

Certified by:<br />

SIGNATURE<br />

SIGNATURE OF SUPERVISOR<br />

890720-06-5310 MRS. NORHAFIZAH RAMLI<br />

(NEW IC NO. /PASSPORT NO.)<br />

NAME OF SUPERVISOR<br />

Date: 6 th JULY 2012 Date: 6 th JULY 2012<br />

NOTES :*If the thesis is CONFIDENTAL or RESTRICTED, please attach with the letter from<br />

the organization with period and reasons for confidentiality or restriction


“I hereby declare that I have read this thesis and in my<br />

opinion this thesis is sufficient in terms <strong>of</strong> scope and quality for the<br />

award <strong>of</strong> the degree <strong>of</strong> Bachelor <strong>of</strong> Engineering (<strong>Electrical</strong> – Medical Electronics)”<br />

Signature : ………………………………………...<br />

Name<br />

: MRS. NORHAFIZAH BINTI RAMLI<br />

Date : 6 th JULY 2012


i<br />

WIRELESS GAS MONITORING SYSTEM OF<br />

GAS DETECTOR<br />

ZULAIKA BINTI HAMDON<br />

A report submitted in partial fulfillment<br />

<strong>of</strong> the requirements for the award <strong>of</strong> the degree <strong>of</strong><br />

Bachelor <strong>of</strong> Engineering (<strong>Electrical</strong> – Medical Electronics)<br />

<strong>Faculty</strong> <strong>of</strong> <strong>Electrical</strong> Engineering<br />

UNIVERSITI TEKNOLOGI MALAYSIA<br />

JUNE 2012


ii<br />

I declare that this thesis entitled “WIRELESS GAS MONITORING SYSTEM OF<br />

GAS DETECTOR” is the result <strong>of</strong> my own research except as cited in the<br />

references. The thesis has not been accepted for any degree and is not concurrently<br />

submitted in candidature <strong>of</strong> any other degree.<br />

Signature : ....................................................<br />

Name<br />

ZULAIKA BINTI HAMDON<br />

: ....................................................<br />

Date : ...................................................<br />

27 JUNE 2012


iii<br />

To my beloved<br />

parents<br />

Hamdon bin Kahar and Faridah bt Ab. Kadir<br />

siblings,<br />

Siti Norfazlin, Siti Norazelah, Farrahana, Syamimi Waznah, Nabihah and Iskandar Fitri<br />

Dedicated in thankful appreciation for your supporting, encouragement and best wishes.


iv<br />

ACKNOWLEDGEMENT<br />

In preparing this thesis, I dealt with many people and they have a great<br />

contribution towards my understanding and thoughts.<br />

First and foremost, I would like to acknowledge and extend my gratitude to my<br />

main supervisor, Puan Norhafizah Ramli, for the encouragement, guidance and<br />

enthusiasm given throughout the completion <strong>of</strong> this project. In particular, I also wish to<br />

express my sincere appreciation to, Dr. Fauzan Khairi Che Harun who is willing to<br />

spend his precious time to give some ideas and suggestion towards this project. This<br />

thesis would not have been the same as presented here without continued support and<br />

interest from them.<br />

My appreciation also goes to my family who has been so tolerant and supports<br />

me all these years. Thanks for their encouragement, love and emotional supports that<br />

they had given to me.<br />

Furthermore, my great appreciation dedicated to my SEP members batch 2007<br />

and those who involve directly or indirectly with this project. Their views, tips, support,<br />

and assistance in various conditions are useful indeed.


v<br />

ABSTRACT<br />

The purpose <strong>of</strong> this project is to develop data <strong>monitoring</strong> <strong>system</strong> <strong>of</strong> alarm <strong>system</strong><br />

for <strong>gas</strong> <strong>detector</strong>. The <strong>gas</strong> sensor used in this project is MQ3 and MQ9 which are detect<br />

the present <strong>of</strong> alcohol and Liquefied Petroleum Gas (LPG). These sensors will detect the<br />

concentration <strong>of</strong> the <strong>gas</strong> according the voltage output <strong>of</strong> the sensor. To make the sensors<br />

operate in the alarm <strong>system</strong> and data <strong>monitoring</strong> <strong>system</strong>, Arduino Uno was used as the<br />

microcontroller for the whole <strong>system</strong>. The circuit also includes LEDs, buzzer, exhaust<br />

fan and Zigbee. Zigbee will send the data reading from <strong>gas</strong> sensor to data <strong>monitoring</strong><br />

<strong>system</strong> that display on LABVIEW by <strong>wireless</strong>. A graphical user interface (GUI) was<br />

created using LABVIEW for end user <strong>monitoring</strong> purpose.


vi<br />

ABSTRAK<br />

Tujuan projek ini adalah untuk membangunkan sistem pemantauan data sistem<br />

penggera untuk pengesan <strong>gas</strong>. Sensor <strong>gas</strong> yang digunakan dalam projek ini adalah MQ3<br />

dan MQ9 yang akan mengesan kehadiran <strong>gas</strong> alkohol dan Gas Petroleum Cecair (LPG).<br />

Sensor ini juga akan mengesan kepekatan <strong>gas</strong> mengikut output voltan sensor yang<br />

ditunjukkan. Untuk membuat sensor beroperasi dalam sistem penggera dan data sistem<br />

pemantauan, Arduino Uno yang bertindak sebagai mikropengawal bagi seluruh sistem<br />

digunakan dan disambungkan bersama-sama sensor <strong>gas</strong> dan juga sistem penggera. Litar<br />

ini juga termasuk LED, buzzer, kipas ekzos dan ZigBee. ZigBee akan menghantar data<br />

dari sensor <strong>gas</strong> kepada sistem pemantauan data paparan pada LabVIEW secara tidak<br />

berwayar. Antara muka pengguna grafik (GUI) telah dicipta menggunakan LabView<br />

untuk tujuan pemantauan pengguna akhir.


vii<br />

TABLE OF CONTENTS<br />

CHAPTER TITLE PAGE<br />

TITLE PAGE<br />

DECLARATION OF THESIS<br />

DEDICATION<br />

ACKNOWLEDGEMENT<br />

ABSTRACT<br />

ABSTRAK<br />

TABLE OF CONTENTS<br />

LIST OF TABLES<br />

LIST OF FIGURES<br />

LIST OF SYMBOLS<br />

LIST OF APPENDICES<br />

i<br />

ii<br />

iii<br />

iv<br />

v<br />

vi<br />

vii<br />

x<br />

xi<br />

xiv<br />

xvi<br />

1 INTRODUCTION<br />

1.1 Background 1<br />

1.2 Problem Statement 2<br />

1.3 Objectives 3<br />

1.4 Scope <strong>of</strong> the Project 3<br />

1.5 Thesis Outlines 5<br />

2 LITERATURE REVIEW


viii<br />

2.1 Introduction 6<br />

2.2 The Hazardous Gas 10<br />

2.3 Sensor and Instrumentation 10<br />

2.3.1 Gas Sensor Working Principle 11<br />

2.3.2 Zigbee 12<br />

2.4 Programming Tools 13<br />

2.4.1 LABVIEW 13<br />

2.4.2 Arduino 14<br />

2.5 Indicator 15<br />

2.5.1 Buzzer 16<br />

2.5.2 LED 17<br />

2.5.3 Exhaust Fan 18<br />

3 METHODOLOGY<br />

3.1 Introduction 19<br />

3.2 Hardware Implementation 23<br />

3.2.1 Gas Sensor Circuit 23<br />

3.2.2 Output circuit 25<br />

3.2.3 PCB devolopment 28<br />

3.3 S<strong>of</strong>tware Implementation 29<br />

3.3.1 Gas Concentration Calculation 29<br />

3.3.2 Arduino Programming 35<br />

3.3.3 Zigbee Programmimg 40<br />

3.3.4 LABVIEW 43<br />

4 RESULT AND DISCUSSION<br />

4.1 Introduction 50<br />

4.2 Project Description 50<br />

4.3 Project Result 51<br />

5 CONCLUSION AND RECOMMENDATION


ix<br />

5.1 Introduction 56<br />

5.2 Conclusion 56<br />

5.3 Recommendation 57<br />

REFERENCES 58<br />

APPENDICES 60


x<br />

LIST OF TABLES<br />

TABLE NO. TITLE PAGE<br />

3.1 Threshold Value for Gas Concentration MQ3<br />

and MQ9<br />

26<br />

3.2 Gas Sensor input and output voltage range 29<br />

3.3 Threshold Value for MQ9 and MQ3 34


xi<br />

LIST OF FIGURES<br />

FIGURE NO. TITLE PAGE<br />

2.1 The overall <strong>system</strong> <strong>of</strong> Carbon Monoxide<br />

Detection and Autonomous Countermeasure<br />

System for a mill use Wireless sensor and<br />

Actuator Network<br />

7<br />

2.2 Design <strong>of</strong> the sensor location 8<br />

2.3 Result <strong>of</strong> the <strong>gas</strong> concentration based on the<br />

sensor replacement<br />

9<br />

2.6 Gas sensor working principle 11<br />

2.7 Zigbee module 12<br />

2.8 LabVIEW icon image 13<br />

2.9 Arduino board 15<br />

2.10 Buzzer model 16<br />

2.11 LEDs images 17<br />

2.12 Exhaust Fan Images 18


xii<br />

3.1 Methodology <strong>of</strong> the Project 20<br />

3.2 Block Circuit Diagram 21<br />

3.3 Experiment Diagram <strong>of</strong> the Project 22<br />

3.4 Circuit Diagram for Gas Detector 22<br />

3.5 MQ3 and MQ6 image 23<br />

3.6 Gas Sensor Circuit Diagram 24<br />

3.7 The Gas Sensor Connection to Arduino Pins. 25<br />

3.8 Output Circuit Diagram 26<br />

3.9 Relay Connection Circuit Diagram 27<br />

3.10 Zigbee Output Connection Circuit 28<br />

3.11 Voltage Output <strong>of</strong> Gas Sensor Versus<br />

Reading <strong>of</strong> Bits in Arduino.<br />

3.12 Resistance Ratio versus Concentration Gas<br />

for MQ9<br />

3.13 Flow chart for the Arduino Programming for<br />

MQ9<br />

30<br />

32<br />

36<br />

3.14 Arduino input and output port initialization 37<br />

3.15 Declaration <strong>of</strong> the pin 38<br />

3.16 Programming process in Arduino 40<br />

3.17 Zigbee receiver Connection to USB Port 40<br />

3.18 Test the COM Of Each Zigbee 41


xiii<br />

3.19 Result Output for Com Test 40<br />

3.20 Setting the Programming 1 42<br />

3.21 Setting the Programming 2 42<br />

3.22 Test The Connection <strong>of</strong> Both Zigbee. 43<br />

3.23 Visa Interfacing Block Diagram 44<br />

3.24 Visa Read Output 44<br />

3.25 Converter Process 45<br />

3.25 Web Publishing Tools LABVIEW 46<br />

3.27 Step 1 47<br />

3.28 Step 2 48<br />

3.29 Step 3 49<br />

4.1 Alarm indicator <strong>of</strong> the project 51<br />

4.2 Overall Project Configuration 52<br />

4.3 Monitoring System for MQ9 53<br />

4.4 Monitoring System for MQ3 53<br />

4.5 System Monitoring in Internet Server 54<br />

4.6 Packaging <strong>of</strong> the project 55


xiv<br />

LIST OF SYMBOLS<br />

CO - Carbon Monoxide<br />

LPG - Liquefied Petroleum Gas<br />

CO2 - Carbon Dioxide<br />

CH4 - Ammonia<br />

GSM - Global System For Mobile Communications<br />

LED - Light Emitting Diode<br />

GUI - Graphical User Interface<br />

WSN - Wireless Sensor Network<br />

PIR - Pyroelectric Infrared<br />

LCD - Liquid Crystal Display<br />

OSHA - Occupational Safety And Health Administration<br />

SNO2 - Tin Oxide<br />

V - Voltage Value (Volt)<br />

I - Current In The Circuit (A)


xv<br />

R - Resistance (Ohm)<br />

RF - Radio Frequency<br />

Vo - Output Voltage (Volt)<br />

PPM - Parts Per Million


xvi<br />

LIST OF APPENDICES<br />

APPENDIX TITLE PAGE<br />

1 Block diagram for MQ6 in LABVIEW 63<br />

2 Block diagram for MQ3 in LABVIEW 64<br />

3 Arduino programming for MQ3 65<br />

4 Arduino programming for MQ6 66


1<br />

CHAPTER 1<br />

INTRODUCTION<br />

1.1 Background<br />

In human‟s daily life, environment gives the most significant impact to their<br />

health issues. Therefore, environment and industry air quality issues are critically<br />

discussed to increase the awareness and responsibility regarding the threat on the<br />

environment towards public and workers health. Most <strong>of</strong> the dangerous <strong>gas</strong> such as<br />

carbon monoxide (CO), refrigerant <strong>gas</strong> and liquefied petroleum <strong>gas</strong> (LPG) are colorless<br />

and odorless compound that are produced by incomplete combustion. Therefore, <strong>gas</strong><br />

<strong>detector</strong> device is needed in order to inform the safety situation continuously.<br />

Carbon monoxide (CO), <strong>of</strong>ten referred to as a "silent killer" is an injurious <strong>gas</strong><br />

and its prolonged exposure to living beings can lead to brain damage and even death.<br />

The harmfulness <strong>of</strong> CO is dependent on both, the concentration <strong>of</strong> the <strong>gas</strong> and the<br />

exposure time. Thus, a small concentration <strong>of</strong> the CO when exposed for a long period <strong>of</strong><br />

time can be fatal just like a large concentration <strong>of</strong> the CO for a small period <strong>of</strong> time.<br />

Fires are the most common source <strong>of</strong> CO [1]. In smaller quantities (e.g. 100 ppm) it<br />

may cause a headache and dizziness after a couple <strong>of</strong> hours <strong>of</strong> exposure. Higher<br />

concentrations (example 3200 ppm) may causes headaches and dizziness after 5–10


2<br />

min, and death within 30 min. Very high concentrations (e.g. 12800 ppm) causes<br />

unconsciousness after a couple <strong>of</strong> breaths, followed by death in less than 3 min. [2] The<br />

indoor dangerous sources are the leak source <strong>of</strong> CO, CO2 and CH4, which may be <strong>gas</strong><br />

tank or the fire site. The essential component <strong>of</strong> coal <strong>gas</strong> or nature <strong>gas</strong> is CO or alkanes<br />

<strong>gas</strong>. The burning <strong>of</strong> chemical materials or decorative materials will emanate CO, CO2<br />

and alkanes <strong>gas</strong>. The danger <strong>of</strong> these <strong>gas</strong>es arising is from two aspects, one is the<br />

toxicity <strong>of</strong> these <strong>gas</strong>es themselves, the other side is that the accumulation <strong>of</strong> these <strong>gas</strong>es<br />

will easy be ignited. The position <strong>of</strong> <strong>gas</strong> tank or pipeline is usually fixed, so it is easy to<br />

inspect, yet the fire site is random, and it will be difficult for inspection. [3] The danger<br />

<strong>of</strong> the CO <strong>gas</strong> is the same as the LPG and others dangerous <strong>gas</strong> in the environment.<br />

Gas <strong>detector</strong> is a <strong>gas</strong> detecting device. It only can detect if there is a <strong>gas</strong> leakage<br />

or the leaking concentration. Meanwhile, the <strong>monitoring</strong> <strong>system</strong> is a <strong>system</strong> that is used<br />

for displaying how much concentration <strong>of</strong> <strong>gas</strong> is in that place but viewing take place in<br />

another remote computer, GSM networking or internet server. Therefore, <strong>monitoring</strong><br />

<strong>system</strong> give the advantages to users such that they can monitor the situation <strong>of</strong> the room<br />

or the place where leakage occurrence may happened at safe distance continuously. .<br />

1.2 Problem Statements<br />

There are so many health issues related to dangerous <strong>gas</strong> in industrial area. Thus,<br />

the atmosphere <strong>of</strong> a workplace should be regularly monitored and controlled in order to<br />

maintain clean air environment. However, efforts in industrial air quality control have<br />

been impeded by the lack <strong>of</strong> science-based approaches to identify and assess atmosphere<br />

air quality and level <strong>of</strong> dangerous <strong>gas</strong>.


3<br />

As a solution for the problem, a <strong>monitoring</strong> <strong>system</strong> <strong>of</strong> <strong>gas</strong> <strong>detector</strong> by <strong>wireless</strong><br />

<strong>system</strong> needs to be developed in order to solve the problem. By <strong>monitoring</strong> <strong>system</strong><br />

<strong>wireless</strong>ly, user can remotely view the condition <strong>of</strong> the room or <strong>of</strong>fice without them<br />

being there themselves.<br />

1.3 Objectives <strong>of</strong> Project<br />

The objectives <strong>of</strong> this project are:<br />

i. To analyze <strong>gas</strong> sensor in detecting the LPG and alcohol <strong>gas</strong> based on the<br />

two <strong>gas</strong> sensor.<br />

ii.<br />

iii.<br />

To design <strong>gas</strong> control <strong>system</strong> that shows the indicator alarm to the user.<br />

To develop a <strong>system</strong> that can automate <strong>monitoring</strong> using LABVIEW.<br />

1.4 Scopes <strong>of</strong> Project<br />

This project are divided into s<strong>of</strong>tware programming and hardware. For the<br />

hardware, it can be categorized into four <strong>system</strong>s:<br />

i. The sensing <strong>system</strong><br />

ii. Arduino Uno Board<br />

iii. Output <strong>system</strong>


4<br />

iv. Zigbee<br />

Arduino Uno is a device that acts similarly to a microcontroller unit. In this<br />

project, Arduino is the perfect microcontroller due to its high performance and special<br />

features. The Arduino Uno is an open-source electronic prototyping platform based on<br />

flexible, easy-to-use hardware and s<strong>of</strong>tware. Further explanation on this unit is discussed<br />

in chapter 2 and 3. The sensing circuit <strong>system</strong> consists <strong>of</strong> Liquefied Petroleum Gas<br />

(LPG) sensor, MQ 6 and alcohol <strong>gas</strong> sensor, MQ 3. These sensors are used to detect the<br />

presence <strong>of</strong> specified <strong>gas</strong> in the surroundings area. The output <strong>system</strong> consists <strong>of</strong> LEDs,<br />

buzzer and exhaust fan. Zigbee or xbee will transfer sensor data read from Arduino port<br />

to a computer in a <strong>wireless</strong> connection.<br />

The s<strong>of</strong>tware design are divided into three parts that are:<br />

i. Arduino programming<br />

ii. Zigbee programming<br />

iii. LABVIEW design<br />

Arduino s<strong>of</strong>tware is used to write the programming for the Arduino board<br />

microcontroller. On the other hand, X-CTU is used to program zigbee in order for the<br />

data to be transferred. Meanwhile, the LABVIEW Graphical User Interface (GUI) is<br />

used to monitor the level <strong>of</strong> <strong>gas</strong> concentration.


5<br />

1.5 Thesis Outlines<br />

There are five chapters in this thesis which are introduction, literature review,<br />

methodology, result and discussion and finally conclusion and recommendation. Each<br />

chapter will discuss its own aspects related to the project.<br />

Chapter one is the introduction for the project. Problem statement, object and<br />

scope <strong>of</strong> the project along with the summary <strong>of</strong> works have been discussed in this<br />

chapter. Then, chapter two discusses more on the theory and literature reviews that has<br />

been done before by another person or group. Besides that, this chapter also discusses<br />

the type <strong>of</strong> Arduino used for the project, the sensor chosen, and also the s<strong>of</strong>tware involve<br />

in programming the zigbee and Arduino.<br />

Chapter 3 focuses on the methodology and approaches on the project. This<br />

includes the s<strong>of</strong>tware implementation and hardware development <strong>of</strong> the project. Results<br />

and discussion are presented in chapter four. Lastly, chapter five is the conclusion for<br />

the whole project. Some future suggestions such as a functional addition and hardware<br />

improvement the project are also mentioned.


6<br />

CHAPTER 2<br />

LITERATURE REVIEW<br />

2.1 Introduction<br />

This chapter will discuss in details on the components and instruments used for<br />

this project in general. Besides that, there are couple more <strong>of</strong> past related project or<br />

paper work that is related to this project.<br />

A related project <strong>of</strong> detecting <strong>of</strong> <strong>gas</strong> <strong>detector</strong> is project paper by titled “Carbon<br />

Monoxide Detection and Autonomous Countermeasure System for a mill use Wireless<br />

sensor and Actuator Network” by University <strong>of</strong> Engineering and Technology from<br />

Peshawar, Pakistan [4]. The central controller is a high-end PC is connected to the<br />

TelosB <strong>wireless</strong> sensor module via USB and to the actuator circuit via RS232.. The CO<br />

sensor module is connected to a TelosB node and interface with zigbee <strong>wireless</strong><br />

connectivity to the central controller. The CO concentration was recorded and<br />

transferred to a central computer.


7<br />

Figure 2.1: The overall <strong>system</strong> <strong>of</strong> Carbon Monoxide Detection and Autonomous<br />

Countermeasure System for a mill use Wireless sensor and Actuator Network [4]<br />

Figure 2.1 show the overall <strong>system</strong> for the project[4]. The main <strong>system</strong> is the<br />

computer which is called as the base station. This is because, the computer will receive<br />

the signal from the sensor by TelosB, then send the command to the alarm <strong>system</strong> and<br />

internet server. Actuator will control siren and exhaust fan as the alarm <strong>system</strong> for the<br />

<strong>gas</strong> <strong>detector</strong>. In the final result, when the CO concentration crosses the threshold value


8<br />

(which is 300ppm), the actuator circuit comes into action and the siren and exhaust fan<br />

are autonomously turned on through relay[].<br />

Besides that, there is another related paper “Design, Characterization and<br />

Management <strong>of</strong> a <strong>wireless</strong> sensor Network for Smart Gas <strong>monitoring</strong>” by <strong>Faculty</strong> <strong>of</strong><br />

<strong>Electrical</strong> Engineering and Computing, University <strong>of</strong> Zagreb, Croatia[5]. The <strong>system</strong><br />

represent with energy management that involves three levels which are sensor level,<br />

node level and lastly network level. The sensor board is designed with a <strong>wireless</strong> sensor<br />

network (WSN) node that can autonomously send the recorded data by <strong>wireless</strong> [5]. The<br />

sensor board also contains with two modalities which are <strong>gas</strong> sensor and Pyroelectric<br />

Infrared (PIR) sensor. The network is multimodal that used information from the PIR<br />

sensor and neighbor nodes to detect the present <strong>of</strong> <strong>gas</strong> concentration and modulate the<br />

duty cycle <strong>of</strong> the node. Figure 2.2 below shows the design <strong>of</strong> the location <strong>of</strong> sensor<br />

placed in a different room.<br />

Figure 2.2: Design <strong>of</strong> the sensor location [5]


9<br />

Figure 2.3: Result <strong>of</strong> the <strong>gas</strong> concentration based on the sensor replacement [5]<br />

Figure 2.3 above shows the result <strong>of</strong> the <strong>system</strong> operation. The concentrations <strong>of</strong><br />

CO are depending on the time <strong>of</strong> sensor senses the <strong>gas</strong>ses. Between 1300 and 1400,<br />

kitchen room gave the highest reading <strong>of</strong> CO concentration from the analysis <strong>of</strong> the<br />

graph. Meanwhile, bedroom with door closed mostly detect zero percent <strong>of</strong> CO <strong>gas</strong>.<br />

The third paper that is related to this project is “Toxic Gas Release Alarm<br />

System Using PIC Microcontroller” by Zarith S<strong>of</strong>ia Suraya Bt Hj Bakeri from Universiti<br />

Teknologi Malaysia[6]. This project was created to detect carbon monoxide using TGS<br />

2442 <strong>gas</strong> sensor and generate an alarm signal when the detected <strong>gas</strong> reaches its<br />

hazardous level. Powered by Microchip‟s PIC18F2550, this project alarmed when the<br />

carbon monoxide <strong>gas</strong> reach a hazardous level and be aware <strong>of</strong> the <strong>gas</strong> concentration<br />

level displayed on the LCD <strong>system</strong>.


10<br />

2.2 The hazardous <strong>gas</strong>es<br />

Based on Occupational Safety and Health Administration (OSHA), the definition<br />

<strong>of</strong> hazardous <strong>gas</strong> is defined as those chemical present in the workplace which are<br />

capable <strong>of</strong> causing harm. From the definition <strong>of</strong> the hazardous <strong>gas</strong>, the chemical term<br />

refer to dust, mixtures and common materials such as paints, fuels and solvents.<br />

According to the limitation <strong>of</strong> the LPG <strong>gas</strong>, OSHA mentioned that exposes over<br />

1000ppm <strong>of</strong> LPG <strong>gas</strong> will cause hazard to the human respiration <strong>system</strong>[7]. Therefore,<br />

this value is used as the threshold value for the project. Meanwhile, the alcohol <strong>gas</strong><br />

threshold value was chosen to be half value from the graph <strong>of</strong> the <strong>gas</strong> sensor<br />

2.3 Sensors and Instrumentation<br />

The initial data receiver came from the <strong>gas</strong> sensor. Study on the working<br />

principle <strong>of</strong> <strong>gas</strong> sensor needs to be done in order to understand where the voltage output<br />

came from. Besides that, zigbee will also be an important component that needs to be<br />

analyzed for data transferring by <strong>wireless</strong>. Therefore, the following subsection explained<br />

the <strong>gas</strong> sensor and zigbee working principle working.


11<br />

2.3.1 Gas sensor working principle<br />

Figure 3.6 illustrates the working principle <strong>of</strong> the <strong>gas</strong> sensor such that when a<br />

metal oxide crystal such as SnO2 is heated <strong>gas</strong> is adsorbed on the crystal surface with a<br />

negative charge. Then donor electrons in the crystal surface are transferred to the<br />

adsorbed oxygen, resulting in leaving positive charges in a space charge layer. Thus,<br />

surface potential is formed to serve as a potential barrier against electron flow. Inside the<br />

sensor, electric current flows through the conjunction parts (grain boundary)[]. At grain<br />

boundaries, absorbed oxygen forms a potential barrier which prevents carriers from<br />

moving freely. The reduced barrier height decreases sensor resistance.<br />

Figure 2.6: Gas sensor working principle [8]<br />

V = IR ------------(2.1)<br />

V = voltage value (volt)<br />

I = current in the circuit (A)<br />

R = resistance (ohm)


12<br />

From Ohms Law in equation 2.1, voltage value is directly proportional to the<br />

current and resistance value in the circuit. Therefore, as the sensor detect higher <strong>of</strong><br />

concentration <strong>gas</strong> level, resistance value in the grain boundary will increase. As the<br />

resistance increase, the output voltage will also be increase.<br />

2.3.2 Zigbee<br />

Figure 2.7 : Zigbee module<br />

Zigbee <strong>wireless</strong> protocol as shown in Figure 2.7 provides means to network a set<br />

<strong>of</strong> autonomous devices with standard radio frequency transceiver to perform some<br />

networked task. In the proposed <strong>system</strong> a vehicular RF takes the role <strong>of</strong> a Zigbee end<br />

devices while tas reader and writer module takes the role <strong>of</strong> Zigbee coordinates[9].<br />

Zigbee series 1 is used in this projet. To ensure the data are succesfully transfered with<br />

the other Zigbee receiver, some programming needs to be installed for both the zigbee<br />

using X-CTU s<strong>of</strong>tware. This is will be explained further in the chapter 3.


13<br />

2.4 Programming Tools<br />

LabVIEW and Arduino are the programming tools used for this project. But, the<br />

writing programming is mostly used in Arduino. Meanwhile, LabVIEW use<br />

programming type <strong>of</strong> block diagram.<br />

2.4.1 LABVIEW<br />

Figure 2.8: LabVIEW icon image<br />

LabVIEW (Laboratory Virtual Instrument Engineering Workbench) as in Figure<br />

2.8 is a graphical programming environment used by millions <strong>of</strong> engineers and<br />

scientists to develop sophisticated measurement, test, and control <strong>system</strong>s using intuitive<br />

graphical icons and wires that resemble a block diagram. It <strong>of</strong>fers unrivaled integration<br />

with thousands <strong>of</strong> hardware devices and provides hundreds <strong>of</strong> built-in libraries for


14<br />

advanced analysis and data visualization – all for creating virtual instrumentation. The<br />

LabVIEW platform is scalable across multiple targets and functions, and, since its<br />

introduction in 1986, it has become an industry leader [10].<br />

LabVIEW programs are called virtual instruments, or VIs, because their<br />

appearance and operation imitate physical instruments, such as oscilloscopes and<br />

multimeters [10]. LabVIEW departs from the sequential nature <strong>of</strong> traditional<br />

programming languages and features an easy to use graphical programming<br />

environment, including all <strong>of</strong> the tools necessary for data acquisition(DAQ), data<br />

analysis, and presentation <strong>of</strong> results [10].<br />

A LabVIEW VI consists <strong>of</strong> two major components which is a Block Diagram<br />

and a graphical user interface (GUI), known as Front Panel. Block Diagram is a window<br />

where the graphical source code is developed and the Front Panel is a window that<br />

serves as the user interface which allows user to customize it with objects like graphs,<br />

knobs and buttons (National Ins., 2006).<br />

2.4.2 Arduino<br />

The Arduino Uno as shown in Figure 2.9 is a microcontroller board based on the<br />

ATMEL microcontroller ATmega328. It has 14 digital input or output pins (<strong>of</strong> which 6<br />

can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB<br />

connection, a power jack, an ICSP header, and a reset button [11]. It contains everything<br />

needed to support the microcontroller; simply connect it to a computer with a USB cable<br />

or power it with a AC-to-DC adapter or battery to get started. The Arduino Uno can be


15<br />

powered via the USB connection or with an external power supply. The power source is<br />

selected automatically.<br />

Figure 2.9: Arduino board [11]<br />

The focus <strong>of</strong> this project is on the programming <strong>of</strong> Arduino. Arduino is the open<br />

source s<strong>of</strong>tware used to create the language programming in order to run the <strong>system</strong>.<br />

2.5 Indicator<br />

Some indicators have been installed with the <strong>system</strong> in the project. There are<br />

including buzzer, LED and exhaust fan. The information details on the devices use<br />

explained in the following subsections.


16<br />

2.5.1 Buzzer<br />

Figure 2.10: Buzzer model<br />

Buzzer as shown in Figure 2.11 is an audio signaling device. The typical uses <strong>of</strong><br />

buzzers are for alarms, timers and confirmation <strong>of</strong> user input such as a mouse click or<br />

keystroke. The project used an electronic type <strong>of</strong> buzzer which is a piezoelectric element<br />

that driven by an Arduino microcontroller signals.


17<br />

2.5.2 LED<br />

A light emitting diode (LED) as shown in Figure 2.12 is a semiconductor light<br />

source. LED is used as the indicator lamp in the many devices and is increasingly used<br />

for lighting. The LED is based on the semiconductor diode.<br />

Figure 2.11: LEDs images<br />

When a diode is forward biased which is switch on, electron are able to<br />

recombine with holes within the devices, releasing energy in the form <strong>of</strong> photon. This<br />

effect is called electroluminescence and the colour <strong>of</strong> the light is determined by the<br />

energy gap <strong>of</strong> the semiconductor. LED are usually integrated optical components are<br />

used to shape its radiation pattern and assist in the reflection.


18<br />

2.5.3 Exhaust Fan<br />

Exhaust fan as shown in Figure 2.13 is a fan for ventilating an interior by<br />

drawing air from the interior and expelling it outside. This project needs a <strong>system</strong><br />

combination with exhaust fan as the precaution step before entering the dangerous level.<br />

Exhaust fan will suck out all the air inside the room or building that had been installed<br />

with the <strong>system</strong> to the outside <strong>of</strong> the building. Therefore, the air quality inside the<br />

building will maintain in the safe air quality.<br />

Figure 2.12: Exhaust fan model


19<br />

CHAPTER 3<br />

METHODOLOGY<br />

3.1 Introduction<br />

Figure 3.1 shows the basic flow <strong>of</strong> methodology and approach for the project.<br />

The the project is divided into two parts which are hardware and s<strong>of</strong>tware. For the<br />

s<strong>of</strong>tware implementation, it involves writing code and programming the Arduino and<br />

zigbee. Meanwhile, hardware implementation involves designing the circuit <strong>of</strong> the<br />

project and PCB development. After both parts was completethe next was the testing<br />

and debugging proces. Each part <strong>of</strong> the project will be discussed in details in this<br />

chapter.


20<br />

Start<br />

Writing programming and<br />

compiling the program to<br />

Arduino<br />

Circuit design and basic<br />

connection<br />

Programming the<br />

zigbee connection<br />

PCB development<br />

Testing and debugging &<br />

circuitry<br />

Error<br />

Yes<br />

No<br />

Display<br />

data<br />

Interfacing with<br />

LABVIEW<br />

Interface with<br />

internet server<br />

End<br />

Figure 3.1: Methodology <strong>of</strong> the Project


21<br />

DC power<br />

supply<br />

Arduino<br />

Board<br />

Alarm<br />

Indicator<br />

Gas Sensor<br />

LABVIEW<br />

(GUI)<br />

Figure 3.2: Block Circuit Diagram<br />

As shown in Figure 3.2, the block diagram is about the connection <strong>of</strong> the <strong>gas</strong><br />

<strong>detector</strong> implementation. In this project, output voltage from the <strong>gas</strong> sensor will be<br />

delivered to the Arduino board. The heart <strong>of</strong> the <strong>system</strong> is the Arduino board. All the<br />

inputs and the outputs will be connected to the Arduino. When the <strong>gas</strong> sensor MQ6 or<br />

MQ3 detect the presence <strong>of</strong> <strong>gas</strong>, it will send analogue signal to an analog digital<br />

converter (ADC) inside the Arduino. An Arduino will process this signal and transfer to<br />

the LABVIEW using zigbee. In the same time, Arduino also will analyze the signal<br />

according the threshold value <strong>of</strong> <strong>gas</strong> concentration. The <strong>gas</strong> concentration value will<br />

determine which LEDs will be lit up and if the red LED light up, this will also triggers<br />

the buzzer to warn the users <strong>of</strong> <strong>gas</strong> concentration in the dangerous level. On the other<br />

hand, as the yellow LED light up, this will also triggers the relay for switching on the<br />

exhaust fan to suck out all the dangerous <strong>gas</strong> in the room and as the precaution before<br />

dangerous level.


22<br />

Figure 3.3: Experiment Diagram <strong>of</strong> the Project<br />

Figure 3.3 shows the image <strong>of</strong> the hardware built and Figure 3.4 is an illustration<br />

<strong>of</strong> the circuit diagram <strong>of</strong> the hardware. Xbee in the circuit diagram act as the transmitter<br />

for transfer the data <strong>wireless</strong>ly.<br />

BUZZER<br />

RED LED<br />

1S<br />

VCC<br />

GND<br />

3.3V<br />

5V<br />

GND<br />

A0<br />

ARDUINO<br />

BOARD<br />

13<br />

12<br />

11<br />

GREEN LED<br />

YELLOW<br />

LED<br />

5V<br />

relay<br />

5V<br />

exhoust<br />

fan<br />

TX<br />

RX<br />

3.3V<br />

Vout<br />

Vin<br />

XBEE<br />

GND<br />

Figure 3.4: Circuit Diagram for Gas Detector


23<br />

3.2 Hardware implementation<br />

In the <strong>wireless</strong> <strong>monitoring</strong> <strong>system</strong> <strong>of</strong> <strong>gas</strong> <strong>detector</strong>, there are a few parts <strong>of</strong><br />

hardware involved. This section will discuss on the design and function <strong>of</strong> each<br />

component that are connected to the Arduino in order to build the project. Along with<br />

that this section also explains how the circuitry connection between the components and<br />

microcontroller is made. This includes the sensor circuit and also the output circuit<br />

which comprises <strong>of</strong> LEDs, exhaust fan and a buzzer.<br />

3.2.1 Gas sensor circuit<br />

Figure 3.5: MQ3 and MQ6 image [12]<br />

In this project, MQ 6 is used to detect the liquefied Petroleum Gas (LPG),<br />

meanwhile MQ3 is used as the replacement <strong>of</strong> MQ 6 in detecting alcohol <strong>gas</strong>. The<br />

replacement <strong>of</strong> <strong>gas</strong> sensor in the project to show that level <strong>of</strong> different dangerous <strong>gas</strong> can<br />

be obtain by using the same method. Figure 3.5 shows the image <strong>of</strong> both the <strong>gas</strong> sensor.


24<br />

Figure 3.6: Gas Sensor Circuit Diagram [13]<br />

The circuit diagram for both the sensor is the same as shown in Figure 3.6.There<br />

are three output pins from this sensor which are reference voltage (VCC), ground pin<br />

(GND) and the output voltage pin. RL shown in the Figure 3.5 is the adjustable<br />

resistance. The connection between protection resistor in the sensor circuit and<br />

adjustable resistor are in serial which form a load resistor (RL). The sensor‟s resistance<br />

between Rs and RL form a voltage divider. Based on the chart provided in the MQ3 and<br />

MQ6 data sheet, Rs in the clean air under given temperature and humidity constant.<br />

Figure 3.6 also shows the sensor come out with 6pins. Pin H act as the coil <strong>of</strong> the <strong>gas</strong><br />

sensor. Meanwhile, pin A and B are connected in pairing and was connected as in the<br />

circuit diagram above. The calculation for <strong>gas</strong> concentration is described in detailed in<br />

section 3.3.1.<br />

GAS SENSOR<br />

1S<br />

VCC<br />

GND<br />

A0<br />

5V<br />

GND<br />

Figure 3.7: The Gas Sensor Connection to Arduino Pins.


25<br />

Figure 3.7 above shown <strong>gas</strong> sensor connection to the Arduino pins. The A0 pin<br />

connected at the Arduino will read the output voltage from the sensor.<br />

3.2.2 Output circuit<br />

The output circuit consists <strong>of</strong> four type components:<br />

i. Light-Emitting Diode (LED)<br />

ii. Buzzer<br />

iii. Exhaust Fan<br />

iv. Zigbee<br />

All <strong>of</strong> four components have their own purpose for the project in order to inform<br />

the users that the level <strong>of</strong> dangerous <strong>gas</strong> in the surrounding areas continuously. There are<br />

three LEDs used namely as red LED, yellow LED and green LED. All <strong>of</strong> these LED<br />

indicate three different level <strong>of</strong> <strong>gas</strong> concentration in the atmosphere as listed in Table<br />

3.1.


26<br />

Table 3.1: Threshold Value for Gas Concentration MQ3 and MQ9<br />

LED<br />

Gas concentration value (ppm)<br />

LPG (MQ6)<br />

Alcohol (MQ3)<br />

Green < 500 < 0.4<br />

Yellow 500 > = x = > 1000 0.4 > = x = > 1<br />

Red > 1000 > 1<br />

When the red LED is light up, buzzer will also be trigged to inform user that the<br />

surrounding areas have reached a dangerous level and emergency evacuation is needed.<br />

Meanwhile, exhaust fan will turn on along with the yellow LED to show the level<br />

concentration in the warning stage and exhaust fan is used to suck out the dangerous <strong>gas</strong><br />

as the precaution before entering the dangerous level.<br />

BUZZER<br />

RED LED<br />

13<br />

12<br />

11<br />

330k ohm<br />

330k ohm<br />

330k ohm<br />

GREEN LED<br />

5V<br />

relay<br />

5V<br />

exhaust<br />

fan<br />

YELLOW<br />

LED<br />

2N22<br />

Figure 3.8: Output Circuit Diagram


27<br />

Figure 3.8 show the output circuit diagram which act as the alarm <strong>system</strong> to the<br />

<strong>system</strong>. Red LED and buzzer are connected in the same pin from the Arduino, 13. Same<br />

as the yellow LED and exhaust fan at the pin 11. At the same time, pin 11 includes the<br />

relay circuit act as a switch tothe exhaust fan. All the LEDs are covered with a light<br />

transparents casing in previously shown in Figure 3.3 to give visibility to the brightness<br />

when the LEDs light up. The output for pin 12 from Arduino is green LED only.<br />

9V<br />

5V<br />

3 4<br />

normally open<br />

2<br />

1<br />

normally closed<br />

5<br />

RELAY<br />

R<br />

11 Transistor<br />

exzos<br />

fan<br />

Figure 3.9: Relay Connection Circuit Diagram<br />

Figure 3.9 show the relay connection circuit diagram from the Arduino to the<br />

exhaust fan.Relay is need in this project because exhaust fan require a 9V battery. Relay<br />

is an electromagnetic device that works on the magnetic field interfacing. Relay should<br />

be checked first before making the connection circuit to test whether the connection in<br />

the normally open or closed by using multimeter. If the multimeter sounds up with a<br />

„bit‟ that‟s mean the pin in the normally closed. Meanwhile, if the connection pin 2 and<br />

4 are tested, no sound will be heard at the multimeter. Exhaust fan is connected at the<br />

normally open pin because it will be turned on when it gets the information from<br />

Arduino pin only. Therefore, pin 5 at the relay will be not connected with any<br />

component in the circuit.


28<br />

Last but not least, the output circuit from the Arduino is zigbee. Zigbee from the<br />

output pin RX and TX in the Arduino acts as the transmitter. All the data from the<br />

sensor reading will be transferred to another zigbee receiver to interface with<br />

LABVIEW in the computer by <strong>wireless</strong>. Figure 3.10 below shows the circuit output<br />

diagram for zigbee from the Arduino.<br />

TX<br />

RX<br />

3.3V<br />

XBEE<br />

VCC<br />

DOUT<br />

DIN<br />

GND<br />

Figure 3.10: Zigbee Output Connection Circuit<br />

3.2.3 PCB development<br />

For the PCB development, donut board is used in this project. Before soldering<br />

all the components on the board, bread board was first used to ensure that the connection<br />

between each component is functional for this project. Donut board does not have<br />

connection to each hole like the strip board. In order to make the connection, solder<br />

method is used to connect all components. Besides that, female holders are uses to<br />

connect the jumper wires from Arduino to the board circuit. The PCB development<br />

circuit diagram is shown in Figure 3.4.


29<br />

3.3 S<strong>of</strong>tware Implementation<br />

This section will specifically discuss the methodology to interface the sensor and<br />

hardware module. The most important part is to enable the analog sensor to send analog<br />

data to Arduino then transfer to the LABVIEW. The first technique to interface the<br />

analog output to Arduino is to produce the relation between the sensor analog range and<br />

Arduino analog to digital converter (ADC) specification. This relation is based on <strong>gas</strong><br />

concentration calculation and will be explained in details the following section.<br />

3.3.1 Gas Concentration Calculation Process<br />

The following calculation will be clarified in numbering step to construct an<br />

equation for this sensor. Based on the datasheet <strong>of</strong> MQ3 and MQ9 the input and output<br />

voltage range shown in Table 3.2.<br />

Table 3.2: Gas Sensor input and output voltage range<br />

Specification<br />

Gas sensor<br />

MQ 9 MQ 3<br />

Input voltage range DC 5.0 ± 0.2 V DC 5.0 ± 0.2 V<br />

Output voltage range DC 0 – 5.0 V DC 0 – 5.0 V


30<br />

As mention in chapter 2, Arduino is 10 bit analog to digital converter<br />

microcontroller. Therefore, based on the hardware, the real input voltage <strong>of</strong> <strong>gas</strong> sensor is<br />

5V.<br />

i. Step 1:<br />

Since the binary for Arduino is 10-bit, it is equal to 2^10= 1024 steps or levels <strong>of</strong> the<br />

resolution. The maximum output from the <strong>gas</strong> sensor, 5V is then divided into 1024.<br />

From the calculation above, 1-bip output is equal to 4.88mV in the real voltage output.<br />

Figure 3.12 below shows the relation between voltage output from <strong>gas</strong> sensor and<br />

Arduino reading more clearly.<br />

voltage output (V)<br />

5<br />

4<br />

3<br />

2<br />

1<br />

204.8 409.6 614.4 819.2 1024<br />

digital ouput (bit)<br />

Figure 3.11: Voltage Output <strong>of</strong> Gas Sensor Versus digital output in<br />

Arduino.


31<br />

ii. Step 2:<br />

The value <strong>of</strong> <strong>gas</strong> concentration can be obtained by calculating the value <strong>of</strong> sensor<br />

resistor (Rs). The value <strong>of</strong> Rs is calculated using voltage divider in the <strong>gas</strong> sensor circuit<br />

diagram as the the equation below:<br />

From the Rs value, we can compute the <strong>gas</strong> concentration. Vo represents the voltage<br />

output from the <strong>gas</strong> sensor. Equation 3.2 is obtained from the <strong>gas</strong> sensor calibration<br />

datasheet. Once the Rs value is calculated, it will proceed to the next step.


32<br />

iii. Step 3:<br />

(200, 2)<br />

(1000, 1)<br />

Figure 3.12: Resistance Ratio versus Concentration Gas<br />

for MQ9 [13 ]<br />

Figure 3.13 shows the graph <strong>of</strong> sensor resistance ratio (Rs/Ro) versus concentration <strong>gas</strong><br />

in ppm for MQ9. Ro is the sensor resistance (Rs) value at 1000ppm. Therefore, based on<br />

the graph above, Ro is equal to 1 (Rs/ Ro). From graph, we can get the relationship<br />

between Rs and LPG concentration in ppm. Equation 3.3 shows the relationship between<br />

Rs and LPG concentration value.


33<br />

Alpha (α) in the equation 3.3 shows the graph in Figure 3.13 is slope value. The slope<br />

value can be obtained using the equation 3.4.<br />

α<br />

α<br />

By taking the two points from the linear graph, we can calculate the slope <strong>of</strong> the LPG<br />

concentration <strong>gas</strong> which is equal to -1. Therefore, with the slope value equal to -1,<br />

equation 3.3 can be simplified into equation 3.5 by substitute the value <strong>of</strong> slope value <strong>of</strong><br />

graph.<br />

The same methods are applied to the <strong>gas</strong> sensor MQ3 in the step 3 from the beginning to<br />

obtain and calculate the concentration <strong>of</strong> alcohol <strong>gas</strong>. The equation for alcohol <strong>gas</strong><br />

concentration is in equation 3.6 below.


34<br />

iv. Step 4:<br />

Since Arduino only read in the 10-bit numbering, the threshold value for alarm <strong>system</strong> to<br />

be functional as well as the project set up, concentration value need to convert into 10-<br />

bit data to programmed the Arduino programmer. The threshold values are based on the<br />

OSHA organization standard value. By using the equation 3.5 and 3.6 in step 3, value <strong>of</strong><br />

<strong>gas</strong> concentration can be obtain. Table 3.3 below shows all the threshold value for the<br />

both <strong>gas</strong> sensor which are taken from OSHA.. The calculation for converting the value<br />

<strong>of</strong> voltage output to digital output is based on the equation 3.7 below.<br />

-<br />

Table 3.3: Threshold Value for MQ9 and MQ3<br />

Mode<br />

Gas sensor<br />

MQ 9 MQ 3<br />

Vo 10-bit reading Vo 10-bit reading<br />

Green < 1.67 = 2.5V<br />

Vo > = 512<br />

Vo > = 2.5V<br />

Vo > = 512<br />

Red > 2.5V > 512 > 2.5V > 512


35<br />

3.3.2 Arduino Programming<br />

Arduino programming is the heart <strong>of</strong> this project. This is because, all the data<br />

from sensor to LABVIEW <strong>monitoring</strong> <strong>system</strong> and alarm <strong>system</strong> controlled by Arduino.<br />

Besides that, Arduino also trigger alarm <strong>system</strong> when detect the threshold value that<br />

have been set up. Moreover, Arduino will send the data to the computer in LABVIEW<br />

by <strong>wireless</strong> with zigbee device.<br />

Figure 3.13 show the whole process includes in the <strong>gas</strong> sensor MQ 9 for<br />

detecting the LPG concentration level.


36<br />

start<br />

read the output<br />

voltage by arduino<br />

from <strong>gas</strong> sensor<br />

send data to<br />

LabView using xbee<br />

MQ6<br />

Vo > 1.67v <br />

no<br />

turn on the<br />

green led<br />

yes<br />

MQ6<br />

Vo > 2.5v <br />

no<br />

turn on the yellow<br />

led and exhaust<br />

fan<br />

yes<br />

turn on the red<br />

led and buzzer<br />

end<br />

Figure 3.13: Flow Chart for The Arduino Programming for MQ9<br />

Firstly, all the input and output pin in Arduino must be declare. Then, initial<br />

sensor value must be set as 0. The data receive from sensor can calculate in the decimal


37<br />

place as the float sensor declare in line 6 below. Analog input pin that the potentiometer<br />

<strong>of</strong> <strong>gas</strong> sensor is attached to pin A0. The declaration programming for this step shows as<br />

Figure 3.14.<br />

constintanalogInPin = A0;<br />

constintledred = 13;<br />

constintledgreen = 12;<br />

constintledyellow = 11;<br />

intsensorValue = 0;<br />

float sensor;<br />

figure 3.14: Arduino input and output port initialization<br />

After that, loop is very important which represent all the data will continuously<br />

repeat by time. In this project, there are 2 loop include. First loop is to initialize serial<br />

communication at the bound rate 9600. This is also sets the digital pin as the output as<br />

shown in Figure 3.15.


38<br />

void setup()<br />

{<br />

Serial.begin(9600);<br />

pinMode(ledgreen, OUTPUT);<br />

pinMode(ledred,OUTPUT);<br />

pinMode(ledyellow,OUTPUT);<br />

}<br />

Figure 3.15 : Declaration <strong>of</strong> the pin<br />

Meanwhile, the second loop is mostly the main process for the alarm <strong>system</strong><br />

trigger. All the threshold value is declared in this loop. First <strong>of</strong> all, the <strong>system</strong> read the<br />

sensor value as shown in Figure 3.16. If the sensor value is over or under the limitation<br />

<strong>of</strong> threshold value, some indicator as the output <strong>system</strong> will be turning on. Finally, the<br />

result from the sensor value will be print to the serial monitor. The flow chart <strong>of</strong> the<br />

programming show in the Figure 3.13.


39<br />

void loop() {<br />

sensorValue = analogRead(analogInPin);<br />

if (sensorValue>= 512)<br />

{<br />

digitalWrite(ledgreen, LOW);<br />

digitalWrite(ledyellow, LOW);<br />

digitalWrite(ledred, HIGH);<br />

delay(50);<br />

Set the LED blinking<br />

digitalWrite(ledred, LOW);<br />

delay(50);<br />

}<br />

else if (sensorValue> 342 &&sensorValue< 512)<br />

{<br />

digitalWrite(ledgreen, LOW); // sets the LED on<br />

digitalWrite(ledyellow, HIGH);<br />

digitalWrite(ledred, LOW); // sets the LED <strong>of</strong>f<br />

}<br />

else if (sensorValue


3.3V<br />

RX<br />

TX<br />

5V<br />

GND<br />

40<br />

digitalWrite(ledyellow, LOW);<br />

digitalWrite(ledred, LOW); // sets the LED <strong>of</strong>f<br />

}<br />

Serial.print(sensorValue);<br />

delay(500);<br />

}<br />

Figure 3.16: Programming Process in Arduino<br />

3.3.3 Zigbee Programming<br />

210x<br />

XBEE<br />

VCC<br />

DOUT<br />

DIN<br />

GND<br />

Figure 3.17: Zigbee receiver Connection to USB Port<br />

Figure 3.17 shows the connection diagram for Zigbee receiver. Both <strong>of</strong> the<br />

zigbee receiver and transmitter must be set up with the programming in order to transfer


41<br />

data from Arduino successfully. Therefore, the Zigbee must be connected as <strong>of</strong> Figure<br />

3.17.<br />

Driver microchip 210x for USB port must be installed in the computer in order to<br />

read the port. After that, XCTU s<strong>of</strong>tware is needed to run the programming with Zigbee.<br />

Once the XCTU s<strong>of</strong>tware is installed and executed in the computer, each COM for each<br />

zigbee must be tested by clicking on the button Test/Query as shown in Figure<br />

3.18.XCTU s<strong>of</strong>tware is support for programming and configuring Zigbee, WIFI<br />

modules. After that a dialog box will popped up to inform that the COM connection is<br />

successful. Figure 3.19 shows the result output for Com test.<br />

Figure 3.18: Test the COM Of Zigbee<br />

Figure 3.19: Result Output for Com Test


42<br />

The set up for the Zigbe data transfer is done by opening the modem<br />

configuration at the up right corner <strong>of</strong> the window XCTU. This step is very important to<br />

make sure that the data has been transfer to the exact location. There were four items<br />

that need to be considered. First is PAN ID. This is to show the location number <strong>of</strong> the<br />

port. The value <strong>of</strong> the ID must be the same. As shown in figure 3.20, the ID for this<br />

zigbee is 111. Then set the destination address high as 0 and the destination address low<br />

as FFFF. Serial interfacing will also be the most important things in this step. As we set<br />

the bound rate at the Arduino at 9600, the interfacing data rate also must be 9600. Figure<br />

3.21 shows the interfacing data rate at 3 which is equal to 9600.<br />

Figure 3.20: Setting the Programming 1<br />

Figure 3.21: Setting the Programming 2


43<br />

The last step is to test the connection between two zigbee. Figure 3.22 shows the<br />

data transfer between two zigbee is succesful. As shown in figure 3.22, the writing in<br />

blue colour is the data transfer at COM40. Meanwhile, the red colour in COM44 is the<br />

receiver and vice versa. Therefore, both <strong>of</strong> the Zigbee can be used as the receiver and<br />

transmiter terminal.<br />

Figure 3.22: Test The Connection <strong>of</strong> Both Zigbee.<br />

3.3.4 LABVIEW<br />

Labview is used in the <strong>monitoring</strong> <strong>system</strong> in this project. Therefore, for<br />

interfacing the data transfer by zigbee in the LABVIEW, Virtual Instrument S<strong>of</strong>tware<br />

Architecture (VISA) configuration serial ports are required. VISA is the lower layer <strong>of</strong><br />

functions in the LabVIEW instrument driver VIs that communicates with the driver<br />

s<strong>of</strong>tware to communicate with extenal I/O devices such as zigbee modules. Figure 3.23<br />

shows the VISA interfacing block diagram connection. There are three levels for the<br />

visa interface which are configure serial port, visa read and VISA closed. All three <strong>of</strong> the<br />

parts are a must have for the interfacing process.


44<br />

Figure 3.23: VISA Interfacing Block Diagram<br />

The first level visa configure serial port is for initializes the serial ports specified<br />

by visa resources name to a specified settings. Wire data to the visa resources name<br />

input to determine the polymorphic instance to use or manually sellect the instance. In<br />

this project, COM 40 has been chosed as the zigbee port in that location. Besides that,<br />

the value <strong>of</strong> 9600 in the Figure 3.23 shows the bound rate <strong>of</strong> the project <strong>system</strong> from<br />

arduino and zigbee. From the Figure 3.23 also, the grey line in the figure shows the<br />

while loop for repeating the subdiagram inside it untill conditional terminal, an input<br />

terminal receives a particular Boolean value. The Boolean value depends on the<br />

continuation behaviour <strong>of</strong> the loop.<br />

Figure 3.24: VISA Read Output


45<br />

After interfacing the data transfer and LABVIEW was done, the next process is<br />

to read the data transfer. From the figure 3.24, decimal string to number is needed for<br />

converting the numeris characters in string thats starting at <strong>of</strong>fset to a decimal interger<br />

and return it in number. Once the string number from visa has been changed, the output<br />

number needs to convert back into the original <strong>of</strong> voltage value. The converter process is<br />

shown in Figure 3.25. As mentioned before, Arduino will read the data in the 10-bit data<br />

only. Therefore, to convert the value in the original voltage is by the equation in 3.7.<br />

Figure 3.25: Converter Process<br />

The next step in LABVIEW process is to show the LED indicators for user<br />

<strong>monitoring</strong>. The range will conduct the voltage value according to the threshold value<br />

that has been set before.<br />

Finally, the last step is to monitor the concentration value <strong>of</strong> the <strong>gas</strong>. In this step,<br />

the concentration value is calculate based on the graph analysis as mentioned before.<br />

Therefore, to calculate the <strong>gas</strong> concentration for LPG and alcohol <strong>gas</strong> are using the<br />

equation 3.8 and 3.9 as below.


46<br />

The last stage in the data <strong>monitoring</strong> <strong>system</strong> is interface the <strong>system</strong> with internet<br />

server. There are very easy step in this project because LABVIEW s<strong>of</strong>tware already<br />

provide built-in function process. To start turning data into internet server, first at all<br />

find the web publishing tool at at menu tools as show in Figure 3.26.<br />

Figure 3.26: Web Publishing Tools LABVIEW


47<br />

The the window <strong>of</strong> web publishing tool will be come out as show in Figure 3.27.<br />

From Figure 3.27, the first step browse the VI name <strong>of</strong> the project and set it as<br />

embedded viewing mode.<br />

Figure 3.27: Step 1<br />

The second step is shown in Figure 3.28. Document title and summary <strong>of</strong> this<br />

project need to be add in this step for the data <strong>monitoring</strong> in the internet server.


48<br />

Figure 3.28: Step 2<br />

Then, the final step is save the new web page as show in Figure 3.29. by saving<br />

the data <strong>of</strong> web page, this <strong>system</strong> can automatically running in the internet server at the<br />

web address(URL) given by LABVIEW.


Figure 3.29: Step 3<br />

49


50<br />

CHAPTER 4<br />

RESULT AND DISCUSSION<br />

4.1 Introduction<br />

This chapter explains about the results achived in the project and a few<br />

discussions on problem solving during process and experiment <strong>of</strong> completing this<br />

project. The data collection is using types <strong>of</strong> <strong>gas</strong> sensor MQ3 and MQ9 for Alcohol and<br />

LPG <strong>gas</strong> exposes. Then the data analyzed and compared with information obtain from<br />

the several reference sources from OSHA.<br />

4.2 Project Description<br />

Project done is based on the objectives started before whichis analyzing a sensor<br />

circuit for the <strong>gas</strong> sensor. This sensor node will detect the level <strong>of</strong> concentration <strong>of</strong> the<br />

<strong>gas</strong> exposed and convert it into analog voltage and directly sending it into Arduino.<br />

After transferring the data, Arduino will read the data into the digital format. Arduino


51<br />

processes analog to digital converter (ADC) from 0 to 1024 which are in 10 bits.<br />

Voltage output from the <strong>gas</strong> sensor (0-5)V will be read as (0-1024) decimal output in<br />

Arduino. Furthermore, this <strong>system</strong> will enable data transfer in LABVIEW by <strong>wireless</strong><br />

using zigbee device and complete with the alarm <strong>system</strong>.<br />

4.3 Project Result<br />

Figure 4.1 show the output result <strong>of</strong> the alarm <strong>system</strong> when Arduino threshold in<br />

the warning mode. Yellow LED and exhaust fan will be turn on as the initially <strong>system</strong><br />

set up in order to control the air quality in the building. Yellow LED means warning in<br />

the <strong>system</strong>.<br />

Figure 4.1: Alarm indicator <strong>of</strong> the project.


52<br />

The overall project set up shown in the Figure 4.2. the <strong>system</strong> are divided into<br />

two part. First part is on the alarm <strong>system</strong>. The second part is on the s<strong>of</strong>tware <strong>system</strong><br />

which is <strong>monitoring</strong> <strong>system</strong>.<br />

Figure 4.2: Overall Project Configuration<br />

An experimented was carried out using two type <strong>of</strong> <strong>gas</strong> sensor with two different<br />

kinds <strong>of</strong> <strong>gas</strong>ses. The first experiment was done with MQ9 <strong>gas</strong> sensor. This sensor detects<br />

the concentration <strong>of</strong> the LPG <strong>gas</strong>. The result for <strong>monitoring</strong> <strong>system</strong> <strong>of</strong> MQ9 <strong>gas</strong> sensor is<br />

shown in the Figure 4.3 below. The second experiment is to detect the level <strong>of</strong><br />

concentration alcohol <strong>gas</strong> by using MQ3 <strong>gas</strong> sensor. Figure 4.4 shows the outcome result<br />

for second <strong>gas</strong> sensor, MQ3.


53<br />

Voltage output graph<br />

Expose in the high<br />

concentration <strong>of</strong> <strong>gas</strong><br />

Back in normal<br />

Figure 4.3: Monitoring System for MQ9<br />

Indicator for level<br />

<strong>of</strong> safety<br />

Detect the <strong>gas</strong><br />

Figure 4.4: Monitoring System for MQ3


54<br />

After that, the <strong>system</strong> <strong>of</strong> <strong>gas</strong> <strong>monitoring</strong> sensor has been transferred to the<br />

internet server. Figure 4.5 shows the data <strong>monitoring</strong> <strong>system</strong> in the internet browser. The<br />

interface <strong>of</strong> the data <strong>monitoring</strong> with internet server will give an advantages to user for<br />

<strong>monitoring</strong> the building or industrial air environment quality in the long distance<br />

continuously.<br />

Figure 4.5: System Monitoring in Internet Server<br />

Figure 4.6 shows the packaging <strong>of</strong> the hardware and the <strong>wireless</strong> <strong>gas</strong> <strong>monitoring</strong><br />

<strong>system</strong>. This <strong>system</strong> is smell and portable that can be continuously installed in the<br />

building. The size <strong>of</strong> suitable building is depends on the type <strong>of</strong> the Zigbee used. The<br />

room size that suitable in this project is 100m x 100m.


Figure 4.6: packaging <strong>of</strong> the project<br />

55


56<br />

CHAPTER 5<br />

CONCLUSION AND RECOMMENDATION<br />

5.1 Introduction<br />

This section will conclude the whole project and future recommendations for<br />

students or individual who is interested in continuing this project as their research.<br />

5.2 Conclusion<br />

As a conclusion, reading <strong>of</strong> the output voltage from the <strong>gas</strong> sensor shows the<br />

value <strong>of</strong> concentration and level <strong>of</strong> dangerousness in red LED. Control <strong>system</strong> that<br />

reacts as the alarm <strong>system</strong> has been design based on the indicator for user. Data<br />

reading from the <strong>gas</strong> sensor was successfully transferred to LABVIEW using Zigbee<br />

and easily monitored without wire and displayed in the internet.


57<br />

This <strong>system</strong> is built to help user to feel comfortable in a work place and easy<br />

to monitor the range <strong>of</strong> air quality in the environment from their own figure via<br />

LEDs, exhaust fan and buzzer. This <strong>system</strong> device also gives an advantage to the<br />

user to easily get the information about the air quality in their building or industrial<br />

area by <strong>monitoring</strong> the <strong>system</strong> by using PC via Zigbee <strong>wireless</strong>.<br />

5.3 Recommendation<br />

For further improvement, the research can add some features that enables the<br />

master controller to control the sensing element. This is to guarantee there is a<br />

reliable back-up <strong>system</strong> for this project if any emergency occurs. In addition, this<br />

<strong>system</strong> was able to monitor and control air condition for various implementations<br />

with some <strong>system</strong> alterations.<br />

The toxic <strong>gas</strong> release alarm <strong>system</strong> safety features can also be improved by<br />

adding another function to check the sensor‟s condition in case the sensor is not<br />

working properly or if the sensor‟s calibration has been displaced.<br />

A power saving features and power supply back-up would also be an<br />

essential addition to the <strong>system</strong> in case the main power supply is down. The alarm<br />

<strong>system</strong> can also be hooked up to a timer and a phone that dials directly to the owner<br />

and also the authorities if the dangerous CO concentration levels are detected<br />

continuously for more than one or two hours.


58<br />

REFERENCES<br />

[1] Incorporated, C. T., Technologies, C., & Technologies, C. (2011). Cytron<br />

USB to UART Converter User ‟ s Manual, (June), 1-23.<br />

[2] Dissanayake, S. D., Karunasekara, P. P. C. R., Lakmanaarachchi, D. D.,<br />

Rathnayaka, a J. D., & Samarasinghe, a T. L. K. (2008). Zigbee Wireless<br />

Vehicular Identification and Authentication System. 2008 4th International<br />

Conference on Information and Automation for Sustainability, 257-260.<br />

[4] F. He, Z. Du, and Y. Sun, “Indoor Dangerous Gas Environment Detected by<br />

Mobile Robot,” 2009<br />

[4] M. F. Jan, Q. Habib, and M. Irfan, “Carbon Monoxide Detection and<br />

Autonomous Countermeasure System for a Steel Mill using Wireless Sensor<br />

and Actuator Network,, pp. 405-409, 2010.<br />

[5] Somov, A., Baranov, A., Savkin, A., Spirjakin, D., Spirjakin, A., &<br />

Passerone, R. (2011). Development <strong>of</strong> <strong>wireless</strong> sensor network for<br />

combustible <strong>gas</strong> <strong>monitoring</strong>. Sensors & Actuators: A. Physical, 1-8.<br />

[6] S<strong>of</strong>ia, Z., Binti, S., & Bakeri, H. J. (2010). UNIVERSITI TEKNOLOGI<br />

MALAYSIA (April).<br />

[8] Characteristics, S., Design, D., & Detectors, M. ,Technical Information on<br />

Usage <strong>of</strong> TGS Sensors for, 1-12.<br />

[9] ]Jeliˇ, V., Magno, M., Paci, G., Brunelli, D., & Benini, L. (2011). Design<br />

Characterization and Management <strong>of</strong> a Wireless Sensor Network for Smart<br />

Gas Monitoring. Sciences-New York, 4, pg 115-120.<br />

[10] Health, E., & Elements, L. (2012). Liquefied Petroleum Gas (Canada)<br />

Section 1 : Identification <strong>of</strong> the substance or mixture and <strong>of</strong> the supplier


59<br />

Section 2 : Hazard ( s ) Identification Section 3 : Composition / Information<br />

on Ingredients Section 4 : First Aid Measures, 1-8.<br />

[11] Datasheet, Uno, T. A. Arduino Uno, 328.<br />

[12] Datasheet MQ-6 Semiconductor Sensor for LPG, 2-4.<br />

[13] Datasheet MQ-3 Semiconductor Sensor for Alcohol, 3-5.


60<br />

APPENDIX<br />

1. Block diagram for MQ6 in LABVIEW


2. Block diagram for MQ3 in LABVIEW<br />

61


3. Arduino programming for MQ3<br />

62


4. Arduino programming for MQ6<br />

63

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!