LPG Gas Leakage Detection using Arduino

LPG Gas Leakage Detection using Arduino

Nowadays, fire accidents and blasts due to LPG gas leakage is the major problem. At present, LPG gas can be used in home kitchen, car and gas go-down. But, due to some reasons the LPG gas might leak from the gas cylinders, this may cause the cylinder blast, fire accident, damage the house and risk of a life to the living persons in the house. The fire ignite can be occurred due to many reasons such as an electrical short circuit, oil lamps or candles kept inside the house. To overcome this problem, an LPG leakage detection system is used to detect the presence of the gas in the surrounding.

An LPG gas sensor is a one kind of device which is used to sense the presence of the leakage gas in the surrounding. This sensor is attached to an alarm or buzzer circuit to give an alert to the people through a sound.

Overview

Arduino is the main controlling unit of the robot. Out of the 19 available digital and analog I/O pins, 6 pins are used in this project design.

MQ2 gas sensor is an electronic sensor used for sensing the concentration of gases in the air such as LPG, propane, methane, hydrogen, alcohol, smoke and carbon monoxide.

MQ2 is a metal oxide semiconductor type gas sensor and contains a sensing element, mainly aluminium-oxide based ceramic, coated with Tin dioxide, enclosed in a stainless steel mesh. Concentrations of gas in the gas is measured using a voltage. The output voltage range lies between the 0 volts to 5 volt. This sensor works on 5V DC input voltage. It can detect gases in the concentration of range 200 to 10000ppm.

MQ2 gas sensor have 4 pins: Vcc, DO, AO and Gnd. Vcc and Gnd are connected to the +5v and GND pins of the Arduino. DO is a short form of digital output it can use to get digital output from this pin, by setting a threshold value using the potentiometer.  AO is a short form of analog output this pin outputs 0-5V analog voltage based on the concentration of the alcohol.

A light-emitting diode (LED) is a semiconductor device that emits light when passed through an electric current. LEDs are mainly used in this project as indicator lights (such as power on/off lights) on alcohol detector devices.

A Buzzer is an audio signaling device that is used to alert the people through a sound when the gas leakage occurs.

About Component

Arduino

Arduino Uno is an ATmega 328p Microcontroller based prototyping board. It is an open source electronic prototyping platform that can be used with various sensors and actuators.

Arduino Uno

MQ2

There 4 leads are +5V, AOUT, DOUT, and GND.

The +5V and GND leads establishes power for the gas sensor. The other 2 leads are AO (analog output) and DO (digital output).

MQ2

LED

LED (Light Emitting Diode) is basically a small light emitting device that comes under semiconductor electronic components. It has two terminals (anode and cathode) of a LED when connected to a voltage source in the correct polarity, may produce lights of different colours, as per the semiconductor substance used inside it.

5 mm led

RGB LED means red, blue and green LEDs. RGB LED products combine these three colours to produce over 16 million hues of light

RGB

Buzzer

A buzzer is basically a speaker that you can connect directly to an Arduino.

Electric buzzer wok on the principle of Piezoelectricity. Piezoelectricity is an effect where certain crystals will change shape when you apply electricity to them. By applying an electric signal at the right frequency, the crystal can make sound.

Breadboard

A breadboard is a rectangular plastic board with a bunch of small holes in it. These holes let you easily insert electronic components to temporary electronic circuits (meaning to build prototype and test an early version of) like battery, switch, resistor, and an LED (light-emitting diode).

The top and bottom 4 rows are Connected horizontally and middle holes are connected vertically.

breadboard1

Components needed for this Arduino Project

  • Arduino Uno
  • MQ2 Sensor Module
  • Male and Female jumper wire
  • LED (Green and Red)
  • Breadboard
  • Resistor

Circuit Schematics

circuit-1

Building Connection

Step 1

 First of all, connect the Arduino board with laptop or computer.

Step 2

Install the Arduino software on the computer.

Step 3

Open the Arduino software. The following screen will appear.

Step 4

You can see the Main page of the software.

Step 5

Then, open the new page on the software.

Then select the File→ New.

A new page opens on the Arduino software.

Step 6

I have given a source code that you can use or you can use your own source code.

Then, select File → open → select written program →open the program.

Open the program folder.

 

Select the program and open it.

Step 7

Click TOOL-  Select BOARD – then press ARDUINO/GENUINO UNO.

Again Select TOOL >> Select a PORT >> COM3 ARDUINO UNO

Step 8

Verify the program or compile the program

Step 9

Then connect the Arduino to the laptop and upload the code in Arduino

Step 10

Connect the hardware as per the connection diagram given for the LPG gas leakage detecto.

Step 11

Then the LPG gas leakage detecto will start working.

Interpretation of Code

int LED1 = 12;
int LED2 = 11;
int buzzer = 10;
int GasA0 = A5;
int sensorThreshold = 400;
 

LED1(Red LED), LED2 (Green LED), and Buzzer have taken as an integer variable (int).

LED1, LED2 and  Buzzer has attached to corresponding pin 12, 11 and 10 that indicate as an output signal.

LPG Sensor Pin A0 has taken as an input variable that sensing leakage of LPG Gas and it has attached to analog pin A5.

The Maximum reachest threshold value is 400 which is a healthy limit.

 

Code

int LED1 = 12;
int LED2 = 11;
int buzzer = 10;
int GasA0 = A5;
int sensorThreshold = 400;

void setup() {
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(GasA0, INPUT);
  Serial.begin(9600);
}

void loop() {
  int analogSensor = analogRead(GasA0);

  Serial.print("Pin A0: ");
  Serial.println(analogSensor);
  
  if (analogSensor > sensorThreshold)
  {
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, LOW);
    tone(buzzer, 1000, 200);
  }
  else
  {
    digitalWrite(LED1, LOW);
    digitalWrite(LED2, HIGH);
    noTone(buzzer);
  }
  delay(100);
}
 
Name (required)E-mail (required)Website

Leave a Reply