HOW DOES MQ2 GAS SENSOR OR SMOKE SENSOR WORK? AND INTERFACE WITH ARDUINO

 HOW DOES MQ2 GAS SENSOR OR SMOKE SENSOR   WORK? AND INTERFACE WITH ARDUINO..

In this article "HOW DOES MQ2 GAS SENSOR OR SMOKE SENSOR WORK? AND INTERFACE WITH ARDUINO.." i will tell you about Mq2 Gas Sensor or Smoke Sensor.What is Mq2 Gas Sensor? How does it work and interface with Arduino.And how can to make a simple gas or smoke detector project and that beeps when detects any gas in the air using Mq2 Smoke sensor. And you can make a lot of cool projects from these sensor.
Like..
  • You can create a Breath Checker Project.
  • You can create a Fire detection Project.
  • you can create a Air Quality Checker for indoor or outdoor etc..
Mq2 gas sensor




Mq2 gas sensor is a type of sensor.Which detects Smoke or Gas in the air. This is made metal oxide semiconductor (MOS) . We know as Chemiresistor .When a smoke or gas comes into contact with gas sensor . The MOS material is heated then stars causing the resistance value change according to concentration of gas or smoke. And the resistance value level of sensor is changed depend up on the type of gases presents in the atmosphere of Mq2 sensor.

There are following types of gases detect by Mq2 Gas sensor

  • LPG.
  • Propane.
  • Methane.
  • Butane.
  • CO.
  • Alcohol.
  • Hydrogen etc.
Mq2 gas sensor works on 5v dc and draw at least 800 mW. Smoke sensor has a potentiometer .We can adjust the sensitivity of gas sensor module and one Digital output voltage pin(D0) and one Analog output voltage pin (A0) for read data from the sensor. and it has power led for Indication voltage.and final last output data indication led.

How does it work?

When smoke or gas are contact with sensor in the atmosphere. So the output voltage of the sensor(D0) starts to change the voltage level. This means that whenever the concentration of gas or smoke is increased around of the sensor. The output voltage level of the sensor also starts increasing and when amount of gas level is decreased then also output voltage level  starts decreasing.

We can say that Mq2 sensor of output voltage level proportional to the amount of gas or smoke.

  • Gas sensor of output voltage level greater  the concentration of gas or smoke is greater.
  • When Gas sensor of output voltage level is lower then the concentration of smoke or gas is lower.
Feature:-
  1. It's working voltage 5v.
  2. It can be used detect or measure LPG,Methane,Propane, Butane,CO,Alcohol,Hydrogen.
  3. It can read the digital output voltage 5v from the D0 of Mq2 sensor.
  4. It can read the analog out voltage 0v tto 5v from the A0 of Mq2 sensor.
Application:-

  1. It can be used for fire detection in home,mall,school,college,industries etc..
  2. It can be used for detect different - different gases presence in the atmosphere.
  3. It can be used for air quality checker in indoor or outdoor.
Mq2 Gas Sensor of Pin Diagram

      Vcc       -  5V

     A0         -   Analog Output Pin

     D0         -  Digital Output Pin

    GND     -  GND


Component Required 
  • Arduino Uno with  cable.
  • Mq2 Gas sensor.
  • Buzzer.
  • Red led and Green led.
  • Jumper wire.
  • 9 Volt Battery.
  • Bread Board.
Circuit Diagram

     Mq2       -       Arduino Uno
    
     Vcc        -       5V

     GND      -       GND

     A0         -       Analog Pin A0

     D0         -       Not Used


     Red Led                  -       Arduino Uno
    
    (- ) Terminal           -       GND

    (+) Terminal           -       Digital Pin (D2)


    Green Led             -       Arduino Uno
    
    (- ) Terminal           -       GND

    (+) Terminal           -       Digital Pin (D3)


   Buzzer                    -       Arduino Uno
    
    (- ) Terminal           -       GND

    (+) Terminal           -       Digital Pin (D4)

Interface Mq2 Smoke Sensor ,Buzzer,Red led and Green led with Arduino Uno
Mq2 Smoke sensor interface to Arduino



In This project we will read data from the analog pin A0 of the Gas sensor. When suddenly the gas level starts to increasing then Buzzer starts the beeping and Red led is Turned ON  and Green led is Turned OFF.
 
And when The gas level starts to decreasing the Buzzer stop beeping   and Green led is Turned ON and Red led is Turned OFF..

Code

int mq_A0  = A0;
int red_led  = 2;
int green_led = 3;
int buzzer = 4;
int threshold = 300;
int var;

void setup( )
{

Serial.begin( 9600 );
pinMode( mq_A0, INPUT );
pinMode( red_led, OUTPUT );
pinMode( green_led, OUTPUT );
pinMode( buzzer, OUTPUT );
digitalWrite( buzzer,LOW );

}

void loop( )
{

var = analogRead( mq_A0 );
Serial.print(" Gas Level= ");
Serial.println( var );

if( var > threshold )
{

digitalWrite( red_led, HIGH );
digitalWrite( green_led, LOW );
digitalWrite( buzzer, HIGH );
Serial.println(" Gas Is Detected! ");

}

else
{

digitalWrite( green_led, HIGH );
digitalWrite( red_led, LOW );
digitalWrite( buzzer, LOW );
Serial.println(" Normal Condition ");

}
delay( 500 );
}

Post a Comment

0 Comments