"Every invention has a reason⦠and ours started with a tragedy that could have been prevented."
A few years ago, in our neighborhood, there was a small family running a home-based catering business. One night, while everyone was asleep, a gas leak went unnoticed. By the time the smell reached them, it was already too late. A small spark from the kitchen ignited the leaked gas, causing a fire that destroyed their home and left them with severe injuries.
That incident deeply affected me. I realized that LPG gas is a silent danger β you canβt always see it, and sometimes you donβt even notice the smell until itβs too late. Every year, thousands of families and small businesses face accidents because they rely on manual detection and delayed response.
Thatβs when I decided to create a solution β a Smart IoT-based Gas Leakage Detection & Automatic Prevention System.
This project was born from a simple promise to myself:
βNo family should suffer because of a gas leak when technology can prevent it.β
βNo family should suffer because of a gas leak when technology can prevent it.β
I believe this system can save lives, protect homes, and secure businesses β making our kitchens and industries safer than ever before
This project is a smart IoT-based LPG gas leakage detection and automatic prevention system designed for homes, restaurants, and small industries. It uses an MQ-2 gas sensor to detect LPG or propane leaks, and a flame sensor to monitor the presence of fire. If a gas leak is detected, the system automatically shuts off the gas supply by triggering a solenoid valve via a relay module.
Everything is controlled using an ESP8266 microcontroller, which also connects to the internet to enable real-time alerts and monitoring via IoT platforms like Blynk or a custom web dashboard.
Why did we decide to make it?LPG is widely used in homes and industries, but gas leaks can be life-threatening if not detected early. Traditional gas cylinders and pipelines rely on human senses (smell, sight) to detect leaks, which often leads to delayed responses.
We wanted to create a system that:
Immediately detects gas leaks
- Immediately detects gas leaks
Warns users with visual/audible alerts
- Warns users with visual/audible alerts
Automatically stops the gas supply
- Automatically stops the gas supply
Can be monitored remotely
- Can be monitored remotely
This way, we reduce response time and minimize risks of fire or explosions.
How does it work?Gas Detection (MQ-2 Sensor):Constantly monitors for LPG or propane levels in the air. When gas crosses a safe threshold, it triggers a digital alert.
- Gas Detection (MQ-2 Sensor):Constantly monitors for LPG or propane levels in the air. When gas crosses a safe threshold, it triggers a digital alert.
Flame Detection:If a flame is detected nearby (indicating fire), an emergency alert is also activated.
- Flame Detection:If a flame is detected nearby (indicating fire), an emergency alert is also activated.
Automatic Shutoff (Relay + Solenoid Valve):The ESP8266 receives input from the sensors. If gas is detected, it triggers a relay to close the solenoid valve, cutting off the gas supply.
- Automatic Shutoff (Relay + Solenoid Valve):The ESP8266 receives input from the sensors. If gas is detected, it triggers a relay to close the solenoid valve, cutting off the gas supply.
IoT Alerts:Users get real-time alerts (through Blynk, email, or app) when a leak is detected. Optionally, the system can display sensor readings and status on a mobile app dashboard.
- IoT Alerts:Users get real-time alerts (through Blynk, email, or app) when a leak is detected. Optionally, the system can display sensor readings and status on a mobile app dashboard.
To transform our vision into a functional and reliable LPG gas leakage prevention system, we followed a structured implementation approach involving both hardware integration and IoT system design. Below are the key steps we took to complete this project:
π§ 1. Hardware Setup and Initial TestingSelected and sourced the appropriate components: ESP8266, MQ-2 gas sensor, flame sensor, 5V relay module, solenoid valve, and power supply unit.
- Selected and sourced the appropriate components: ESP8266, MQ-2 gas sensor, flame sensor, 5V relay module, solenoid valve, and power supply unit.
Individually tested each sensor (MQ-2 and flame) on a breadboard to understand output behaviors.
- Individually tested each sensor (MQ-2 and flame) on a breadboard to understand output behaviors.
Verified that the relay could successfully control the solenoid valve using manual triggers.
- Verified that the relay could successfully control the solenoid valve using manual triggers.
Created a new template and device on the Blynk IoT platform.
- Created a new template and device on the Blynk IoT platform.
Configured Virtual Pins (V0, V1, V2, V3) for gas levels, flame detection, manual override, and system status display.
- Configured Virtual Pins (V0, V1, V2, V3) for gas levels, flame detection, manual override, and system status display.
Connected the ESP8266 to Blynk using the auth token and Wi-Fi credentials.
- Connected the ESP8266 to Blynk using the auth token and Wi-Fi credentials.
Programmed the ESP8266 to:
Read analog gas levels continuously.
- Read analog gas levels continuously.
Detect flames using digital logic (LOW = flame present).
- Detect flames using digital logic (LOW = flame present).
Automatically shut the valve when gas is high and no flame is detected.
- Automatically shut the valve when gas is high and no flame is detected.
Allow manual override via Blynk app switch (for testing or emergency scenarios).
- Allow manual override via Blynk app switch (for testing or emergency scenarios).
- Programmed the ESP8266 to:
Read analog gas levels continuously.
Detect flames using digital logic (LOW = flame present).
Automatically shut the valve when gas is high and no flame is detected.
Allow manual override via Blynk app switch (for testing or emergency scenarios).
Included real-time status feedback on the app for clarity and transparency.
- Included real-time status feedback on the app for clarity and transparency.
Simulated gas leaks using controlled exposure to LPG or lighter fluid spray.
- Simulated gas leaks using controlled exposure to LPG or lighter fluid spray.
Monitored sensor outputs to identify a safe gas detection threshold (~400 analog units).
- Monitored sensor outputs to identify a safe gas detection threshold (~400 analog units).
Adjusted flame detection logic for improved responsiveness and avoided false positives.
- Adjusted flame detection logic for improved responsiveness and avoided false positives.
Built an intuitive mobile UI on Blynk showing:
Gas levels on a graph (optional)
- Gas levels on a graph (optional)
Flame status in binary form
- Flame status in binary form
Valve status and alert text
- Valve status and alert text
- Built an intuitive mobile UI on Blynk showing:
Gas levels on a graph (optional)
Flame status in binary form
Valve status and alert text
Enabled push notifications or dashboard messages for leak detection events.
- Enabled push notifications or dashboard messages for leak detection events.
Migrated the breadboard circuit to a soldered prototype or PCB.
- Migrated the breadboard circuit to a soldered prototype or PCB.
Encased the sensors and controller in a heat-resistant enclosure with proper ventilation slots.
- Encased the sensors and controller in a heat-resistant enclosure with proper ventilation slots.
Ensured power isolation between the relay module and microcontroller for safety
- Ensured power isolation between the relay module and microcontroller for safety
Comments