LPG gas leakage detector using Arduino

It is a useful Arduino based LPG gas leakage detector & alarm system. You can make it using Arduino Nano or Arduino Uno board. download Arduino code for LPG leakage detector.

Here we are using an MQ2 gas sensor module & a 16×2 LCD for alert display. The MQ2 sensor can detect LPG ( liquefied petroleum gas) which is used for our cocking GAS, gas lighter & some industrial purpose.

lpg gas leakage detector using arduino
lpg gas leakage detector using arduino

You need to make

  • Arduino Nano
  • 16X2 (1602) LCD Display
  • MQ2 gas sensor
  • Active Buzzer
  • 10K Potentiometer
  • Female header pins
  • Perfboard or dotted board
  • For power
  • 5v charger or power bank

You can use 9 volt as power source. connect 9v + to Arduino VIN pin & (-) to Arduino Gnd pin.

How does it work

lpg gas leakage detector using arduino
lpg gas leakage detector using arduino

The mq2 sensor detects if LPG is present in the air & its D0 pin become high. D0 is connected to Arduino pin D7. according to code, when the Arduino D7 pin gets high, the buzzer turns on & the LCD show ” LPG Gas Leakage Alert “.

Connection

lpg gas leakage detector using arduino circuit
lpg gas leakage detector using arduino circuit

Connect all parts according to circuit diagram.

Mq2 gas sensor D0 pin connected to Arduino D7 pin & gas sensor Vcc is connected to Arduino 5v & GND to Arduino GND.

LCD connection details

LCD pin 1 VSS is connected to Arduino GND

LCD VCC is connected to Arduino 5V

LCD VEE/ Vo is connected to 10K Potentiometer middle pin

LCD RS is connected to Arduino D12

LCD R/W is connected to Arduino GND

LCD E is connected to Arduino D11

LCD D4 is connected to Arduino D5

LCD D5 is connected to Arduino D4

LCD D6 is connected to Arduino D3

LCD D7 is connected to Arduino D2

LCD LED A pin is connected to Arduino 3.3v

LCD LED K pin is connected to Arduino GND

Buzzer + is connected to Arduino pin D13 & buzzer (-) pin is connected to GND.

lpg gas leakage detector using arduino
lpg gas leakage detector using arduino

LPG gas leakage detector Arduino code

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

#define lpg_sensor 7
#define buzzer 13

void setup() 
{
  pinMode(lpg_sensor, INPUT);
  pinMode(buzzer, OUTPUT);
  lcd.begin(16, 2);
  lcd.print("LPG Gas Detector");
  lcd.setCursor(0,1);
  lcd.print("Techno Review 85");
  delay(2000);
}

void loop() 
{
  if(digitalRead(lpg_sensor))
  {
    digitalWrite(buzzer, LOW);
    lcd.clear();
    lcd.print("   NO LPG GAS   ");
    lcd.setCursor(0, 1);
    lcd.print("    LEAKAGE     ");
    delay(400);
    digitalWrite(buzzer, LOW);
    delay(500);
  }
  
  else 
  {
    digitalWrite(buzzer, HIGH);
    lcd.clear();
    lcd.print(" LPG Gas Leakage ");
    lcd.setCursor(0,1);
    lcd.print("     Alert    ");
    delay(1000);
  }
}

Copy above code & paste to Arduino IDE & upload it to Arduino

10K Potentiometer used for controlling contrast of LCD

Video Tutorial

1 Comment

  1. Not used: C:\Users\PATRONS AUTOMATION\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
    exit status 1
    ‘POSITIVE’ was not declared in this

Leave a Reply

Your email address will not be published. Required fields are marked *