My Project Fabrication Report Updated

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 49

SMART GAS LEAKAGE DETECTOR WITH ARDUINO BOARD AND

EXHAUST SYSTEM.

Submitted by

MORGAN MICAH DUNGA

INDEX NO: 4061150532

KABETE NATIONAL POLYTECHNIC

Supervised By

SADRIN KARANI

PROJECT PROPOSAL SUBMITTED TO THE KENYA NATIONAL


EXAMINATION COUNCIL FOR THE AWARD OF DIPLOMA IN
MEDICAL ENGINEERING.

JULY, 2023
DECLARATION
I declare that this project proposal is my own work and has not been presented to any institution
for the award of any academic qualification.

NAME: DUNGA MICAH MORGAN

SIGN: …………………………. DATE: ………………...............

INDEX NO: 4061150532

DECLARATION BY SUPERVISOR(S)

This project proposal has been submitted with my approval at Kabete National Polytechnic.

NAME: SADRIN KARANI

SIGN:……………………………… DATE: ……………………………….

ii
Contents
DECLARATION...................................................................................................................................ii
LIST OF FIGURES..............................................................................................................................vi
ACKNOWLEDGMENTS...................................................................................................................vii
ABSTRACT.........................................................................................................................................viii
CHAPTER 1..........................................................................................................................................1
1.0 Introduction/Background...........................................................................................................1
1.1 Problem Statement......................................................................................................................1
1.2 Justification..................................................................................................................................2
1.3 Objectives.........................................................................................................................................2
1.3.1 Main Objective..........................................................................................................................2
1.3.2 Specific Objectives....................................................................................................................2
1.4 Specifications of Components.........................................................................................................3
CHAPTER 2..........................................................................................................................................4
LITERATURE REVIEW.....................................................................................................................4
2.1 Related work................................................................................................................................4
CHAPTER 3..........................................................................................................................................5
3.0 METHODOLOGY..........................................................................................................................5
3.1 Introduction.................................................................................................................................5
3.2 Block diagram(s) of the system...................................................................................................5
3.3 Design and Implementation............................................................................................................6
3.3.1 Hardware design...........................................................................................................................6
3.3.1.1 Power Supply.........................................................................................................................6
3.3.1.2 Sensing block 1.....................................................................................................................14
3.3.1.3 Actuating Section 1..............................................................................................................15
3.3.2 Software development................................................................................................................18
Write the Code:....................................................................................................................................18
3.3.2.1 Algorithm.............................................................................................................................21
3.3.3 Implementation process.............................................................................................................23
RESULTS CONCLUSION AND RECOMMENDATIONS............................................................29
4.1 The results and analysis............................................................................................................29
4.2 Conclusion..................................................................................................................................31

iii
4.3 Recommendations......................................................................................................................32
REFFERENCES OF THE PROJECT...............................................................................................34
APPENDICES.....................................................................................................................................36
APPENDIX A......................................................................................................................................36
APPENDIX B.......................................................................................................................................40
Pin configuration of LCD display...................................................................................................40
APPENDIX C......................................................................................................................................41
Pin configuration of Arduino Nano board.....................................................................................41

iv
LIST OF FIGURES
Figure 3. 1: Block Diagram of IoT based intelligent Gas leakage Detector using Arduino.....................5
Figure 3. 2: Circuit diagram of buzzer.......................................................................................................8
Figure 3. 3: Circuit diagram of LCD..........................................................................................................9
Figure 3. 4: Circuit diagram of Arduino.................................................................................................11
Figure 3. 5: Arduino Uno board of IoT-based intelligent gas leakage detector......................................11
Figure 3. 6: Circuit diagram of WIFI......................................................................................................13
Figure 3. 7: Circuit Diagram of IoT-based intelligent gas leakage detector using Arduino...................14
Figure 3. 8: All components of the project...............................................................................................23
Figure 3. 9: Mq2 gas sensor.....................................................................................................................24
Figure 3. 10:writing the code....................................................................................................................24
Figure 3. 11: Assembling of project.........................................................................................................28
Figure 3. 12: powering the project............................................................................................................29
Figure 3. 13: testing the project...............................................................................................................30

v
ACKNOWLEDGMENTS
In the word no work has been completed smoothly where there is no guidance and help. The
project work is the result of an effort of more than three-month duration during which I have
been accompanied and supported by many people. It is a pleasure that I have now the
opportunity to express my gratitude to all of them.

Firstly, I offer millions of thanks to God, who has given me strength to complete this project
successfully. At the very beginning, I would like to express my immense gratitude and delightful
thanks to Mr. David Ochieng, trainer, department of Electrical and Electronics Engineering,
Kabete National Polytechnic for giving me an opportunity to work on this topic, in which I found
interest. My respect is also due to him for his wisdom, guidance, supervision and faithful
discussion with me throughout the work.

I would also like to extend my warmest thanks to my supervisor Mr. Sadrin Karani, Trainer of
Electronics. He not only agrees to supervise the project wholeheartedly, but from the beginning
of my study here, he supported me with incessant generosity.

Not forgetting to thank all staff members of Electrical and Electronics Engineering Department
and the polytechnic as a whole for their full support and motivation.

Finally big thanks to my parents, to my family and friends for their invaluable encouragement
and support all the way.

vi
ABSTRACT
This project proposes the design and implementation of an Internet of Things (IoT) gas leak
detector and auto exhaust system using Arduino. The system is designed to detect the presence of
gas in the air and automatically activate an exhaust fan to remove the gas, shut down valves and
send sms notifications and calls and to alert and prevent hazards. The gas concentration level is
displayed on an LCD display and an LED indicator provides a visual alert if the concentration
level reaches a dangerous threshold. The system is also equipped with a Wi-Fi module, which
allows it to connect to the internet and send alerts to a remote user if the gas concentration level
exceeds a certain threshold. The gas sensor module used in the system is able to detect both
Carbon Monoxide (CO) and Liquefied Petroleum Gas (LPG), which are commonly found in
homes and other indoor environments. The proposed system is cost-effective, easy to use, and
can be integrated into an IoT network for remote monitoring and control. This system can
provide a useful solution for ensuring the safety of indoor environments and preventing potential
gas hazards.

vii
CHAPTER 1
1.0 Introduction/Background
Gas leaks can pose a serious threat to human health and safety, as well as damage to property.
Carbon Monoxide (CO) and Liquefied Petroleum Gas (LPG) are two of the most common types
of gas leaks that occur in indoor environments. CO is a colorless, odorless, and tasteless gas that
is produced by incomplete combustion of fossil fuels, and can cause headaches, dizziness,
nausea, and even death in high concentrations. LPG is a flammable hydrocarbon gas that is used
in many heating appliances, cooking equipment, and vehicles, and can pose a fire or explosion
risk if not properly handled.

To address the issue of gas leaks, various gas detection systems have been developed to detect
and alert people to the presence of gas in the air. However, most of these systems are either too
expensive, complex, or require specialized training to operate.

The rise of the Internet of Things (IoT) has made it possible to develop more cost-effective and
user-friendly gas detection systems that can be easily integrated into smart home networks. This
project proposes the design and implementation of an IoT-based gas leak detector and auto
exhaust system using Arduino, which can detect the presence of CO and LPG in the air and
automatically activate an exhaust fan to remove the gas and prevent any hazards.

1.1 Problem Statement


There is a need for a gas detection system that can be integrated into an IoT network for remote
monitoring and control, and can send alerts to a remote user if the gas concentration level
exceeds a certain threshold. The proposed solution is an IoT-based gas leak detector and auto
exhaust system using Arduino, which is cost-effective, user-friendly, and can detect both CO and
LPG in the air. The system is designed to automatically activate an exhaust fan to remove the gas
and prevent any hazards and to it can be easily installed in homes, offices and other indoor
environments.

The proposed system is equipped with a gas sensor module, LCD display, LED indicator, Wi-Fi
module, and GSM module, and can be controlled through a user-friendly interface. The system is
also able to send alerts to a remote user if the gas concentration level exceeds a certain threshold.

1
1.2 Justification
A gas leakage detector is an essential safety device that detects the presence of gas and alerts
people before a hazardous situation arises. An IoT-based gas leakage detector using an Arduino
can detect the gas leakage quickly and notify people using various mediums such as email, SMS,
or mobile notifications. The Arduino board is cost-effective compared to other microcontrollers,
and it is easy to program, making it an excellent option for designing an IoT-based gas leakage
detector. The IoT-based gas leakage detector using an Arduino can monitor gas levels in real-
time and generate alerts if the levels exceed the safe limit. This feature ensures that people can
take corrective action promptly, minimizing the risk of accidents and fatalities. With IoT
technology, the gas leakage detector can be monitored remotely, giving property owners and
managers a way to keep tabs on gas levels from anywhere in the world. This feature is especially
beneficial for businesses that operate across multiple locations. An IoT-based gas leakage
detector using an Arduino can be integrated with other smart home automation systems, allowing
property owners to automate and control various home functions, including heating, cooling, and
ventilation systems. The IoT-based gas leakage detector using an Arduino can run on low power,
making it an energy-efficient solution for gas detection. In conclusion, an IoT-based gas leakage
detector using an Arduino is a justified solution for gas detection as it provides early detection, is
cost-effective, monitors gas levels in real-time, can be monitored remotely, can be integrated
with other smart home automation systems, and is energy-efficient.

1.3 Objectives
1.3.1 Main Objective
The objective of this project is to develop an IoT-based gas leak detector and auto exhaust
system using Arduino that can detect gas leaks in real-time and prevent dangerous build-up of
gases by automatically venting the area.

1.3.2 Specific Objectives


 To prevent outbreak of fire due to presence of LPG that causes explosions hence death and
destruction of property.
 To provide a vital way of monitoring the concentration of gases within our surrounding
areas.

2
1.4 Specifications of Components
1. 5V DC USB cable
2. WIFI module ESP8266
3. 16 x 2 LCD 5DC size 84mm by 44mm blue backlight
4. Electromagnetic small buyer of 5DC
5. Small 5DC fan
6. MQ-2 Gas sensor
7. Arduino Nano ATmega
8. Red and Green 5mm LED bulbs
9. 22 AWG gauge Jumper wires
10. 8.2mm x 5.5mm Breadboard
11. uf and nF ceramic capacitors
12. pull up and series resistors
13. NPN Transistors
14. Push buttons
15. Crystal oscillator
16. Regulator
17. Diodes
18. Adapter
19. Switch
20. IC
21. IC sockets
22. GSM SIM800L module

3
CHAPTER 2
LITERATURE REVIEW
2.1 Related work
The issue of gas leaks and the need for gas detection systems has been a topic of research and
development for several decades. Various types of gas sensors have been developed, such as
semiconductor sensors which have their own advantages and disadvantages. The development of
semiconductor gas sensors can be traced back to the mid-1950s when researchers at the Bell
Telephone Laboratories discovered that certain metals and metal oxides exhibited changes in
electrical conductivity when exposed to certain gases. This discovery led to the development of
the first semiconductor gas sensor in the early 1960s by G. E. Hagen and H. Scheel at the
Siemens Research Laboratory in Germany. They work on the principle of gas adsorption and
desorption on the surface of a semiconductor material, which leads to changes in the electrical
conductivity of the material. However Semiconductor gas sensors may be affected by changes in
temperature, which can affect their accuracy and reliability.

In recent years, the rise of the Internet of Things (IoT) has led to the development of more cost-
effective and user-friendly gas detection systems that can be easily integrated into smart home
networks. Several studies have been conducted on the development of IoT-based gas detection
systems using Arduino. For example, in a study by B. K. Panda et al. (2020), an IoT-based gas
detection system using Arduino and Wi-Fi was developed, which was able to detect multiple
gases, including CO, LPG, and Methane, and send alerts to a mobile application.

Another study by G. Ahirwal et al. (2019) proposed an IoT-based gas leakage detection and
control system using Arduino and Zigbee, which was able to detect and control gas leaks in real-
time, and provide remote monitoring and control through a web application.

Overall, these studies demonstrate the potential of IoT-based gas detection systems using
Arduino to provide a cost-effective, user-friendly, and reliable solution for preventing gas
hazards in indoor environments. However, more research is needed to improve the accuracy and
reliability of these systems and to develop new features, such as auto-exhaust systems, to further
enhance their effectiveness.

4
CHAPTER 3
3.0 METHODOLOGY
3.1 Introduction
The gas leakage detection process begins with a gas sensor, which is connected to the Arduino.
The gas sensor is designed to detect the presence of specific gases, such as carbon monoxide,
natural gas, or propane. The gas sensor sends data to the Arduino, which processes the data and
determines if there is a gas leak. If the Arduino detects a gas leak, it triggers an alarm to alert the
user and activates the exhaust fan. The exhaust fan is connected to the Arduino and is
programmed to automatically turn on when a gas leak is detected. The fan pulls air from the area
and vents it to the outside, preventing the accumulation of dangerous gases. The auto-exhaust
feature is designed to automatically turn off the exhaust fan when the gas concentration drops
below the danger level.

3.2 Block diagram(s) of the system

Red Green 16 x 2 LCD Display

5V power supply LED LED

ESP8266

WIFI module
GSM SIM800l module
Arduino nano

Fan
MQ 2 gas sensor

Buzzer

Figure 3.1: Block Diagram of IoT based intelligent Gas leakage Detector using Arduino

5
3.3 Design and Implementation
The design and implementation of the project aims at addressing the critical issue of gas leakage
by using the power of Internet of Things (IoT) and Arduino technology. Due to increased
concern on safety in residential and industrial environments, the smart gas leakage detector
offers a reliable and efficient solution.

The system incorporates an Arduino microcontroller, which acts as the brain of the device. The
Arduino works with sensors such as gas sensors to detect presence of dangerous and highly
flammable gases in the environment. The sensors continuously monitor the air quality to enable
detection and measurement of gas level.

The device is integrated with IoT capabilities that enable the system to communicate with a
centralized server or cloud platform, enabling remote monitoring and control. By imposing this
connectivity, users can receive instant alerts and notifications on their smartphones in case of a
gas leak.

In addition, the device offers advanced features such as data logging and analytics. The device
stores gas level readings over time, allowing users to access historical data for analysis and trend
monitoring. This data driven approach facilitates proactive maintenance and improves overall
safety measures.

3.3.1 Hardware design


3.3.1.1 Power Supply
Typically, an Arduino board requires 5VDC power supply, which can be provided by a USB
cable or a DC power supply. The project will use a simple DC power jack that will be used to
connect the power source directly to the Arduino hence no rectifier will be needed.

Power Consumed by WIFI module

The WIFI module used in construction of the project will be ESP8266 which has a power
consumption of 70ma when transmitting data and 20ma when in standby mode. Power
consumption will be calculated as follows;

Power consumption in standby mode = 20ma x 0.5 hours = 10ma

6
Power consumption in transmit mode = 70ma x 0.5 hours = 35ma

Total power consumption = power consumption in standby mode + power consumption in


transmit mode

10ma + 35ma = 45ma

Therefore, the total power consumed by the WIFI module of the project when it spends its half of
the time in standby mode and half of the time in transmit mode is 45ma.

Power Consumed by LCD

The project will use 16x2 LCD characters that operates at 5DC. A current rating of 20ma will be
used for the LED backlight of the LCD.

Assuming the LCD is in use for an hour total capacity consumed is calculated as follows;

Capacity consumed = (operating voltage x current rating x time capacity consumed

(5V x 20ma) x 1 hour capacity consumed = 100mWh

The voltage required by the LCD of an IoT based intelligent gas leakage detector using Arduino
is 5DC.

Power consumed by the Buzzer

An electromagnetic buzzer of operating voltage of 5V DC is suitable for this project with a


current of 30ma.

The capacity consumed will be calculated as follows;

Capacity consumed = (operating voltage x current rating) x time capacity consumed

(5V x 30ma) x 1 hour capacity consumed = 150ma

7
Figure 3.2: Circuit diagram of buzzer

Power consumed by fun

The fun used in this project will be a small DC fan of 5DC voltage with a current rating of
100ma.

The total capacity used for this project will be calculated as follows per hour;

Capacitor consumed = (operating voltage x current rating_ x time capacity consumed

(5V x 100ma) x 1 hour capacity consumed = 500ma

LCD display

A character LCD of 16x2 with 5DC will be used in this device as it is simple to use and requires
fewer pins to interface in the Arduino board. LCD provides a visual interface for the user to
interact with the device.

It has 7 digital output pins which are connected to the Arduino as follows;

Pin1 (VSS) – connected to the ground

Pin 2 (VDD) – connected to +5V power supply

Pin3 (VO) – connected to a potentiometer that controls the contrast of the display

Pin 4 (9RS) – connected to a digital output pin on the Arduino board to select mode of operation
(command or data)

8
Pin 5 (RW) – connected to ground to set the LCD in write mode

Pin 6 (E) - connected to a digital output pin on the Arduino board to enable LCD to accept
commands or data

Pin 7-14 (D0-D7) – connected to digital output pins on the Arduino board to send data to the
LCD

Figure 3.3: Circuit diagram of LCD

Gas Sensor Module

This is the sensing element of the gas leakage detector. It detects the presence of gas in the air
and sends the data to the Arduino board.

The project will use MQ-2 gas sensor that is commonly used in detecting leaks such as LPG,
propane, methane, hydrogen, CO and other gases. It can detect gas concentrations in range of
200-10,000ppm.

MQ-2 gas sensor works on the principle of the metal oxide semiconductor (MOS) sensor. It
consists of a sensing element of tin dioxide (SnO2) that is heated to a high temperature using a
small heater element. When the sensor comes in contact with the target gas, the gas molecule are
absorbed on the surface of the SnO2 sensing element, which changes its electrical conductivity.

The change in conductivity of the sensing element is detected by signal conditioning circuitry of
the MQ-2 sensor module, which converts the analog signal into digital signal that can be read by
the Arduino board. The analog output voltage from the MQ-2 sensor is proportional to the

9
concentration of target gas in the air. Arduino board can then use this information to determine
the gas concentration level and trigger alerts.

Arduino Board

The Arduino board is the brain of the system. It receives the gas sensor data and processes it
using an algorithm to determine if there is a gas leak or not. If a gas leak is detected, it triggers
an alert.

It features 14 digital input/output pins, 6 analog inputs and a variety of other features that makes
it easy to interface with other sensors and devices.

The Arduino board communicates with the MQ-2 gas sensor module, LCD display, buzzer and
other devices interfaced with it using digital or analog pins. These pins are used to read sensor
data, send output signals and control the behavior of the various components of the gas leakage
detector.

The MQ-2 gas sensor is connected to the Arduino board via analog output signal from the sensor
and converts it into a digital value. The LCD display is connected to the board using digital input
pins which are used to send data and control signals to the display

Similarly the buzzer and any other components used in the project are connected to the Arduino
board using appropriate input pins and other interfaces such as PWM (pulse width modulation)
for controlling intensity of buzzer.

In addition to connecting and controlling the various parts of the IoT-based intelligent gas
leakage detector, the Arduino board runs the software or firmware that determines the behavior
of the device. This software typically includes algorithms for detecting gas leaks, processing
sensor data, triggering alarms or alerts and communicates with other devices or systems via
WIFI or other communication interfaces.

10
Figure 3.4: Circuit diagram of Arduino Nano

Figure 3.5: Arduino Nano board of IoT-based gas detector

The fan

5DC brushless fan will be used in designing of this project due to its low noise and high
efficiency. The fan can be powered by a wide range of voltage

It can be controlled by the Arduino board, which can turn it on or off depending on the gas
sensor data. For example, if the gas sensor detects a high concentration of gas, the Arduino board

11
can turn on the fan to distribute the gas across the sensor for a more accurate reading.
Conversely, if the gas sensor data is low or normal, the fan can be turned off to conserve power

WIFI module

ESP8266 WIFI module will be used in the construction of this project since it’s relatively has
low cost, easy to use and provides reliable WIFI connectivity over a range distance.

This WIFI module consists of a microcontroller and WIFI transceiver. The microcontroller is
responsible for managing WIFI connection and handling data transfers between the gas sensor,
LCD display, buzzer and other components of the device. The WIFI transceiver is responsible
for transmitting and receiving data over the wireless network.

To use the ESP8266 WIFI module in an IoT-based intelligent gas using Arduino, first it is
connected to the Arduino board using serial communication and then program the Arduino board
to interact with the gas sensor, LCD display, buzzer and other components of the device using
the ESP8266 module to transmit and receive data wirelessly.

To connect to WIFI network, the ESP8266 module needs to be programmed with the name and
password. Once connected, the module can transmit and receive data over the network, allowing
the gas leakage detector to communicate with other devices or systems.

Figure 3.6: Circuit diagram of WIFI

12
IoT

AWS IoT (Amazon Web Services) will be used. The purpose of IoT for this device is to enable
remote monitoring and control of the device as well as to provide real-time alerts and
notifications the event of gas leak. By connecting the internet through a WIFI module, it can
transmit data to a cloud-based IoT platform, where it can be analyzed. This data include
information such as gas levels, temperatures and humidity.

By using an IoT platform, the gas leakage detector can also be remotely controlled, allowing
users to turn off the buzzer or fan for example from their smart phones or computer.

In general the purpose of IoT in an IoT-based gas leakage detector is to enhance the devices
functionality, enabling it to provide more accurate and timely information about gas leaks and
allowing for greater control and flexibility in its operations.

CIRCUIT DIAGRAM

Figure 3.7: Circuit Diagram of IoT-based intelligent gas leakage detector using Arduino

13
3.3.1.2 Sensing block 1
The project will entail the following components as part of the sensing block;

Gas Sensor: The gas sensor is the primary sensing component that detects the presence of gas.
There are various gas sensors available in the market, such as MQ-2, MQ-5, MQ-135, etc. These
sensors can detect different types of gases, including LPG, methaneand carbon monoxide.
Temperature and Humidity Sensor (Optional): In addition to gas detection, you may want to
monitor the temperature and humidity levels in the environment. This can provide additional
context and help identify potential risks or false alarms. Common temperature and humidity
sensors include DHT11 and DHT22.

Arduino Board: Arduino Nano is the central control unit of the gas leakage detector. It collects
data from the sensors, processes it, and controls the overall operation of the system.

Power Supply: I will use a suitable power supply to power the Arduino board and the sensing
components. That is USB connection to a computer.

Wiring and Breadboard: I will use appropriate jumper wires and a breadboard to connect the gas
sensor, temperature and humidity sensor, and Arduino board. I will ensure that the connections
are secure and correct to avoid any electrical issues.

It's important to note that the exact connections and circuitry depend on the specific gas sensor
and other components that I will use. Reference to the datasheets and documentation of the
sensors to understand their pin configurations and wiring requirements will be of help in
construction and designing of the project.

Once the necessary sensing parts have been assembled, I will connect them to the Arduino board
and program it to read data from the sensors. I will use the Arduino IDE and appropriate libraries
for the gas sensor and any additional sensors included. The Arduino code will read the sensor
values, process them, and trigger appropriate actions or alerts based on predefined thresholds or
conditions.

Additionally, to make the system IoT-enabled, I will integrate a Wi-Fi module, such as ESP8266
with the Arduino board. This will enable the transmission of sensor data to an IoT platform or
server for further analysis and remote monitoring.

14
3.3.1.3 Actuating Section 1
To actuate an IoT-based intelligent gas leakage detector using Arduino, you I will incorporate
various actuating components to trigger actions in response to gas detection. Here are some
actuating parts I will use:

Buzzer: When a gas leak is detected, the Arduino will activate the buzzer to generate a loud
sound, alerting occupants of the potential danger. The buzzer works by converting electrical
signals into sound waves.

LED Indicators: LED indicators will be incorporated to provide visual feedback. The LEDs will
be connected to the Arduino board be illuminated when a gas leak is detected.

Red LED will indicate the gas level has passed the required threshold whereas green LED will
indicate the gas level is at required level.

GSM SIM800L Module:

Notifications/Alerts: I will integrate the Arduino with a Wi-Fi module and use protocols like
MQTT or HTTP to communicate with an IoT platform or cloud service. When a gas leak occurs,
the Arduino can send a message to the platform, which can then trigger notifications via email,
SMS, or mobile applications.

Steps of implementing actuation of IoT-based gas leakage detector using Arduino

 Identifying the actuating components to incorporate into the system, such as a buzzer,
LEDs, relay, solenoid valve, or notifications.
 Connect the actuating components to appropriate digital or analog pins of the Arduino
board.
 Write the Arduino code to control the actuating components based on the gas sensor
readings.
 Define thresholds or conditions for triggering the actuations. For example, when the gas
concentration exceeds a certain level, activate the buzzer, illuminate LEDs, or trigger the
relay.
 Test and fine-tune the actuation logic to ensure proper functionality.

15
 Integrate IoT connectivity and add the necessary code to establish a connection to the Wi-
Fi network and communicate with the IoT platform or cloud service.
 Modify the code to send gas sensor data and trigger notifications or alerts when a gas leak
is detected.
 Deploy and monitor the IoT-based gas leakage detector, ensuring that all actuating
components are functioning correctly.

I will prioritize safety when designing and implementing gas detection systems and follow
relevant safety guidelines and regulations to ensure the proper functioning and installation of the
gas leakage detector.

The software development of an IoT-based intelligent gas leakage detector using Arduino
involves writing code to control the Arduino board, interface with the sensors, handle data
processing, and establish IoT connectivity. Here's a brief description of the software
development process:

 Set up the Arduino IDE. Install the Arduino Integrated Development Environment (IDE)
on the computer. The IDE provides a platform to write, compile, and upload code to the
Arduino board.
 Define Libraries. Identify and install the required libraries for the gas sensor, temperature
and humidity sensor (if used), and any other components you to incorporate. These
libraries provide pre-built functions and code examples to interface with the sensors.
 Sensor Initialization. In the Arduino setup function, initialize the gas sensor and any other
sensors to be used. Set up the necessary pin modes and configurations.
 Sensor Data Reading. In the Arduino loop function, continuously read data from the gas
sensor and other sensors. Retrieve the sensor readings using appropriate functions
provided by the sensor libraries.
 Data Processing and Actuation. Process the sensor data as needed. Compare the readings
against predefined thresholds to determine if a gas leak has occurred. If a gas leak is
detected, activate the desired actuating components, such as a buzzer, LEDs, or relay.
 IoT Connectivity. Integrate a Wi-Fi module, such as ESP8266 or ESP32, to enable IoT
connectivity. Configure the Wi-Fi module to connect to your local Wi-Fi network.

16
 Data Transmission. Establish a connection to the IoT platform or cloud service using
protocols like MQTT or HTTP. Transmit the sensor data, including gas sensor readings,
temperature, humidity, and actuation status, to the IoT platform for further analysis and
monitoring.
 Remote Monitoring and Alerting. Set up appropriate notifications or alerts in your IoT
platform to receive real-time notifications when a gas leak is detected. This can be done
via email, SMS, or mobile applications.
 Debugging and Testing. Test the software implementation thoroughly to ensure proper
functioning of the gas leakage detector. Use serial debugging to print debug information
to the Arduino IDE's serial monitor and identify any issues or errors.
 Optimization and Refinement. Optimize the code for efficiency, memory usage, and
performance. Refine the actuation thresholds and logic based on real-world testing and
feedback.
 Deployment. Once the software is tested and functioning correctly, upload the final code
to the Arduino board and integrate it into the gas leakage detection system.

17
3.3.2 Software development
To develop an IoT-based gas detection system using Arduino Nano, NodeMCU, Blynk push
notification, and a GSM module for call and SMS functionality, you'll need to follow these steps:
Set up the Hardware:
Connect the Arduino Nano and NodeMCU to the breadboard.
Connect the MQ-2 gas sensor, LCD display, WIFI module, GSM module, red LED bulb, green
LED bulb, DC fan, and buzzer to the appropriate pins of the Arduino Nano and NodeMCU.
Use jumper wires to establish connections between the components and the Arduino Nano and
NodeMCU. Refer to the pin connections in the code provided earlier for reference.
Install Required Libraries:
Install the Blynk library for Arduino IDE. Open the Arduino IDE, go to "Sketch" > "Include
Library" > "Manage Libraries," search for "Blynk," and install the library.
Install any other required libraries such as Wire.h, hd44780.h,
hd44780ioClass/hd44780_I2Cexp.h, and DFRobotDFPlayerMini.h. You can install them in a
similar manner through the Arduino IDE's Library Manager.
Create a Blynk Project:
Download the Blynk app on your smartphone and create a new Blynk project.
Obtain the Blynk auth token from the project settings in the app. You'll need this token in the
code to establish the connection with Blynk.

Write the Code:


#include <Blynk.h>

#include <Wire.h>

#include <hd44780.h>

#include <hd44780ioClass/hd44780_I2Cexp.h>

#include <DFRobotDFPlayerMini.h>

const char* ssid = "Quality Air Net";

const char* password = "Quality254";

const char* server = "https://docs.blynk.io/";

const int serverPort = 80;

18
const int gasSensorPin = A0;

const int gasThreshold = 100;

hd44780_I2Cexp lcd;

DFRobotDFPlayerMini mp3;

const int fanPin = A1;

const int buzzerPin = A2;

const int greenLEDPin = A3;

const int redLEDPin = A4;

const int solenoidPin = A5;

void setup() {

Serial.begin(115200);

lcd.begin(16, 2);

mp3.begin(Serial);

pinMode(fanPin, OUTPUT);

pinMode(buzzerPin, OUTPUT);

pinMode(greenLEDPin, OUTPUT);

pinMode(redLEDPin, OUTPUT);

pinMode(solenoidPin, OUTPUT);

mp3.begin(Serial);

mp3.volume(15);

19
void loop() {

int gasLevel = analogRead(gasSensorPin);

if (gasLevel > gasThreshold) {

sendDataToServer(gasLevel);

activateAlarm();

makeCall();

} else {

deactivateAlarm();

delay(1000);

void sendDataToServer(int gasLevel) {

void activateAlarm() {

digitalWrite(fanPin, HIGH);

digitalWrite(buzzerPin, HIGH);

digitalWrite(greenLEDPin, LOW);

digitalWrite(redLEDPin, HIGH);

digitalWrite(solenoidPin, HIGH);

20
void deactivateAlarm() {

digitalWrite(fanPin, LOW);

digitalWrite(buzzerPin, LOW);

digitalWrite(greenLEDPin, HIGH);

digitalWrite(redLEDPin, LOW);

digitalWrite(solenoidPin, LOW);

void makeCall() {

Serial.println("Making a call...");

Serial.println("ATD+254721471026;");

delay(10000);

Serial.println

Serial.println("Call ended.");

3.3.2.1 Algorithm
Set up the Hardware:

Connect the Arduino Nano and NodeMCU to the breadboard.

Connect the MQ-2 gas sensor, LCD display, WiFi module, GSM module, red LED bulb, green
LED bulb, DC fan, and buzzer to the appropriate pins of the Arduino Nano and NodeMCU using
jumper wires.

Initialize the Libraries and Variables:

Include the necessary libraries for Blynk, gas sensor, LCD display, GSM module, etc.

Define variables for gas sensor pin, gas threshold level, pin assignments for LEDs, fan, buzzer,
etc. Set up the Blynk authentication token.

21
Set up the Hardware and Connections:

Initialize the LCD display and any other hardware components.

Set the pin Mode for LEDs, fan, buzzer, and other pins.

Set up the Blynk Connection:

Establish a connection with the Blynk server using the Blynk library.

Connect to the WIFI network using the NodeMCU and provide the necessary credentials.

Read Gas Sensor Data:

Read the analog value from the gas sensor pin using the analog Read () function.

Convert the analog value to a gas level value or any relevant unit of measurement.

Gas Level Check:

Compare the gas level value with the predefined gas threshold level.

If the gas level exceeds the threshold, proceed with the following steps; otherwise, skip to the
next gas level reading.

Activate Alarm and Safety Measures:

Turn on the fan, buzzer, and red LED to alert the user about the high gas level.

Open the solenoid valve or take any other safety measure required to mitigate the gas presence.

Send Data to Blynk:

Use the Blynk.virtualWrite() function to send the gas level data to the Blynk app.

This data can be used to display the gas level on the Blynk app dashboard.

Push Notification:

Send a push notification to the Blynk app using the Blynk.notify() function.

The notification can contain a message indicating the high gas level and the required action.

Make a Call:

Use the GSM module to make a call to a predefined phone number.

Use the appropriate AT command to initiate the call.

22
Wait for a specific duration to establish the call connection.

End the call using the ATH command.

Deactivate Alarm and Safety Measures:

Turn off the fan, buzzer, and red LED.

Close the solenoid valve or perform any necessary actions to ensure safety.

Loop and Delay:

Repeat the above steps periodically in the loop () function.

Use a delay to control the frequency of gas level readings and system operation.

That's the algorithm for an IoT-based gas detection system using Arduino Nano, NodeMCU,
Blynk push notification, and a GSM module for call and SMS functionality.

3.3.3 Implementation process


To implement an IoT-based gas detection system using Arduino and NodeMcu with Blynk push
notifications and a GSM module for call and SMS alerts, I will need the following components
and steps:

Components:

Arduino nano board

NodeMcu board

Gas sensor module

GSM module

Blynk mobile application (available for Android and iOS)

Steps:

Set up the Arduino board:

Connect the gas sensor module to the Arduino board.

Connect the GSM module to the Arduino board.

Connect the NodeMcu board to the Arduino board using serial communication (UART).

23
Make sure the necessary libraries for the gas sensor module, GSM module, and Blynk are
installed.

Set up the Blynk mobile application:

Install the Blynk mobile application on your smartphone.

Create a new Blynk account and obtain an authentication token.

Configure Blynk in Arduino IDE:

Open the Arduino IDE and go to Sketch -> Include Library -> Manage Libraries.

Search for "Blynk" and install the Blynk library.

Include the Blynk library in your Arduino sketch.

Use the authentication token obtained in Step 2 to establish a connection between the Arduino
board and the Blynk app.

Code implementation:

Write the Arduino code to read data from the gas sensor module.

Set a threshold value for gas concentration, above which an alert will be triggered.

Use conditional statements to check if the gas concentration exceeds the threshold.

If the threshold is exceeded, send a push notification using Blynk.notify() function to the Blynk
app.

If the gas concentration is critical, use the GSM module to make a phone call or send an SMS to
a specified phone number.

Upload the code to the Arduino board:

Connect the Arduino board to your computer via USB.

Select the appropriate board and port in the Arduino IDE.

Click on the "Upload" button to upload the code to the Arduino board.

Test the system:

Open the Blynk mobile application on your smartphone.

Create a new project and select the appropriate hardware (NodeMcu).

Add the necessary widgets (e.g., notification widget) to the Blynk app interface.

24
Run the project and monitor the gas sensor readings.

If the gas concentration exceeds the threshold, you should receive a push notification on your
smartphone. If the gas concentration is critical, you should also receive a phone call or SMS
alert.

Figure 3.8: All components of the project

Figure 3.9: Mq2 gas sensor

25
Figure 3.10:writing the code

Figure 3.11: Assembling of project

26
Figure 3.12: powering the project

Figure 3.13: testing the project

27
28
CHAPTER 4

RESULTS CONCLUSION AND RECOMMENDATIONS


The following are results and analysis of IoT based intelligent gas leakage detector using
Arduino Uno board:

4.1 The results and analysis


It provides insights into the system's performance, gas detection accuracy, and effectiveness in
alerting and responding to gas leaks. Here are some key aspects to consider for results and
analysis.

Gas Detection Accuracy:

Measure the accuracy of the gas sensor in detecting different gas concentrations. Compare the
sensor readings against calibrated reference values to determine the accuracy and precision of the
gas detection.

Conduct tests with known gas concentrations to assess the detector's ability to differentiate
between safe levels and potentially dangerous gas levels.

Actuation Response:

Evaluate the response time and effectiveness of the actuating components (buzzer, LEDs, relay,
etc.) in alerting users to the gas leak. Measure the time it takes for the actuation to occur after
detecting the gas leak.

Assess the actuation mechanism's ability to capture attention and warn individuals in the vicinity
of the gas leak.

IoT Connectivity:

Verify the reliability and stability of the Wi-Fi connection between the Arduino Uno board and
the IoT platform or server.

Measure the time it takes for the gas sensor data to be transmitted to the IoT platform or server.

29
Confirm the successful reception of gas sensor data on the IoT platform and its availability for
further analysis and monitoring.

Notifications and Alerts:

Test the notifications and alerts mechanism (email, SMS, mobile app, etc.) to ensure that relevant
stakeholders receive timely and accurate information about the gas leak.

Evaluate the effectiveness of the notification system in alerting users in different scenarios and
assessing the system's ability to escalate notifications to appropriate parties, if necessary.

False Positive and False Negative Rates:

Analyze the occurrence of false positive and false negative readings. Identify any instances
where the detector incorrectly detects a gas leak (false positive) or fails to detect an actual gas
leak (false negative). Investigate and address potential causes of false readings.

System Reliability and Stability:

Assess the overall reliability and stability of the gas leakage detection system over an extended
period of operation.

Monitor and record any system failures, downtime, or issues that may affect the system's
performance.

Conduct regular maintenance and calibration to ensure continued accuracy and functionality.

User Feedback and Satisfaction:

Gather feedback from users and stakeholders regarding their experience with the IoT-based gas
leakage detector.

Seek input on the usability, effectiveness, and reliability of the system.

Use the feedback to identify areas for improvement and address any user concerns.

30
4.2 Conclusion
Basing on results and analysis of IoT based intelligent gas leakage detector using Arduino Uno
board, several conclusions can be drawn:

Effectiveness of Gas Leakage Detection: The gas leakage detector using the Arduino Uno board
has proven to be effective in detecting gas leaks. The sensor connected to the board accurately
detects the presence of gas, triggering an alert mechanism to notify users of potential danger.

Real-time Monitoring: The IoT capabilities of the gas leakage detector allow for real-time
monitoring of gas levels and leakages. The Arduino Uno board, when connected to the internet,
can send alerts or notifications to users' devices, enabling prompt action to mitigate the risks
associated with gas leaks.

Increased Safety: The integration of IoT technology and intelligent features enhances the safety
aspect of gas leakage detection. With the Arduino Uno board, the detector can not only detect
gas leaks but also automatically shut off the gas supply, preventing further leakage and potential
accidents.

User-Friendly Interface: The gas leakage detector's user interface, likely implemented through a
mobile application or web interface, provides users with an intuitive and easy-to-understand
platform for monitoring and controlling the detector. The Arduino Uno board's programming
capabilities allow for customization of the interface based on user preferences.

Scalability and Flexibility: The Arduino Uno board's open-source nature and wide community
support enable scalability and flexibility in the gas leakage detector's design and implementation.
Additional sensors or modules can be easily integrated into the system, allowing for the detection
of various types of gases or expanded functionalities.

Cost-Effectiveness: The Arduino Uno board, being an affordable microcontroller, contributes to


the overall cost-effectiveness of the gas leakage detector. The availability of inexpensive sensors
and components further enhances the affordability without compromising on functionality or
performance.

Limitations and Areas for Improvement: While the gas leakage detector using the Arduino Uno
board is a promising solution, some limitations may need to be addressed. For example, the

31
range of the wireless connectivity between the Arduino Uno board and the user's device might
have limitations. Additionally, the accuracy and sensitivity of the gas sensor may vary based on
environmental conditions, requiring calibration or periodic maintenance.

In conclusion, the IoT-based intelligent gas leakage detector utilizing the Arduino Uno board has
demonstrated effective gas leak detection, real-time monitoring, increased safety, user-friendly
interface, scalability, and cost-effectiveness. However, further refinements and enhancements
can be explored to address the system's limitations and improve overall performance.

4.3 Recommendations
Basing on the conclusion of the results and analysis of the IoT-based intelligent gas leakage
detector using Arduino Uno board, the following recommendations can be made to further
improve the system:

Enhance Wireless Connectivity. If the range of wireless connectivity between the Arduino Uno
board and user devices is limited, consider using alternative wireless technologies such as
Bluetooth, Zigbee, or Wi-Fi extenders to improve the coverage area and ensure reliable
communication between the detector and user devices.

Calibration and Maintenance. To address variations in accuracy and sensitivity of the gas sensor
based on environmental conditions, implement regular calibration procedures or provide user
instructions for periodic maintenance. This will help ensure consistent and reliable gas detection
performance.

Expand Gas Detection Capabilities. Depending on the specific application and requirements,
consider integrating additional gas sensors to detect a wider range of gases. This would enable
the detector to identify and alert users about multiple types of gas leaks, providing a more
comprehensive safety solution.

Implement Machine Learning Algorithms. To further enhance the intelligence of the gas leakage
detector, consider implementing machine learning algorithms. By analyzing historical data and
patterns, the system can learn to differentiate between normal fluctuations in gas levels and
actual gas leakages, reducing false alarms and enhancing overall accuracy.

32
Integrate Smart Home Integration. Enable integration with popular smart home platforms or
voice assistants such as Amazon Alexa or Google Assistant. This would allow users to control
and monitor the gas leakage detector using voice commands or through existing smart home
automation systems.

Provide Remote Control Features. Extend the functionality of the mobile application or web
interface to enable remote control of the gas leakage detector. This would allow users to
remotely activate or deactivate the gas supply, providing an added layer of convenience and
safety.

User Education and Documentation: Provide comprehensive user documentation, including setup
instructions, troubleshooting guides, and safety guidelines. Educate users about the potential
dangers of gas leaks, proper response procedures, and the importance of regularly testing and
maintaining the gas leakage detector.

Collaborate with Gas Service Providers. Establish partnerships or collaborations with gas service
providers to promote the adoption and installation of IoT-based gas leakage detectors. This can
help raise awareness, ensure compliance with safety regulations, and potentially offer incentives
for users to integrate the detectors into their gas supply systems.

By implementing these recommendations, the IoT-based intelligent gas leakage detector using
Arduino Uno board can be further improved in terms of functionality, performance, user
experience, and safety, providing a more robust and reliable solution for gas leak detection.

33
REFFERENCES OF THE PROJECT
Arduino Official Website: The official website of Arduino (https://www.arduino.cc/) provides
extensive documentation, tutorials, and examples for Arduino boards and their applications in
various projects.

NodeMCU Documentation: The NodeMCU documentation (https://nodemcu.readthedocs.io/)


offers detailed information about NodeMCU development boards, including pinouts,
programming, and usage.

Blynk Documentation: Blynk's official documentation (https://docs.blynk.io/) provides a


comprehensive guide to using the Blynk IoT platform, including setup instructions, widget
usage, and integrating hardware with Blynk.

MQ Gas Sensor Library: Depending on the specific gas sensor you are using, there may be
dedicated libraries available. Search for the library that corresponds to your gas sensor model to
access the necessary functions and examples.

GSM Module Datasheet and AT Commands: Obtain the datasheet or documentation for your
GSM module to understand its pinout, features, and communication protocols. The
documentation should also include a list of AT commands for making calls and sending SMS
messages.

Online Tutorials and Project Guides: Explore online platforms such as Instructables
(https://www.instructables.com/) and Hackster (https://www.hackster.io/) for project guides and
tutorials related to gas detection systems using Arduino, NodeMCU, Blynk, and GSM modules.
These platforms often provide step-by-step instructions, code examples, and hardware setup
details.

Arduino and NodeMCU Community Forums: Engage with the Arduino and NodeMCU
community forums, such as Arduino Forum (https://forum.arduino.cc/) and NodeMCU
Community (https://www.esp8266.com/), to seek guidance, ask questions, and learn from others'
experiences.

YouTube Video Tutorials: Search for video tutorials on YouTube that demonstrate the
development of gas detection systems using Arduino, NodeMCU, Blynk, and GSM modules.

34
Video tutorials can provide visual demonstrations and explanations that may be helpful in
understanding the implementation process.

35
APPENDICES
APPENDIX A
Code of the project

#include <Blynk.h>

#include <Wire.h>

#include <hd44780.h>

#include <hd44780ioClass/hd44780_I2Cexp.h>

#include <DFRobotDFPlayerMini.h>

const char* ssid = "Quality Air Net";

const char* password = "Quality254";

const char* server = "https://docs.blynk.io/";

const int serverPort = 80;

const int gasSensorPin = A0;

const int gasThreshold = 100;

hd44780_I2Cexp lcd;

DFRobotDFPlayerMini mp3;

const int fanPin = A1;

const int buzzerPin = A2;

const int greenLEDPin = A3;

const int redLEDPin = A4;

const int solenoidPin = A5;

36
void setup() {

Serial.begin(115200);

lcd.begin(16, 2);

mp3.begin(Serial);

pinMode(fanPin, OUTPUT);

pinMode(buzzerPin, OUTPUT);

pinMode(greenLEDPin, OUTPUT);

pinMode(redLEDPin, OUTPUT);

pinMode(solenoidPin, OUTPUT);

mp3.begin(Serial);

mp3.volume(15);

void loop() {

int gasLevel = analogRead(gasSensorPin);

if (gasLevel > gasThreshold) {

sendDataToServer(gasLevel);

activateAlarm();

makeCall();

} else {

deactivateAlarm();

37
delay(1000);

void sendDataToServer(int gasLevel) {

void activateAlarm() {

digitalWrite(fanPin, HIGH);

digitalWrite(buzzerPin, HIGH);

digitalWrite(greenLEDPin, LOW);

digitalWrite(redLEDPin, HIGH);

digitalWrite(solenoidPin, HIGH);

void deactivateAlarm() {

digitalWrite(fanPin, LOW);

digitalWrite(buzzerPin, LOW);

digitalWrite(greenLEDPin, HIGH);

digitalWrite(redLEDPin, LOW);

digitalWrite(solenoidPin, LOW);

void makeCall() {

Serial.println("Making a call...");

Serial.println("ATD+254721471026;");

38
delay(10000);

Serial.println

Serial.println("Call ended.");

39
APPENDIX B

Pin configuration of LCD display


16x2 LCD display typically has 16 pins. Here is a description of the pinout for a standard 16x2
LCD display:

VSS (Ground): Connected to the ground (0V) of the circuit.

VDD (Power): Connected to the power supply voltage (usually +5V).

V0 (Contrast): Connected to a potentiometer to control the contrast of the display.

RS (Register Select): Used to select the register for data or command input.

R/W (Read/Write): Used to select the read or write mode. Connected to the ground for write
mode.

E (Enable): Used to enable the LCD and latch the data.

7-14. D0-D7 (Data Lines): These are the bidirectional data lines connected to the microcontroller
for sending data and commands.

LED+ (Backlight Anode): Connected to the positive terminal of the backlight LED.

LED- (Backlight Cathode): Connected to the negative terminal of the backlight LED.

It's important to note that the pinout may vary depending on the specific LCD module you are
using. Some modules may have additional pins for features like backlight control or SPI
communication. Always refer to the datasheet or documentation provided with your specific
LCD module for accurate pinout details.

40
APPENDIX C
Pin configuration of Arduino Nano board
The Arduino Nano, based on the ATmega328P microcontroller, has the following pin
configuration:

+-----+

D13 1 |* | 30 GND

D12 2 | | 29 AREF

D11 3 | | 28 AVCC

D10 4 | | 27 PC7

D9 5 | | 26 PC6

D8 6 | | 25 PC5

D7 7 | | 24 PC4

D6 8 | | 23 PC3

D5 9 | | 22 PC2

D4 10 | | 21 PC1

D3 11 | | 20 PC0

D2 12 | | 19 PD7

D1 13 | | 18 PD6

D0 14 | | 17 PD5

VCC 15 | | 16 PD4

+-----+

41
The pin numbers (D0, D1, D2, etc.) correspond to the digital pins of the Arduino Nano.
Additionally, the ATmega328P microcontroller on the Nano also has analog input pins labeled
A0 to A7, which can be used for analog input or digital I/O.

42

You might also like