LPG Gas Leakage Detector using Arduino


BySaddam 49

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   ");


Get Our Weekly Newsletter!

Subscribe below to receive most popular news, articles and DIY projects from Circuit Digest


  • Arthur's picture
    Aug 15, 2015

    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?

  • Rae's picture
    Sep 03, 2015

    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. :)

  • Madhu's picture
    Sep 28, 2015

    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.

  • me's picture
    Nov 18, 2015

    What is the alternative of BC547 Transistor?

  • Abhishek's picture
    Nov 21, 2015

    Any General purpose small NPN transistor should work, like 2N2222, BC548, BC546, 2N3904, BC337 etc.

  • ajay's picture
    Dec 26, 2015

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

  • Osama 's picture
    Feb 02, 2016


    How i can interface these Arduino with computer for programming


  • Ragav's picture
    Feb 02, 2016

    Why does my circuit switch off automatically when i connect the vcc of sensor to the vcc of arduino ? Pls help

  • Jayant's picture
    Feb 06, 2016

    what do you mean by "circuit switch off"? Please be specific and check the circuit connections twice.

  • Ramesh 's picture
    Feb 03, 2016

    plz i request you to kindly tell me detailed meaning of this program. :)

  • Jayant's picture
    Feb 06, 2016

    Program is easy and self explanatory, just go through our other basic projects and check some beginners tutorials on internet.

  • Ragav's picture
    Feb 14, 2016

    My sensor doesnt light up if i connect my arduino's vcc to its vcc. But my lcd screen lights up perfectly. Pls help.

  • Ragav's picture
    Feb 15, 2016

    My lcd screen shows only black boxes. What should i do ?

  • azizi's picture
    Mar 01, 2016

    I got the same problem,when my sensor detected a gas,..my buzzer buzzing but my LCD shows only black boxes. What should i do ?

  • saddam khan's picture
    saddam khan
    Jun 10, 2016

    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.

  • m.fairose's picture
    Mar 01, 2016

    When my sensor detect gas,my buzzer is ON but my LCD goes blank. What should i do ?

  • saddam khan's picture
    saddam khan
    Jun 10, 2016

    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.

  • Tri's picture
    Mar 06, 2016

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

  • Oluwafemi's picture
    Apr 11, 2016

    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?.

  • Bangon Kali's picture
    Bangon Kali
    May 05, 2016

    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. Read about Intrinsic safety https://en.wikipedia.org/wiki/Intrinsic_safety 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!

  • diane's picture
    Jun 29, 2016

    can i use Arduino Uno instead of Arduino Mini ? Please help thank you :)

  • John Rey Amestoso's picture
    John Rey Amestoso
    Jul 25, 2016

    Can you give me the complete and specific materials needed for this project?

  • Maddy's picture
    Aug 20, 2016

    Required materials/components are already given in the article.

  • SARAH SOHAIL's picture
    Sep 11, 2016

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

  • preeth's picture
    Sep 19, 2016

    can i use mq-2 or mq-6 instead of mq-3 module? will all lighters contain LPG gas?

  • rahul patidar's picture
    rahul patidar
    Oct 18, 2016

    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.

  • sravan's picture
    Dec 25, 2016

    can u provide connections using arduino uno ! plzz ?

  • preethi's picture
    Jan 03, 2017

    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

  • sravan's picture
    Jan 05, 2017

    plzzz can u send me the circuit diagram using arduino uno plzzz :!!

  • Ferguson's picture
    Jan 18, 2017

    How about coupling and making it look more attractive?...how can that be done

  • keyur's picture
    Jan 23, 2017

    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.

  • keyur's picture
    Feb 12, 2017

    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

  • vignesh's picture
    May 08, 2017

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

  • Maddy's picture
    Jul 10, 2017

    Yes you should use potentiometer to control the brightness of the LCD, sometimes brightness is too high that text might not be visible.

  • Ashutosh's picture
    May 31, 2017

    I am mot getting the exact lpg gas sensor module..Can anyone provide me the link from where i can get this ??

  • sreepriya's picture
    Jun 24, 2017

    how to upload the code into arduino pro mini

  • Shah Utsav's picture
    Shah Utsav
    Jul 05, 2017

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

  • yatimi's picture
    Aug 09, 2017

    how to make using gas sensor mq-2?

  • Tuhin Hazra's picture
    Tuhin Hazra
    Nov 30, 2017

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

  • Hrushikesh's picture
    Mar 13, 2018

    Can i use arduino nano instead? and if yes will there be any changes in connections?

  • yuvraj's picture
    Mar 22, 2018

    Should i use alphanumeric display or ordinary lcd display?

  • Shrey's picture
    Jul 19, 2018

    How to i trip mcb while gas leackage using arduino ?

  • priya's picture
    Jul 23, 2018

    sir how can i make msg alert in this project

  • ASHUTOSH KUMAR's picture
    Aug 17, 2018

    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.

  • Aswinth Raj's picture
    Aswinth Raj
    Aug 19, 2018

    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  

Log in or register to post Comment