Audio

[Audio][slideshow]

GSM based SMS Alert Fire Alarm System using Arduino

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.

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.

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.

3. Quick Actions to shut down Fire – 90% of fire damages occur due to lack of early fire detection. A fire attack is usually silent and people will know about fire only when it has spread across a large area. SMS based Fire Alert system gives warning immediately to multiple mobile numbers and hence remedy actions can be taken quickly. This helps to prevent major damages and losses created by a fire accident.

Note 1:- This same circuit can be used to build an arduino temperature alarm system – where an alert has to be sent or a buzzer has to be turned on when temperature goes above or below a particular level.

So lets get to the circuit & coding part!

Note 2:- I suppose you already know how to deal with temperature sensor LM35 and you know how to interface GSM Module with Arduino. Please read and learn those two articles before going ahead..

Circuit Diagram of GSM based Fire Alarm System using Arduino

GSM based Fire Alarm System using Arduino

Circuit Diagram Explanation-Arduino Fire Detector

The circuit connections of this arduino fire alarm are very simple to understand and implement. If you are a beginner, read the following tutorials to grasp connections perfectly.

1. LM35 Temperature Sensor and Arduino – Interfacing Arduino with fire sensor LM35- read this tutorial to learn how to connect LM35 and Arduino

2. GSM Module and Arduino – read this tutorial to learn how to send SMS using Arduino and GSM Module

3. LCD and Arduino – read this tutorial to learn how to connect 16×2 LCD module to Arduino

Program/Code for Fire Alarm System using Arduino

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++;  }    

Important Aspects of the Program

When we develop Fire Alarm Systems or such critical systems, the one important aspect we have to keep in mind is the real world scenario. A “fire” can occur any time (24×7). This means our system must constantly monitor fire 24×7 all the month and year. If you look into the program, you will see it has only 2 function calls inside void loop() – that is CheckFire() and CheckShutDown()

CheckFire() – is the function which monitors occurrence of a fire 24×7. This function fetches the temperature measured by LM35 and stores it to the variable Temp_alert_val for comparison. This temperature value is compared against a set value of 45 degree Celsius. Usually room temperature is between 25 degree Celsius and 30 degree Celsius in tropical areas. This will vary with continents and locations. You have to change this comparison value by measuring the average room temperature of the installation site!

If fire occurs, room temperature will cross 45 degrees (within seconds) and 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<3 – means 3 SMS alerts will be sent to each mobile number. If you want to send 5 alerts, just change the stopping condition to sms_count<5 – you got it ? The function to send SMS (using AT Commands) – SendTextMessage() will be called 3 times if SMS alert count is 3. This function SendTextMessage() will be invoked as many times as the number SMS alerts set in the program.

Note:- We have limited the number of SMS alerts using the stopping condition. Once a fire accident occurs and the set number of SMS alerts has been sent, the system will not send any more SMS! The system assumes that its job is over by sending SMS. Humans has to come and shut down the fire. After sending alerts, the system will start monitoring Shut Down process. Once the Fire has been shut down, system will reactivate its SMS alert settings by resetting the sms_count variable back to zero.

CheckShutDown() – is the function which monitors if fire was shut down. We need to entertain this function only if a fire accident has occurred. To limit the entry to the statements inside this routine, we have introduced a variable Fire_Set. This variable status will be set to value 1 when a fire accident occurs (check the statement inside SetAlert()). The statements inside CheckShutDown() will be executed only if the value of Fire_Set==1. (If not there was no fire accident and we don’t need to waste time executing ShutDown checking statements). We consider the fire has been shut down once room temperature is back to normal. So if our variable Temp_shut_val falls less than 28 degrees, we consider fire has been shut and things are safe. We start our FireAlarm monitoring again with SMS Alerts active! (We reset the Fire_Set variable and sms_count variable back to zero – which are conditions of normal room status)

Implementation of the project!

We have tested this project and code in our lab many times before publishing here. I am attaching a photograph of the final output below.

GSM based Fire Alarm Project

SMS based Fire Alarm
SMS based Fire Alarm using Arduino
GSM Fire Alarm System

If you have any doubt/queries – post in comments section!

We hope you have built an arduino fire alarm with sms alert successfully! This project is good enough to build a home fire alarm system using arduino.We have more arduino projects for you to try and they are listed below!

First of all, have a look at our Arduino Projects collection – which lists 100+ arduino based projects. If you are interested in some fire, smoke and gas detection based projects, here we go:

1. Gas Leakage Detection using Arduino – is a very interesting project to detect LPG leak or the presence of other types of gases like hydrogen, CO etc. Designed using MQ5, Arduino, GSM Module and Buzzer.

2. Arduino Burglar Alarm – is an intruder alert system using PIR sensor and Arduino.

3. Digital Thermometer using Arduino – to build a thermometer with display on LCD using Arduino

4. Temperature Logger using Arduino – to build a temperature monitor using arduino and log temperature levels

Lights

[Lights][grids]