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

Author

104 Comments

  1. Dushyant

    Does this project needs to be connected to a computer all the time!?

  2. Hi, this project is similar to mine. But how is it possible to add a siren.
    Please give the code for siren and how it is compatible.
    Thank you.

  3. i cant get any messga in phone with my gsm 900a module..pls help

  4. Hello sir good day! What if the homeowner changes his/her phone number? How to change or edit the number? How about changing the number using UI (application) Is that even possible sir? Badly need your thoughts sir for our project.

  5. Hi sir

    Im just wondering if this device can also use multiple kinds of sensor. So you can i dentified which room the fire occurs .

  6. Hi,
    I am using the same LM35,GSM and Arduino to design SMS based temperature monitoring system. The temperature should be 30 degrees celsius. When above or below this value, SMS is send to my mobile phone. Then, I can send SMS to set the temperature to 30 degrees celsius through my mobile phone. Can you please share the code to meet this situation? Kindly.

  7. can i set alert temperature range using fuzzy logic…

  8. murima froduard

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

  9. Is this code applicable for Bangladesh? Our country code is 880. How can I show the message ” Fire scan – ON without using GSM module(just for testing the LCD screen and LM35 sensor) I have bought the GSM module SIMCOM SIM900. Do I need to change anything within the code if I use this GSM module?

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

      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.

  11. teja surendar reddy

    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

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

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

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

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

    • jojo

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

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

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

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

  19. John Paul VIloria

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

  20. Roldan karl Beterbo

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

    • jojo

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

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

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

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

    • jojo

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

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

      Use GPS module for location. Good idea 🙂

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

    • jojo

      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.

  26. Tegegn Mancha

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

    • jojo

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

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

    • jojo

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

  28. Muhammad Hamzah

    Does this circuit work for a UK telephone number?

    • jojo

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

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

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

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

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

  32. sunny emejuru

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

    • jojo

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

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

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

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

    • jojo

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

      • 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

          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

  35. jonathan

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

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

    • jojo

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

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

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

  38. john steven madulin

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

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

    • jojo

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

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

  41. shailaja

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

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

      @dory – You need to rework codes to suit DHT11

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

    • jojo

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

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

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

    • jojo

      @Rohit – Everything is given in this article…

  46. Hemant Kalra

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

    • jojo

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

      • prashant chougule

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

        • jojo

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

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

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

    • jojo

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

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

      @dharani

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

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

  50. bernadettedeles

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

    • jojo

      @bernadettedeles – LM35 – Temperature Sensor

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

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

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

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

        • jojo

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

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

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

      • john steven madulin

        how can i assure that it will function??