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


Comments (41)

  • Arthur's picture

    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?

    Aug 15, 2015
  • Rae's picture

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

    Sep 03, 2015
  • Madhu's picture

    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.

    Sep 28, 2015
  • me's picture

    What is the alternative of BC547 Transistor?

    Nov 18, 2015
  • Abhishek's picture

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

    Nov 21, 2015
  • ajay's picture

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

    Dec 26, 2015
  • Osama 's picture


    How i can interface these Arduino with computer for programming


    Feb 02, 2016
  • Jayant's picture

    You can connect Arduino with pc using USB cable and Arduino IDE software (Arduino Nightly : Arduino NIghtly software is used to write, verify and upload the code to arduino, through PC.

    Feb 06, 2016
  • Ragav's picture

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

    Feb 02, 2016
  • Jayant's picture

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

    Feb 06, 2016
  • Ramesh 's picture

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

    Feb 03, 2016
  • Jayant's picture

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

    Feb 06, 2016
  • Ragav's picture

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

    Feb 14, 2016
  • Ragav's picture

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

    Feb 15, 2016
  • azizi's picture

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

    Mar 01, 2016
  • saddam khan's picture
    saddam khan

    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.

    Jun 10, 2016
  • m.fairose's picture

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

    Mar 01, 2016
  • saddam khan's picture
    saddam khan

    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.

    Jun 10, 2016
  • Tri's picture

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

    Mar 06, 2016
  • Oluwafemi's picture

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

    Apr 11, 2016
  • Bangon Kali's picture
    Bangon Kali

    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 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!

    May 05, 2016
  • diane's picture

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

    Jun 29, 2016
  • Abhishek's picture

    Yes, you can

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

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

    Jul 25, 2016
  • Maddy's picture

    Required materials/components are already given in the article.

    Aug 20, 2016
  • SARAH SOHAIL's picture

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

    Sep 11, 2016
  • preeth's picture

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

    Sep 19, 2016
  • Abhishek's picture

    Yes you can use MQ2 or MQ6 sensor.

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

    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.

    Oct 18, 2016
  • sravan's picture

    can u provide connections using arduino uno ! plzz ?

    Dec 25, 2016
  • preethi's picture

    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

    Jan 03, 2017
  • sravan's picture

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

    Jan 05, 2017
  • Ferguson's picture

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

    Jan 18, 2017
  • keyur's picture

    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 for suggestions.

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

    Jan 23, 2017
  • keyur's picture

    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

    Feb 12, 2017
  • vignesh's picture

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

    May 08, 2017
  • Maddy's picture

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

    Jul 10, 2017
  • Ashutosh's picture

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

    May 31, 2017
  • sreepriya's picture

    how to upload the code into arduino pro mini

    Jun 24, 2017
  • Shah Utsav's picture
    Shah Utsav

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

    Jul 05, 2017
  • yatimi's picture

    how to make using gas sensor mq-2?

    Aug 09, 2017

Leave a comment