GSM based SMS Alert Fire Alarm System using Arduino

jojo August 10, 2016 95 Comments

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

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

Comments
  • murima froduard
    June 30, 2017

    hi iam proud of working on your project but iam beginner can you me something to remark when implementing this projects

  • Zul
    March 15, 2017

    hello…i want ask when after the sensor detect heat, the word at LCD come out ‘Fire alert, SMS send’ , but after i low the heat into <25, the word, "Fire Shut! SAFE NOW" , didnt come on.Any solution for that problem ? Thanks alot CIRCUIT TODAY

    • jojo
      April 7, 2017

      You may double check the program. If you have made any changes to the program, make sure the program flow (control) enters the subroutine to check shut down.

  • March 2, 2017

    SIr
    my project is similar to your project as i am doing the sms based fire alaram in vehicles but can i add DC submersible water pump to it to spray water

  • Francis Ramos
    February 28, 2017

    The GSM i am using is not like yours because of financial constraints
    so i used SIM900A without shield, and i have a trouble because the GSM doesnt send any message but the two components work well please answer as soon as possible before the deadline.
    Please

  • khan
    February 12, 2017

    good evening sir
    sir i am going develop a project which is ” server room monitoring system using Arduino and GSM module ” which can send sms to operator if there is changes in following factor : –
    1. temperature change
    2. humidity
    3. power pulse change
    4. smoke sensor

  • JAGAN KANIPAKAM
    February 9, 2017

    And provide the reduction methods also please sir, about to stop the fire like a robot, using this GSM module, through the another mobile with SMS

  • JAGAN KANIPAKAM
    February 9, 2017

    Sir , please provide a video based description about this project,Iam confused about the programs , there are different things we used like temperature detector,GSM module,LCD display,and each one is having different code,we need to merge the all program codes together???????

    • jojo
      April 7, 2017

      @Jagan – this is a complete program developed using subroutines. Subroutines are used for easy development and understanding of the program. You may copy this as such and paste into Arduino IDE. Then burn it!

  • Akshay
    December 29, 2016

    i have gsm module 900A ,the code isn’t working with this module. so tell us which module we have to used for this project….. which module you have used in this project..

  • murthy
    December 16, 2016

    Can you. Plz send the code for. Interfacing pir sensor instead of lm35

  • CORINA
    December 5, 2016

    are you using arduino uno R3 ?

    • jojo
      April 7, 2017

      Yes 🙂

  • hitesh bhoi
    November 29, 2016

    Can i connect limit switch instead of LM35,,to get pressing sms on mobiel?,,i want to connect multiple limt switch then what will be a change in code?> please help

  • John Paul VIloria
    September 16, 2016

    Can we replace the lm35 with dht11 and gsm sim900 to sim 800?

  • Roldan karl Beterbo
    September 14, 2016

    how can i use the 10k potentiometer? please guide..
    and where is the potentiometer in the expected output?

    • jojo
      April 7, 2017

      10K Potentiometer is used to adjust the contrast of LCD module.

  • John Patrick Gallardo
    September 11, 2016

    Sir jojo I am a Grade 10 student and working on a LASER alarm project, can i use this code for our laser alarm project ?? or do you know the code for the sending of SMS in a laser alarm ?? Please Sir i really need you help for our project. I hope for your reply.

  • Alsadig
    July 18, 2016

    Hi Jojo
    Greetings
    Please help I want to use more than one smoke sensor in different location using one program to control the system .

    Thanks

  • Bharath
    July 3, 2016

    The temperature sensor gets heated up as soon as I connect the circuit to the Arduino.

    • jojo
      April 7, 2017

      @Bharath – You might have connected the sensor wrongly. Check datasheet of LM35 and connect correctly.

  • manisha
    May 23, 2016

    i thought of improvising this project by sending alert to fire engine along with the location where fire accident occurred….. so that they can rescue immediately …how about implementing it?

    • jojo
      April 7, 2017

      Use GPS module for location. Good idea 🙂

  • KEVIN RUTTO
    May 21, 2016

    hi, is it possible to interface a solenoid valve to the arduino for automatic extunguishing?, and if yes what will a solenoid valve be powered by a 5V from the arduino?

    • jojo
      April 7, 2017

      You can connect a pump or solenoid valve or whatever actuators you would like. The real point here is you can not connect any of these directly to arduino. You can only send a command to turn these devices ON/OFF from arduino. Inorder to power these devices, you should use a separate power supply (independent of arduino) and in most cases you should use a driving circuitry to drive these devices properly via arduino.

  • May 14, 2016

    thank’s for all ur discription,would u help by C code programm for arduino based remote peteint monitoring system by using gsm

    • jojo
      April 7, 2017

      You dont need “C” code for Arduino!!! You can write much easily in Arduino Programming Language. Its very much similar to writing in C.

  • May 5, 2016

    Very detail article and well described, thanks you,
    can you help me regarding this two points
    Apart from SMS alert if I want to make continuous ring in my mobile what changes need to be done,
    How I interface digital input signal to give continuous ring

    • jojo
      April 7, 2017

      @ uttam – Use AT commands to make a call and your problem is solved. Replace the AT commands for sending SMS with that of to make a call.

  • Muhammad Hamzah
    April 18, 2016

    Does this circuit work for a UK telephone number?

    • jojo
      April 7, 2017

      Circuit and program is independent of country. Change the mobile number in the program with your country code.

  • Salil
    April 17, 2016

    can we add two sensors to this system. SMoke and a temperature sensor?

    • khan
      February 12, 2017

      yes you can add both sensor but for that u have to change programing and power supply as well.

  • srividhya
    March 17, 2016

    I am doing garbage monitoring using arduino uno and i am using GSM sim900 module how can i send sms using this GSM module

  • salil
    March 14, 2016

    hello , can you tell how can we add the code of a MQ2 sensor to this existing program?
    Thank You

  • sunny emejuru
    March 10, 2016

    this is a very nice project.. please i need a comprehensive lists of all the components needed for this project. thank you

    • jojo
      March 10, 2016

      @sunny emejuru – Please look at the circuit diagram carefully. Its an LM35, Arduino, a GSM Module and an LCD Module with some resistors!

  • BASANT
    March 10, 2016

    I have connected all the components as per your circuit diagram and uploaded your above given program but in Serial monitor it is showing random temperature values like 60, 70 and the sms gets sent within room temperature. This thing happens only if I switch on the GSM module, and if I switch off the GSM Module the Serial Monitor shows perfect temperature like 28, 29…Please help

    • jojo
      March 10, 2016

      @BASANT – It can be a “ground” problem. You have to make all “ground” connections common at one point. It just means, Ground pins of Arduino, LM35, GSM Module and LCD – all should be connected to a common ground rail. Got it ?

  • rohit shukla
    March 6, 2016

    the code isnt working i have a gsm module 900a and a arduino just the sensor is mq6
    the dailing is not taking place help me out

    • jojo
      March 6, 2016

      @Rohit – We have tested this code many times. Also we use this same code to build our Fire Alarm kits. So we have no doubt about its working. You might have run into some other problem.

      • AKASH
        March 22, 2017

        Dear Jojo

        This is very good project that you have prepared,

        my application is different we have high voltage motor with water cooling system, now in case of cooling system fail, we want to sent the Motor temperature “HIGH” & “LOW” massage over GSM,
        I want to use NTC temperature sensor,Arduino Uno & GSM module
        Can you help me to prepare program for this application & NTC sensor connection.

        Thanks

        • jojo
          April 7, 2017

          Hi Akash,

          You need to make the following changes.

          1. High voltage motor needs a separate circuit to drive the motor (a driving transistor or IC is necessary)
          2. Our program is designed for LM35 – which is a linear sensor. NTC (thermistor) is non linear. You have to calibrate accordingly.

          If you need us to design a custom circuit+program, please write to us – info@circuitstoday.com

  • jeyaganesh
    February 3, 2016

    clear explanation

  • jonathan
    January 21, 2016

    would you please give me a design of water level sensor connecting arduino to send sms to the server computer or phone.

  • venny ribz
    December 15, 2015

    Good day sir… I will be working on a project closely related to yours, and i have a hard time deciding on how can be the information from the arduino-GSM shield be receive by my computer or what devices i have to use. Our proposed system is a fire alarm system that the information will be sent to a cellphone and computer. We will be installing a smoke sensor, gsm shiled, arduino in an establishment the server will be 1 km away.
    Hoping for your response asap.
    Thank you.

    • jojo
      March 1, 2016

      @venny – complex stuffs 😉 You can put the sensor in monitoring area along with arduino and gsm module. The challenge is giving output to a computer/server at 1 KM away. I think you can use internet based communication to achieve this. Send your message over internet from arduino and receive it on PC.

  • jr.
    December 6, 2015

    can i use smoke detector on that project??

    • jojo
      February 3, 2016

      Yes – you can

  • Nerissa
    December 1, 2015

    what if in a case of which you want to change the mobile number of an occupant of a house, (i.e not making the mobile number of the sms alert permanent in case of change of occupant in the case of a rented apartment).

    • jojo
      March 1, 2016

      @Nerissa – For this, you have to collect the mobile number via a keypad interfaced to arduino or via an SMS sent to the mobile number of sim card inserted in the GSM module. In both cases, you need to alter this program. A fresh approach is needed in programming. Memory must be interfaced to save mobile number on power failure.

  • December 1, 2015

    will it work 100% successful???? thanks!!

  • Ridhwan
    November 26, 2015

    good day! i have a problem uploading the program. it said that the ‘CheckFire’ was not declared in this scope. why is that?

    • jojo
      February 3, 2016

      @Ridhwan – Its a minor glitch in the code. Scan and rework!

  • zoni
    November 26, 2015

    sir, how can we include the directory of my serial software ?

  • shailaja
    November 24, 2015

    sir, may i know the estimated cost for this project 🙂

  • dory
    November 16, 2015

    hello, i have something to ask. if i want to use DHT11 as sensor, what should i change in the codes? does it used same code line for “temp_read=analogRead(sensor);”? thanks sir

    • jojo
      February 3, 2016

      @dory – You need to rework codes to suit DHT11

  • Jawad
    November 12, 2015

    Sir. Can i add MQ2 smoke sensor in this project ????

    • jojo
      February 3, 2016

      Yes – You need to rework the code to suit MQ2 outputs

  • ritik
    October 2, 2015

    where can i buy this at cheapest please
    and could you do a video about asembleing this please

  • rohit mishra
    September 14, 2015

    as i m a begineer hw will i start to construct my adruino based SMS alert fire alarm system.
    please send me the construction and working principle of that project

    • jojo
      September 16, 2015

      @Rohit – Everything is given in this article…

  • Hemant Kalra
    September 12, 2015

    Can the above circuit be simulated in any simulator before practical implementation?

    • jojo
      September 16, 2015

      @Hemant – If you have arduino and gsm module, you can implement this project faster than simulation

      • prashant chougule
        January 22, 2016

        How can I read sms and use that into the program as command in arduino uno. send me the sample program.

        • jojo
          February 3, 2016

          @Prashant – Refer AT Commands to read sms from GSM module.

  • Jessica
    September 10, 2015

    Hello everyone,
    I’m using and I2C LCD and did the necessary replacements in code and the temperature and alarming messages display on LCD perfectly fine which means the loops and most part of the code works well, just SMS cannot be sent to my phone. Also made sure to change the pins of Tx and Rx that for my Arduino are 0 and 1 and dont know what can be wrong. Would greatly appreciate some help, Thank you!

    • Jessica
      September 10, 2015

      Also, the GSM/GPRS module im using is from SIMCOM and compatible with UNOR3

    • jojo
      September 16, 2015

      @Jessica – Just check the delays are proper. Also do some trouble shooting. Make sure AT COMMANDS are proper!

  • dharani
    July 31, 2015

    hiee! i js hv a doubt..hw cn i replace the arduion uno with arduino nano?? n wil d prog that is written for uno change if i replace it with nano??

    • jojo
      August 19, 2015

      @dharani

      Check for hardware connections and pins in nano. Change the pins in software accordingly. Also check for instruction compatibility….

  • Gerald
    July 20, 2015

    sir, what if the device is put on populated areas like squatter areas, how will the device determine if its really a big fire not just a single cigarette smoke or something not really that dangerous? thanks for your help.

  • bernadettedeles
    July 2, 2015

    Good day… sir i just wanted to ask .. what smoke sensor did you used?
    hoping for your response ASAP.
    Thank you

    • jojo
      July 5, 2015

      @bernadettedeles – LM35 – Temperature Sensor

      • bernadettedeles
        July 16, 2015

        Good day sir… I will be working on a project closely related to yours, and i have a hard time deciding on how can be the information from the arduino-GSM shield be receive by my computer or what devices i have to use. Our proposed system is a fire alarm system that the information will be sent to a cellphone and computer. We will be installing a smoke sensor, gsm shiled, arduino in an establishment the server will be 1 km away.
        Hoping for your response asap.
        Thank you.

  • Camille
    July 1, 2015

    hi sir …i just want to ask if it will be possible to use PC instead of lcd screen display that you used..? thanks sir

    • jojo
      July 2, 2015

      @Camille – You can use Serial Monitor of Arduino IDE to display messages/output status messages on PC screen

      • Camille
        July 2, 2015

        good day! just want to ask what smoke sensor did you used?
        Thanks

        • jojo
          July 5, 2015

          @Camille – Its not smoke sensor. We used a “temperature sensor” – LM35

  • jee
    May 19, 2015

    Hi sir..im here to ask a few question..i wonder why my lcd screen does not display any output as my circuit same as yours..T_T
    Thanks sir

    • jojo
      May 19, 2015

      @jee – If you don’t see back light of LCD turned (that is LCD not powered up) – you may check power connections (Vcc to +5v, Vss to GND and LED+ to +5v and LED- to GND). If the back light is ON and character is not displaying, you may adjust the potentiometer connected Vee.

Leave a Reply to CORINA Cancel reply

Your email address will not be published. Required fields are marked *