MQ-2 Gas Sensor Arduino.

As I currently reside in India, most of the houses here have a LPG -Gas stove system for cooking food and various other kitchen activities.
There are LPG cylinders which are used as a fuel source for the gas stove.

Many a times, disastrous accidents take place due to leakage of these cylinders, in these situations we must administer proper care and safety.

Keeping this in mind, in today’s post I have worked on MQ-2 gas sensor(FC-22) powered and interfaced with arduino uno.

Here is its datasheet :-
http://www.allelectronics.com/mas_assets/theme/allelectronics/spec/GS-29.pdf

Now, First of all you will require these components :-

  1. Arduino UNO or Genuino UNO
  2. Breadboard
  3. LED’s
  4. Resistors
  5. Jumper wires
  6. MQ-2 gas sensor.
  7. Buzzer

CIRCUIT DIAGRAM :-

Capture.JPG

 

CODE :-

******
 
 All the resources for this project:
 https://www.electromaniaweb.wordpress.com 
https://www.arduino.cc

*******/

int LED1 = 12;
int LED2 = 11;
int buzzer = 10;
int smokeA0 = A5;
int sensorThreshold = 400;

void setup() {
  pinMode(LED1, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(smokeA0, INPUT);
  Serial.begin(9600);
}

void loop() {
  int analogSensor = analogRead(smokeA0);

  Serial.print("Pin A0: ");
  Serial.println(analogSensor);
  // Checks if it has reached the threshold value
  if (analogSensor > sensorThreshold)
  {
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, LOW);
    tone(buzzer, 1000, 200);
  }
  else
  {
    digitalWrite(LED1, LOW);
    digitalWrite(LED2, HIGH);
    noTone(buzzer);
  }
  delay(100);
}

 

MQ-2 Pin diagram :-

Capture

That’s it guys.
Install this in your kitchen or garage for better safety and protection of your loved ones.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s