Building an LPG Gas Leak Detector with SMS Alerts: Sensors, Placement and Safety

LPG cylinders are in almost every kitchen in Nepal. A leaking regulator, a cracked hose or a burner left open can fill a closed kitchen with gas. One spark from a light switch or a refrigerator relay is then enough to ignite it. A gas detector that sounds an alarm, cuts off the supply and sends an SMS gives people time to act, even when nobody is home.
This post explains how such a detector works and what matters when you build one.
How the MQ-2 sensor works
The MQ-2 is a cheap, widely used gas sensor. Inside is a small tin dioxide (SnO₂) element heated to a few hundred degrees. In clean air its resistance is high. Combustible gases such as LPG, propane, methane and hydrogen, as well as smoke, react at the hot surface and lower the resistance. The module turns that into a voltage the microcontroller reads on an analog pin.
Three things follow from how it works:
- It needs warm-up time. A new sensor should be powered for a day or two before its readings settle. After that, allow a minute or two at every power-up before trusting it.
- It is not selective. It also responds to alcohol, cooking fumes and humidity changes. The MQ-3 is more sensitive to alcohol vapour, so a design can use both and compare.
- It drifts. Readings change with temperature, humidity and age. Calibrate against clean air at installation and re-check periodically.
Choosing alarm levels
Gas concentration is compared with the Lower Explosive Limit (LEL), the lowest concentration that can ignite. For LPG (a propane and butane mix) the LEL is roughly 1.8 to 2.1 % by volume.
Detectors normally alarm far below that, for example:
| Level | Typical threshold | Action |
|---|---|---|
| Warning | about 10 % of LEL | Buzzer, start exhaust fan |
| Alarm | about 20 to 25 % of LEL | Close gas valve, siren, send SMS |
A cheap MQ-2 cannot measure % LEL accurately without careful calibration, so treat its readings as a trend and set thresholds conservatively.
Where to mount the sensor
LPG is heavier than air. It sinks and collects near the floor, in corners and in cupboards under the stove. Mount the sensor low, about 30 cm above the floor and within a few metres of the cylinder and stove, but not directly above the burner where cooking fumes cause false alarms.
(Natural gas, which is mostly methane, is the opposite: it rises, so its sensors go near the ceiling.)
What the controller should do on alarm
- Close the gas supply. A motorised or solenoid valve, or a servo turning a valve, stops more gas from coming in. This is the most valuable action.
- Ventilate. Start an exhaust fan rated for the job, mounted so its motor is not in the gas stream.
- Warn people locally with a loud buzzer and a light.
- Send an SMS to one or more phone numbers.
- Latch the alarm until someone checks the kitchen and resets it.
One thing it must not do is switch ordinary mains devices on or off inside the gas cloud. A spark from a relay or switch can ignite the gas. Keep the controller's relays and the fan motor outside the area where gas collects, or use equipment rated for it.
Sending the SMS
GSM modules such as the SIM900 or SIM800 are controlled with AT commands over a serial port. Sending a text message is a short sequence: set text mode with AT+CMGF=1, start a message with AT+CMGS="number", send the text and end it with Ctrl+Z.
Two practical points:
- These modules draw current peaks of up to about 2 A while transmitting. A weak supply makes them reset mid-message. Give them their own regulator and a large capacitor close to the module.
- SIM800 and SIM900 are 2G modules. If your network retires 2G, a 4G module with the same AT commands is the safer long-term choice.
Limit how often SMS messages go out, for example one alarm message and then a reminder every few minutes, so a long event does not use up the SIM credit.
A detector is not a certified safety device
A home-built MQ-2 detector is a useful extra layer, but it is not a certified gas detector. For homes, restaurants and commercial kitchens, use a certified detector and shut-off valve, keep hoses and regulators in good condition, and turn off the cylinder valve when the kitchen is not in use.
See the design
The gas and smoke detector with SMS alert project uses MQ-2 and MQ-3 sensors, a SIM900 module, an exhaust fan and a servo-driven gas valve, with firmware tested in simulation. For learning to simulate projects like this one, see the Proteus beginner's guide.