Introduction: LPG Gas Detector

LPG Gas Detector is a simple and effective DIY project for beginners. It is important to know about these sensors and calibration of the sensors because safety is one of the major points. In This article we will discuss Gas Senor, Working of it and calibration. Also, we will make an LPG gas detector and warning alarm system.

Step 1: What Is MQ2 Sensor

MQ2 is one of the commonly used gas sensors in the MQ sensor series. It is a
Metal Oxide Semiconductor (MOS) type Gas Sensor also known as Chemiresistors.

Step 2: Working of Sensor

The detection is based upon the change of resistance of the sensing material when the Gas comes in contact with the material. Using a simple voltage divider network, concentrations of the gas can be detected.

Step 3: Material Required

MQ2 Gas sensor * 1

Arduino UNO * 1

Buzzer * 1

Led * 1

Jumper wires

Step 4: Connections



pin A0---------|-------------ANG--------|------------------------|-------------

pin 13---------|---------------------------|------------------------|---------+ve

pin 7-----------|---------------------------|----------___ -ve----|----------------



Step 5: Code

void setup() {
pinMode(7, OUTPUT); //buzzer Connect to pin no 7

pinMode(A0, INPUT); //Sensor connect to pin no A0

pinMode(13, OUTPUT); //LED Connect to pin no 13

Serial.begin(9600); //Serial coomunication


void loop()


int gasvalue = analogRead(A0); // analog read sensor value

if(gasvalue >= 830) //of gas is present check the value and replace this value with your sensor value

{ digitalWrite(7, LOW);

digitalWrite(13, HIGH);

Serial.println("LPG Gas detected Danger ");



{ digitalWrite(7, HIGH);

digitalWrite(13, LOW);

Serial.println("No LPG Safe area"); }

Step 6: Clibration

There is a pot on the sensor you can adjust it according to your conditions. Take the reading when gas is present and again on normal condition. Replace the values in code according to your values.

I am using a lighter as an LPG source.

Step 7:

If you want to make a professional product PCB is one of the major components. Try NextPCB

They have amazing quality, custom colour option and instant quotation. They have multi-layer PCB at affordable price. Highly recommend try once you will definitely amaze with the quality.