
Fire Detection And Notification Alarm using Arduino
In this blog, we will implement a smart alarm solution that will send us notifications over SMS and calls in case of a fire outbreak.
Components Required and their Information:
- Flame Sensor Module
- GSM SIM800C Modem Shield with Antenna
- 5mm Red LED
- 5mm Green LED
- 5V Passive Buzzer
- Arduino UNO
- Breadboard
- Jumper Cables
- 9V Battery
- Battery 9V Snap Connector + DC Jack
Flame Sensor Module:
This module basically comprises a comparator IC with a phototransistor that will output a digital low signal whenever it detects IR radiation due to nearby fire. It outputs a digital high signal otherwise. There is a potentiometer to adjust the sensitivity of the sensor.
GSM SIM800C Modem Shield with Antenna:
This one small modem can help use the GSM network of a SIM card. It can be used to make text messages and calls. It can also provide the user with the GPS location. Its low form factor and comparatively lower power requirements make it a good option for this project.
5V passive buzzer
This sensor will automatically start buzzing as soon as 5V is supplied to its +ve Lead.
5mm LED
Both the LEDs can directly be connected to 5V without the need for a resistor thus making the circuit easier to build.
Working Principle:
- The Flame Sensor which consists of a phototransistor will conduct some amount of current when infrared rays from a Fire source is incident on the sensor.
- This, in turn, will cause the sensor to output a digital high signal.
- Our Arduino will be continuously listening to the output of the module and as soon as detect its status as high,
- We will send a request to the GSM SIM800C to send a text message and a call to the predefined number.
- And Bam! You just received the Alert.
The circuit diagram and explanation:
- First Connect the Cathode (+ve) of the 5mm Red LED to digital pin 9 (D9) on Arduino.
- Similarly, connect the Cathode (+ve) of the 5mm Green LED to digital pin 8 (D8) on Arduino.
- Now, connect the Anode (-ve) of both the LEDβs to the Ground pin on Arduino.
- Then connect the +ve of Buzzer to digital pin 5 (D5) on Arduino.
- Next, connect the D0 pin on the Flame Sensor Module to digital pin 5 (D5) on Arduino.
- Connect the VCC and GND on the Flame Sensor Module to the 5V pin and the Ground pin on Arduino respectively.
- Now, connect the TX and RX of SIM800C to the RX (D0) and TX (D1) of Arduino respectively.
- Finally, give the SIM800C power supply using a 9V battery or a 12V Power Supply. Also, ensure that all systems are having common ground by connecting the ground on SIM800C to Ground Pin on Arduino.
- This completes our connection.
Code:
/*
Β * Flame detection and notification system
Β * Code developed by Jatin Vira
Β */
Β
#define redled 9Β Β Β Β Β Β //This will define "redled" as number 9 whenever it occurs again in code
#define greenled 8Β Β Β Β //This will define "greenled" as number 8 whenever it occurs again in code
#define BuzzerPin 7Β Β Β //This will define "BuzzerPin" as number 7 whenever it occurs again in code
#define FlamePin 5Β Β Β Β //This will define "FlamePin" as number 5 whenever it occurs again in code
Β
boolean Flame_Sensor_Value = HIGH;Β Β Β //This variable will store the value of Flame Sensor
Β
void setup()Β //This will run only once and at the start of the program
{
Β /*By using pinMode function we will declare stateΒ
Β Β * of each pin as Output/Input depending on their nature
Β Β * We use OUTPUT when we have to define the output state of the pin (0/5V)
Β Β * We use Input when we have to read
Β Β */
Β pinMode(BuzzerPin, OUTPUT);
Β pinMode(redled, OUTPUT);
Β pinMode(greenled, OUTPUT);
Β pinMode(FlamePin, INPUT);
Β Serial.begin(9600);Β Β //Set the baud rate to 9600 bit per second
}
Β
void loop()Β Β //This will run indefinitely till the program is terminated
{
Β Flame_Sensor_Value = digitalRead(FlamePin); //Store the value of sensor in this variable
Β
Β if (Flame_Sensor_Value == LOW)Β //check if condition matches with fire detection state
Β {
Β Β Β /*Turn on Indicators*/
Β Β Β digitalWrite(BuzzerPin, HIGH);Β Β Β // Turn Buzzer on
Β Β Β digitalWrite(redled, HIGH);Β Β Β Β Β Β // Turn Red LED on
Β Β Β digitalWrite(greenled, LOW);Β Β Β Β Β // Turn Green LED off
Β Β Β
Β Β Β /*Responsible for sending SMS*/
Β Β Β Serial.println("AT+CMGF=1");Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β //Selects SMS message format as TEXT
Β Β Β delay(1000);Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β // Delay of 1 second
Β Β Β Serial.println("AT+CMGS=\"+91xxxxxxxxxx\""); // Replace x with mobile number
Β Β Β Serial.println("FIRE IN THE HOUSE");Β Β Β Β Β Β Β Β // The SMS text you want to send
Β Β Β Serial.println((char)26);
Β Β Β delay(500);
Β Β Β
Β Β Β /*Responsible for making a CALL*/
Β Β Β Serial.println("ATD+ +91xxxxxxxxxx;"); // Replace x with your mobile number
Β Β Β delay(5000);Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β //Wait for Call to reach
Β Β Β Serial.println("ATH");Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β //Hang up the Call
Β }
Β else
Β {
Β
Β Β Β digitalWrite(BuzzerPin, LOW);Β Β Β Β Β Β Β Β Β // Turn Buzzer off
Β Β Β digitalWrite(greenled, HIGH);Β Β Β Β Β Β Β Β Β // Turn Green LED on
Β Β Β digitalWrite(redled, LOW);Β Β Β Β Β Β Β Β Β Β Β Β // Turn Red LED off
Β }
}
Output
Β
- As soon as the sensor detects that some form of IR radiation is incident, it outputs a low signal which when read by the microcontroller outputs a serial print command which has AT commands responsible to make a call and send a text message to a predetermined number.
- A call and a text SMS are received along with the Red LED glowing and the buzzer ringing.
This blog has been submitted by VCET Robotics Club, VCET VasaiΒ under the Robocraze Club Outreach Program.