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 :-

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





 All the resources for this project:


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);

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

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


MQ-2 Pin diagram :-


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


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s