Рет қаралды 12,784
LPG Gas Leakage Detector with SMS Alert | Home Safety Project
Scroll down for code.....
In this tutorial we are going to learn how to detect LPG gas leakage and send SMS notification via GSM Module. It can be a good home safety features, as we can forget to off or accidentally gas leaking, until we know this, it's already late. With this project, it will detect within 5 to 10 seconds of leakage and send the SMS. Even you can receive call for that, but we are not going in this video. This video shows how MQ2 sensor detect LPG gas leakage and GSM SIM900 module will send SMS to owner about gas leakage.
LiquidCrystal_I2C library Github link
github.com/fde...
I2C scanner arduino website
playground.ard...
If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.
LIST OF COMPONENT (affiliate links)
amzn.to/2fvSRJq (Arduino)
amzn.to/2ytw1ve (SIM900) (SIM900 is for US & Canada user & SIM900A is mostly for Asian user)
amzn.to/3dTEGr0 (MQ2 Gas Sensor)
amzn.to/2zg8aeX (I2C)
amzn.to/2yBk7eT (LCD display)
amzn.to/2vSpUON (LED)
amzn.to/2vmSK8l (Resistor)
amzn.to/2wxPmWz (Breadboard)
amzn.to/2vJ3lvo (Jumper wire)
Track: Julius Dreisig & Zeus X Crona - Invisible [NCS Release]
Music provided by NoCopyrightSounds.
Watch: • Julius Dreisig & Zeus ...
Free Download / Stream: ncs.io/InvisibleYO
#include (LiquidCrystal_I2C.h) //instead of parenthesis () put angle bracket as KZbin description does not allow angle bracket
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x3F, 16, 2);
#include (SoftwareSerial.h)
SoftwareSerial SIM900(7, 8);
int led = 2;
int sensor = A0;
int threshold = 150; // threshold value
void setup() {
pinMode(led, OUTPUT);
pinMode(sensor, INPUT);
SIM900.begin(19200);
Serial.begin(19200);
delay(10000);
lcd.begin();
}
void loop() {
float MQ2SensorValues = analogRead(sensor);
lcd.setCursor(0, 0);
lcd.print("Ur Home is Safe!");
lcd.setCursor(0, 1);
lcd.print("Sensor Value:");
lcd.setCursor(13, 1);
lcd.print(MQ2SensorValues);
Serial.println(MQ2SensorValues);
if (MQ2SensorValues ) threshold) // Checks if MQ2 Sensor Value greater than threshold value
{
lcd.setCursor(0, 0);
lcd.print("Gas Leakage...!!");
digitalWrite(led, HIGH);
sendSMS();
}
digitalWrite(led, LOW);
delay(500);
lcd.clear();
}
void sendSMS() {
// AT command to set SIM900 to SMS mode
SIM900.print("AT+CMGF=1
");
delay(100);
// REPLACE THE X's WITH THE RECIPIENT'S MOBILE NUMBER
// USE INTERNATIONAL FORMAT CODE FOR MOBILE NUMBERS
SIM900.println("AT + CMGS = \"XXXXXXXXXXXXX\"");
delay(100);
// REPLACE WITH YOUR OWN SMS MESSAGE CONTENT
SIM900.println("Gas Leakaged..!!");
delay(100);
// End AT command with a ^Z, ASCII code 26
SIM900.println((char)26);
delay(100);
SIM900.println();
// Give module time to send SMS
delay(60000);
}