Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views52 pages

Part 2

Uploaded by

katasanipandu
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)
5 views52 pages

Part 2

Uploaded by

katasanipandu
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
You are on page 1/ 52

CHAPTER 1

INTRODUCTION

1.1 OVERVIEW OF THE PROJECT

Gas leakage is a serious problem and nowadays it is observed in many places like
residences, industries, and vehicles like Compressed Natural Gas (CNG), buses, cars, etc. It is
noticed that due to gas leakage, dangerous accidents occur. The Liquefied petroleum gas (LPG),
or propane, is a flammable mixture of hydrocarbon gases used as fuel in many applications like
homes, hostels, industries, automobiles, and vehicles because of its desirable properties which
include high calorific value, less smoke, less soot, and meager harm to the environment.

Liquid petroleum gas (LPG) is highly inflammable and can burn even at some distance
from the source of leakage. This energy source is primarily composed of propane and butane
which are highly flammable chemical compounds. These gases can catch fire easily. In homes,
LPG is used mainly for cooking purposes. When a leak occurs, the leaked gases may lead to an
explosion.

Gas leakage leads to various accidents resulting in both material loss and human injuries.
Home fires have been occurring frequently and the threat to human lives and properties has been
growing in recent years. The risks of explosion, fire, suffocation are based on their physical
properties such toxicity, flammability, etc.

The number of deaths due to the explosion of gas cylinders has been increasing in recent
years. The Bhopal gas tragedy is an example of accidents due to gas leakage. The reason for such
explosions is due to substandard cylinders, old valves, no regular checking of gas cylinders,
worn out regulators and a lack of awareness of handling gas cylinders.

1
1.2 OBJECTIVE OF THE PROJECT

The primary objective of this project is to develop an affordable and effective LPG gas
leakage detection system using Arduino technology. This system aims to enhance safety by
promptly detecting gas leaks and alerting individuals or organizations through audible alarms.
By achieving this objective, the project seeks to mitigate the risks associated with gas leakage
incidents, thereby protecting lives, property, and the environment.

Additionally, the project aims to make gas safety measures more accessible and
affordable, particularly in resource-constrained regions and households. By leveraging the cost-
effectiveness and open-source nature of Arduino, the project intends to democratize access to
critical safety tools, ensuring that even communities with limited financial resources can benefit
from reliable gas leakage detection.

Another key objective is to utilize the innovative capabilities of Arduino to create a


scalable and adaptable detection system. This includes integrating advanced sensor technology,
data processing, and connectivity features to develop a user-friendly solution that can be tailored
to various environments, from domestic kitchens to industrial facilities. The system's modular
design aims to facilitate easy customization and integration with existing infrastructures, thereby
broadening its application scope and enhancing overall safety.

2
1.3 ORGANIZATION OF THE PROJECT

In the chapter 1, we discussed about the introduction, overview, objective of the project.

In the chapter 2, we discussed about the existing system, proposed system, embedded

system.

In the chapter 3, we discussed about the block diagram description, Hardware description.

In the chapter 4, we discussed about the arduino IDE, arduino setup and initialization,

developing the code.

In the chapter 5, we discussed about the working of the project.

In the chapter 6, we discussed about the result of the project.

In the chapter 7, we discussed about the advantages, applications of the project.

In the chapter 8, we discussed about the conclusion, future scope of the project

3
CHAPTER-2
LITERATURE SURVEY
2.1 EXISTING SYSTEM

The existing systems for detecting LPG gas leaks predominantly rely on conventional gas
detectors, which are generally standalone units equipped with sensors to detect gas
concentrations and activate alarms when levels exceed safe thresholds. These detectors typically
utilize semiconductor, infrared, or catalytic sensors to sense gas presence. While these systems
are effective in identifying leaks, they often come with limitations such as high costs, limited
customization options, and dependence on proprietary technology, which can restrict their
accessibility and scalability, especially for households and small businesses.

Furthermore, many traditional gas detection systems are designed for industrial use,
making them bulky and not user-friendly for domestic environments. They often require
professional installation and maintenance, which adds to the overall cost and complexity. The
lack of integration with modern smart home systems means these detectors cannot always
communicate with other safety or home automation devices, limiting their effectiveness in
providing comprehensive safety solutions. This can result in delayed responses to gas leaks,
potentially increasing the risk of accidents.

In addition, existing gas leakage detection systems may lack advanced connectivity
features. Most traditional detectors do not offer real-time alerts via mobile applications or
integration with Internet of Things (IoT) platforms. This limitation means that users need to be
physically present to hear the alarms, which may not always be feasible. The absence of remote
monitoring capabilities can be a significant drawback, particularly for properties that are left
unattended for extended periods, such as vacation homes or remote industrial sites.

4
.

2.2 PROPOSED SYSTEM

The proposed system for the LPG gas leakage detection project aims to overcome the limitations
of existing systems by leveraging Arduino technology to create an affordable, accessible, and
adaptable solution. This system will utilize an Arduino microcontroller in conjunction with an
MQ-6 gas sensor to detect LPG concentrations in the air. When the sensor detects a gas
concentration above a predefined threshold, it will trigger an alarm through a connected buzzer,
alerting individuals to the potential danger. The system will be designed for easy installation and
use, making it suitable for both domestic and industrial environments.

One of the primary advantages of the proposed system is its cost-effectiveness. By using
Arduino, an open-source and inexpensive platform, the project significantly reduces the overall
cost of the gas detection system. This affordability ensures that the system is accessible to a
broader demographic, including households and small businesses in resource-constrained
regions. Additionally, the open-source nature of Arduino allows for community-driven
improvements and customization, fostering a collaborative approach to enhancing gas safety.

The proposed system will also incorporate modern connectivity features to enhance its
functionality. By integrating with IoT platforms, the system can provide real-time alerts via
mobile applications or SMS, ensuring that users are notified of gas leaks even when they are not
physically present. This remote monitoring capability is particularly beneficial for properties that
are unattended for extended periods. Furthermore, the system can be configured to work with
existing smart home systems, allowing for seamless integration and comprehensive safety
solutions.

5
2.3 INTRODUCTION TO EMBEDDED SYSTEM:

An embedded system is a computer system—a combination of a computer processor,


computer memory, and input/output peripheral devices—that has a dedicated function within a
larger mechanical or electrical system. It is embedded as part of a complete device often
including electrical or electronic hardware and mechanical parts. Because an embedded system
typically controls physical operations of the machine that it is embedded within, it often has
real-time computing constraints. Embedded systems control many devices in common use
today. Ninety-eight percent of all microprocessors manufactured are used in embedded systems.

Modern embedded systems are often based on microcontrollers (i.e., microprocessors


with integrated memory and peripheral interfaces), but ordinary microprocessors (using external
chips for memory and peripheral interface circuits) are also common, especially in more
complex systems. In either case, the processor(s) used may be types ranging from general
purpose to those specialized in a certain class of computations, or even custom designed for the
application at hand. A common standard class of dedicated processors is the digital signal
processor (DSP).

Since the embedded system is dedicated to specific tasks, design engineers can optimize
it to reduce the size and cost of the product and increase the reliability and performance. Some
embedded systems are mass-produced, benefiting from economies of scale. Embedded systems
range from portable devices such as digital watches and MP3 players, to large stationary
installations like traffic light controllers, programmable logic controllers, and large complex
systems like hybrid vehicles, medical imaging systems, and avionics.

Complexity varies from low, with a single microcontroller chip, to very high with
multiple units, peripherals, and networks mounted inside a large equipment rack.

6
Structure of the embedded systems architecture: The below diagram shows the basic
structure of the embedded systems architecture.

Fig. 2.1 basic architecture of embedded system

It measures the quantities that are physical and converts it to an electrical signal which may be
read by an observer or through any electronic tool like an A-D converter. A sensor shops the
measured amount to the memory.

A-D Conventer: An analog-to-digital converter that is used converts the analog signal sent by
using the sensor right into a digital signal.

Processor: Processors process the records to degree the output and keep it to the memory.

7
D-A Converter: A virtual-to-analog converter converts the virtual records fed by using
the processor to analog information.

Actuator: An actuator compares the output given by means of the D-A converter to the
actual (anticipated) output saved in it and stores the authorized output.

Embedded system architecture:


This article makes use of an architectural structures engineering method to embedded
systems due to the fact it’s far one of the maximum powerful gear that can be used to recognize
an embedded structures layout or to clear up demanding situations faced while designing a new
device. What makes the architectural technique so effective is its capacity to informally and
quick speak a layout to a spread of people with or without technical backgrounds, even acting
as a basis in planning the assignment or certainly designing a device. Because it truly outlines
the requirements of the system, architecture can act as a solid basis for studying and testing the
quality of a device and its performance below various situations. Eventually, the diverse
systems of an architecture can then be leveraged for designing destiny merchandise with
comparable traits, as a result allowing design understanding to be reused, and leading to a
decrease of destiny design and development charges. By the use of the architectural technique
in this article, I’m hoping to relay to the reader that defining and expertise the architecture of
an embedded gadget is an important aspect of precise gadget design. This is due to the fact,
similarly to the benefits listed above:

By the use of the architectural technique in this article, I’m hoping to relay to the reader
that defining and expertise the architecture of an embedded gadget is an important aspect of
precise gadget design. This is due to the fact, similarly to the benefits listed above: Each
embedded gadget has an architecture, whether or not it’s miles or isn’t documented, because
every embedded system consists of interacting elements (whether or not hard- ware or software
program).

An architecture by way of definition is a fixed of representations of these factors and


their relationships. In place of having a faulty and steeply-priced architecture forced on you

8
through no longer taking the time to define an structure earlier than beginning improvement,
take control of the design via defining the architecture first.

Because an embedded architecture captures diverse views, which can be representations


of the system, it is a beneficial device in understanding all of the major factors, why every
aspect is there, and why the factors behave the way they do. None of the factors within an
embedded device works in a vacuum.

Each detail inside a device interacts with some different detail in a few fashions. Without
know-how the “whys” at the back of an element’s provided functionality, overall performance,
and so forth, it would be difficult to determine how the gadget could behave underneath a
spread of instances in the real global.

Applications:

Embedded systems are commonly found in consumer, industrial, automotive, home


appliances, medical, commercial, and military applications.

Telecommunications systems employ numerous embedded systems from telephone


switches for the network to cell phones at the end user. Computer networking uses dedicated
routers and network bridges to route data.

Consumer electronics include MP3 players, television sets, mobile phones, video game
consoles, digital cameras, GPS receivers, and printers.

Household appliances, such as microwave ovens, washing machines, and dishwashers,


include embedded systems to provide flexibility, efficiency, and features.

9
Fig. 2.2 applications of embedded systems

Advanced HVAC systems use networked thermostats to more accurately and efficiently
control temperature that can change by time of day and season.

Home automation uses wired- and wireless-networking that can be used to control lights,
climate, security, audio/visual, surveillance, etc., all of which use embedded devices for sensing
and controlling.

Transportation systems from flight to automobiles increasingly use embedded systems.


New airplanes contain advanced avionics such as inertial guidance systems and GPS receivers
that also have considerable safety requirements

10
Various electric motors — brushless DC motors, induction motors and DC motors — use
electronic motor controllers. Automobiles, electric vehicles, and hybrid vehicles increasingly use
embedded systems to maximize efficiency and reduce pollution

Other automotive safety systems using embedded systems include anti-lock braking
system (ABS), Electronic Stability Control (ESC/ESP), traction control (TCS) and automatic
four-wheel drive

Medical equipment uses embedded systems for monitoring, and various medical imaging
(PET, SPECT, CT, and MRI) for non-invasive internal inspections. Embedded systems within
medical equipment are often powered by industrial computers.

Embedded systems are used in transportation, fire safety, safety and security, medical
applications and life-critical systems.

Unless connected to wired or wireless networks via on-chip 3G cellular or other methods
for IoT monitoring and control purposes, these systems can be isolated from hacking and thus be
more secure.

For fire safety, the systems can be designed to have a greater ability to handle higher
temperatures and continue to operate. In dealing with security, the embedded systems can be
self-sufficient and be able to deal with cut electrical and communication systems.

A new class of miniature wireless devices called motes are networked wireless sensors.
Wireless sensor networking, WSN, makes use of miniaturization made possible by advanced IC
design to couple full wireless subsystems to sophisticated sensors, enabling people and
companies to measure a myriad of things in the physical world and act on this information
through IT monitoring and control systems.

These motes are completely self-contained, and will typically run off a battery source for
years before the batteries need to be changed or charged.

11
Characteristics of embedded system

Embedded systems are designed to do some specific task, rather than be a generalpurpose
computer for multiple tasks. Some also have real-time performance constraints that must be met,
for reasons such as safety and usability; others may have low or no performance requirements,
allowing the system hardware to be simplified to reduce costs.

Embedded systems are not always standalone devices. Many embedded systems consist
of small parts within a larger device that serves a more general purpose. For example, the Gibson
Robot Guitar features an embedded system for tuning the strings, but the overall purpose of the
Robot Guitar is, of course, to play music.

Similarly, an embedded system in an automobile provides a specific function as a


subsystem of the car itself. The program instructions written for embedded systems are referred
to as firmware, and are stored in read-only memory or flash memory chips.

They run with limited computer hardware resources: little memory, small or non-existent
keyboard or screen.

User interface in embedded system

systems range from no user interface at all, in systems dedicated only to one task, to
complex graphical user interfaces that resemble modern computer desktop operating systems.

Simple embedded devices use buttons, LEDs, graphic or character LCDs (HD44780 LCD
for example) with a simple menu system.

More sophisticated devices that use a graphical screen with touch sensing or screenedge
buttons provide flexibility while minimizing space used: the meaning of the buttons can change
with the screen, and selection involves the natural behavior of pointing at what is desired.

12
Systems often have a screen with a "joystick button" for a pointing device. Some systems
provide user interface remotely with the help of a serial (e.g. RS232, USB, I²C, etc.) or network

(e.g. Ethernet) connection. This approach gives several advantages: extends the
capabilities of embedded system, avoids the cost of a display, simplifies BSP and allows one to
build a rich user interface on the PC. A good example of this is the combination of an embedded
web server running on an embedded device (such as an IP camera) or a network router. The user
interface is displayed in a web browser on a PC connected to the device, therefore needing no
software to be installed.

Processors in embedded systems

Examples of properties of typical embedded computers, when compared with general-purpose


counterparts, are low power consumption, small size, rugged operating ranges, and low per-unit
cost.
This comes at the price of limited processing resources, which make them significantly
more difficult to program and to interact with. However, by building intelligence mechanisms on
top of the hardware, taking advantage of possible existing sensors and the existence of a network
of embedded units, one can both optimally manage available resources at the unit and network
levels as well as provide augmented functions, well beyond those available.
For example, intelligent techniques can be designed to manage power consumption of
embedded systems. Embedded processors can be broken into two broad categories. Ordinary
microprocessors (μP) use separate integrated circuits for memory and peripherals.

Microcontrollers (μC) have on-chip peripherals, thus reducing power consumption, size
and cost.

In contrast to the personal computer market, many different basic CPU architectures are
used since the software is custom-developed for an application and is not a commodity product
installed by the end user. Both Von Neumann, as well as various degrees of Harvard architectures,
is used.

13
RISC as well as non-RISC processors are found. Word lengths vary from 4-bit to 64-bits
and beyond, although the most typical remain 8/16-bit. Most architecture comes in a large number

of different variants and shapes, many of which are also manufactured by several
different companies.

Numerous microcontrollers have been developed for embedded systems use. General-
purpose microprocessors are also used in embedded systems; but generally, require more support
circuitry than microcontrollers

Tools of embedded system

As with other software, embedded system designers use compilers, assemblers, and
debuggers to develop embedded system software. However, they may also use some more
specific tools: Utilities to add a checksum or CRC to a program, so the embedded system can
check if the program is valid. For systems using digital signal processing, developers may use a
math workbench to simulate the mathematics.

System-level modeling and simulation tools help designers to construct simulation


models of a system with hardware components such as processors, memories, DMA, interfaces,
buses and software behavior flow as a state diagram or flow diagram using configurable library
blocks. Simulation is conducted to select the right components by performing power vs.
performance trade-off, reliability analysis and bottleneck analysis.

15 Typical reports that help a designer to make architecture decisions includes application
latency, device throughput, device utilization, power consumption of the full system as well as
device-level power consumption. A model-based development tool creates and simulates
graphical data flow and UML state chart diagrams of components like digital filters, motor
controllers, communication protocol decoding and multi-rate tasks. Custom compilers and linkers
may be used to optimize specialized hardware.

14
An embedded system may have its own special language or design tool, or add
enhancements to an existing language such as Forth or Basic. Another alternative is to add a real-
time operating system or embedded operating system Modeling and code generating tools often
based on state machines Software tools can come from several sources: Software companies that

specialize in the embedded market Ported from the GNU software development tools
Sometimes, development tools for a personal computer can be used if the embedded processor is a
close relative to a common PC processor As the complexity of embedded systems grows, higher-
level tools and operating systems are migrating into machinery where it makes sense.

For example, cellphones, personal digital assistants and other consumer computers often
need significant software that is purchased or provided by a person other than the manufacturer of
the electronics. In these systems, an open programming environment such as Linux, NetBSD,
OSGi or Embedded Java is required so that the third-party software provider can sell to a large
market.

Embedded systems are commonly found in consumer, cooking, industrial, automotive,


and medical applications. 16 Some examples of embedded systems are MP3 players, mobile
phones, video game consoles, digital cameras, DVD players, and GPS. Household appliances,
such as microwave ovens, washing machines and dishwashers, include embedded systems to
provide flexibility and efficiency.

Advantages
1.It is easy for bulk production.
2.This system is highly reliable for everyday life.
3.It has very few interconnections.
4.This system is tiny in size.
5.They are cheap.
6.It has a quick operation.
7.It has improved product quality and better performance.
8.It optimizes available system resources.

15
9.It has low power operation and efficient

10.They are less error-prone

Fig. 2.3 advantages of embedded system.

16
CHAPTER-3

BLOCK DIAGRAM AND DESCRIPTION

3.1 BLOCK DIAGRAM

BLOCK DIAGRAM AND WORKING:

MQ-2 16 XX 22 LCD
16 LCD

Arduino
POWER SUPPLY
Uno BUZZER

LED(GREEN)
LED(RED)

The block diagram of an LPG gas leakage detector using Arduino illustrates the
functional relationships within the system. At its core is the Arduino board, which serves as the
central processing unit. It receives input from the gas sensor module, responsible for detecting
LPG levels in the environment.
The Arduino processes the data using embedded software that includes algorithms for gas
detection and alarm triggers. Output signals from the Arduino control peripheral devices such as
a display for showing gas levels or system status, a buzzer for audible alerts during high gas

17
concentrations, and potentially interfaces for external control, like relays for shutting off gas
valves.

3.2HARDWARE DISCRIPTION
3.2.1 INTRODUCTION TO AURDUINO

Fig 3.2 ARDUINO UNO

Arduino UNO is a microcontroller board based on the ATmega328P. It has 14 digital


input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic
resonator, a USB connection, a power jack, an ICSP header and a reset 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 get started.

The system begins by continuously monitoring the surrounding environment using an


LPG gas sensor module. This sensor is specifically designed to detect the presence of LPG gas in
the air. It generates analog signals proportional to the concentration of LPG gas detected.

Within the Arduino code, predefined threshold values for LPG gas concentration are set.
These thresholds determine the level at which the system considers the gas concentration to be
hazardous. The Arduino compares the analog signals from the gas sensor with these threshold
values to determine if the detected gas concentration exceeds the safe limit.

The platform utilizes an integrated development environment (IDE) that simplifies


programming with a beginner-friendly version of C++ and a vast library of pre-written code,
enabling users to quickly prototype and develop projects. Arduino's open-source nature
encourages collaboration and innovation among a global community of makers, students, and
professionals who share ideas, troubleshoot issues, and contribute to ongoing development.

18
ARDUINO UNO PIN DIAGRAM

Fig 3.3 ARDUINO UNO PIN DIAGRAM

Arduino is an open-source electronics platform based on easy-to-use hardware and


software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a
Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing
something online.

Arduino can input and output analog signals as well as digital signals. An analog signal
is one that can take on any number of values, unlike a digital signal which as only two values:

19
HIGH and LOW. ... The function used to output a PWM signal is analog Write (pin, value). pin is
the pin number used for the PWM output.

Serial Pins 0 (Rx) and 1 (Tx): Rx and Tx pins are used to receive and transmit TTL serial data.
They are connected with the corresponding ATmega328P USB to TTL serial chip.

External Interrupt Pins 2 and 3: These pins can be configured to trigger an interrupt on a low
value, a rising or falling edge, or a change in value.

PWM Pins 3, 5, 6, 9 and 11: These pins provide an 8-bit PWM output by using analogWrite()
function.

SPI Pins 10 (SS), 11 (MOSI), 12 (MISO) and 13 (SCK): These pins are used for SPI
communication.

In-built LED Pin 13: This pin is connected with an built-in LED, when pin 13 is HIGH – LED
is on and when pin 13 is LOW, its off.

Along with 14 Digital pins, there are 6 analog input pins, each of which provide 10 bits of
resolution, i.e. 1024 different values. They measure from 0 to 5 volts but this limit can be
increased by using AREF pin with analog Reference() function.

 Analog pin 4 (SDA) and pin 5 (SCA) also used for TWI communication using Wire
library.

Arduino Uno has a couple of other pins as explained below:

 AREF: Used to provide reference voltage for analog inputs with analogReference()
function.
 Reset Pin: Making this pin LOW, resets the microcontroller.

20
ARDUINO UNO PIN SPECIFICATIONS

table 3.1 ARDUINO UNO PIN SPECIFICATIONS

21
ARDUINO UNO TECHNICAL SPECIFICATIONS

Table 3.2. ARDUINO UNO TECHNICAL SPECIFICATIONS

22
How to use Arduino Board

The 14 digital input/output pins can be used as input or output pins by using pinMode(),
digitalRead() and digitalWrite() functions in arduino programming.

Each pin operate at 5V and can provide or receive a maximum of 40mA current, and has an
internal pull-up resistor of 20-50 KOhms which are disconnected by default.

Out of these 14 pins, some pins have specific functions as listed below.

• Serial Pins 0 (Rx) and 1 (Tx): Rx and Tx pins are used to receive and transmit TTL serial
data. They are connected with the corresponding ATmega328P USB to TTL serial chip.

• External Interrupt Pins 2 and 3: These pins can be configured to trigger an interrupt on a low
value, a rising or falling edge, or a change in value.

• PWM Pins 3, 5, 6, 9 and 11: These pins provide an 8-bit PWM output by using analogWrite()
function.

• SPI Pins 10 (SS), 11 (MOSI), 12 (MISO) and 13 (SCK): These pins are used for SPI
communication.

• In-built LED Pin 13: This pin is connected with a built-in LED, when pin 13 is HIGH – LED
is on and when 13 pin is LOW, it’s off.

Along with 14 Digital pins, there are 6 analog input pins, each of which provides 10 bits of
resolution, i.e. 1024 different values. They measure from 0 to 5 volts but this limit can be
increased by using AREF pin with analog Reference() function.

• Analog pin 4 (SDA) and pin 5 (SCA) also used for TWI communication using Wire library.

Arduino Uno has a couple of other pins as explained below:

• AREF: Used to provide reference voltage for analog inputs with analogReference()

function.

• Reset Pin: Making this pin LOW, resets the microcontroller.


23
• COMMUNICATION

The Arduino/Genuino Uno has a number of facilities for communicating with a computer,
another Arduino/Genuino board, or other microcontrollers. The ATmega328provides UART
TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX).

An ATmega16U2 on the board channels this serial communication over USB and appears as a
virtual com port to software on the computer. The 16U2 firmware uses the standard USB COM
drivers, and no external driver is needed. However, on Windows, a.inf file is required.

Arduino Software (IDE) includes a serial monitor which allows simple textual data to be sent to
and from the board. The RX and TX LEDs on the board will flash when data is being transmitted
via the USB-to-serial chip and USB connection to the computer (but not for serial
communication on pins 0 and 1). A Software Serial library Allows serial communication on any
of the Uno's digital pins.

Arduino is an open-source electronics platform based on easy-to-use hardware and software.


Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter
message - and turn it into an output - activating a motor, turning on an LED, publishing
something online.

Functions allow structuring the programs in segments of code to perform individual tasks. The
typical case for creating a function is when one needs to perform the same action multiple times
in a program. Functions help the programmer stay organized.

24
3.2.2 MQ- 5 SENSOR

The MQ-5 sensor is specifically designed to detect LPG, making it an ideal choice for gas
leakage detectors. It can sense LPG concentrations in the air and provide an output signal
proportional to the gas concentration.

In addition to LPG, the MQ-5 sensor can detect other gases such as natural gas (methane) and
town gas (hydrogen), offering versatility for detecting multiple types of flammable gases.

25
CHAPTER 4

SOFTWARE DESCRIPTION

4.1 Arduino IDE

Arduino IDE is a versatile software environment designed for programming Arduino-


compatible microcontroller boards. It features an intuitive and user-friendly interface that
supports writing, editing, and uploading code seamlessly across Windows, macOS, and Linux
platforms.

The IDE includes a comprehensive set of tools such as a code editor with syntax
highlighting and auto-indentation, a library manager for easy integration of additional
functionalities, and a board manager for adding new board types effortlessly.

A built-in serial monitor facilitates debugging and communication with Arduino boards
via serial interface. Arduino IDE is renowned for its open-source nature, fostering a vibrant
community that contributes libraries, tutorials, and support, making it an invaluable resource for
hobbyists and professionals alike in developing interactive electronics projects.

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 hardware to upload
programs and communicate with them.

26
Programs written using Arduino Software (IDE) are called sketches. These sketches are
written in the text editor and are saved with the file extension .ino. The editor has features for
cutting/pasting and for searching/replacing text. The message area gives feedback while saving

and exporting and also displays errors. The console displays text output by the Arduino Software
(IDE), including complete error messages and other information. The bottom righthand corner of
the window displays the configured board and serial port. The toolbar buttons allow you to verify
and upload programs, create, open, and save sketches, and open the serial monitor.

Arduino IDE is a robust, open-source development platform tailored for programming Arduino
boards and compatible microcontrollers. It provides a straightforward yet powerful environment
for coding, compiling, and uploading sketches (programs) to various Arduino models. The IDE
features a user-friendly interface with a text editor that supports syntax highlighting, code
completion, and indentation, enhancing code readability and efficiency.

Its library manager simplifies the integration of additional libraries, expanding the capabilities of
projects without complex setup. The board manager facilitates the management of different
Arduino board types and configurations, accommodating a wide range of hardware options.

27
Fig 4.1 ARDUINO UNO

A built-in serial monitor enables real-time communication between the IDE and Arduino boards,
essential for debugging and interacting with projects that involve serial communication
protocols. Arduino IDE's cross-platform compatibility ensures accessibility across Windows,
macOS, and Linux, catering to a diverse community of developers and enthusiasts. With an
active ecosystem of extensions, plugins, and community support, Arduino IDE remains a
cornerstone tool for innovators exploring electronics, robotics, IoT (Internet of Things), and
beyond.

4.2 ARDUINO SETUP AND INSTIALLISATION

The Uno is programmed using the Arduino Software (IDE). Connect your Uno board with an
USB cable.

28
Fig4.2 Arduino UNO and USB cable

If you want to program your Arduino Uno while offline you need to install the Arduino
Desktop IDE. The Uno is programmed using the Arduino Software (IDE), our Integrated
Development Environment common to all our boards.

Before you can move on, you must have installed the Arduino Software (IDE) on your
PC, as explained in our introduction. Connect your Uno board with an A B USB cable.

The USB connection with the PC is necessary to program the board and not just to power
it up. The Uno automatically draw power from either the USB or an external power supply.
Connect the board to your computer using the USB cable.

If you used the Installer, Windows from XP up to 10 will install drivers automatically as
soon as you connect your board. If you downloaded you need to follow the procedure step by
step

• Click on the Start Menu, and open up the Control Panel.

• While in the Control Panel, navigate to System and Security. Next, click on System. Once the
System window is up, open the Device Manager.

29
Fig 4.3. Choose the components to install.

Fig 4.4. Choose the


installation directory.

30
Fig 4.5. Installation in progress.

The process will extract and install all the required files to execute properly the Arduino
Software (IDE)

The text of the Arduino getting started guide is licensed under a Creative Commons Attribution-
ShareAlike 3.0 License. Code samples in the guide are released into the public domain.

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 reserved for 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. Upload the program 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.

31
You've gotten Arduino up and-running If you have problems on uploading programs to the
Arduino. Here are some specific suggestions for troubleshooting each of the pieces. They
include: the drivers for the board, the board and serial port selections in the Arduino software,
access to the serial port, the physical connection to the board, the firmware on the Uno and Mega
2560, the boot loader on the main microcontroller on the board.

Some specific suggestions for troubleshooting each of the pieces are as follows: Arduino
software, drivers, Access to the serial port, physical connection, auto-reset, boot loader are some
of the trouble shooters.

ARDUINO SOFTWARE

The Arduino software ecosystem encompasses several components that collectively enable
users to develop and deploy programs (sketches) on Arduino-compatible microcontroller boards.
Here's an overview of the key elements:

1. Arduino IDE (Integrated Development Environment):

 The Arduino IDE is the primary software tool used for writing, compiling, and uploading
code to Arduino boards.
 It features a user-friendly interface with a text editor optimized for Arduino
programming, complete with syntax highlighting and code completion.
 The IDE includes tools like a serial monitor for debugging and real-time communication
with Arduino boards via USB or serial connections.
 It supports a wide range of Arduino boards and is compatible with Windows, macOS, and
Linux operating systems.

32
2. Arduino CLI (Command Line Interface):

 Arduino CLI is a command-line version of the Arduino IDE, providing a flexible and
scriptable interface for compiling and uploading sketches.
 It allows developers to integrate Arduino workflows into automated build systems or
custom development environments.

3. Arduino Libraries:

 Arduino libraries are collections of pre-written code that extend the functionality of
Arduino boards by providing ready-to-use functions and routines.
 The Arduino IDE and CLI include tools for managing libraries, making it easy to search,
install, and update libraries directly from within the development environment.

4. Arduino Core:

 The Arduino core is a collection of libraries and code specifically tailored to each
supported microcontroller board (e.g., Arduino Uno, Arduino Mega, etc.).
 It abstracts hardware-specific details, allowing developers to write portable code that can
run on different Arduino-compatible boards without modification.

5. Arduino Web Editor:

The Arduino Web Editor is a cloud-based version of the IDE accessible via web
browsers.
 It allows users to write and compile code directly in their browser and upload sketches to
connected Arduino boards, offering flexibility in development environments.

6. Arduino IoT Cloud:

 Arduino IoT Cloud is a platform-as-a-service (PaaS) solution integrated with the Arduino
IDE for developing IoT projects.
 It provides tools for connecting Arduino devices to the cloud, creating dashboards, and
managing IoT applications without extensive backend development.

33
Overall, the Arduino software suite caters to a broad spectrum of users, from beginners
learning to program microcontrollers to advanced developers creating complex embedded
systems and IoT applications. Its open-source nature, extensive community support, and cross-
platform compatibility make Arduino software a powerful and accessible tool for innovation in
electronics and beyond.

4.3 DEVELOPING THE CODE

To develop a code for an LPG gas leakage detector using Arduino, begin by connecting
an MQ-5 gas sensor to an analog pin of the Arduino for reading gas levels. Wire a buzzer to a
digital pin to sound an alarm when gas levels exceed a predefined threshold. In the Arduino IDE,
initialize

pins in the setup() function, read analog sensor values in the loop() function, and compare
them to a set threshold.

When gas levels surpass the threshold, activate the buzzer and possibly other indicators
like LEDs. Test and calibrate the sensor’s sensitivity and threshold values, adjusting as necessary
for accurate detection. Ensure safety precautions during testing and deployment, such as
adequate ventilation. Document your code and circuit for future reference, and consider
enhancements like integrating with IoT platforms for remote monitoring.

Developing a code for an LPG gas leakage detector using Arduino involves several
detailed steps and considerations. Firstly, ensure you have all necessary components: an Arduino
board (such as Arduino Uno or Nano), an MQ-5 gas sensor, a buzzer or alarm module, and
optionally LEDs for visual alerts. Begin by wiring the MQ-5 sensor to the Arduino, typically
connecting its analog output to an analog input pin and ensuring proper power and ground

34
connections. In the Arduino IDE, start by declaring constants and variables for pins and sensor
thresholds. In the setup() function, initialize the sensor and alarm pins, and optionally set up
serial communication for debugging.

In the loop() function, continuously read analog values from the sensor using
analogRead(), compare these values to a predefined threshold to determine if gas levels exceed
safe limits, and trigger the alarm accordingly by setting the buzzer pin high. Consider adding
debounce logic or using a timer to control alarm duration and prevent false alarms.

Test the system thoroughly, calibrate the sensor sensitivity and threshold based on real-
world conditions, and ensure proper safety precautions are observed during testing and
deployment. Document your code, circuit diagram, and calibration process for future reference
and improvement. Advanced enhancements may involve integrating with IoT platforms for
remote monitoring or adding features like data logging for analysis.

#include <LiquidCrystal.h>

// Initialize the LCD with the numbers of the interface pins

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

// Define the pin numbers

const int redLedPin = 13; // Pin connected to the Red LED

const int yellowLedPin = 5; // Pin connected to the Yellow LED

const int buzzerPin = 4; // Pin connected to the buzzer

const int gasSensorPin = A0; // Pin connected to the MQ-5 gas sensor

// Threshold value for gas detection

const int thresholdValue = 300; // Adjust based on your calibration

35
void setup() {

// Initialize the LED pins as outputs

pinMode(redLedPin, OUTPUT);

pinMode(yellowLedPin, OUTPUT);

// Initialize the buzzer pin as an output

pinMode(buzzerPin, OUTPUT);

// Initialize the gas sensor pin as an input

pinMode(gasSensorPin, INPUT);

// Initialize serial communication for debugging

Serial.begin(9600);

// Initialize the LCD

lcd.begin(16, 2);

lcd.setCursor(0, 0);

lcd.print("Gas Detection");

void loop() {

// Read the gas sensor value

36
int gasSensorValue = analogRead(gasSensorPin);

// Print the gas sensor value to the serial monitor

Serial.print("Gas Sensor Value: ");

Serial.println(gasSensorValue);

// Check if the gas sensor value exceeds the threshold

if (gasSensorValue > thresholdValue) {

// Turn the Red LED on and Yellow LED off

digitalWrite(redLedPin, HIGH);

digitalWrite(yellowLedPin, LOW);

// Turn the buzzer on

digitalWrite(buzzerPin, HIGH);

// Display the gas detected message on the LCD

lcd.setCursor(0, 1);

lcd.print("Gas Detected ");

} else {

// Turn the Red LED off and Yellow LED on

digitalWrite(redLedPin, LOW);

digitalWrite(yellowLedPin, HIGH);

// Turn the buzzer off

digitalWrite(buzzerPin, LOW);

37
// Display the no gas message on the LCD

lcd.setCursor(0, 1);

lcd.print("No Gas ");

// Wait for 100 milliseconds before the next loop

delay(100);

CHAPTER-5
WORKING OF THE PROJECT

The LPG gas leakage detector project using Arduino operates by employing an MQ-5 gas
sensor, which detects the presence of LPG (liquefied petroleum gas) in the surrounding air. This
sensor works on the principle of detecting changes in conductivity when exposed to different
concentrations of gas. It outputs an analog voltage signal that is directly proportional to the gas
concentration detected. This analog signal is then fed into one of the Arduino's analog input pins,
such as A0, for processing.

In the Arduino code, a threshold value is predefined to determine the level at which the
sensor triggers an alert for gas leakage. This threshold value can be adjusted depending on the
desired sensitivity and the specific application requirements. Within the loop() function of the
Arduino sketch, the analog voltage from the gas sensor is continuously monitored using the
analogRead() function. The Arduino compares this reading to the predefined threshold.

38
When the analog voltage surpasses the set threshold, indicating that the concentration of
LPG gas has exceeded safe limits, the Arduino initiates an alarm. This alarm typically activates
by setting a digital output pin (connected to a buzzer or alarm module) to a high state, producing
an audible alert to notify users of the gas leakage. Optionally, visual indicators like LEDs can be
integrated into the circuit to provide additional visual alerts.

Throughout development and deployment, rigorous testing is essential to ensure the


sensor's sensitivity is appropriately calibrated for reliable gas detection. Safety precautions must
be observed during testing, including proper ventilation and handling of gas-sensitive
components. Once calibrated and tested, the gas leakage detector can be deployed in
environments where LPG gas is used, such as kitchens or industrial settings, providing

continuous monitoring and timely alerts to enhance safety and prevent potential hazards
associated with gas leaks.

If the sensor detects a concentration of LPG gas above the set threshold, the Arduino
triggers an alarm system. This typically involves activating a buzzer or alarm module connected
to a digital output pin, providing an audible alert to warn users of potential gas leakage. Safety
precautions, including proper ventilation and sensor calibration, are crucial during testing and
deployment to ensure accurate and reliable operation. Advanced features like IoT integration for
remote monitoring or data logging can enhance the project's functionality, making it suitable for
deployment in homes, kitchens, or industrial environments where LPG gas safety is paramount.

39
Fig 5.2.1. Working of the project

The working principle of a gas leakage detector using Arduino involves several steps, from
sensing gas concentration to triggering alarms. Here's a detailed overview of how the system
operates.

Gas Sensing:

The gas sensor module, typically based on MQ series gas sensors, detects the presence of
specific gases by measuring changes in resistance. When the sensor comes in contact with the
target gas, its resistance changes proportionally to the gas concentration in the surrounding
environment.

The gas sensor module outputs analog voltage signals corresponding to the gas concentration,
which are read by the Arduino Uno.

Sensor Interfacing:

The gas sensor module is connected to one of the analog input pins of the Arduino Uno.
Wiring connections are established between the sensor module and the Arduino Uno to ensure
proper communication and power supply.

Calibration:
40
Before deployment, the gas sensor may require calibration to ensure accurate readings.

Calibration involves exposing the sensor to known gas concentrations and adjusting sensitivity
parameters to match the expected response curve. This step ensures that the sensor provides
reliable and consistent readings in real-world environments.

Data Processing:

The Arduino Uno continuously reads analog sensor data from the gas sensor module.

The analog voltage signals received from the sensor are converted into digital values using the
analog-to-digital converter (ADC) of the Arduino Uno.

These digital values represent the gas concentration levels detected by the sensor.

Threshold Detection:

Threshold values for triggering alarms are predefined based on safety standards and
requirements. The Arduino Uno compares the detected gas concentration levels with the
predefined threshold values.

If the gas concentration exceeds the threshold, indicating a potential gas leakage, the alarm
system is activated.

Alarm Triggering:

When the detected gas concentration exceeds the predefined threshold, the Arduino Uno
activates the alarm system.The alarm system typically consists of an audible buzzer and a visual
LED indicator.

The buzzer emits a loud sound to alert occupants of the presence of hazardous gas, while
the LED indicator provides a visual indication of the alarm status.

Alarm Deactivation:

Once the gas concentration returns to safe levels, the alarm system is deactivated. The
Arduino Uno continuously monitors gas concentration levels and reactivates the alarm system if
the concentration exceeds the threshold again.

User Notification:
41
Optionally, the gas leakage detector can incorporate additional features for user
notification.For example, the system can be configured to send notifications to a smartphone or
computer via Wi-Fi or Bluetooth modules, providing remote monitoring and alerts.

By following these steps, the gas leakage detector using Arduino effectively detects the
presence of hazardous gases and triggers timely alarms to ensure the safety of
occupants and properties.

Vin: This is the input voltage pin of the Arduino board used to provide input supply from an
external power source.

5V: This pin of the Arduino board is used as a regulated power supply voltage and it is used to
give supply to the board as well as onboard components.

3.3V: This pin of the board is used to provide a supply of 3.3V which is generated from a

Analog Pins: The pins A0 to A5 are used as an analog input and it is in the range of 0-5V.

Digital Pins: The pins 0 to 13 are used as a digital input or output for the Arduino board

42
CHAPTER-6

RESULT

The LPG gas leakage detector using Arduino provides a reliable and immediate alert
mechanism to detect and respond to LPG leaks. Central to the system is an Arduino board that
processes data from an MQ-5 gas sensor, which detects LPG concentration in the air. When the
gas level exceeds a predefined threshold, the Arduino activates a buzzer and an LED, providing
both audible and visual alerts.

43
The buzzer, connected to a digital output pin, sounds a loud alarm, while the LED lights
up, offering a clear visual indication of the gas leak. Resistors ensure the proper operation of the
LEDs and sensors, while a power supply sustains the system. The setup includes connecting
wires to establish necessary electrical connections. In normal conditions, the system remains
silent with

the LED off, while continuously updating gas concentration readings on the Serial
Monitor. Upon detecting a leak, the system immediately triggers the alerts, ensuring safety
through real-time detection and clear signaling of potential hazards. This robust design ensures
the system's reliability and effectiveness in environments where LPG is used.

44
CHAPTER-7

APPLICATIONS AND ADVANTAGES

7.1 APPLICATIONS

An LPG gas leakage detector using Arduino has a wide range of applications across
various sectors due to its ability to provide timely alerts and enhance safety. Here are some key
applications:

1.Residential Use:

45
Home Safety: Installing LPG gas leakage detectors in kitchens and areas where LPG is used can
prevent accidents caused by gas leaks. It ensures the safety of households by providing early
warnings, allowing residents to take immediate action.

2.Industrial Use:

Factories and Manufacturing Plants: In industries where LPG is used for heating or as a fuel
source, gas leakage detectors can prevent potential explosions or fires. They are crucial in
maintaining safe working environments.

Chemical Plants: Facilities that handle volatile chemicals benefit from gas leakage detectors to
monitor and control gas leaks, ensuring the safety of workers and equipment.

3.Commercial Use:

Restaurants and Food Establishments: Commercial kitchens that use LPG for cooking need
reliable gas leakage detectors to protect staff and customers from the dangers of gas leaks.

Hotels and Hospitality: Ensuring the safety of guests by installing gas detectors in hotel
kitchens and heating systems that use LPG.

4.Automotive Sector:

CNG and LPG Vehicles: Vehicles that run on LPG or CNG can use gas leakage detectors to
ensure the safety of passengers by detecting leaks from fuel systems.

5. Agricultural Sector:

Greenhouses and Farms: LPG is sometimes used in agricultural applications for heating. Gas
detectors can help in preventing leaks that might affect crops or pose a risk to farmworkers.

6.Public Transport Systems:

Buses or other public transport systems that use LPG can be equipped with detectors to ensure
passenger safety.

46
7.2 ADVANTAGES

LPG gas leakage detectors using Arduino offer several advantages that enhance safety,
efficiency, and versatility in various applications. Here are the key advantages:

1.Cost-Effective:

DIY Capability: The system can be assembled as a DIY project, reducing labor costs associated
with professional installations.

2.Customization and Flexibility:

Adjustable Sensitivity: The threshold for gas detection can be easily adjusted in the Arduino
code, allowing customization for different environments and requirements.

Integration with Other Systems: Arduino can interface with various other sensors and
modules, enabling integration with home automation systems, IoT networks, or other safety
devices.

3.Real-Time Monitoring:

Immediate Alerts: The system provides real-time detection and immediate alerts via buzzers
and LEDs, ensuring quick response to potential gas leaks.

Serial Monitoring: Continuous data logging and real-time monitoring through the Serial
Monitor allow for ongoing surveillance and record-keeping of gas concentration levels.

4.Ease of Use:

Simple Setup: The system is straightforward to assemble and program, even for individuals with
basic electronics and programming knowledge.

47
User-Friendly Interface: The use of visual (LED) and audible (buzzer) alerts makes the system
easy to understand and operate without requiring complex training.

5.Reliability and Accuracy:

Sensitive Detection: MQ-5 sensor is highly sensitive to LPG and other combustible gases,
ensuring accurate detection and reliable performance.

Stable Operation: Arduino-based systems are known for their stability and consistent
performance in various conditions.

Learning Opportunity: Building and programming an LPG gas leakage detector provides a
valuable learning experience for students and hobbyists interested in electronics, programming,
and safety systems.

CHAPTER-8

CONCLUSION AND FUTURE SCOPE

8.1 CONCLUSION

The final conclusion for the LPG gas leakage detector using Arduino project is that it
offers a highly effective, customizable, and cost-efficient solution for enhancing safety in
environments where LPG is utilized.

The integration of an Arduino board with a gas sensor (such as the MQ-5) allows for
accurate and real-time detection of gas leaks, with immediate alerts provided through both
audible (buzzer) and visual (LED) signals. This system not only ensures timely intervention to

48
prevent potential accidents and hazards but also provides continuous monitoring with data
logging capabilities.

Key advantages of this project include its affordability, ease of assembly, and flexibility
in customization and expansion. The Arduino platform's versatility allows for integration with
other safety systems and IoT networks, enhancing the overall functionality and reach of the
detector. Furthermore, the educational value of building and programming the detector makes it
an excellent project for students and hobbyists interested in learning about electronics and safety
systems.

In conclusion, the LPG gas leakage detector using Arduino is a reliable and practical tool
that significantly improves safety measures in residential, commercial, industrial, and
educational settings. Its ability to provide immediate and clear alerts ensures that potential gas
leaks are detected early, minimizing the risk of accidents and ensuring a safer environment for all
users.

8.2 FUTURE SCOPE

The future scope for the LPG gas leakage detector using Arduino is broad and promising,
with potential enhancements and applications across various fields. Here are several areas where
the project can be expanded and improved:

1.Integration with IoT:

Smart Home Integration: Connect the gas leakage detector to smart home systems, allowing
users to receive alerts on their smartphones or other connected devices. This enables remote
monitoring and control.

49
Cloud-Based Monitoring: Implement cloud services to log data and send alerts via the internet.
This allows for long-term data storage and analysis, and remote access to gas concentration
levels from anywhere.

2.Advanced Alert Systems:

SMS and Email Notifications: Integrate GSM modules to send SMS alerts or use internet
services for email notifications in case of a gas leak, providing timely warnings even when users
are not at home.

Voice Alerts: Add a speaker module to provide voice alerts, which can be more noticeable and
informative than simple buzzer alarms.

3.Enhanced Sensor Capabilities:

Multi-Gas Detection: Upgrade the system to detect multiple types of gases (e.g., carbon
monoxide, methane) by adding additional sensors. This broadens the safety applications of the
device.

Higher Precision Sensors: Use more advanced gas sensors with higher sensitivity and accuracy
to improve the reliability of leak detection.

4.Power and Connectivity Improvements:

Battery Backup: Implement a battery backup system to ensure the detector remains operational
during power outages.

Wireless Communication: Use Wi-Fi or Bluetooth modules to reduce wiring complexity and
enhance connectivity options for data transmission and device control.

5.Data Analytics and Machine Learning:

50
Predictive Analytics: Utilize data analytics to predict potential gas leaks based on historical
data, allowing for proactive maintenance and prevention.

CHAPTER-9

REFERENCES

• IOSR Journal of Electronics and Communication Engineering (IOSR-JECE)


e-ISSN: 2278-2834,p- ISSN: 2278-8735.Volume 9, Issue 1, Ver. VI (Feb.
2014), PP 53-58 www.iosrjournals.org

• International Journal of Electronics Engineering Research. ISSN 0975-6450


Volume 9, Number 7 (2017) pp. 1095-1097

51
• Abhishek, P. Bharath, “Automation of lpg cylinder leakage monitoring
system,” International Journal of Combined Research and Development
(IJCRD), pp. 693 – 695, 2016.

52

You might also like