Tuesday, 12 July 2016

GSM based SMS Alert Fire Alarm System using Arduino


http://www.circuitstoday.com/wp-content/uploads/2015/04/GSM_based_Fire_Alarm_System_using_Arduino.png

                

           In this article,we are going to build a Fire Alarm System using Arduino, LM35 Temperature Sensor and GSM Module. The objectives of this fire detector using arduino is to sense the surroundings for occurrence of fire with help of LM35 temperature sensor, and send 3 SMS alerts to two mobile numbers stored inside the arduino program if fire is detected (using GSM Module).

              We have developed a very good tutorial on how to interface GSM Module with Arduino and send/receive SMS using GSM module. Interfacing any device with a micro controller is the first step to building a useful system or project with that particular device. In this tutorial, we are going to build a very interesting project – a Fire Alarm System which will send SMS to a set of Mobile Numbers when fire occurs in a particular location. 
          We have seen many typical Fire Alarm projects which will alert with a siren or that activates an automatic shutdown mechanism. This fire alarm project make use of modern communication technologies to deal with emergencies. 

Applications of SMS based Fire Alarm System

1. SMS based Fire Alarm system are very useful in remote locations where human interaction is limited. Such systems are useful in mines, industrial areas, factories etc.
2. Night Owl – We all know owls don’t sleep during night. SMS based Fire Alarm system helps to monitor locations and alert during fire that occurs in night time.
So here is our program to monitor Fire Accident and to monitor the Shut Down Process (that should happen after a fire accident)!
#include <SoftwareSerial.h>
#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 
SoftwareSerial mySerial(9, 10);

int sensor=A1;
float temp_read,Temp_alert_val,Temp_shut_val;
int sms_count=0,Fire_Set;


void setup()
{
  pinMode(sensor,INPUT);
  mySerial.begin(9600);   
  Serial.begin(9600);    
  lcd.begin(16,2);  
  delay(500);
}

void loop()
{
CheckFire();
CheckShutDown();
}

void CheckFire()
{
lcd.setCursor(0,0);
lcd.print("Fire Scan - ON");
Temp_alert_val=CheckTemp();
if(Temp_alert_val>45)
{
 SetAlert(); // Function to send SMS Alerts
}
}

float CheckTemp()
{
temp_read=analogRead(sensor); // reads the sensor output (Vout of LM35)
temp_read=temp_read*5;    // converts the sensor reading to temperature
temp_read=temp_read/10;  // adds the decimal point
return temp_read; // returns temperature value in degree celsius
}

void SetAlert()
{
while(sms_count<3) //Number of SMS Alerts to be sent
{  
SendTextMessage(); // Function to send AT Commands to GSM module
}
Fire_Set=1; 
lcd.setCursor(0,1);
lcd.print("Fire Alert! SMS Sent!");
}

void CheckShutDown()
{
if(Fire_Set==1)
{

Temp_shut_val=CheckTemp();
if(Temp_shut_val<28)
{
lcd.setCursor(0,1);
lcd.print("Fire Shut! SAFE NOW");
sms_count=0;
Fire_Set=0;
}}}

void SendTextMessage()
{
  mySerial.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(2000);
  mySerial.println("AT+CMGS=\"+919544xxxxxx\"\r"); // change to the phone number you using 
  delay(2000);
  mySerial.println("Fire in NEW ROOM!");//the content of the message
  delay(200);
  mySerial.println((char)26);//the stopping character
  delay(5000);
   mySerial.println("AT+CMGS=\"+919847xxxxxx\"\r"); // change to the phone number you using 
  delay(2000);
  mySerial.println("Fire in NEW ROOM!");//the content of the message
  delay(200);
  mySerial.println((char)26);//the message stopping character
  delay(5000);
  sms_count++;
}
http://www.circuitstoday.com/wp-content/uploads/2015/04/2.jpg