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

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

Show Comments

94 thoughts on “GSM based SMS Alert Fire Alarm System using Arduino

  1. Zul

    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

    Reply
    • jojo Post author

      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.

      Reply
  2. Francis Ramos

    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

    Reply
  3. khan

    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

    Reply
  4. JAGAN KANIPAKAM

    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

    Reply
  5. JAGAN KANIPAKAM

    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???????

    Reply
    • jojo Post author

      @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!

      Reply
  6. Akshay

    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..

    Reply
  7. hitesh bhoi

    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

    Reply
  8. John Patrick Gallardo

    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.

    Reply
  9. Alsadig

    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

    Reply
    • jojo Post author

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

      Reply
  10. manisha

    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?

    Reply
  11. KEVIN RUTTO

    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?

    Reply
    • jojo Post author

      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.

      Reply
    • jojo Post author

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

      Reply
  12. Uttam Dutta

    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

    Reply
    • jojo Post author

      @ 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.

      Reply
    • jojo Post author

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

      Reply
  13. srividhya

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

    Reply
  14. sunny emejuru

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

    Reply
    • jojo Post author

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

      Reply
  15. BASANT

    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

    Reply
    • jojo Post author

      @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 ?

      Reply
  16. rohit shukla

    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

    Reply
    • jojo Post author

      @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.

      Reply
      • AKASH

        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

        Reply
        • jojo Post author

          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

          Reply
  17. jonathan

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

    Reply
  18. venny ribz

    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.

    Reply
    • jojo Post author

      @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.

      Reply
  19. Nerissa

    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).

    Reply
    • jojo Post author

      @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.

      Reply
  20. Ridhwan

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

    Reply
  21. dory

    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

    Reply
  22. rohit mishra

    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

    Reply
  23. Jessica

    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!

    Reply
  24. dharani

    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??

    Reply
    • jojo Post author

      @dharani

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

      Reply
  25. Gerald

    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.

    Reply
  26. bernadettedeles

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

    Reply
      • bernadettedeles

        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.

        Reply
  27. Camille

    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

    Reply
  28. jee

    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

    Reply
    • jojo Post author

      @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.

      Reply

Leave a Reply

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