0% found this document useful (0 votes)
15 views

Mini Project

Uploaded by

Kotte Sai kiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Mini Project

Uploaded by

Kotte Sai kiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

GAS LEAKAGE DETECTOR AND MONITORING SYSTEM

CH.SATHVIKA
D.SAI SUMANTH
D.VIGNESHWAR REDDY

Department Of Electronics and Communication


Engineering

MAHATMA GANDHI INSTITUTE OF


TECHNOLOGY

Chaitanya Bharathi P.O., Gandipet, Hyderabad – 500075


2024

1
GAS LEAKAGE DETECTOR AND MONITORING SYSTEM
MINI PROJECT
REPORT
SUBMITTED
IN PARTIAL FULFILMENT OF THE
REQUIREMENTS FORTHE DEGREE OF
BACHELOR OF TECHNOLOGY

IN
ELECTRONICS AND COMMUNICATION
ENGINEERING
BY
CH.SATHVIKA (21261A04D8)
D.SAI SUMANTH (21261A04D9)
D.VIGNESHWAR REDDY (21261A04E0)

Department Of Electronics and Communication


Engineering

MAHATMA GANDHI INSTITUTE OF


TECHNOLOGY
Chaitanya Bharathi P.O., Gandipet, Hyderabad –
500075
2024

2
MAHATMA GANDHI INSTITUTE OF
TECHNOLOGY

Chaitanya Bharathi P.O., Gandipet, Hyderabad – 500075

Department Of Electronics and Communication Engineering

CERTIFICATE

Date: /2024
This is to certify that the mini project work entitled “GAS LEAKAGE DETECTOR AND
MONITORING SYSTEM ” is a bonafide work carried out by

CH.SATHVIKA (21261A04D8)
D.SAI SUMANTH (21261A04D9)
D.VIGNESHWAR REDDY (21261A04E0)

in partial fulfilment of the requirements for the degree of


BACHELOR OFTECHNOLOGY in ELECTRONICS &
COMMUNICATION ENGINEERING by the Jawaharlal Nehru technological
university, Hyderabad during the academic year 2024-25.

The results embodied in this report have not been submitted by any other
university or institution for the award of any degree or diploma.

DR.T.R.VIJAYALAKSHMI DR S P Singh
Associate Professor Head of Dept

3
ACKNOWLEDGEMENT

We express our deep sense of gratitude to our Guide


DR.T.R.VIJAYALAKSHMI, M.G.I.T, Hyderabad, for her valuable
guidance and encouragement in carrying out our Project.

We are highly indebted to our Professor Coordinators Associate Professor


S Srinivasa Rao, Associate Professor Dr. G. Madhavi, Assistant Professor
K.RAGHU, Electronics and Communication Engineering Department, who
has given us all the necessary technical guidance in carrying out this project.

We wish to express our sincere thanks to Dr S.P. Singh, Head of the


Department of Electronics and Communication Engineering, M.G.I.T., for
permitting us to pursue our project and encouraging us throughout the
Project.

Finally, we thank all the people who have directly or indirectly helped us
through the course of our Project.

CH.SATHVIKA (21261A04D8)
D.SAI SUMANTH (21261A04D9)
D.VIGNESHWAR REDDY (21261A04E0)

4
ABSTRACT:

Leakage of gas is a major issue in the industrial sector, residential buildings, and gas-
powered vehicles, one of the preventive methods to stop accidents associated with gas
leakage is to install gas leakage detection devices. The focus of this work is to propose
a device that can detect gas leakage and alert the owners to avert problems due
to gas leakages.

The system was designed for gas leakage monitoring and alerts via an Arduino
microcontroller with a buzzer and an MQ-2 gas sensor. The circuit contains a
Arduino,MQ-2 gas sensor, buzzer ,LCD , Jumper wires ,Bread board , regulator power
supply board, sim900 GSM modem.The output of this research will be significant in
averting problems associated with gas leakages now and in future.

Gas detectors can be used to detect combustible, flammable and toxic gas and oxygen
depletion. This type of device is used widely in industry and can be found in locations,
such as on oil rigs, to monitor manufacture processes and emerging technologies such
as photovoltaic. They may be used in firefighting.
It is the process of identifying potentially hazardous gas leaks by sensors. These sensors
usually employ an audible alarm to alert people when a dangerous gas has been
detected. Exposure to toxic gases can also occur in operations such as painting,
fumigation, fuel filling, construction, excavation of contaminated soils, landfill
operations, entering confined spaces, etc. Common sensors include combustible gas
photoionizationdetectors, infrared point sensors, ultrasonic sensors, electrochemical
gas sensors, and semiconductor sensors. More recently, infrared imaging sensors have
come into use. All of these sensors are used for a wide range of applications and can be
industrial plants, refineries, pharmaceutical manufacturing, fumigation facilities, pape
-r pulp mills,aircraft and shipbuilding facilities, hazmat operations, waste-water
treatment facilities, vehicles, indoor air quality testing and homes.

5
Table of Contents:

CERTIFICATE FROM ECE DEPARTMENT ….3


ACKNOWLEDGEMENT ........................................ 4
ABSTRACT ............................................................... 5
TABLE OF CONTENTS …………………………..7
LIST OF FIGURES ................................................. 8
CHAPTER 1 OVERVIEW

1.1 Introduction ....................................................................................................... 9

1.2 Aim of the project .............................................................................................. 11

1.3 Significance ......................................................................................................... 11

1.4 Methodology ...................................................................................................... 11

1.5 Scope .................................................................................................................. 12

1.6 Organisation of work ........................................................................................... 13


1.6.1 Software Requirements .................................................................... 13

1.6.2 Hardware Requirements ................................................................... 13


CHAPTER 2 LITERATURE SURVEY
2.1 Introduction ........................................................................................................ 14

2.2 Gas leakage detection through sms alert............................................14

CHAPTER 3 ANALYSIS
3.1 Arduino Uno(Applications) .................................................................................. 15
3.2 Arduino board ........................................................................................................ 16
3.3 Features of Arduino................................................................................................. 17
3.4 GSM ....................................................................................................................... 19
3.5 Intelligent GSM device for automation and security ............................................. 22
3.6 MQ-2 sensor .............................................................................................................23
3.7 LCD & I2C................................................................................................................ 24

6
CHAPTER 4 DESIGN
4.1 Flowchart.......................................................................................................... 25
4.2 Connectivity .................................................................................................... 24
4.3 Set up for implementation… ............................................................................ 26

CHAPTER 5 IMPLEMENTATION
5.1 Coding ............................................................................................................ 27
5.2 Arduino IDE ..................................................................................................... 29
The compilation process................................................................ 30
Installation Process ....................................................................... 31
Installing Additional Arduino Libraries ....................................... 32
Manual installation ....................................................................... 36
Open your first sketch ................................................................ 37
Select your board type and port..................................................... 38
Upload the program....................................................................... 40

CHAPTER 6 CONCLUSION AND FUTURE SCOPE


6.1 Conclusion and Result .................................................................................... 41
6.2 Future Scope.................................................................................................... 42

REFERENCES .................................................................................. 43

7
LIST OF FIGURES

3.1 Arduino Board ........................................................................ 16


3.2 Arduino Uno with digital i/o ................................................... 17
3.3 Pin diagram of Arduino uno..................................................... 18
3.4 GSM Modem ........................................................................... 19
3.5 GSM Modem Circuit ............................................................... 20
3.6 MQ-2 Sensor ............................................................................ 23
3.7 LCD ...........................................................................................24
3.8 LCD with I2C Interface ............................................................ 24
5.1 Arduino IDE.............................................................................29
5.2 Arduino Setup ........................................................................... 30
5.3 Destination Folder .................................................................... 31
5.4 Installing process........................................................................ 32
5.5 Include Library............................................................................33
5.6 Library Manager ........................................................................ 34
5.7 Add Library............................................................................... 35
5.8 Sketchbook Location.................................................................. 36
5.9 Add Manual Library.................................................................... 37
5.10 Code Example ............................................................................ 38
5.11 Board Selection ........................................................................... 39
5.12 Select Port ................................................................................... 39
5.13 Uploading Code ........................................................................... 40
5.14 Include Lirary (revisited) ............................................................ 40
6.1 Physical Connection of the Gas leakage detector(SetUp) ............. 41
6.2 Results obtained ............................................................................ 41

8
1.1 INTRODUCTION:
CHAPTER 1
OVERVIEW

Gas leakage is a critical safety concern in both residential and industrial settings. The
accidental release of combustible gases such as Liquefied Petroleum Gas (LPG),
methane, or natural gas can lead to hazardous situations, including explosions, fires, or
health risks caused by inhalation of toxic gases. Early detection of gas leaks is essential
to mitigate such dangers and protect lives and property. In this context, technological
advancements have enabled the development of automated systems for gas leak
detection, offering rapid alerts to ensure prompt intervention.
This project focuses on the design and implementation of a Gas Leakage Detection
System with SMS Alert using an Arduino Uno microcontroller and a GSM900 module.
The system serves as a practical and cost-effective solution for monitoring gas leaks
and notifying users in real time through SMS alerts.
The core of the system is the MQ-2 gas sensor, which is highly sensitive to the presence
of combustible gases. It continuously monitors the concentration of gases in the
surrounding environment and outputs a voltage signal proportional to the gas
concentration. When the gas concentration exceeds a predefined safety threshold, the
sensor detects the anomaly and sends a signal to the Arduino Uno microcontroller. The
Arduino Uno, programmed to interpret the sensor data, processes this signal and
triggers appropriate actions.
One of the standout features of this system is the integration of the GSM900 module,
which enables wireless communication. Upon detecting a gas leak, the Arduino sends
a command to the GSM module to transmit an SMS alert to predefined phone numbers.
This alert contains information about the gas leak, ensuring that the user is informed
immediately, even when they are not present at the site.
In addition to SMS alerts, the system can activate other safety measures, such as
sounding an alarm or activating a solenoid valve to cut off the gas supply. These
secondary measures further enhance the system's capability to prevent accidents. The
9
Arduino Uno serves as the control hub, coordinating the actions of the gas sensor, GSM
module, and any additional components such as buzzers or indicator LEDs.
The choice of components, including the Arduino Uno and GSM900 module, makes
the system highly versatile and scalable. The Arduino Uno, with its ease of
programming and compatibility with various sensors and modules, simplifies the
development process. The GSM900 module ensures reliable communication over long
distances, enabling alerts to be sent to users anywhere within the network coverage area.
This gas leakage detection system has wide-ranging applications in domestic,
commercial, and industrial settings. In households, it can prevent accidents caused by
leaking LPG cylinders. In industries, it can ensure compliance with safety regulations
and prevent catastrophic accidents in environments where flammable gases are stored
or used. Additionally, it can be deployed in restaurants, hotels, laboratories, and other
establishments where gas usage is prevalent.
The project represents a practical implementation of Internet of Things (IoT)
principles, combining sensors, microcontrollers, and communication technologies to
create a smart, automated safety solution. Beyond its core functionality, the system can
be enhanced with features like integration with cloud platforms for remote monitoring,
logging gas concentration data for analysis, or linking to mobile apps for advanced
control and notifications.
By leveraging the capabilities of the Arduino Uno and GSM900, this gas leakage
detection system demonstrates how simple, affordable technology can be used to
address critical safety challenges. Its ability to detect leaks, alert users in real time, and
take preventive measures ensures a proactive approach to gas safety. This mini-project
serves as a practical example of how IoT and embedded systems can be applied to
improve safety and enhance quality of life, making it a valuable contribution to the field
of automation and safety engineering.

10
1.2 AIM OF THE PROJECT:
To design and implement an lpg gas leakage detection and alert system that
enhances the safety of households and industries by detecting potential gas
hazards and providing an early warning to prevent accidents, fires, and
explosions.

1.3 SIGNIFICANCE:

The Gas Leakage Detection with SMS Alert System is a critical


innovation for ensuring safety in environments where combustible gases
like LPG or methane are used. Gas leaks, if undetected, can lead to
catastrophic events such as fires, explosions, and toxic inhalation, posing
significant threats to human lives and property. This system addresses these
risks by providing immediate, real-time SMS alerts to designated users,
ensuring prompt action can be taken.

The system’s ability to detect gas leaks and notify users remotely makes it
especially valuable in homes, hotels, restaurants, laboratories, and
industries. It offers an affordable, efficient, and user-friendly solution,
integrating readily available components like gas sensors, microcontrollers,
and GSM modules. The system enhances safety compliance in industrial
environments and prevents costly accidents while safeguarding workers and
infrastructure.

Moreover, the system contributes to energy conservation by identifying and


minimizing gas wastage due to leaks, reducing utility costs and
environmental impact. Its modular design also supports scalability,
allowing for integration with smart home technologies, IoT platforms, or
mobile apps for advanced monitoring and control.

In summary, this system plays a pivotal role in improving safety standards,


reducing accident risks, conserving resources, and aligning with modern
automation trends, making it a valuable tool in today’s technology-driven
world.

1.4 METHODOLOGY:
Component Selection:
Use an MQ-2 gas sensor to detect combustible gases.
Employ an Arduino Uno microcontroller for data processing.
Integrate a GSM900 module for sending SMS alerts.
System Design:
Connect the MQ-2 sensor to the Arduino to monitor gas levels.
Program the Arduino to compare sensor readings with a predefined
threshold.
Alert Mechanism:
11
When gas concentration exceeds the threshold, the Arduino triggers the
GSM module to send an SMS alert to predefined phone numbers.
Activate additional safety features like alarms or solenoid valves, if
applicable.
Testing and Calibration:
Test the system under controlled conditions to ensure accurate gas
detection.
Calibrate the sensor to optimize sensitivity for specific gases.

Implementation:
Deploy the system in homes, restaurants, or industries.
• Ensure periodic maintenance for reliable performance.

1.5 SCOPE:

Enhanced Safety: Provides real-time alerts to prevent accidents like fires, explosions,
and toxic inhalation.

Wide Applications: Suitable for homes, restaurants, hotels, laboratories, and industrial
setups where combustible gases are used.

Cost-Effective Solution: Offers an affordable alternative to advanced safety systems,


using readily available components.

Scalability: Can be integrated with IoT platforms, smart home systems, and mobile
apps for advanced monitoring and control.

Energy Conservation: Helps detect and minimize gas wastage, reducing costs and
environmental impact.

Compliance and Reliability: Supports safety compliance in industrial environments


while ensuring user-friendly operation.

12
1.6 ORGANISATION OF WORK:
1.6.1 Software requirements:
• Arduino IDE
1.6.2 Hardware requirements:
• ARDUINO UNO
• GSM SIM 900
• MQ-2 SENSOR
• POWER SUPPLY
• JUMPER WIRES
• BUZZER
• LCD

13
CHAPTER 2
LITERATURE
STUDY

2.1 INTRODUCTION [1]


The aim is to develop a gas leak detection and location system for the
production safety in Petrochemical Industry. The system is based on
Wireless Sensor Networks (WSN); it can collect the data of monitoring
sites wirelessly and sent to the computer to update values in the location
software. Consequently, it can give a real-time detective of the potential
risk area, collect the data of a leak accident and locate the leakage point.
However the former systems can not react in time, even cannot obtain data
from an accident and locate accurately. The paper has three parts, first,
gives the overall system design, and then provides the approaches on both
hardware and software to achieve it.

2.2 Gas leakage detection through sms alert:[2]

Gas Sensors: Studies emphasize using MQ series sensors (e.g., MQ-2, MQ-6) for
accurate detection of LPG, methane, and other combustible gases, highlighting their
affordability and sensitivity.
Microcontrollers: Research shows Arduino Uno as a popular choice for processing
sensor data due to its simplicity, reliability, and compatibility with multiple modules.
SMS Alerts: The integration of GSM modules (e.g., GSM900, SIM800L) for real-
time SMS notifications is widely studied, ensuring timely alerts for leak detection.
Applications: Literature covers implementations in homes, industries

14
CHAPTER 3

ANALYSIS

3.1 ARDUINO UNO

The UNO is that the best board to urge started with electronics and coding. If this is
often your first experience tinkering with the platform, the UNO is that the most
robust boardyou'll start twiddling with . The UNO is that the most used and
documented board of the entire Arduino family.
Arduino Uno may be a microcontroller board supported the ATmega328P
(datasheet). Ithas 14 digital input/output pins(of which 6 are often used as PWM
outputs), 6 analog in puts, a 16 MHz quartz , a USB connection, an influence jack,
an ICSP header and a res et button.
It contains everything needed to support the microcontroller; simply connect it to a
computer with a USB cable or power,it with a AC•to•DC adapter or battery to urge
started.
There are many versions of Arduino boards introduced within the market like
Arduino U no, Arduino Due, Arduino. Leonardo, Arduino Mega, however,
commonest versions are Arduino Uno and Arduino Mega. If you're getting to create,
a project concerning digital electronics, embedded system, robotics, or IoT, then
using Arduino Uno would be the, simplest , easy and most economical option.
Fig 3.1: Arduino Board

3.2 ARDUINO BOARD:


There are various types of Arduino boards in which many of them were third-party
compatible versions. The most official versions available are the Arduino Uno R3
and theArduino Nano V3. Both of these run a 16MHz Atmel ATmega328P 8-bit
microcontroller with 32KB of flash RAM 14 digital I/O and six analogue I/O and
the 32KB will not sound like as if running Windows. Arduino projects can be stand-
alone or they can communicatewith software on running on a computer. For e.g.
Flash, Processing, Max/MSP). The board is clocked by a 16 MHz ceramic resonator
and has a USB connection for power and communication. You can easily add micro
SD/SD card storage for bigger tasks.
Fig 3.2: Arduino uno with digital i/o

3.3 FEATURES OF ARDUINO:


• It is an easy USB interface. This allows interface with USB as this is like a
serial device.
• The chip on the board plugs straight into your USB port and supports on your
computer as a virtual serial port. The benefit of this setup is that serial
communication is an extremely easy protocol which is time-tested and USB
makesconnection with modern computers and makes it comfortable.
• It is easy-to-find the microcontroller brain which is the ATmega328 chip. It
has more number of hardware features like timers, external and internal
interrupts, PWM pins and multiple sleep modes.
Fig 3.3: Pin diagram of Arduino uno

You can then use Atmel’s FLIP software (Windows) or the DFU programmer (Mac
OS Xand Linux) to load a new firmware.

Arduino is essential in a gas leakage detection system for the following reasons:
1. Data Processing: It reads and processes signals from gas sensors (e.g., MQ-2) to
detect gas concentrations.
2. Threshold Comparison: It compares gas levels to predefined safety thresholds to
determine if a leak is present.
3. Triggering Alerts: Arduino triggers the GSM module to send SMS alerts when a
leak is detected.
4. Control Actions: It can activate additional safety measures, like alarms or
shutting off gas valves.
5. Easy Programming: Arduino is simple to program, making it ideal for rapid
development and customization.
6. Cost-Effective and Versatile: It is affordable and compatible with various sensors
and modules for scalable solutions.

18
3.4 GSM [3]:

GSM may be a mobile communication modem; it's stands for global system for
mobile communication (GSM). The idea of GSM was famoused at Bell
Laboratories in 1970. Itis widely used mobile communication system within the
world. GSM is an open and digitalized cellular technology used for transmitting
mobile voice and data servicesoperates at the 850MHz, 900MHz, 1800MHz and
1900MHz frequency bands.

GSM system was popularised as a digital system using time division multiple access
(TDMA) technique for communication purpose. A GSM digitizes and reduces the
info , then sends it down through a channel with two different streams of client data,
each in itsown particular slot . The digital system has a capability to hold 64 kbps to
120 Mbps of knowledge rates.

Fig 3.4 GSM Modem


Fig.3.5 GMS Modem Circuit

There are various cell shape during a GSM system like macro, micro, pico and
umbrella cells. Each cell varies as per the implementation domain. There are five
different cell shape during a GSM network macro, micro, pico and umbrella cells.
The coverage width of every cell varies consistent with the implementation
environment.
Time Division Multiple Access
TDMA technique relies on assigning different time slots to every user on an
equivalent frequency. It can easily adapt to data transmission and speech and may
carry 64kbps to120Mbps of knowledge rate.
GSM Architecture
A GSM network consists of the following components:
• A Mobile Station: it's the mobile which consists of the transceiver, the display and therefore the
processor and is controlled by a SIM card operating over the network.
• Base Station Subsystem: It acts as an connection between the mobile station and therefore the
network subsystem. It contains of the down Transceiver Station which contains the radio
transceivers and handles the protocols for communication with mobiles. It also consists of the
bottom Station Controller which controls the bottom Transceiver station and acts as a interface
between the mobile station and mobile switching centre.

• Network Subsystem: It provides the essential network connection to the mobile stations.The basic
a material of the Network Subsystem is that the Mobile Service Switching Centre which provides
access to different networks like ISDN, PSTN etc. It also consistsof the house Location Register
and therefore the Visitor Location Register which providesthe decision routing and roaming
capabilities of GSM. It also consists the Equipment Identity Register which maintains an account
of all the mobile equipments wherein each mobile is identified by its own IMEI number. IMEI
stands for International Mobile Equipment Identity.

Features of GSM Module:

• Improved spectrum efficiency


• International roaming
• Compatibility with integrated services digital network (ISDN)
• Support for new services.
• SIM phonebook management
• Fixed dialing number (FDN)
• Real time clock with alarm management
• High-quality speech
• Uses encryption to form phone calls safer
• Short message service (SMS)
The security strategies standardized for the GSM system make it the foremost secure
telecommunications standard currently accessible. Although the confidentiality of a call and
secrecy of the GSM subscriber is simply ensured on the radio channel, this is oftena serious step
in achieving end-to- end security.
GSM Modem
A GSM modem may be a device which may be either a mobile or a modem device whichmay be
wont to make a computer or the other processor communicate over a network. AGSM modem
needs a SIM card to be operated and operates over a network range subscribed by the network
operator. It are often connected to a computer through serial, USB or Bluetooth connection.
A GSM modem also can be a typical GSM mobile with the acceptable cable and softwaredriver to
attach to a interface or USB port on your computer. GSM modem is typically preferable to a GSM
mobile . The GSM modem has wide selection of applications in transaction terminals, supply chain
management, security applications, weather stationsand GPRS mode remote data logging.
Working of GSM Module:
From the below diagram, a GSM modem duly interfaced to the MC through the extent shifter IC
Max232. The SIM card mounted GSM modem upon receiving digit command by SMS from any
cell phone send that data to the MC through serial communication. While the program is executed,
the GSM modem receives command ‘STOP’ to develop an output at the MC, the contact point of
which are wont to disable the switch . The command so sent by the user is predicated on an
intimation received by him through theGSM modem ‘ALERT’ a programmed message as long as
the input is driven low. The complete operation is displayed over 16×2 LCD display.

3.4 Intelligent GSM Device for Automation and Security


In these days, the GSM mobile terminal has become one of the items that are constantlywith us.
Just like our wallet/purse, keys or watch, the GSM mobile terminal provides us acommunication
channel that enables us to communicate with the world. The requirementfor a person to be
reachable or to call anyone at any time is very appealing.

In this project, as the name says project is based on GSM network technology for
transmission of SMS from sender to receiver. SMS sending and receiving is used for ubiquitous
access of appliances and allowing breach control at home. The system proposes two sub-systems.
Appliance control subsystem enables the user to control home appliances remotely and the security
alert subsystem gives the automatic securitymonitoring.

The system is capable enough to instruct user via SMS from a specific cell number to change the
condition of the home appliance according to the user’s needs and requirements. The second aspect
is that of security alert which is achieved in a way that on the detection of intrusion, the system
allows automatic generation of SMS thus alertingthe user against security risk.

3.5 MQ-2 SENSOR [4]:


The MQ2 is used in gas leakage detecting equipment in consumer and industry
applications, this sensor has high sensitivity in detecting LPG compared to MQ 2, It can
also be used to detect natural gas, coal gas, avoid the noise of alcohol, cooking fumes,
and cigarette smoke. The sensitivity can be adjusted by the potentiometer at the back of
this sensor module.

Fig. 3.6 MQ-2 Sensor

FEATURES:
• Power supply needs: 5V
• Interface type: Analog
• Pin Definition: 1-Output 2-GND 3-VCC
• High sensitivity to LPG, natural gas, town gas Small sensitivity to alcohol, smoke
Fast response Stable and long life Simple drive
• circuit Size: 40x20mm

23
3.7 Liquid Crystal Displays (LCD) with Arduino
The LiquidCrystal library allows you to control LCD displays that are compatible
with the Hitachi HD44780 driver. There are many of them out there, and you can
usually tell them by the 16-pin interface.
Output of the sketch on a 16x2 LCD

Fig. 3.7 LCD

The LCDs have a parallel interface, meaning that the microcontroller has to manipulate
several interface pins at once to control the display. The interface consists of the
following pins:
• A register select (RS) pin that controls where in the LCD's memory you're
writing data to. You can select either the data register, which holds what goes on
the screen, or an instruction register, which is where the LCD's controller looks
for instructions on what to do next.
• A Read/Write (R/W) pin that selects reading mode or writing mode
• An Enable pin that enables writing to the registers
• 8 data pins (D0 -D7). The states of these pins (high or low) are the bits that you're
writing to a register when you write, or the values you're reading when you read.

I2C(inter integrated circuit):


It uses only 2 bi-directional open-drain lines for data communication called SDA and
SCL. Both these lines are pulled high.
Serial Data (SDA): Transfer of data takes place through this pin.
Serial Clock (SCL) : It carries the clock signal.
I2C operates in 2 modes
• Master mode
• Slave mode

Fig. 3.7 LCD with I2C Interface

24
CHAPTER 4: DESIGN

4.1 FLOW CHART:

LCD DISPLAY >200

LCD DISPLAY<200

4.2 Connectivity:

1. GSM to Arduino Connection


To enable SMS alerts, the GSM module (e.g., SIM900 or SIM800L) is connected to the
Arduino Uno as follows:
• Power Supply: The GSM module is powered using a 5V supply from the Arduino
or an external adapter. Ensure the module’s voltage requirements are met to avoid
damage.
• Serial Communication: Connect the TX (Transmit) pin of the GSM module to
the RX (Receive) pin of the Arduino Uno and the RX pin of the GSM module to
the TX pin of the Arduino for serial communication.
• Grounding: Ensure a common ground connection between the GSM module,
25
Arduino, and power source.
2. Power Supply Connection
• The Arduino Uno is powered via USB or an external 9V-12V DC adapter.
• The MQ-2 gas sensor and any additional modules, such as alarms or LEDs, are
powered through the Arduino’s 5V and 3.3V pins.
• The GSM module requires a stable power supply, often connected to an external
adapter to handle its higher current requirements during transmission.

Set-Up for Implementation


1. Hardware Assembly:
o Connect the MQ-2 sensor to the Arduino's analog input for detecting gas
concentrations.
o Connect a buzzer or LED to digital pins for local alerts.
o Integrate the GSM module for sending SMS alerts.
2. Software Setup:
o Write and upload Arduino code using the Arduino IDE, ensuring the GSM
module is initialized to send messages when gas levels exceed the
threshold.
o Calibrate the MQ-2 sensor for accurate readings.
3. Testing and Deployment:
o Power the setup and test with controlled gas leaks to ensure the sensor
triggers alerts appropriately.
o Verify SMS alerts are received promptly on the configured phone number.
This setup ensures a reliable and functional LPG gas leakage detection system with
SMS alert capability.

26
CHAPTER 5

5.1 Coding
IMPLIMENTATION
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
// Define Pins

#define GAS_SENSOR_PIN A0 // Gas sensor analog pin


#define BUZZER_PIN 11 // Buzzer pin
// Initialize LCD (I2C address 0x27, 16 columns, 2 rows)
LiquidCrystal_I2C lcd(0x27, 16, 2);
// GSM Module RX and TX
Software Serial gsm Serial(3, 4); // RX, TX
// Threshold Value for Gas Sensor (Adjust as needed)
#define GAS_THRESHOLD 200
// Phone number for SMS alert
#define PHONE_NUMBER "+919392863105"
void setup() {
// Serial Monitor Initialization
Serial.begin(9600);
// GSM Module Initialization
gsmSerial.begin(9600);
// Configure Pin Modes
pinMode(GAS_SENSOR_PIN, INPUT);
pinMode(BUZZER_PIN, OUTPUT);
digitalWrite(BUZZER_PIN, LOW); // Turn off buzzer initially
// Initialize LCD
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Gas Detector");

27
delay(2000);
// GSM Module Setup
initializeGSM();
}
void loop() {
int gasLevel = analogRead(GAS_SENSOR_PIN); // Read gas sensor value
// LCD Display
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Gas Level: ");
lcd.print(gasLevel);
// Serial Monitor Output
Serial.print("Gas Level: ");
Serial.println(gasLevel);
// Check if Gas Level Exceeds Threshold
if (gasLevel > GAS_THRESHOLD) {
lcd.setCursor(0, 1);
lcd.print("Gas Alert!");
Serial.println("Status: ALERT! High gas level detected! Activating buzzer...");
digitalWrite(BUZZER_PIN, HIGH); // Turn on buzzer
// Send SMS Alert
sendSMS(gasLevel);
delay(5000); // Wait to avoid repeated alerts
} else {
lcd.setCursor(0, 1);
lcd.print("Safe");
Serial.println("Status: Safe");
digitalWrite(BUZZER_PIN, LOW); // Turn off buzzer
}
delay(1000); // Delay for stability
}
void initializeGSM() {
Serial.println("Initializing GSM...");
gsmSerial.println("AT"); // Check GSM Module

28
delay(1000);
gsmSerial.println("AT+CMGF=1"); // Set SMS mode to text
delay(1000);
gsmSerial.println("AT+CSCS=\"GSM\""); // Set character set to GSM
delay(1000);
Serial.println("GSM Initialized.");
}
void sendSMS(int gasLevel) {
String alertMessage = "ALERT: High gas level detected! Level: " + String(gasLevel);
// Send SMS Command
gsmSerial.println("AT+CMGS=\"" PHONE_NUMBER "\"");
delay(1000);
// Send SMS Content
gsmSerial.print(alertMessage);
delay(1000);
// Send CTRL+Z to Send SMS
gsmSerial.write(26); // ASCII code for CTRL+Z
delay(5000);
Serial.println("SMS Sent: " + alertMessage);
}Arduino IDE

The Arduino Integrated Development Environment - or Arduino


Software (IDE) - contains a text editor for writing code, a message area,
a text console, a toolbar with buttons for common functions and a series
of menus. It connects to the Arduino and Genuino hardware to upload
programs and communicate with them.

Figure 5.1: Arduino IDE


29
5.1.1 The compilation process
The Arduino code is actually just plain old c without all
the header part (the includes and all). when you press the
'compile' button, the IDE savesthe current file as Arduino’s in
the 'lib/build' directory then it calls a make file contained in the
'lib' directory. This makes file copies arduino.c as prog.c into
'lib/tmp' adding 'wiringlite.inc'as the beginning of it. This
operation makes the arduino/wiring code into a proper c file
(called prog.c).

After this, it copies all the files in the 'core' directory into
'lib/tmp'. these files are the implementation of the various

Fig. 5.2 Installation Options

arduino/wiring commands adding to these files adds commands


to the language. The core files are supported by pascal stang's
procyon avr-lib that is contained in the 'lib/avrlib' directory.

At this point the code contained in lib/tmp is ready to be compiled with the
c compiler contained in 'tools'. If the make operation is succesfull then you'll
have prog.hex ready to be downloaded into the processor.
30
NOTE: The next release will see each architecture
(avr/pic/8051) to treated as a 'plug-in' to the IDE so that the user
can just select from a menu the microcontroller board to use and
the IDE will pick the right compilation sequence.

5.1.2 Installation Process


Get the latest version from the download page. You can
choose between the Installer (.exe) and the Zip packages. We
suggest you use the first one that installs directly everything you
need to use the Arduino Software (IDE), including the drivers.
With the Zip package you need to installthe drivers manually.
The Zip file is also useful if you want to create a portable
installation. When the download finishes, proceed with the
installation and please allow the driver installation process
when you get a warning from the operating system.

Component Installing Choose the components to install:

Figure 5.3: Destination Folder

Choose the installation directory (we suggest keeping the default one).
31
Figure 5.4: Installing Process
The process will extract and install all the required files to
execute properlythe ArduinoSoftware (IDE).

5.1.3 Installing Additional Arduino Libraries


Once you are comfortable with the Arduino software
and using the built-in functions, you may want to extend the
ability of your Arduinowith additional libraries.

5.1.3.1 What are Libraries?


Libraries are a collection of code that makes it easy for you to
connect to a sensor,display, module, etc. For example, the built-
in Liquid Crystal library makes it easy to talk to character LCD
displays. There are hundreds of additional libraries available on
the Internet for download. The built-in libraries and some of
these additional libraries are listed in thereference. To use the
additional libraries, you will need t o i n s t a l l t h e m .

32
5.1.3.2 How to Install a Library Using the Library Manager
To install a new library into your Arduino IDE you can
use the Library Manager (available from IDE version 1.6.2).
Open the IDE and click to the "Sketch" menu and then Include
Library > Manage Libraries.

Figure 5.5: Include Library

Then the Library Manager will open, and you will find a list of
libraries that are already installed or ready for installation. In
this example we will installthe Bridge library. Scroll the list to
find it, click on it, then select the version of the library you want
to install. Sometimes only one version of the library is available.
If the version selection menu does not appear, don't worry it is
normal.

33
Finally click on install and wait for the IDE to install the new
library. Downloading may take time depending on your
connection speed. Once it has finished, an Installed tag should
appear next to the Bridge library. You can close the library
manager.

Figure 5.6: Library Manager


You can now find the new library available in the Sketch > Include Librarymenu. If you want to add
your own library to Library Manager, follow theseinstructions.
Importing a .zip Library
Libraries are often distributed as a ZIP file or folder. The name of the folder is the name of the
library. Inside the

34
folder will be a .cpp file, a .h fileand often a keywords.txt file,examples folder, and other files
required by
the library. Starting with version 1.0.5, you can install 3rd party libraries in the IDE. Do not unzip the
downloaded library, leave it as is.
In the Arduino IDE, navigate to Sketch > Include Library > Add .ZIP Library. At the top of the drop-
down list, select the option to "Add .ZIP Library''.

Figure 5.7: Add Library

You will be prompted to select the library you would like to


add. Navigate to the .zip file's location and open it.

Return to the Sketch > Include Library menu. menu. You should
now see the library at the bottom of the drop-down menu. It is
ready to be used in your sketch. The zip file will have been
expanded in the libraries folder in your Arduino sketches
directory. NB: the Library will be available to use in sketches,
but with older IDE versions examples for the library will not be
exposed in the File > Examples until after the IDE has restarted.

35
5.1.4 Manual installation:
When you want to add a library manually, you need to
download it as a ZIP file, expand it and put in the proper
directory. The ZIP file contains all you

need, including usage examples if the author has provided them.


The library manager is designed to install this ZIP file
automatically as explained in theformer chapter, but there are
cases where you may want to perform the installation process
manually and put the library in the libraries folder of your
sketchbook by yourself.

You can find or change the location of your sketchbook folder


at File > Preferences >Sketchbook location.

Figure 5.8: Sketchbook Location

Go to the directory where you have downloaded the ZIP file of the library.

36
Figure 5.9: Add Manual Library

Extract the ZIP file with all its folder structure in a


temporary folder, thenselect the main folder, that should
have the library name. Copy it in the “libraries” folder inside
your sketchbook.
Start the Arduino Software (IDE), go to Sketch > Include
Library. Verifythat the library you just added is available in
the list and upload the code.

5.1.5 Open your first sketch


Open the LED blink example sketch: File > Examples >01.Basics >
Blink.

37
Figure 5.10: Code Example

5.1.6 Select your board type and port


You'll need to select the entry in the Tools >
Board menu thatcorresponds to your Arduino board.

38
Figure 5.11: Board Selection

Select the serial device of the board from the Tools | Serial Port
menu. This is likely to be COM3 or higher (COM1 and COM2
are usually reservedfor hardware serial ports). To find out, you
can disconnect your board and re-open the menu; the entry that
disappears should be the Arduino board.

Reconnect the board and select that serial port.

Figure 5.12: Select Port

39
5.1.7 Upload the program
Now, simply click the "Upload" button in the
environment. Wait a few seconds -you should see the RX and
TX leds on the board flashing. If the upload is successful, the
message "Done uploading." will appear in the status bar.

Figure 5.13: Uploading Code

A few seconds after the upload finishes, you should see the
pin 13 (L) LED on the board start to blink (in orange). If it does,
congratulations! You've gotten Arduino up-and- running.
If you have problems, please see the trouble

shooting.
Figure 5.14: Include Library

40
CHAPTER 6
6.1 RESULTS AND CONCLUSIONS:

This work presents the design and implementation of gas leakage detection system.
Various works on gas leakages detection system was reviewed and presented. I was
discovered that some of the existent research don’t takes in to considerations the cost
effectiveness for the purpose of implementation of gas leakages detection at
individual/domestic uses, and not easy to be further modified. This research work had
advanced in knowledge as it included an embedded system to alert users via multiple
mobile phones for further action to be taken when leakage is detected. The device
detects gas leakage using a highly sensitive MQ-2 gas sensor to activate a buzzer that
alert people of leakages, and also sent an SMS with the information “Gas Leakage
Detected” from the SIM800 GSM Module as a backup to alert the appropriate authority
or facility owner of a gas leakage. This design could be adopted, funded, and
implemented as it has a great potential of mitigating against accidents associated with
LPG leakage.

Output:

When no leakage of gas when gas is detected

41
6.2 FUTURE SCOPE:
• Expansion of Devices: More devices will become smart,
offering diverse automation options.

• Advanced AI Integration: Artificial intelligence will


enhance smart homesystems, making them more intuitive.

• Energy Sustainability: Focus on eco-friendly solutions for


energy-efficientand sustainable smart homes.

• Increased Connectivity: Homes will be more


interconnected, enabling seamless communication bet

• Affordability: Continued advancements will likely


reduce costs, making smart home technology more
accessible to a wideraudience.

42
REFERENCES:
BOOKS:
[1] Punch newspaper 2021, Panic as gas leakage occurs in Ikeja. Available at
“https://punchng.com/breaking-panic-as-gas-leakage occurs-in-ikeja “ retrived January 17,
2021.
[2] A., L. (2017). Wireless gas leak detection improves employee protection, environs, and
production value.
[3] Arpitha, T. K. (2016). FPGA-GSM-based gas leakage detection system. Bangalore. IEEE
Annual India Conference (INDICON), 1-4.
[4] Chengjun, D. X. (2011). Development of gas leak detection and location system based on
wireless sensor networks. Shanghai. Third International Conference on Measuring Technology
and Mechatronics Automation, 1067–1070.
[5] Kareem, H. (2019). Embedded real‐time system for detecting leakage of the gas used in
Iraqi kitchens. Indonesia J. Elect Eng Comp Sci .vol 14, 1171-1176.
[6] Loth, J. M. (2003). Technology Assessment of online Acoustic monitoring Leak In
fragment in the underground, natural gas Transmission Lines. USA: West Virginia University.
[7] Manohar, R. a. (2018). Android Introduction to Detection. Hindu: Nwebweze, O.
(December 2015) vanguard News .com .
[8] Murvaya, P. (2011). A survey in Gas leak Detection and localization technology. Journal
of loss prevention in the Process Industries, 11-25.
[9] Park, G. L. (2013). Development of gas safety management system for smart‐home
services. Distributor Sensor Network, 9-10.
[10] Sonkar, B. S. (2015). Microcontroller-based LPG Leakage Detector using GSM Module.
International Journal of Electrical and Electronics Research, Vol .111, 264-269.

43

You might also like