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..
I am already 4 articles published based on Arduino projects. If you want to make projects. so you go read articles and make it.
MQ2 GAS SENSOR
There are following types of gases detect by Mq2 Gas sensor
- LPG.
- Propane.
- Methane.
- Butane.
- CO.
- Alcohol.
- Hydrogen etc.
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.
- It's working voltage 5v.
- It can be used detect or measure LPG,Methane,Propane, Butane,CO,Alcohol,Hydrogen.
- It can read the digital output voltage 5v from the D0 of Mq2 sensor.
- It can read the analog out voltage 0v tto 5v from the A0 of Mq2 sensor.
- It can be used for fire detection in home,mall,school,college,industries etc..
- It can be used for detect different - different gases presence in the atmosphere.
- It can be used for air quality checker in indoor or outdoor.
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
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 );
}
0 Comments