Introduction
The gas leak detection system is designed to detect the leakage of hazardous gases in real-time with a horn. It helps prevent accidents caused by LPG, methane, propane, and other gases. This system uses the MQ-2 gas sensor, which can detect smoke, LPG, CO, and methane. When the gas exceeds a safe limit, the horn emits a warning sound. An additional LED can be used as a visual warning. This system is ideal for homes, hotels, industrial areas, and kitchens. The goal of this project is to reduce the risks of fires and the inhalation of toxic gases. It is simple, cost-effective, and very effective for safety purposes. The sending of SMS or alerts can be expanded using GSM modules. Gas levels can also be displayed on an LCD or logged online through IoT. This project features a combination of sensors, microcontrollers, and security automation. It helps raise awareness about the dangers of invisible and odorless gases. This system operates 24/7 without human supervision. It can be installed near gas pipelines or cylinders for greater safety. This system supports early identification and quick evacuation in emergency situations. It is an essential project for safe and smart homes or industries.
Hardware Components (Written Form)
Component | Quantity | Description |
Arduino Uno/Nano | 1 | Main microcontroller |
MQ-2 Gas Sensor | 1 | Detects LPG, smoke, methane |
Buzzer | 1 | Alarm during gas leak |
Red LED | 1 | Indicator for gas detection |
Green LED | 1 | System power/ready indicator |
220Ω Resistors | 2 | For LEDs |
Breadboard | 1 | Easy circuit building |
Jumper Wires | Several | Wiring connections |
USB Cable/9V Battery | 1 | To power the Arduino |
Arduino Uno/Nano:
|
MQ-2 Gas Sensor:
|
Buzzer:
|
Red LED & Green LED:
|
|
220Ω Resistors:
|
Breadboard:
|
Jumper Wires:
|
USB Cable/9V Battery:
|
🔌 Wiring Components (Written Form)
🔸 MQ-2 Sensor to Arduino
- VCC→ Arduino 5V
- GND→ Arduino GND
- A0 (Analog Output)→ Arduino A0
🔸 Buzzer
- +→ Arduino pin 8
- –→ GND
🔸 LEDs
- Red LED +→ Arduino pin 7 via 220Ω resistor
- Green LED +→ Arduino pin 6 via 220Ω resistor
- Both – (Cathode)→ GND
💻 Arduino Code: Gas Leakage Detection
#define gasSensor A0
#define buzzer 8
#define redLED 7
#define greenLED 6
void setup() {
pinMode(buzzer, OUTPUT);
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
Serial.begin(9600);
digitalWrite(greenLED, HIGH); // System ready indicator
}
void loop() {
int gasValue = analogRead(gasSensor);
Serial.print(“Gas Value: “);
Serial.println(gasValue);
if (gasValue > 400) { // Threshold for gas detection
digitalWrite(buzzer, HIGH);
digitalWrite(redLED, HIGH);
digitalWrite(greenLED, LOW);
Serial.println(“⚠️ Gas Leak Detected!”);
} else {
digitalWrite(buzzer, LOW);
digitalWrite(redLED, LOW);
digitalWrite(greenLED, HIGH);
}
delay(500);
}
