0% found this document useful (0 votes)
92 views51 pages

Gas Leakage Detection with ESP8266 & MQ-6

This document describes a project to develop an automatic gas leakage detection and alarming system using an ESP8266 and MQ6 gas sensor. The system will detect gas leaks and activate an alarm circuitry. A group of 4 students completed this project to fulfill the requirements for a Bachelor of Technology degree in Electrical and Electronics Engineering at Sanketika Institute of Technology and Management. The project was carried out under the guidance of their project supervisor.

Uploaded by

Safi Kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views51 pages

Gas Leakage Detection with ESP8266 & MQ-6

This document describes a project to develop an automatic gas leakage detection and alarming system using an ESP8266 and MQ6 gas sensor. The system will detect gas leaks and activate an alarm circuitry. A group of 4 students completed this project to fulfill the requirements for a Bachelor of Technology degree in Electrical and Electronics Engineering at Sanketika Institute of Technology and Management. The project was carried out under the guidance of their project supervisor.

Uploaded by

Safi Kumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

AUTOMATIC GAS LEAKAGE DETECTION AND ALARMING

SYSTEM USING ESP8266 AND MQ6 GAS SENSOR


A Project Report submitted in partial fulfillment of the requirement
for the award of degree
Of
BACHELOR OF TECHNOLOGY
In
ELECTRICAL AND ELECTRONICS ENGINEERING

By
[Link] ([Link].206D5A0202)
[Link] ([Link].206D5A0204)
[Link] SWAROOP ([Link].206D5A0205)
[Link] KUMAR ([Link].206D5A0206)
Under the Guidance of
Mr. [Link] CHAKRAVARTHY [Link]

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING


SANKETIKA INSTITUTE OF TECHONOLOGY AND MANAGEMENT
(Affiliated to JNTU, Kakinada)
POTHINAMALLAYYA PALEM, VISAKHAPATNAM – 530041
ANDHRA PRADESH, INDIA.

MAY – 2022-2023
SANKETIKA INSTITUTE OF TECHONOLOGY AND
MANAGEMENT
DEPARTMENT OF ELECTRICAL and ELECTRONICS ENGINEERING
Pothinamallaya Palem, Visakhapatnam-530041
(2020-2023)

CERTIFICATE

This is to certify that the project entitled “AUTOMATIC GAS LEAKAGE DETECTION AND
ALARMING SYSTEM USING ESP8266 AND MQ6 GAS SENSOR” is submitted by
[Link] ([Link].206D5A0202) [Link] ([Link].206D5A0204) [Link] SWAROOP
([Link].206D5A0205) [Link] KUMAR ([Link].206D5A0206) the following students, in
fulfillment of the requirement for the award of degree in “ Bachelor of Technology” in
Dept. of Electrical and Electronics Engineering for the academic year 2020-2023.

Project guide Head of the Department

Mr. CH. Vishnu Chakravarthy , [Link] Mr. CH. Vishnu Chakravarthy , [Link]
Electrical & Electronics Engineering Electrical & Electronics Engineering

EXTERNAL EXAMINER
CONTENTS
Acknowledgement
Abstract
Introduction

TITLE PAGE NUMBER


Chapter I: Introduction
1.1 Specification 11
1.2 Pin Definition 12
1.3 Using Arduino IDE 12
1.4 Install the ESP8266 Board Package

1.5 Setup ESP8266 Support 12


1.6 Blink Test

1.7 Connecting via WIFI

1.8 Flashing NodeMCU on the ESP8266 using Windows

1.8.1 Pin Assignment

1.8.2 Wiring

Chapter II: Solution Methodology


2.1 Main Block Diagram 11
2.2 Components 12
Chapter III: Selection Of Components
3.1 Node Mcu 14
3.1.1 Node Mcu Esp-12e Pin Mapping 15
3.1.2 Working 17
3.2 MQ-6 Gas Sensor
3.3 How To Use Dual- Channel Relay Module 21
3.4 Code For Hardware Kit 28
Chapter IV: Working of Project
4.1 Working of each components
4.1.1 NODEMCU ESP8266 30
4.1.2 Buzzer 32
4.1.3 Led 33
4.1.4 Power Supply Circuit 35
4.1.5 Liquid Petroleum Gas (LPG) 35
4.1.6 Scope And Limitations 35
4.1.7 Mq6 Gas Sensor 36
4.1.8 Gas Leakage Detection System 36
4.1.9 Sensitivity Characteristics 37
4.2 Operation of the circuit
4.3 Conclusion

PROJECT S ASSOCIATE
[Link] ([Link].206D5A0202)
[Link] ([Link].206D5A0204)
[Link] SWAROOP ([Link].206D5A0205)
[Link] KUMAR ([Link].206D5A0206)

4
ACKNOWLEDGEMENT
No thesis is created entirely by an individual, many people have helped to create the

thesis and each of their contribution has been valuable. Our deepest gratitude goes to our

project guide Mr. [Link] CHAKRAVARTHY, Head of the Department, of Electrical and

Electronics Engineering, for his guidance, support, motivation and encouragement

throughout the period this work was carried out. His readiness for consultation at all

times, his educative comments, his concern and assistance even with practical things have

been invaluable. We express our gratitude to Mr. [Link] CHAKRAVARTHY, Head of

the Department, Electrical and Electronics Engineering for his invaluable suggestions and

constant encouragement all through the project work.

We would also like to convey our sincerest gratitude and indebtedness to all other

faculty members and staff of Department of Electrical and Electronics Engineering,

Sanketika institute of technology and management, who bestowed their great effort and

guidance at appropriate times without which it would have been very difficult on our

project work.

An assemblage of this nature could never have been attempted with our reference

to and inspiration from the work of others whose details are mentioned in reference

section. We acknowledge our indebtness to all of them. They rendered us enormous

support being apart during the whole tenure of our stay in this college.
ABSTRACT

LPG Cylinders are widely used in Indian Subcontinent. The demand for LPG Cylinder

is increasing with time. It was used widely in Urban and sub-urban areas, but in past 5-10

years the demand has reached in rural areas also. Similarly, the demand of LPG Cylinder

has increased in the Industrial Sector. Liquid petroleum gas is highly flammable gas. With

the increase of usage of LPG Cylinders, there has been a rise in accidents pertaining to gas

leakages. Leakage of this gas raises risk of building fire, suffocation and explosion.

There have been many accidents due to explosion of LPG cylinders and in some of

circumstances it is due to negligence of gas leakage. Arduous and diligent work is required

to monitor gas leakages all the time. In view to address above problem, IOT system is

proposed which diligently monitors the gas leakages with great precision & accuracy.

Whenever there is any gas leakage, the MQ-6 gas sensor will sense it and the corresponding

alarm circuitry will be activated.

Keywords: IOT, MQ-6, Real Time, Node-MCU, Propane and Butane Gas..

6
INTRODUTION

liquefied petroleum gas (LPG), also called LP gas, any of several liquid mixtures of the

volatile hydrocarbons propene, propane, butene, and butane. It was used as early as

1860 for a portable fuel source, and its production and consumption for both domestic

and industrial use have expanded ever since. A typical commercial mixture may also

contain ethane and ethylene, as well as a volatile mercaptan, an odorant added as a

safety precaution.

Liquefied petroleum gas (LPG) is recovered from “wet” natural gas (gas with

condensable heavy petroleum compounds) by absorption. The recovered product has a

low boiling point and must be distilled to remove the lighter fractions and then be

treated to remove hydrogen sulfide, carbon dioxide, and water. The finished product is

transported by pipeline and by specially built seagoing tankers. Transportation by truck,

rail, and barge has also developed, particularly in the United States.

LPG reaches the domestic consumer in cylinders under relatively low pressures. The

largest part of the LPG produced is used in central heating systems, and the next largest

as raw material for chemical plants. LPG commonly is used as fuel for gas barbecue grills

and gas cooktops and ovens, for gas fireplaces, and in portable heaters. In Europe, LPG

water heaters are common. It is also used as an engine fuel and for backup generators.

Unlike diesel, LPG can be stored nearly indefinitely without degradation. Compare

liquefied natural gas.

7
CHAPTER-I

NODEMCU ESP8266

The ESP8266 is the name of a micro controller designed by Espress if Systems.

The ESP8266 itself is a self-contained WiFi networking solution offering as a bridge

from existing micro controller to WiFi and is also capable of running self-contained

applications. This module comes with a built in USB connector and a rich assortment of

pin-outs. With a micro USB cable, you can connect NodeMCU dev kit to your laptop and

flash it without any trouble, just like Arduino. It is also immediately breadboard

friendly.

Fig.1.1: NODEMCU ESP8266

1.1 Specification:

Voltage 3.3V.
Wi-Fi Direct (P2P) soft-AP.
Current consumption 10uA~170mA.
Flash memory 16MB max (512K normal).
attachable
Processor: Tensilica 32-bit.
L106
Processor speed 80~160MHz.
8
RAM 32K + 80K.
GPIOs 17 (multiplexed with other functions).
Analog to Digital 1 input with 1024 step resolution.

Fig.1.2: NODEMCU Pins

1.2 Using Arduino IDE :

The most basic way to use the ESP8266 module is to use serial

commands, as the chip is basically a WiFi/Serial transceiver. However, this is not

convenient. What we recommend is using the very cool Arduino ESP8266 project,

which is a modified version of the Arduino IDE that you need to install on your

computer. This makes it very convenient to use the ESP8266 chip as we will be using

the well-known Arduino IDE. Following the below step to install ESP8266 library to

work in Arduino IDE environment.

1.3 Install the ESP8266 Board Package

Enter [Link]
9
into Additional Board Manager URLs field in the Arduino v1.6.4+ preferences.

Fig. 1.3.1 Click ‘File’ -> ‘Preferences’ to access this panel.

Next, use the Board manager to install the ESP8266 package.

Fig. 1.3.2. Click ‘Tools’ -> ‘Board:’ -> ‘Board Manager…’ to access this panel.

Scroll down to ESP8266 by ESP8266 Community ’ and click “Install” button to install
10
the ESP8266 library package. Once installation completed, close and re-open Arduino

IDE for ESP8266 library to take effect.

1.4 Setup ESP8266 Support

When you've restarted Arduino IDE, select ‘Generic ESP8266 Module’ from the ‘Tools’ -

> ‘Board:’ dropdown menu.

Fig. 1.4.1. Select 80 MHz as the CPU frequency (you can try 160 MHz overclock later)

Fig. 1.4.2. Select ‘115200’ baud upload speed is a good place to start - later on you can

try higher speeds but 115200 is a good safe place to start.

11
Fig. 1.4.3. Go to your Windows ‘Device Manager’ to find out which Com Port ‘USB-Serial

CH340’ is assigned to. Select the matching COM/serial port for your CH340 USB-Serial

interface.

Find out which Com Port is assign for CH340 Select the correct Com Port as indicated on ‘Device

Manager”

12
1.5 Blink Test

We'll begin with the simple blink test.

Enter this into the sketch window (and save since you'll have to). Connect a LED as

shown in Figure3-1.

void setup() {
pinMode(5, OUTPUT); // GPIO05, Digital Pin D1
}

void loop() {
digitalWrite(5, HIGH);
delay(900);
digitalWrite(5, LOW);
delay(500);
}

Now you'll need to put the board into bootload mode. You'll have to do this before each

upload. There is no timeout for bootload mode, so you don't have to rush!

 Hold down the ‘Flash’ button.

 While holding down ‘ Flash’, press the ‘RST’ button.

 Release ‘RST’, then release ‘Flash’

 When you release the ‘RST’ button, the blue indication will blink once, this means its

ready to bootload.

Fig.1.5.1: Steps for Blinking Test


13
Once the ESP board is in bootload mode, upload the sketch via the IDE, Figure 3-2.

Fig.1.5.2: Connection diagram for the blinking test

Figure 1.5.3 Uploading the sketch to ESP8266 NodeMCU module.

The sketch will start immediately - you'll see the LED blinking.
14
1.6 Connecting via WiFi

OK once you've got the LED blinking, let’s go straight to the fun part, connecting to a

webserver. Create a new sketch with this code:

Don’t forget to update:

const char* ssid = "yourssid";

const char* password = "yourpassword";

to your WiFi access point and password, then upload the same way: get into bootload

mode, then upload code via IDE.

/*
* Simple HTTP get webclient test
*/

#include <ESP8266WiFi.h>
const char* ssid = "handson"; // key in your own SSID
const char* password = "abc1234"; password
// key in your own WiFi access point

Open up the IDE serial console at 115200 baud to see the connection and webpage

printout!

15
Fig.1.6.1: NODEMCU ESP8266

That's it, pretty easy right ! This section is just to get you started and test out your module.

16
NodeMCU is a firmware that allows you to program the ESP8266 modules with LUA

script. And you’ll find it very similar to the way you program your Arduino. With just a few

lines of code you can establish a WiFi connection, control the ESP8266 GPIOs, turning your

ESP8266 into a web server and a lot more.

Fig. 1.6.2 ESP8266 Module Breadboard Friendly with Header Connector

1.7 Flashing NodeMCU Firmware on the ESP8266 using Windows :

 ESP8266 Module Breadboard Friendly

 PL2303HX USB-UART Converter Cable

 Some Male-to-Female Jumper Wires

1.7.1 Pin Assignment:

Fig.1.7.1: Pin Assigment


16

1.7.2 Wiring:

Fig.1.7.2: Wiring diagram

ESP8266 Pin Description

CH_PD Pull high, connect to Vcc +3.3V

Vcc Power Supply +3.3V

TXD Connect to RXD (white) of PL2303HX USB-Serial converter

cable

RXD Connect to TXD (Green) of PL2303HX USB-Serial converter

cable

GPIO0 Pull low, connect to GND pin

GND Power Supply ground


17

CHAPTER-II

SOLUTION METHODOLOGY

2.1 MAIN BLOCK DIAGRAM

Fig.2.1: Main Block diagram


18
2.2 COMPONENTS:

 BREAD BOARD :

A Breadboard is simply a board for prototyping or building circuits on.

It allows you to place components and connections on the board to make circuits

without soldering. The holes in the breadboard take care of your connections by

physically holding onto parts or wires where you put them and electrically connecting

them inside the board.

 NODEMCU ESP8266 :

NodeMCU is a low-cost open source IoT platform.[4][5] It initially

included firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and

hardware which was based on the ESP-12 module.[6][7] Later, support for the ESP32

32-bit MCU was added.

 BUZZER :

A buzzer is a small yet efficient component to add sound features to

our project/system. It is very small and compact 2-pin structure hence can be easily

used on breadboard, Perf Board and even on PCBs which makes this a widely used

component in most electronic applications.

 LED :

LEDs work on the principle of Electroluminescence. On passing a

current through the diode, minority charge carriers and majority charge carriers

recombine at the junction. On recombination, energy is released in the form of

photons. As the forward voltage increases, the intensity of the light increases and
reaches a maximum.

19
 MQ6 GAS SENSOR :

The MQ-6 Gas sensor can detect or measure gases like LPG and butane.

The MQ-6 sensor module comes with a Digital Pin which makes this sensor to operate

even without a microcontroller and that comes in handy when you are only trying to

detect one particular gas. When it comes to measuring the gas in ppm the analog pin

has to be used, the analog pin also TTL driven and works on 5V and hence can be used

with most common microcontrollers.

 MALE TO MALE CABLES :

Male ends have a pin protruding and can plug into things, while female

ends do not and are used to plug things into. Male-to-male jumper wires are the most

common and what you likely will use most often. When connecting two ports on a

breadboard, a male-to-male wire is what you’ll need.

 POWER SUPPLY CIRCUIT (5 volts)

 LIQUID PETROLEUM GAS (LPG) :

Liquefied petroleum gas (LPG) is recovered from “wet” natural gas (gas

with condensable heavy petroleum compounds) by absorption. The recovered

product has a low boiling point and must be distilled to remove the lighter fractions

and then be treated to remove hydrogen sulfide, carbon dioxide, and water. The

finished product is transported by pipeline and by specially built seagoing tankers.

Transportation by truck, rail, and barge has also developed, particularly in the United

States.
20

CHAPTER-III

SELECTION OF COMPONENTS

3.1.1 NodeMCU

NodeMCU is an open source IoT platform. It includes firmware which run on the

ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on

the ESP-12 module. The term "NodeMCU" by default refers to the firmware.

NodeMCU was created shortly after the ESP8266 came out. On December 30,

2013, Espressif Systems began production of the ESP8266. NodeMCU started on 13

Oct 2014, when Hong committed the first file of NodeMcu-firmware to GitHub.

Another important update was made on 30 Jan 2015, when Devsaurus ported the

u8glib to NodeMCU project, enabling NodeMCU to easily drive LCD, Screen, OLED,

even VGA displays.

In summer 2015 the creators abandoned the firmware project and a group of

independent but dedicated contributors took over. By summer 2016 the NodeMCU

included more than 40 different modules.

NodeUSB is an open IOT platform about the size of a standard USB stick. It

was designed to leverage NodeMCU (Lua) for easy programming and has the extra

feature of USB capability. It is ideal for Plug-n-Play solutions, allowing easy

prototyping for developers.


21
ESP8266 NodeMCU offers-

 Arduino-like hardware IO

 Event-driven API for network applications

 10 GPIOs D0-D10, PWM functionality, IIC and SPI communication, 1-

Wire and ADC A0 etc. all in one board

 Wifi networking (can be uses as access point and/or station, host a

webserver), connect to internet to fetch or upload data.

 Excellent few $ system on board for Internet of Things (IoT) projects.

Recently, there has been interest in programming ESP8266 systems using Arduino

IDE. Programming, of ESP8266 using Arduino IDE is not very straight forward, until

it is properly configured. Especially because, the Input and output pins have different

mapping on NodeMCU than those on actual ESP8266 chip.

3.1.2 NodeMCU ESP-12E PIN MAPPING

First and foremost word of - CAUTION!

 The ESP8266 chip requires 3.3V power supply voltage. It should not be

Powered with 5 volts like other Arduino boards.

 NodeMCU ESP-12E dev board can be connected to 5V using micro USB

connector or Vin pin available on board.

The I/O pins of ESP8266 communicate or input/output max 3.3V only, i.e. the pins

are NOT 5V tolerant inputs.

22
Fig3.1.1: NodeMCU Pin Diagram

In case to interface with 5V I/O pins, there is a need to use level conversion system

(either built on own using resistor voltage divider or using ready to use level

converters (e.g. these ones adafruit or aliexpress etc.). The pin mapping of NodeMCU dev

board are different from those of ESP8266 GPIOs.

3.2 MQ-6 GAS SENSOR

The MQ-6 Gas sensor can detect or measure gases like LPG and butane. The MQ-6

sensor module comes with a Digital Pin which makes this sensor to operate even without a

microcontroller and that comes in handy when you are only trying to detect one particular

gas.

So if you are looking for a sensor to detect or measure gasses like LPG, or methane with

or without a microcontroller, then this sensor might be the right choice for you.
25
Using a MQ sensor it detect a gas is very easy. You can either use the digital pin or the

analog pin to accomplish this. Simply power the module with 5V and you should notice the

power LED on the module to glow and when no gas it detected the output LED will remain

turned off meaning the digital output pin will be 0V.

Remember that these sensors have to be kept on for pre-heating time (mentioned in

features above) before you can actually work with it. Now, introduce the sensor to the gas you

want to detect and you should see the output LED to go high along with the digital pin, if not

use the potentiometer until the output gets high. Now every time your sensor gets introduced

to this gas at this particular concentration the digital pin will go high (5V) else will remain low

(0V).

If you are looking for some accuracy with your readings then measuring the PPM

would be the best way to go with it. It can also help you to distinguish one gas from another.

So to measure PPM you can directly use a module. A basic wiring for the sensor from

datasheet is shown below.

Fig. 3.2.1 MQ-6 Gas Sensor Wiring Diagram

3.2.1 Alternate gas sensors:

Senosor Name Gas to measure


MQ-2 Methane, Butane, LPG, Smoke

26
MQ-3 Alcohol, Ethanol, Smoke
MQ-4 Methane, CNG Gas
MQ-5 Natural gas, LPG
MQ-6 LPG, butane
MQ-7 Carbon Monoxide
MQ-8 Hydrogen Gas
MQ-9 Carbon Monoxide, flammable gasses
MQ-131 Ozone
MQ-135 Air Quality
MQ-136 Hydrogen Sulphide gas

 Why we taken MQ-6 Gas sensor ?

MQ-6 gas sensor has a high sensitivity to Propane, Butane, and LPG, also the

response to Natural gas. The sensor could be used to detect different

combustible gas, especially Methane, which is with low cost and suitable for

different applications.

 MQ-6 Specifications :

S/no. Particulars Range

1 Operating Voltage +5V

2 Detection of Gases LPG or Butane gas

3 Analog output voltage 0V to 5V

4 Digital Output Voltage 0V or 5V (TTL Logic)

5 Preheat duration 20 seconds

6 Sensor type Digital or analog sensor

27
3.3 SOFTWARE

Arduino - Installation

Set up the Arduino IDE on our computer and prepare the board to receive the program via

USB cable.

Step 1: − First you must have your NODEMCU board (you can choose your favorite board) and

a USB cable. In case you use NodeMCU ESP8266, you will need a standard USB cable (A plug to

B plug), the kind you would connect to a USB printer as shown in the following image.

Fig.3.3.1: USB cable

In case you use NODEMCU, you will need an A to Mini-B cable instead as shown in the

following image.

28
Fig.3.3.2: Mini-b cable

Step 2 − Download Arduino IDE Software.

You can get different versions of Arduino IDE from the Download page on the Arduino Official

website. You must select your software, which is compatible with your operating system

(Windows, IOS, or Linux). After your file download is complete, unzip the file.

Fig.3.3.3: Arduino IDE installation

Step 3 − Power up your board.

NODEMCU ESP8266 automatically draw power from either, the USB connection to the

computer or an external power supply The power source is selected with a jumper, a small

piece of plastic that fits onto two of the three pins between the USB and power jacks. Check

that it is on the two pins closest to the USB port.

Connect the NODEMCU board to your computer using the USB cable. The green power LED

(labeled PWR) should glow.

Step 4 − Launch Arduino IDE.

After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the

folder, you can find the application icon with an infinity label ([Link]). Double-click

the icon to start the IDE.

29
Step 5 − Open your first project.

Once the software starts, you have two options −

Create a new project.

Open an existing project example. To create a new project, select File → New.

Fig.3.3.4: Arduino IDE installation

30
Fig.3.3.5: Opening New file

To open an existing project example, select File → Example → Basics → Blink.

Fig.3.3.6: Arduino IDE installation

Here, we are selecting just one of the examples with the name Blink. It turns the LED on and

off with some time delay. You can select any other example from the list.

Step 6 − Select your NODEMCU board.

To avoid any error while uploading your program to the board, you must select the correct

NODEMCU board name, which matches with the board connected to your computer.

Go to Tools → Board and select your board.

31
Fig.3.3.7: Tool Bar Board

Here, we have selected Arduino Uno board according to our tutorial, but you must select the

name matching the board that you are using.

Step 7 − Select your serial port.

Select the serial device of the NODEMCU board. Go to Tools → Serial Port menu. This is likely to

be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find

out, you can disconnect your Arduino board and re-open the menu, the entry that disappears

should be of the Arduino board. Reconnect the board and select that serial port.

Fig.3.3.8: Arduino Port selection

32
Step 8 − Upload the program to your board.

Before explaining how we can upload our program to the board, we must demonstrate the

function of each symbol appearing in the NODEMCU IDE toolbar.

Fig.3.3.9: Operating Buttons

A − Used to check if there is any compilation error.

B − Used to upload a program to the NODEMCU board.

C − Shortcut used to create a new sketch.

D − Used to directly open one of the example sketch.

E − Used to save your sketch.

F − Serial monitor used to receive serial data from the board and send the serial data to the

board.

Now, simply click the "Upload" button in the environment. Wait a few seconds; you will see the

RX and TX LEDs on the board, flashing. If the upload is successful, the message "Done uploading"

33
will appear in the status bar.

Note − If you have an Arduino Mini, NG, or other board, you need to press the reset button

physically on the board, immediately before clicking the upload button on the Arduino Software

3.4 CODE FOR HARDWARE KIT

// const int flame = A0;

int th = 200;

void setup() {

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

pinMode(flame,INPUT);

pinMode(D0,OUTPUT);

[Link](9600);

void loop() {

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

int t = analogRead(flame);

[Link](t);

if (t>th)

{digitalWrite(D0,HIGH);

[Link]("buzzer is ON");

delay(2000);
34
}

else

digitalWrite(D0,LOW);

[Link]("buzzer is OFF");

delay(2000); } }

RESULT :

Fig.3.4.1: Initial Starting condition

35
Fig.3.4.2: OFF condition

CHAPTER-IV

4.1 WORKING & FEATURES OF EACH PART

4.1.1 NODEMCU ESP8266 :

Fig.4.1.1: NODEMCU ESP8266

NodeMCU is an open source IoT platform. It includes firmware which runs on the
36
ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on the ESP-12

module. The term “NodeMCU” by default refers to the firmware rather than the DevKit.

The firmware uses the Lua scripting language. It is based on the eLua project, and built on

the Espressif Non-OS SDK for ESP8266. It uses many open source projects, such as lua-

cjson, and spiffs.

Specifications

Voltage 3.3V.
Wi-Fi Direct (P2P) soft-AP.
Current consumption 10uA~170mA.
Flash memory attachable 16MB max (512K normal).
Processor: Tensilica L106 32-bit.
Processor speed 80~160MHz.
RAM 32K + 80K.
GPIOs 17 (multiplexed with other functions).
Analog to Digital 1 input with 1024 step resolution.

Features :

 Version : DevKit v1.0

 Breadboard Friendly

 Light Weight and small size.

 Uses wireless protocol 802.11b/g/n.

 3.3V operated, can be USB powered.

 Built-in wireless connectivity capabilities.

 Built-in PCB antenna on the ESP-12E chip.

 Capable of PWM, I2C, SPI, UART, 1-wire, 1 analog pin.

 Uses CP2102 USB Serial Communication interface module.

 Arduino IDE compatible (extension board manager required).

37
 Supports Lua (alike [Link]) and Arduino C programming language.

Applications :

 Internet Smoked Alarm.

 VR Tracker.

 Octopod.

 Serial Port Monitor.

 ESP Lamp.

 Incubator Controller.

 IoT home automation.

 Security Alarms.

Fig.4.1.2: NODEMCU ESP8266 PIN DIAGRAM

4.1.2 Buzzer:

38
Fig.4.1.2: Buzzer

An audio signaling device like a beeper or buzzer may be electromechanical

or piezoelectric or mechanical type. The main function of this is to convert the signal from

audio to sound. Generally, it is powered through DC voltage and used in timers, alarm

devices, printers, alarms, computers, etc. Based on the various designs, it can generate

different sounds like alarm, music, bell & siren.

The pin configuration of the buzzer is shown below. It includes two pins namely positive

and negative. The positive terminal of this is represented with the ‘+’ symbol or a longer

terminal. This terminal is powered through 6Volts whereas the negative terminal is

represented with the ‘-‘symbol or short terminal and it is connected to the GND terminal.

Features:

 Color is black.

 The frequency range is 3,300Hz.

 Operating Temperature ranges from – 20° C to +60°C.

 Operating voltage ranges from 3V to 24V DC.

 The supply current is below 15mA.

39
4.1.3 LED:

Fig.4.1.3: LED

LED, in full light-emitting diode, in electronics, a semiconductor device that emits infrared

or visible light when charged with an electric current. Visible LEDs are used in many

electronic devices as indicator lamps, in automobiles as rear-window and brake lights,

and on billboards and signs as alphanumeric displays or even full-colour posters. Infrared

LEDs are employed in autofocus cameras and television remote controls and also as light

sources in fibre-optic telecommunication systems.

The familiar lightbulb gives off light through incandescence, a phenomenon in which the

heating of a wire filament by an electric current causes the wire to emit photons, the

basic energy packets of light. LEDs operate by electroluminescence, a phenomenon in

which the emission of photons is caused by electronic excitation of a material. The

material used most often in LEDs is gallium arsenide, though there are many variations

on this basic compound, such as aluminum gallium arsenide or aluminum gallium indium

phosphide. These compounds are members of the so-called III-V group of semiconductors

—that is, compounds made of elements listed in columns III and V of the periodic table.

By varying the precise composition of the semiconductor.

40
The wavelength (and therefore the colour) of the emitted light can be changed. LED

emission is generally in the visible part of the spectrum (i.e., with wavelengths from 0.4 to

0.7 micrometre) or in the near infrared (with wavelengths between 0.7 and 2.0

micrometres). The brightness of the light observed from an LED depends on the power

emitted by the LED and on the relative sensitivity of the eye at the emitted wavelength.

Maximum sensitivity occurs at 0.555 micrometre, which is in the yellow-orange and

green region. The applied voltage in most LEDs is quite low, in the region of 2.0 volts; the

current depends on the application and ranges from a few milliamperes to several

hundred milliamperes.

The term diode refers to the twin-terminal structure of the light-emitting device. In a

flashlight, for example, a wire filament is connected to a battery through two terminals,

one (the anode) bearing the negative electric charge and the other (the cathode) bearing

the positive charge. In LEDs, as in other semiconductor devices such as transistors, the

“terminals” are actually two semiconductor materials of different composition and

electronic properties brought together to form a junction. In one material (the negative,

or n-type, semiconductor) the charge carriers are electrons, and in the other (the positive,

or p-type, semiconductor) the charge carriers are “holes” created by the absence of

electrons. Under the influence of an electric field (supplied by a battery, for instance,

when the LED is switched on), current can be made to flow across the p-n junction,

providing the electronic excitation that causes the material to luminance.

Features:

 Long life.

 Energy efficiency.
41
 High brightness and intensity.

 Exceptional color range.

 Reliability.

 Instantaneous illumination.

4.1.4 Power supply circuit:

The power supply circuit is used to convert the PLN 220V AC voltage into a 5 volt DC

voltage. (Azis et al., 2019) The 5volt DC will be used as a voltage source for the

microcontroller device so that the input and output connected to the microcontroller will

work. (Evalina et al., 2019)

4.1.5 Liquid Petroleum Gas (LPG):

Liquid Petroleum Gas (LPG) is gas produced from oil refineries or gas refineries, the main

components of which are propane (C3H8) and butane (C4H10) containing about 97% and

the rest is filled with Pentane gas (C5H11) liquefied. Pertamina began marketing LPG in

1969 with the trademark LPG. Comparison of the composition of propane and butane is

391 30:70. Mercaptane is commonly added to LPG to give a distinctive odor, so that gas

leaks can be detected quickly. Based on the composition of propane and butane.

4.1.6 Scope and limitations:

Scope are (1) notices Methane leak, Butane leak, and LPG leak, or any such petroleum

centered gaseous material, (2) Generate Sound Alarm when gas outflow is noticed, (3)

Transmit SMS Alert to consent person, (4) Displaying gas outflow status that signifies if

the gas is in normal stage or not, (5) Automatic closure of gas source using solenoid
42
controller .

Limitation are portable gas cook top cannot be organized this proposed project.

And LPG hand wheel cannot be controlled in this proposed project.

4.1.7 MQ6 Gas Sensor:

The gas cylinders mostly contains LPG. The main constituents of LPG are propane and

butane gas. The sensor available to detect this gases is MQ-6 and MQ-5. But MQ-6 sensor

detects only LPG and butane gas. So, we selected it. As it detects the gases which are the

main constituent of cylinders, it will give precise and accurate reading. Moreover, this

sensor has very rapid response to LPG gas. It has very small sensitivity for alcohol, smoke.

It detects propane, iso-butane, LPG with very high sensitivity and accuracy. This sensor is

stable, durable, has fast response, and can be used in simple drive circuit. It has analog

output and wide detection range. This are the characteristics of the sensor.

It can detect the gas leakage having the ppm value between 200 to 10000.

4.1.8 Gas Leakage Detection System :

The gas leakage detection system consists of Node-MCU ESP8266 module, MQ-6

gas sensor, a led and a buzzer. The cloud service used is [Link]. This system will

be placed at such a location such that there will be no disturbance for the detection of gas

leakage. The preferred location will be near the gas stove. If the MQ-6 sensor finds that

there is any concentration of gas in the surrounding environment, then it will sense it and

will send a signal to Node-MCU. The module will process the signal and will activate the

led or buzzer depending on the strength of the signal received. The maximum voltage to

the sensor is 5V. When it detects the gas in the surrounding, the resistance of the sensor

changes (increases or decreases) the voltage of the sensor. The signal generated by the

sensor will depend on the voltage output of the sensor. Lower the voltage, stronger the
43
signal generated.

We have calibrated the sensor accordingly, if the concentration of the gas detected is

between 200-400 ppm then the led will be activated, and a SMS will be sent to the

customer. If the concentration is above 400 ppm, then the buzzer will also be activated

with the help of Node-MCU.

If the concentration of propane and butane is more than 1.8% to 10% in the surrounding

air, then it is very dangerous. It is very likely to catch fire and it creates difficulty for

breathing. So, we have kept it in mind and designed our system in such a way that it

should detect every minute concentration and should help in preventing the further

accidents.

4.1.9 Sensitivity characteristics:

[Link] y characteristics

4.2

Operation of circuit

44
Fig.4.2.1. Circuit connection

The gas leakage detection system consists of Node-MCU ESP8266 module, MQ-6

gas sensor, a led and a buzzer. This system will be placed at such a location such that

there will be no disturbance for the detection of gas leakage. The preferred location will

be near the gas stove. If the MQ-6 sensor finds that there is any concentration of gas in the

surrounding environment, then it will sense it and will send a signal to Node-MCU. The

module will process the signal and will activate the led or buzzer depending on the

strength of the signal received. The maximum voltage to the sensor is 5V. When it detects

the gas in the surrounding, the resistance of the sensor changes (increases or decreases)

the voltage of the sensor. The signal generated by the sensor will depend on the voltage

output of the sensor. Lower the voltage, stronger the signal generated.

We have calibrated the sensor accordingly, if the concentration of the gas


45
detected is between 200-400 ppm then the led will be activated. If the concentration is

above 400 ppm, then the buzzer will also be activated along with the led.

If the concentration of propane and butane is more than 1.8% to 10% in the

surrounding air, then it is very dangerous. It is very likely to catch fire and it creates

difficulty for breathing. So, we have kept it in mind and designed our system in such a way

that it should detect every minute concentration and should help in preventing the

further accidents.

Threshold value Buzzer Led

>200 ON ON
< 200 Off Off

RESULT : Testing of gas leakage monitoring system & weight of load cell carried out

successfully on node MCU.

Fig.4.2.2. While Operating the circuit

IOT Based LPG Cylinder Monitoring System International Journal of Innovative

Research in Electronics and Communications The weight is placed on the stand for the

load cell and it’s reading are observed. The reading given by the load cell is given in

46
grams.

Fig.4.2.3. Initial ON condition

Here the Gas sensor is tested and the corresponding results were observed.

Data was sent to the cloud. When the gas leakage is detected the LED glows and the

Buzzer is turned on simultaneously

Fig.4.2.4. Running condition

The above figure shows the data which is stored on the cloud. The data is sent by the gas

sensor with the help of Node-MCU. The graph indicates the date and time when the gas

leaked and the table next to it will show the amount of gas leaked. The prototype of this

47
proposed system was constructed and tested successfully. The sensor sense when there is

any leakage and turns on the buzzer simultaneously. This system also monitors the data

continuously using cloud.

Fig.4.2.5. OFF Condition

48
CONCLUSION

In this project, we focus on designing a prototype for IoT based

LPG cylinder monitoring system. The proposed system is cost-

effective and it is real-time. It monitors gas leakage on continuous

basis and alerts the customer. The customer will get the information

about the leakage of LPG and if someone is present near his/her house

at that particular time, they will be notified accordingly. IoT based

system will send an alert message to buzzer so that they will be more

aware about the gas level & leakage of LPG.

49
REFERENCES:

[1] Kumar Keshamoni, Sabbani Hemanth, “Smart Gas Level Mo nitoring, Booking

and Gas Leakage Detector over IoT”, IEEE 7th International Advance Computing

Conference,2017.

[2] Chaitali Bagwe, Vidya Ghadi, Vinayshri Naik, Neha Kunte, “IOT Based Gas

Leakage Detection System with Database Logging, Prediction and Smart Alerting-

Review”,March 2018.

[3] [3] B. D. Jolhe, P. A. Potdukhe, N. S. Gawai, “Automatic LPG Booking, Leakage

Detection And Real Time Gas Measurement Monitoring System”, International

Journal of Engineering Research & Technology (IJERT) ,April 4, 2013.

[4] [Link] Naik, [Link] Nagendra Reddy, [Link] Kishore, [Link] Kumar

Reddy. “Arduino Based LPG gas Monitoring & Automatic Cylinder booking with

Alert System”, IOSR Journal of Electronics and Communication Engineering (IOSR-

JECE), August 2016.

[5] [Link], [Link], “A Security Alert System Using Gsm For Gas Leakage”,

International Journal Of VLSI And Embedded Systems,2012.

[6] Shruthi Unnikrishnan, Mohammed Razil, Joshua Benny, Shelvin Varghese and

C.V. Hari,“LPG Monitoring and Leakage Detection System”, IEEE WiSPNET, 2017

Arun Raj, Athira Viswanathan, “LPG gas monitoring system”, INTERNATIONAL

JOURNAL OF INNOVATIVE TECHNOLOGY AND RESEARCH, Volume No.3, 2015.

[7] Mustafa Saad, Hossam Abdoalgader, and Muammaer Mohamed,

“Automatic Fan Speed Control System Using Microcontroller”, 6th Int’l

Conference on Electrical, Electronics & Civil Engineering (ICEECE’2014)

Nov. 27-28, 2014, PP: 87-88.

[8] Surabhi, Upendra Prasad, Vivek Kumar Jain, “Design And

Fabrication Of Temperature based DC Fan Speed Control System using


Microcontroller and Pulse Width Modulation Technique”, International

Journal of Innovative Research in Science, Engineering and Technology,

Vol. 4,Issue 7, July 2015 PP: 5719-5721.

[9] [Link], Dilruba Yasmin, [Link] and [Link],

“Automatic Room Temperature Controlled Fan Speed Controller Using

PT- 100”, International Journal of Scientific and Research, Vol. 6, Issue 8,

August-2015. PP-1780,

[10] [Link],”Controlling Arduino board with smartphone and Blynk

via internet”, Research gate, November 2016.

[11] H. Singh, V. Pallagani and V. Khande, "IoT based smart home automation

system using sensor node," in 4th International Conference on Recent Advances in

Information Technology (RAIT), 2018.

[12] W. A. Jabbar et al., "Design and Fabrication of Smart Home with Internet

of Things

Enabled Automation System", IEEE Access, vol. 7, 2019.


53
[13] K. A. Mohd Annuar, M. F. Maharam, N. A. Ab Hadi, M. H. Harun and M. F. Mohd

Ab Halim, "Development of wireless and intelligent home automation system",

Telkomnika (Telecommunication Comput. Electron. Control., vol. 17, no. 1, 2019.

[14] Harsh Kumar Singh , Saurabh Verma,Shashank Pa, lKavita Pandey,A step

towards Home Automation using IOT,: Twelfth International Conference on

Contemporary Computing (IC3), september 2019.

[15] [Link], GeethapriyaM, ArthiV, Ahasthiya,Theoretical modelling and

implementation of home energy management system using IoT based automation

system, International Conference on Advances in Materials Research,august 2020

You might also like