Gas Leakage Detector Using MQ2 Sensor and Arduino

A Gas Leakage Detector is an important safety project that helps detect harmful gas leaks in homes, kitchens, laboratories, and industries. This DIY project uses the MQ2 Gas Sensor and Arduino Uno to monitor gas levels and activate a buzzer or alarm whenever gas leakage is detected.

In this beginner-friendly tutorial by DiySmartLab.com, you will learn how a gas leakage detector works, required components, circuit connection, Arduino code, applications, and safety tips.

Gas Leakage Detector Using Arduino

What is a Gas Leakage Detector?

A gas leakage detector is an electronic safety device that detects combustible gases like LPG, methane, propane, and smoke in the air. When the gas concentration exceeds a safe limit, the detector activates an alarm system to warn people nearby.

Gas leakage detectors are commonly used in:

  • Home kitchens
  • Gas pipelines
  • Chemical industries
  • Factories and workshops
  • Laboratories
  • Smart home automation systems

How Does a Gas Leakage Detector Work?

The project uses an MQ2 Gas Sensor, which senses gas concentration in the environment. The sensor sends analog data to the Arduino Uno. If the gas level crosses a preset threshold value, Arduino activates:

  • A buzzer alarm
  • An LED indicator
  • Optional exhaust fan or relay system

This quick warning system helps prevent accidents caused by gas leakage.

MQ2 Gas Sensor Working Principle

Components Required

  • Arduino Uno
  • MQ2 Gas Sensor Module
  • Buzzer
  • LED
  • 220Ω Resistor
  • Breadboard
  • Jumper Wires
  • USB Cable

MQ2 Gas Sensor Pin Diagram

The MQ2 sensor module usually contains four pins:

  • VCC → Power Supply (5V)
  • GND → Ground
  • A0 → Analog Output
  • D0 → Digital Output
MQ2 Gas Sensor Pin Diagram

Gas Leakage Detector Circuit Diagram

Connect the MQ2 gas sensor with Arduino Uno as follows:

  • MQ2 VCC → Arduino 5V
  • MQ2 GND → Arduino GND
  • MQ2 A0 → Arduino A0
  • Buzzer Positive → Arduino Pin 8
  • Buzzer Negative → GND
  • LED Positive → Arduino Pin 7 through 220Ω resistor
  • LED Negative → GND
Gas Leakage Detector Circuit Diagram

Arduino Code for Gas Leakage Detector


int gasSensor = A0;
int buzzer = 8;
int led = 7;

void setup() {
  pinMode(buzzer, OUTPUT);
  pinMode(led, OUTPUT);
  Serial.begin(9600);
}

void loop() {

  int gasValue = analogRead(gasSensor);

  Serial.println(gasValue);

  if(gasValue > 350) {
    digitalWrite(buzzer, HIGH);
    digitalWrite(led, HIGH);
  }
  else {
    digitalWrite(buzzer, LOW);
    digitalWrite(led, LOW);
  }

  delay(500);
}

How the Arduino Code Works

  • The Arduino continuously reads analog values from the MQ2 sensor.
  • If the gas level exceeds the threshold value (350), the alarm activates.
  • The buzzer starts beeping.
  • The LED turns ON to indicate danger.
  • If gas concentration returns to normal, the alarm stops automatically.

Gas Leakage Detector Breadboard Connection

The breadboard setup makes the project easy for beginners. Ensure all jumper wire connections are tight and correct before powering the circuit.

Gas Leakage Detector Breadboard Connection

Applications of Gas Leakage Detector

  • Kitchen gas leakage monitoring
  • Industrial gas safety systems
  • Smart home safety projects
  • Fire prevention systems
  • LPG cylinder leakage detection
  • Chemical laboratory safety monitoring

Advantages of MQ2 Gas Leakage Detector

  • Low-cost safety project
  • Easy for beginners
  • Fast gas detection response
  • Works with Arduino and ESP32
  • Can detect multiple gases
  • Easy to upgrade with IoT features

Safety Tips While Using Gas Sensors

  • Always test the sensor in a ventilated area.
  • Do not expose the sensor directly to flames.
  • Use proper power supply connections.
  • Calibrate the sensor before final installation.
  • Install the detector near gas sources carefully.

Future Improvements

You can upgrade this project using:

  • ESP32 WiFi notifications
  • GSM SMS alerts
  • LCD display module
  • Relay-controlled exhaust fan
  • Blynk IoT mobile monitoring
  • Smart home automation integration

Conclusion

The Gas Leakage Detector Using MQ2 Sensor and Arduino is an excellent beginner electronics project that improves home and industrial safety. It is simple, affordable, and highly useful for detecting dangerous gas leaks before accidents happen.

If you are learning Arduino and sensor interfacing, this project is a great practical example for understanding gas sensors, analog input reading, and alarm systems.

Frequently Asked Questions (FAQs)

What gases can the MQ2 sensor detect?

The MQ2 sensor can detect LPG, methane, propane, smoke, hydrogen, and combustible gases.

Can I use ESP32 instead of Arduino Uno?

Yes, the MQ2 sensor works perfectly with ESP32 and other microcontrollers.

What is the operating voltage of MQ2 sensor?

The MQ2 gas sensor operates on 5V DC power supply.

Can this project send mobile notifications?

Yes, you can add WiFi or GSM modules to send alerts to smartphones.

Is this project suitable for beginners?

Yes, this is one of the best beginner Arduino safety projects.

Leave a Reply

Your email address will not be published. Required fields are marked *