GSM based Fire Alarm System using Arduino – IoT Project

GSM based fire alarm system using Arduino iot project

GSM based Fire Alarm System using Arduino

 

The fire alarm system alerts people when smoke, fire, carbon monoxide or other fire-related emergencies are detected. These alarms may be automatically turned on by smoke detectors or by manual fire detection devices.

Fire alarm systems are very important as they warn us about any fire related emergencies in their early stages. It can help up in saving a lot of lives as well as cause less damage to properties.

Conventional fire alarm systems do not have fire detection capabilities. These alarms have the manual pull levers and only triggers a local alarm.

A person has to discover the fire in order to turn the fire alarm on. This scenario causes a significant amount of delay, which can ultimately lead to a lot of loss.

As a solution to this problem, we will build a GSM based fire alarm system that notifies the user about any fire emergency via SMS alerts and phone call alerts.

 

 

In this system, the infrared flame sensor and buzzer help in detecting the fire. As soon as a fire is detected, the buzzer is turned ON and this starts the SMS alerts and phone call alerts. These alerts are sent to the predefined phone numbers.

We can register up to three phone numbers. Here, we use GSM SIM800l module for alerting the user about the fire. The flame sensor pin set as input for reading the data and buzzer pin is set as output. If fire is sensed around the infrared sensor, it changes the data in the system and this change is captured by Arduino’s module.

According to the code, once fire is detected, multi-sms and multi-call functions are called and these functions send the alerts to the predefined phone numbers.

Hence, with the help of this project, we can easily build a home fire alert system which can help us in detecting fire and save lives and property.

 

See alsoGSM and GPRS :What exactly these are? Difference between both

 

Components required

  • Arduino Nano
  • Infrared Flame Sensor
  • Buzzer
  • Breadboard
  • Jumper wires
  • 7V battery
  • GSM SIM800l sim

 

Circuit Diagram

 

circuit diagram of GSM based fire alarm system

Image 1:  credit mentioned below

 

Code

 

#include <SoftwareSerial.h>

 

//———————————————————————————–

//Alert reciever’s phone number with country code

const String PHONE_1 = “+9779800990088”;

const String PHONE_2 = “”; //optional

const String PHONE_3 = “”; //optional

//———————————————————————————–

 

//———————————————————————————–

#define rxPin 2

#define txPin 3

SoftwareSerial sim800L(rxPin,txPin);

//———————————————————————————–

 

//———————————————————————————–

int Flame_sensor = 5;

int Flame_detected;

//———————————————————————————–

 

//———————————————————————————–

#define buzzer_pin 4

//———————————————————————————–

 

void setup()

{

//———————————————————————————–

//Begin serial communication: Arduino IDE (Serial Monitor)

Serial.begin(115200);

 

//———————————————————————————–

//Begin serial communication: SIM800L

sim800L.begin(9600);

 

//———————————————————————————–

pinMode(Flame_sensor, INPUT);

 

//———————————————————————————–

pinMode(buzzer_pin, OUTPUT);

digitalWrite(buzzer_pin,LOW);

 

//———————————————————————————-

Serial.println(“Initializing…”);

//Once the handshake test is successful, it will back to OK

sim800L.println(“AT”);

delay(1000);

sim800L.println(“AT+CMGF=1”);

delay(1000);

//———————————————————————————–

}

 

void loop()

{

while(sim800L.available()){

Serial.println(sim800L.readString());

}

 

Flame_detected = digitalRead(Flame_sensor);

Serial.println(Flame_detected);

//delay(100);

//———————————————————————————–

//The fire is detected, trigger Alarm and send sms

if (Flame_detected == 0)

{

digitalWrite(buzzer_pin,HIGH);

Serial.println(“Fire detected…! take action immediately.”);

send_multi_sms();

make_multi_call();

}

//———————————————————————————–

//No fire is detected, turn OFF Alarm

else

{

digitalWrite(buzzer_pin,LOW);

}

//———————————————————————————–

}

 

//———————————————————————————–

void send_multi_sms()

{

if(PHONE_1 != “”){

Serial.print(“Phone 1: “);

send_sms(“Fire detected…! take action immediately.”, PHONE_1);

}

if(PHONE_2 != “”){

Serial.print(“Phone 2: “);

send_sms(“Fire detected…! take action immediately.”, PHONE_2);

}

if(PHONE_3 != “”){

Serial.print(“Phone 3: “);

send_sms(“Fire detected…! take action immediately.”, PHONE_3);

}

}

//———————————————————————————–

 

//———————————————————————————–

void make_multi_call()

{

if(PHONE_1 != “”){

Serial.print(“Phone 1: “);

make_call(PHONE_1);

}

if(PHONE_2 != “”){

Serial.print(“Phone 2: “);

make_call(PHONE_2);

}

if(PHONE_3 != “”){

Serial.print(“Phone 3: “);

make_call(PHONE_3);

}

}

//———————————————————————————–

 

//———————————————————————————–

void send_sms(String text, String phone)

{

Serial.println(“sending sms….”);

delay(50);

sim800L.print(“AT+CMGF=1\r”);

delay(1000);

sim800L.print(“AT+CMGS=\””+phone+”\”\r”);

delay(1000);

sim800L.print(text);

delay(100);

sim800L.write(0x1A); //ascii code for ctrl-26 //Serial2.println((char)26); //ascii code for ctrl-26

delay(5000);

}

//———————————————————————————–

 

//———————————————————————————–

void make_call(String phone)

{

Serial.println(“calling….”);

sim800L.println(“ATD”+phone+”;”);

delay(20000); //20 sec delay

sim800L.println(“ATH”);

delay(1000); //1 sec delay

}

 

 

 Output of Fire alarm system Project

 

output of GSM based fire alarm system

Image 2 : credit mentioned below

 

Advantages

  • Does not require Wi-Fi or Bluetooth connection.
  • Helps in reducing fire damages by 90% by early fire detection.
  • Cost effective

Disadvantages

  • Maximum 3 phone numbers can be registered.
  • Does not help in putting out the fire, just alerts the predefined mobile numbers.

Applications

  • Houses, complex, buildings.
  • It is very useful in locations like factories, industries, mines, etc.
  • It helps in monitoring locations during the night when everyone is asleep.

 

See also: How IoT is changing Livestock Monitoring and Farming?

 

Let us know what you think about GSM based fire alarm system using Arduino in the comment section below.

If you like this post subscribe our YouTube Channel for IoT video Tutorials. You can also find us on Twitter, Facebook, and Instagram for more updates.

 

Image 1 and 2 credit: theGSMprojects

IoTDunia
IoTDunia is working towards a vision of empowering the youth by providing them with great professional opportunities with Internet of Things to build world class ecosystem.