Last Updated on August 10, 2016 by jojo in Arduino with 8 Comments
We have published lots of interesting arduino projects like GSM based Fire Alarm System , Line Following Robot, RFID Based Access Control System and many other useful projects. This time, we are publishing a highly useful home application – Gas Leakage Detector using Arduino and GSM Module with SMS Alert and Sound Alarm. We have published an LPG Sensor Project using Arduino and MQ2 sensor before – which senses lpg leak and produces sound alarm. The project also has a relay system which turns ON or OFF a particular device upon gas leak (say we can turn the main electrical supply OFF upon gas leak to prevent fire).
So let’s come to our project!
Objectives of the Project
Detect Gas Leakage (like LPG leak, Butane leak, Methane leak) or any such petroleum based gaseous substance that can be detected using MQ5 Sensor.
Setup an SMS based Alert Mechanism and send 3 SMS (3 alert messages) to 2 specified mobile numbers (input inside the arduino program)
Produce a sound alarm upon gas leak and stop the alarm once gas leak is under control (gas presence in atmosphere is under normal range)
Display status in an LCD using a 16×2 LCD module.
Lets begin to build our project – Gas/LPG leakage detector with SMS Alert and Sound Alarm!.
I recommend you read the following tutorials before building this project!
1. Interfacing MQ5 Sensor to Arduino – teaches you how to interface MQ5 LPG sensor to Arduino and read values using analog or digital out pins of the MQ5 module.
2. Interfacing GSM Module to Arduino – teaches you how to interface a GSM module to Arduino and send/receive text messages using AT Commands.
GSM Module – Buyers Guide – are you looking to buy a GSM module? There are a handful of product variants for GSM module – like SIM900, SIM300, SIM800 etc. We have created this buyers guide to help you select the right GSM module for your project needs.
Circuit Diagram – Gas Leakage Detector using Arduino with GSM Module
Important Aspects about the Program
When we develop critical systems like Gas Leakage Detector or similar systems like Fire Alarm System, we need to monitor the sensor parameters continuously(24×7). So our system must monitor “gas leak” continuously.This is achieved by scanning the sensor output (digital out of MQ5) continuously inside the ScanGasLevel() subroutine. If you look into the program, the main function loop() has only two subroutines – CheckGas() and CheckShutDown() – which are called repeatedly. CheckGas() – is a subroutine which scans sensor output continuously and take actions if there occurs a ‘gas leak’ at any point of time. CheckShutDown() – is a subroutine to monitor the shut down process and check if status of room is back to normal conditions (no gas leaking).
CheckGas() – is the function which monitors occurrence of a gas leak 24×7. This function fetches the gas level measured by MQ35 (by reading digital out of MQ35 using digitalRead() command) and stores it to the variable Gas_alert_val for comparison. If there is no ‘gas leak’ – the sensor out will beHIGH. If there occurs a ‘gas leak’ at any point of time, the sensor out will immediately change to LOWstatus. The statement if(Gas_alert_val==LOW) checks this and if a gas leak occurs, then an inner subroutine SetAlert() will be invoked.
SetAlert() is the function that controls number of SMS alerts sent to each mobile number loaded in the program. The number of SMS alerts sent can be altered by changing the stopping condition of while loop. The stopping condition sms_count