IoT Forest Fire Detection using Arduino and GSM
Forest fire is the very dangerous that will harmful to Wildlife and Environment.

It could be avoided if a robust system could be deployed in forest areas to detect the fire and alert to Fire extinguishing authority to take immediate action.

This project intention is to build a Forest fire detection system using IoT which would detect the fire and send an emergency alert to Authority through IoT.

Here a GSM/GPRS module is used to communicate with IoT sever as usually in forest areas network bandwidth is very low or not available. Hence a 2G network is preferable to communicate with the server.

Component details:
1. Arduino Nano
2. GPS/GPRS Module
3. 3.7V Li-ion Battery
4. Flame sensor

SIM800L Module Working:
SIM800L is a compact module that allows GPRS transmission, send/receive SMS, and making voice calls. SIM800L module has two antennas included on it.

The first is for a ring antenna which can be soldered directly on the board and the other is meant for an external antenna.

Specification:
1. Input voltage: 3.4V – 4.2V
2. Interface: UART and AT commands
3. Supported frequencies: Quad Band (850 / 950 / 1800 /1900 MHz)
4. SIM card socket: micro SIM slot
5. Antenna connector: IPX
6. Working temperature range: -40 do + 85 ° C

Block Diagram:


As shown in the schematic block diagram below, the project consists of Flame sensor, Arduino Nano & SIM800L GSM/GPRS module as its primary components.

The fire can be detected by the flame sensor which gives a digital output that corresponds to the Fire status and is received by the Arduino Nano.

Arduino compares the signal and triggers the SIM800L in case of fire incidents. Through AT commands, SIM800L communicates with thingspeak server.

SIM800L is connected to Arduino Nano via Logic shifting resistors as SIM800L works on 3.3v Logic. Separate power is given to SIM800L module because it works in 3.4-4.2V DC and 5V DC external supply is given to Arduino Nano.

Alternatively, a 3.7-5 V Boost converter can be used here to avoid two power supplies using with solar panel.
Sign up for Thingspeak
First, go to https://thingspeak.com/ and create a new free Mathworks account if you don’t have a Mathworks account before.

#include <SoftwareSerial.h>
SoftwareSerial gprsSerial(10, 11);
#include <String.h>
int flag = 0;
void setup()
{
  pinMode(9, OUTPUT);
  pinMode(12, INPUT);
  gprsSerial.begin(9600);// the GPRS baud rate
  Serial.begin(9600);    // the GPRS baud rate
  Module_Init();
}
void loop()
{
  if (gprsSerial.available())
    Serial.write(gprsSerial.read());
  int fire = digitalRead(12);
  if (fire == 0)
  {
    digitalWrite(9, HIGH);
    gprsSerial.println("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",\"80\"");//start up the connection
    delay(6000);
    ShowSerialData();
    gprsSerial.println("AT+CIPSEND");//begin send data to remote server
    delay(4000);
    ShowSerialData();
    String str = "GET https://api.thingspeak.com/update?api_key=ER43PXXXXXHQF0I&field1=" + String(1);
    Serial.println(str);
    gprsSerial.println(str);//begin send data to remote server
    delay(4000);
    ShowSerialData();
    digitalWrite(9, LOW);
    gprsSerial.println((char)26);//sending
    delay(5000);//waitting for reply, important! the time is base on the condition of internet
    gprsSerial.println();
    ShowSerialData();
    gprsSerial.println("AT+CIPSHUT");//close the connection
    delay(100);
    ShowSerialData();
    flag = 0;
  }
  else
  {
    digitalWrite(9, LOW);
    if (flag == 0)
    {
      flag = 1;
      gprsSerial.println("AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",\"80\"");//start up the connection
      delay(6000);
      ShowSerialData();
      gprsSerial.println("AT+CIPSEND");//begin send data to remote server
      delay(4000);
      ShowSerialData();
      String str = "GET https://api.thingspeak.com/update?api_key=ER43PWT91CGHQF0I&field1=" + String(0);
      Serial.println(str);
      gprsSerial.println(str);//begin send data to remote server
      delay(4000);
      ShowSerialData();
      digitalWrite(9, LOW);
      gprsSerial.println((char)26);//sending
      delay(5000);//waitting for reply, important! the time is base on the condition of internet
      gprsSerial.println();
      ShowSerialData();
      gprsSerial.println("AT+CIPSHUT");//close the connection
      delay(100);
      ShowSerialData();
    }
  }
}
void ShowSerialData()
{
  while (gprsSerial.available() != 0)
    Serial.write(gprsSerial.read());
  delay(5000);
}
void Module_Init()
{
  gprsSerial.println("AT");
  delay(1000);
  gprsSerial.println("AT+CPIN?");
  delay(1000);
  gprsSerial.println("AT+CREG?");
  delay(1000);
  gprsSerial.println("AT+CGATT?");
  delay(1000);
  gprsSerial.println("AT+CIPSHUT");
  delay(1000);
  gprsSerial.println("AT+CIPSTATUS");
  delay(2000);
  gprsSerial.println("AT+CIPMUX=0");
  delay(2000);
  ShowSerialData();
  gprsSerial.println("AT+CSTT=\"www\"");
  delay(1000);
  ShowSerialData();
  gprsSerial.println("AT+CIICR");
  delay(3000);
  ShowSerialData();
  gprsSerial.println("AT+CIFSR");
  delay(2000);
  ShowSerialData();
  gprsSerial.println("AT+CIPSPRT=0");
  delay(3000);
  ShowSerialData();
}

About the Author

Subramanian

Hello! My Dear Friends. I am Subramanian. I am writing posts on androiderode about Electronics testing and equipments.

View All Articles