LPG gas sensor interface with Arduino (MQ6)

INTRODUCTION: –

LPG is the term we are very familiar with as this is the gas on which we cook our food, but this can be very harmful as it is very rapidly flammable so it must be used and handle with care. So, to check the presence of LPG gas in our nearby environment we today are going to make an LPG detector for home and various other uses. Now, most of the flats and houses are built mounted LPG gas sensors which prevent leaking ad many gas accidents.

Many more sensors for LPG detection are available in the market and are more advanced but today we are going to use which is very easily available to all in the electronics market.

LPG gas sensor arduino

DESCRIPTION: –

For today’s DIY, we need a few components like Arduino Uno, lad’s, buzzer, and one LPG(MQ-6) sensor. the working of this sensor is as same as of MQ-3 sensor discussed in one of my previous tutorials. So, for a detailed working head on to that project of Alcohol detector.

The sensor also has an onboard power led and also an onboard Status led which will blink whenever the LPG gas sensor detects LPG gas in its nearby environment. that is a good project and can be included in the home automation system

The sensor gives both digital and analog output. The difference between the two is very simple in digital output only high or low means either 1 or 0 is transmitted to the microcontroller but in the analog signal, a wide range of values from 0 to 1023 is transmitted to the microcontroller which corresponds strength of the gas in the environment and goes on increasing for mor4e dense fumes the sensor is built out of LM393 IC which has an inbuilt amplifier which amplifies the voltage signal to the detectable range. Also, it has voltage comparators for efficient amplification. The amount of amplification can be adjusted with connecting potentiometers given on the sensor.

MQ-6 LPG gas sensor

*NOTE: – THE SENSOR VALUES DEPEND ON THE STRENGTH AND MAY CHANGE ON SMALL SOURCE OR DISTANCE FROM SOURCE

SCHEMATIC DIAGRAM: –

LPG gas sensor

FEATURES AND APPLICATIONS: –

  • The sensitivity of LPG is very good
  • Easy to use and fix
  • Adjustable value
  • Low price
  • Can be used in the home or any LPG using the area

SENSOR SPECIFICATIONS: –

COMPONENTS NEEDED: –

  • Any microcontroller preferably Arduino Uno for beginners.
  • A red led
  • An MQ-3 Alcohol sensor
  • A breadboard
  • Jumper wires
  • 220ohm resistor
  • A buzzer
LPG gas sensor component

LPG gas sensor with Arduino circuit diagram:

arduino lpg sensor circuit diagram

the above-given diagram is with the buzzer also which will make noise when it detects the LPG and the below-given circuit is only for the detection this not include the buzzer.

Arduino UNOMQ-6 LPG Sensor
( +5V ) VCC
GND GND
D5 PinOUT Pin
Arduino UNOBuzzer
D13 PinPositive Terminal
GND Negative Terminal
Arduino UNOLED220 Ohm Resistor
D12 PinAnode Pin 
 Cathode PinTerminal 1
GND  Terminal 2
LPG gas sensor circuit

First, we take the power lines of the breadboard from the Arduino microcontroller. in the right side there are two lines which are known as the power line and these lines have positive and negative lines.

Arduino UNOMQ-6 LPG Sensor
( +5V )VCC
GND GND
D5 PinOUT Pin
Arduino UNOLED220 Ohm Resistor
D12 PinAnode Pin 
 Cathode PinTerminal 1
GND Terminal 2

VCC/5v–>+ line and GND–> – line.

Then connect the LPG gas leakage detector sensor onto the breadboard and connect power to the sensor from powerlines using jumper wires.

Now connect D0 PIN OF SENSOR TO MICROCONTROLLER DIGITAL PIN 3.

Now connect led to the breadboard + to digital pin 13 of Arduino and – to and in series with 220-ohm resistor. Moreover, we can enhance this version by adding a buzzer to it also like in the above diagram. Connect -live of the buzzer to GND on a breadboard, and +tive to 5V on a breadboard.

MQ6 Sensor Arduino Code: –

 //put this code in the ide of arduino from this line  
       int LED = 12;  
       int BUZZER = 13;  
       int LPG_sensor = 3;// MQ-6 SENSOR  
       int LPG_detected;  
       void setup()  
       {  
         Serial.begin(9600);  
         pinMode(LED, OUTPUT);  
         pinMode(BUZZER, OUTPUT);  
         pinMode(LPG_sensor, INPUT);  
       }  
       void loop()  
       {  
          LPG_detected = digitalRead(LPG_sensor);  
          Serial.println(LPG_detected);  
         if (LPG_detected == 1)  
         {  
           Serial.println("LPG detected...");  
           digitalWrite(LED, HIGH);  
           digitalWrite(BUZZER, HIGH);  
         }  
         else  
         {  
           Serial.println("No LPG detected.");  
           digitalWrite(LED, LOW);  
           digitalWrite(BUZZER, LOW);  
         }  
       }  

now the code is for without a buzzer

 // code for with led only  
 int LED = 12;  
 int LPG_sensor = 3;// MQ-6 SENSOR  
 int LPG_detected;  
 void setup()  
 {  
 Serial.begin(9600);  
 pinMode(LED, OUTPUT);  
 pinMode(LPG_sensor, INPUT);  
 }  
 void loop()  
 {  
 LPG_detected = digitalRead(ALCOHOL_sensor);  
 Serial.println(LPG_detected);  
 if (ALCOHOL_detected == 1)  
 {  
 Serial.println("LPG detected...");  
 digitalWrite(LED, HIGH);  
 }  
 else  
 {  
 Serial.println("No LPG detected ");  
 digitalWrite(LED, LOW);  
 }  
 }  

Learn 10+ basic activity & sensor interfacing with our Arduino ebook. Well explained program. And brief circuit diagram WhatsApp and email support. which will help you to learn basic electronics, Arduino Coding, Sensor interfacing with Arduino, Arduino, and much more. buy Arduino Ebook to learn https://techatronic.com/arduino-ebook/

mq-3 LPG gas sensor

LPG Gas leakage detector Working: –

As the code starts from the first steps it initializes the output pin to which the sensor sends its data. Then inside the setup, we can define the type of function we want on the set pins like input or output. Then in a loop, we read the data collected from the MQ6 sensor available on pin 3 and then print that value on our monitor. We also check for the condition of sensor data to be either high or low and according to the condition led glows which notify the LPG gas leakage detector and turns off.

LPG gas sensor Arduino

In the buzzer code, we also initialize the buzzer pin to pin 13 and set pin mode to OUTPUT in the setup section. In the loop section along with the led we switch Buzzer also high and low. With help of this sensor, we can do more advanced tasks like controlling servo to open windows and alarm connected to the sensor, etc.

https://www.youtube.com/watch?v=bnJZUvyp9xo&t=21s

Leave a Comment