LPG Gas Leakage Detector using Arduino

Published  June 23, 2015   49
S Saddam
Arduino based LPG Gas Detector

While LPG is an essential need of every household, its leakage could lead to a disaster. To alert on LPG leakage and prevent any mishappening there are various products to detect the leakage. Here we have developed an Arduino based LPG gas detector alarm. If gas leakage occurs, this system detects it and makes an alert by buzing the buzzer attached with the circuit. This system is easy to build and anyone who have some knowledge of electronics and programing, can build it..


We have used a LPG gas sensor module to detect LPG Gas. When LPG gas leakage occurs, it gives a HIGH pulse on its DO pin and arduino continuously reads its DO pin. When Arduino gets a HIGH pulse from LPG Gas module it shows “LPG Gas Leakage Alert” message on 16x2 LCD and activates buzzer which beeps again and again until the gas detector module doesn't sense the gas in environment. When LPG gas detector module gives LOW pulse to arduino, then LCD shows “No LPG Gas Leakage” message. 

Arduino Based LPG Gas Detector Project Block Diagram

Components Used

  1. Arduino Pro Mini
  2. LPG Gas sensor Module
  3. Buzzer
  4. BC 547 Transistor
  5. 16x2 LCD
  6. 1K resistor
  7. Bread board
  8. 9 volt battery
  9. Connecting wires


LPG Gas Sensor Module

This module contains a MQ3 sensor which actually detects LPG gas, a comparator (LM393) for comparing MQ3 output voltage with reference voltage. It gives a HIGH output when LPG gas  is sensed. A potentiometer is also used for controlling sensitivity of gas sensing. This module is very easy to interface with microcontrollers and arduino and easily available in market by name “LPG Gas Sensor Module”. We can also build it by using LM358 or LM393 and MQ3.

LPG Gas Sensor Module


Circuit Diagram and Description

Arduino Based LPG Gas Detector Circuit Diagram

As shown in the schematic diagram above, it contains Arduino board, LPG GAS Sensor Module, buzzer and 16x2 LCD module. Arduino controls the whole process of this system like reading LPG Gas sensor module output, sending message to LCD and activating buzzer. We can set sensitivity of this sensor module by inbuilt potentiometer placed on it. 


LPG gas sensor module's DO pin is directly connected to pin 18 (A4) of Arduino and Vcc and GND are connected to Vcc and GND of arduino. LPG gas sensor module consist a MQ3 sensor which detects LPG gas. This MQ3 sensor has a heater inside which needs some heater supply to heat up and it may takes up to 15 minute to get ready for detecting LPG gas. And a comparator circuit is used for converting Analog output of MQ3 in digital. A 16x2 LCD is connected with arduino in 4-bit mode. Control pin RS, RW and En are directly connected to arduino pin 2, GND and 3. And data pin D0-D7 are connected to 4, 5, 6, 7 of arduino. A buzzer is connected with arduino pin number 13 through a NPN BC547 transistor having a 1 k resistor at its base.


Program Description

In programming we have used digital read function to read output of LPG gas sensor module and then performed operation according to input.

Reading input

For testing this project we have used a cigarette lighter which contains LPG gas.


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

#define lpg_sensor 18
#define buzzer 13

void setup() 
  pinMode(lpg_sensor, INPUT);
  pinMode(buzzer, OUTPUT);
  lcd.begin(16, 2);
  lcd.print("LPG Gas Detector");
  lcd.print("Circuit Digest");

void loop() 
    digitalWrite(buzzer, HIGH);
    lcd.print("LPG Gas Leakage");
    lcd.setCursor(0, 1);
    lcd.print("     Alert     ");
    digitalWrite(buzzer, LOW);
    digitalWrite(buzzer, LOW);
    lcd.print("  No LPG Gas ");
    lcd.print("   Leakage   ");


Have any question realated to this Article?

Ask Our Community Members


Submitted by Arthur on Sat, 08/15/2015 - 15:17


I'm confused. When I look it up on the arduino site, it says that the MQ2 sensor is sensitive to LGP but here you used the MQ3 sensor. can you explain why?

Submitted by Rae on Thu, 09/03/2015 - 20:46


Hello, we are trying to use this as a reference for our project. Well, we don't have an Arduino Pro Mini is it ok if we use an arduino uno? Thank you so much for your reply. :)

Submitted by Madhu on Mon, 09/28/2015 - 15:59

In reply to by Rae


I don't think there would be any problem in using arduino uno instead of pro mini to make this project. I have built an LPG detector project with Uno.

Submitted by ajay on Sat, 12/26/2015 - 18:01


how can get LPG gas sensor libraries for proteus
sir please upload the libraries

I think you did anything wrong in connection.

Please make sure the lcd pins.

In code we have selected lcd(3,2,4,5,6,7);

look at this
RS pin Connected at pin 3 and EN at 2.

may be your problem will resolved.
best of luck.

Submitted by Tri on Sun, 03/06/2016 - 21:17


Hi Sir,
Can you share your PROTEUS LIBRARY of the LPG Gas Sensor ?
Thanks you so much for your help!

Submitted by Oluwafemi on Mon, 04/11/2016 - 07:09


Job well done. Is it possible I get a video of the design process?, and also can you tell me where I can get these components in case they are not available in my area here?.

Submitted by Bangon Kali on Thu, 05/05/2016 - 08:02


I commend the creator for this wonderful project but one should be wary of using hobbyist grade electronics for Gas/Flammable applications. The problem is what if a gas leak would be ignited by such device. I would rather advise buying IS rated equipment from certified vendors. Btw, I work for one such vendor but any vendor will do as long as they are certified in delivering IS devices.

Congrats for a job well done!

Submitted by SARAH SOHAIL on Sun, 09/11/2016 - 16:55


kindly guide me how can i get LPG sensor frm proteus library?? asap

Submitted by rahul patidar on Tue, 10/18/2016 - 19:57


the ardunio may be sparking of cold enviorment and conducter liquid interaction in inegrated circuit. but i will not know about whats voltage and current power and frequency in sparking in combination in positive and negative terminal.i will try of 5v and .6 A CURRENT IN IC.AND I WANT know that the limit o f minimum and maximum of power voltage and current.

Submitted by preethi on Tue, 01/03/2017 - 09:37


i want to test the project .pls send to me complete code .There is no main functions in that code. i want extend few modules also. could u help me pls

Submitted by keyur on Mon, 01/23/2017 - 13:18


This type of error at uploading the program on broad pls replay fast

"Arduino: 1.8.2 Hourly Build 2017/01/17 12:35 (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 2302 bytes (7%) of program storage space. Maximum is 32256 bytes.
Global variables use 133 bytes (6%) of dynamic memory, leaving 1915 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\\.\COM1": The system cannot find the file specified.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Submitted by keyur on Sun, 02/12/2017 - 01:47


Hi, sir
when i am supply the arduino uno then after the buzzer and display are show the gas was leakage but that time no gas leakage when i am apply the gas then the both buzzer and display was no gas leakage how to solve the problem
plz Sir reply fast

Submitted by vignesh on Mon, 05/08/2017 - 11:41


i am not getting any display on lcd. only the backlight lights up. all connections are proper. DO i have to use a potentiometer????

Submitted by Shah Utsav on Wed, 07/05/2017 - 17:37


How to make GAS Sensor MQ-6 at home give me Schematic please

Submitted by Tuhin Hazra on Thu, 11/30/2017 - 15:49


The code is not working, therefore the desired output is not coming

Submitted by ASHUTOSH KUMAR on Fri, 08/17/2018 - 09:53


I just wanna know that if I am making a project of LPG gas detection circuit and want to house my compact circuitry on the regulator of LPG gas cylinder then which type of battery will be safer to use. Because as we know that it will be quite dangerous to use batteries like li-po and li-ion etc. near such kind of dangerous gases. So kindly suggest me regarding my sorting the batteries problem.

Using battery for such application is not recommended. Most of the Gas alarms are powered from AC mains directly. This way you can esure that they are active all the time.

May be you can use a battery to back-up in the even of power failure. In those cases a Li-po is normally used. Yes they are dangerous, but only if you design a bad circuit. Li-po has good energy density hence mostly used in portable electronics. You can use a coin cell for back up and they tend to be more safe