0% found this document useful (0 votes)
50 views19 pages

Automated Fire Alert and Extinguishing System

This project aims to build an automated fire alert and extinguishing system for homes and commercial buildings. The system uses a NodeMCU microcontroller interfaced with a flame sensor, sprinkler, DC motor, and motor driver. When the flame sensor detects a fire, an email will be triggered to alert authorities. The sprinkler will turn on and remain on until no fire is detected. An SMTP platform called SMTP2GO will be configured to send emails upon fire detection. The materials, circuit diagram, and NodeMCU code for the system are described.

Uploaded by

Ayush Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views19 pages

Automated Fire Alert and Extinguishing System

This project aims to build an automated fire alert and extinguishing system for homes and commercial buildings. The system uses a NodeMCU microcontroller interfaced with a flame sensor, sprinkler, DC motor, and motor driver. When the flame sensor detects a fire, an email will be triggered to alert authorities. The sprinkler will turn on and remain on until no fire is detected. An SMTP platform called SMTP2GO will be configured to send emails upon fire detection. The materials, circuit diagram, and NodeMCU code for the system are described.

Uploaded by

Ayush Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

AUTOMATED FIRE ALERT

AND EXTINGUISHING
SYSTEM

Group Members:
VAIKUNT RAJESH – 18BCM0004
ANUSHKA RANAUT – 18BCM0051
PRIOJIT SARKAR - 18BCM0083
AYUSH SINGH – 18BCM0097
YASHVARDHAN SAROGI – 18BCM0098
ANNIKKA KUMAR - 18BCM0116
Fire Accident will occur very rarely, but once it occurred it consequences will be
devastating. So at any cost fire accidents should be eliminated completely. Through this
project you are going to build for a unique fire protection system for the Homes and
commercial buildings.
 
PROJECT DESCRIPTION
• We will need NodeMCU to interface the microcontroller with flame sensor,
sprinkler, DC motor and motor driver.
• We will program the microcontroller in such a way that say whenever the
flame sensor detects a fire an email would be triggered to the concerned
authority immediately and also the sprinkler would be turned on.
• Email is triggered via an IOT platform called SMTP2Go. The data collected by
the sensor into the NodeMCU is published on an external cloud service and
continuously observed by the IOT platform. In case of positive response from
the flame sensor, immediately an email is triggered about the fire hazard that
has occurred.
• The sprinkler will be in on position till the flame sensor would detect any
traces of fire present in the surrounding.
• Thereby we can avoid loss of life.
MATERIALS REQUIRED

• NodeMCU ESP8266:
It is an open source IoT platform. It includes firmware which runs on the low
cost Wi-Fi enabled ESP8266 Wi-Fi SoC from Espressif Systems, and
hardware which is based on the ESP-12 module. It has GPIO, SPI, I2C, ADC,
PWM AND UART pins for communication and controlling other peripherals
attached to it. On board NodeMCU has CP2102 IC which provides USB to
TTL functionality. In
this IoT Fire Alarm, we are using one GPIO pin to get the digital data from
the flame sensor.
• Flame Sensor:
Flame sensor is a device which is used to detect the presence of fire in its
surrounding. There are many types of flame sensors available such as Infrared
Flame sensor, Ultraviolet flame sensor etc. In this project we will be
using Infrared Flame Sensor to detect the fire.
Infrared Flame Sensor consists of a photodiode coated with black epoxy which
makes it sensitive to the infrared radiations having wavelength between 700nm
to 1mm and can detect fire up to distance of 100cm within 60 degrees of
angle of detection. This photodiode is based on a three terminal YG1006 NPN
Photo transistor.
• Motor Driver: 
Generally the Arduino board is not capable of providing required
amount of current for running the motors. So we use a device called
Motor Driver which will provide sufficient current for driving the motors.
• DC Motors:
A DC motor is a A DC motor is any of a class of rotary electrical motors
that converts direct current electrical energy into mechanical energy. It
would rotate 360 degrees in a particular direction.
• Submersible pump:
A submersible pump will take water from the water tank till the dc
motor sprinkler system.
Configure SMTP2GO to send Email on
Fire Detection
• SMTP (Simple Mail Transfer Protocol) is a platform used to send and receive large number
of emails from remote locations automatically. Due to its fast and reliable service it is mostly
used by developers and marketers to save their time in sending emails in a secured way.
• Its servers and data centres are all around the world which helps it to select the nearest
server and hence provides fastest connection in sending and receiving emails.
• It can be used in IOT projects to send emails automatically when a particular task is
occurred. In this project we will be using SMTP2GO to send emails alerts when fire is
detected by the flame sensor.
Setting up SMTP2Go:
• Go to https://www.smtp2go.com/ and click on Try SMTP2GO Free.
• Fill the details with your name, email id and password and click on
Submit. Then it will redirect to a page where it will ask you to activate
SMTP2GO.
• Go to your mail box and click on the mail received by SMTP2GO. Click
on Activate Account.
• Now enter the username which is your email id and password. A new
page will open with your username. Save these username and password
in a notepad file which will be needed later in Arduino IDE code. Now click
on Settings and then Click on Users. A new page will open with your user
name and SMTP server details. Save the SMTP server and SMTP Port as
these will be used in Arduino code to connect with SMTP server.
Encoding to Base64 Value

• Before sending username and password to


SMTPTOGO server, we need to encode them into
Base64. To encode them we will used the 
https://www.base64encode.org/.
• Here just enter the username and password you want
to encode into base64 and Click on Encode to
generate the encoded values. Copy and save the
encoded values.
• For instance, is your user name is “[email protected]
then enter this username in the given text area and
then click on encode. The encoded base64 value is
“cGFzc3dvcmQ=”. Similarly do it for password.
CIRCUIT DIAGRAM
NodeMCU Code:
#include <ESP8266WiFi.h>
#include <AFMotor.h>
#define motor1_IN1 12
#define motor1_IN2 11
#define RELAY1 9
#define RELAY2 8
 
const char* ssid = "Enter your ssid";  
const char* password = "enter your password";  
char server[] = "mail.smtp2go.com";  
const int flame = D0; 
const int buzz = D1;
WiFiClient Client;              //define wifi client as client
void setup() {
  pinMode(flame,INPUT);
  pinMode(buzz,OUTPUT);
  Serial.begin(115200);         
  Serial.println("");
  Serial.print("Connecting To: ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);     
  while (WiFi.status() != WL_CONNECTED)
 {
    delay(500);
    Serial.print(".");
 }
  Serial.println("");
  Serial.println("WiFi Connected.");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(motor1_IN1, OUTPUT); // for dc motor
pinMode(motor1_IN2, OUTPUT);
Serial.begin(9600);
}
void loop() {
int t = digitalRead(flame);
Serial.println(t);
if (t==0) {           
digitalWrite(buzz,HIGH);
sendEmail();
Serial.print("Mail sent to:"); 
Serial.println(" The recipient");
Serial.println("");
digitalWrite(motor1_IN1 , HIGH); // for clockwise rotation
digitalWrite(motor1_IN2 , LOW);
delay(500);
digitalWrite(RELAY1, LOW); // turn on relay 1
delay(2000); // wait 2
seconds
digitalWrite(RELAY1, HIGH); // turn off relay 1
digitalWrite(RELAY2, LOW); // turn on relay 2
delay(2000); // wait 2 seconds
digitalWrite(RELAY2, HIGH); // turn off relay 2 
}
digitalWrite(buzz,LOW);
}
byte sendEmail()
{
  if (Client.connect(server, 2525) == 1)        // connect to smtp server with port address 2525
 {
    Serial.println(F("connected to server"));
  } 
  else 
 {
    Serial.println(F("connection failed"));
    return 0;
 }
  if (!emailResp())         // if connection failed return now
    return 0;
  //
  Serial.println(F("Sending EHLO"));
  Client.println("EHLO www.example.com");      
  if (!emailResp()) 
    return 0;
    
  Serial.println(F("Sending auth login"));
  Client.println("AUTH LOGIN");
  if (!emailResp()) 
    return 0;
  
Serial.println(F("Sending User"));
  Client.println("c2VuZGVyQHh5ei5jb20="); //base64, ASCII encoded SMTP Username   
  if (!emailResp()) 
    return 0;
  Serial.println(F("Sending Password"));
  Client.println("cGFzc3dvcmQ=");   //base64, ASCII encoded SMTP Password    
  if (!emailResp()) 
   return 0;
Serial.println(F("Sending DATA"));
  Client.println(F("DATA"));
  if (!emailResp()) 
    return 0;
  Serial.println(F("Sending email"));
  
  Client.println(F("To:  [email protected] "));                
  
  Client.println(F("From: [email protected] "));                 
  Client.println(F("Subject: Fire Alarm\r\n"));
  Client.println(F("Attention: Fire Detected.\n"));
  Client.println(F("."));
  if (!emailResp()) 
    return 0;
  Serial.println(F("Sending QUIT"));
  Client.println(F("QUIT"));
  if (!emailResp()) 
    return 0;
  Client.stop();
  Serial.println(F("disconnected"));
  return 1;
}
byte emailResp()
{
  byte responseCode;
  byte readByte;
  int loopCount = 0;
  while (!Client.available()) 
 {
    delay(1);
    loopCount++;
    // Wait for 20 seconds and if nothing is received, stop.
    if (loopCount > 20000) 
  {
      Client.stop();
      Serial.println(F("\r\nTimeout"));
      return 0;
  }
 }
  responseCode = Client.peek();
  while (Client.available())
 {
    readByte = Client.read();
    Serial.write(readByte);
 }
  if (responseCode >= '4')
 {
    //  efail();
    return 0;
 }
  return 1;
}
 

You might also like