🔥 IoT Gas Leakage Detection System using ESP32
Gas leakage is one of the major safety concerns in homes and industries. This project uses an ESP32 microcontroller and MQ-2 gas sensor to detect harmful gas leaks such as LPG, methane, and smoke. The system can alert users instantly and can be extended with IoT features for remote monitoring.
ESP32
MQ-2 Gas Sensor
Buzzer / LED
Beginner to Intermediate
- ESP32 Development Board
- MQ-2 Gas Sensor
- Buzzer
- LED Indicator
- Jumper Wires
The MQ-2 sensor detects gas concentration in the air. When the gas level exceeds a threshold, the ESP32 reads the signal and activates a buzzer or LED alert. This system can be enhanced with IoT notifications using Wi-Fi.
VCC → 5V
GND → GND
OUT → GPIO 34
Positive → GPIO 25
Negative → GND
#define GAS_SENSOR 34
#define BUZZER 25
void setup(){
pinMode(GAS_SENSOR, INPUT);
pinMode(BUZZER, OUTPUT);
Serial.begin(9600);
}
void loop(){
int gasValue = analogRead(GAS_SENSOR);
Serial.println(gasValue);
if(gasValue > 300){
digitalWrite(BUZZER, HIGH);
} else {
digitalWrite(BUZZER, LOW);
}
delay(500);
}
- Home gas leakage safety system
- Industrial gas monitoring
- Smart IoT safety solutions
- Fire hazard detection
This project demonstrates a simple yet powerful safety system using ESP32. It can be extended to send alerts via mobile apps or integrated into smart home ecosystems.
