Translate

Arduino Gas Leak Detector Using MQ-2 Sensor

 1. Introduction

Gas leakage is a serious safety hazard in homes, laboratories, and industries. Leakage of gases such as LPG, methane, propane, or smoke can lead to accidents, fires, and health problems if not detected early.

In this project, we build an Arduino Gas Leak Detector using the MQ-2 gas sensor. The MQ-2 sensor can detect combustible gases and smoke present in the air.

When gas concentration exceeds a certain level, the sensor sends a signal to the Arduino. The Arduino then activates a buzzer and LED alarm to warn the user about the gas leak.

This is a simple and practical Arduino project that demonstrates how sensors can be used for safety and environmental monitoring applications.


2. Components

The following components are required for this project:

  • Arduino Uno
  • MQ-2 Gas Sensor Module
  • Buzzer
  • LED
  • 220Ω Resistor
  • Breadboard
  • Jumper Wires
  • USB Cable for Arduino

3. Circuit and Connections

Pinout Diagram of Arduino Uno R3

Pinout Diagram of MQ-2 Sensor

Pinout Diagram of Buzzer

Make the following connections according to the circuit.

MQ-2 Gas Sensor

  • VCC → Arduino 5V
  • GND → Arduino GND
  • DO → Arduino Pin 2

Buzzer

  • Buzzer Positive (+) → Arduino Pin 8
  • Buzzer Negative (–) → Arduino GND

LED Indicator

  • LED Anode (+) → Arduino Pin 13
  • LED Cathode (–) → 220Ω Resistor → GND

The gas sensor detects the presence of gas and sends a signal to the Arduino through the digital output pin.


4. Circuit Working

The MQ-2 gas sensor contains a sensitive material that reacts with combustible gases such as LPG, methane, propane, and smoke.

When gas concentration increases, the resistance of the sensing element changes. The sensor module converts this change into a digital output signal.

The Arduino continuously reads the signal from the sensor.

  • Normal Condition
    • Sensor output HIGH
    • Buzzer OFF
    • LED OFF
  • Gas Detected
    • Sensor output LOW
    • Arduino activates buzzer alarm
    • LED turns ON

This alerts the user immediately when gas leakage occurs.


5. Code

int gasSensor = 2;
int buzzer = 8;
int led = 13;

void setup()
{
  pinMode(gasSensor, INPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(led, OUTPUT);
}

void loop()
{
  int gas = digitalRead(gasSensor);

  if(gas == LOW)
  {
    digitalWrite(buzzer, HIGH);
    digitalWrite(led, HIGH);
  }
  else
  {
    digitalWrite(buzzer, LOW);
    digitalWrite(led, LOW);
  }
}

6. Code Working

First, the pins connected to the gas sensor, buzzer, and LED are defined in the program.

Inside the setup() function, the gas sensor pin is configured as an input, while the buzzer and LED pins are configured as outputs.

In the loop() function, the Arduino continuously reads the signal from the MQ-2 gas sensor.

If the sensor output becomes LOW, it indicates the presence of gas. The Arduino immediately activates the buzzer and LED alarm.

If no gas is detected, the sensor output remains HIGH, and both the buzzer and LED remain OFF.


7. Tips

  • Allow the MQ-2 sensor 20–30 seconds to warm up before taking readings.
  • Adjust the sensitivity potentiometer on the sensor module if required.
  • Place the sensor near the possible gas leakage area for better detection.
  • Avoid placing the sensor in areas with strong airflow, which may affect readings.

8. Uses

This gas detection system can be used in many applications such as:

  • Home gas leakage detection
  • Kitchen safety systems
  • Industrial gas monitoring
  • Fire and smoke detection systems
  • Smart safety and automation projects

9. Conclusion

In this project, we built a simple Arduino Gas Leak Detector using the MQ-2 sensor. The system detects the presence of combustible gases and immediately alerts the user through a buzzer and LED indicator.

This project demonstrates how Arduino and gas sensors can be used to build simple safety monitoring systems.

തുടക്കക്കാർക്കായി ഇലക്ട്രോണിക്സ് ലളിതമായി പഠിക്കാം.

Empowering students in Kerala with hands-on technical skills.