MQ-2

Working Principle:

The MQ-2 Gas Sensor module detects gas leakage in home and industry.
They are useful in gas leakage detection of LPG, propane, methane, i-butane, alcohol, Hydrogen, and smoke. They are sensitive to a range of gasses and are used indoors at room temperature.

 

 

Arduino Interfacing 

 

CODE

int redLed = 12;
int greenLed = 11;
int buzzer = 10;
int smokeA0 = A5;
// Your threshold value
int sensorThres = 400;
void setup() {
  pinMode(redLed, 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 > sensorThres)
  {
    digitalWrite(redLed, HIGH);
    digitalWrite(greenLed, LOW);
    tone(buzzer, 1000, 200);
  }
  else
  {
    digitalWrite(redLed, LOW);
    digitalWrite(greenLed, HIGH);
    noTone(buzzer);
  }
  delay(100);
}

 

 

Pin Configurtion:

Vcc: 5v

GND: GND

A0: Analog pin of arduino

D0: Digital pin of arduino:

 

Advantages:

  • Wide detecting scope
  • High sensitivity and fast response
  • Long life and stable
  • Simple drive circuit

Applications:

  • Detects or measure Gases like LPG, Alcohol, Propane, Hydrogen, CO and even methane
  • Air quality monitor
  • Gas leak alarm
  • Safety standard maintenance
  • Maintaining environment standards in hospitals

Reference:

https://www.instructables.com/id/How-to-use-MQ2-Gas-Sensor-Arduino-Tutorial/

https://create.arduino.cc/projecthub/Aritro/smoke-detection-using-mq-2-gas-sensor-79c54a

https://create.arduino.cc/projecthub/ajayrajan69/mq-2-gas-sensor-arduino-c64791

https://create.arduino.cc/projecthub/Junezriyaz/how-to-connect-mq2-gas-sensor-to-arduino-f6a456