We will learn how to make a fire alarm system using NodeMCUESP8266. This IoT based project detects the nearby flame & informs us.
Things used in this project
Hardware components
NodeMCU ESP8266 Breakout Board ×1
Jumper wires (generic) ×1
Breadboard (generic) ×1
Software apps and online services
Arduino IDE
Blynk
Fritzing
Story
IntroductionThis is quite obvious that you all are updated with the usage and importance of Fire alarm that how significant role it plays in every office or you can banks or in special places. So, today we are going to present something unprecedented for you. This is regarding the IoT project for Fire Alarm Notification System using NodeMCU ESP8266 with Blynk App (useful IoT App).
The NodeMCU ESP8266 collect the information from the fire sensor and send it to Blynk App every second.
NodeMCU is best known for IoT open-source platforms which added firmware that easily runs on the low cost as well. Moreover, this NodeMCU ESP8266 has even included the hardware based on the ERP-12 module.
Now how many Pins it included for the communication?
Almost 6 and also we can share the names with you: GPIO, SPI, ADC, L2C, PWM and the last but not the least UART.
Figure 1
How to detect the presence of fire? Is it possible?
You just understand about the Flame Sensor then you get to know that there were many types of flame sensor. This IoT based Fire Alarm System device also has an infrared flame sensor.
Steps to Follow
Just follows these simple step to connect the circuit or take a look and the diagram below.
First step to connect the GND pin of NodeMCU to G pin of Flame Sensor
Second step is connect the Vin pin of NodeMCU to VCC(+) pin of Flame Sensor
Last & the important step is connect D0 pin of Flame Sensor to D1 pin of NodeMCU
Set up the Blynk App
I give you fully detailed instructions about how to set up your project on Blynk. First of all, you should download the app from your smartphone.
Figure 2
Figure 3
To setup the blynk application, just follow the below steps :
Open the app & login with your mail ID or facebook ID.
Create a New Project.
Give a proper project name (In my case its fire notification).
Choose Device (ESP8266 & NodeMCU).
Copy the AUTH Token which will be sent to your registered mail.
Include a “Push Notification” Widget.
Press “Play” ( The triangle at right up corner). The Blynk app will show NodeMCU is offline.
Its time to upload the full code at your Arduino IDE. You also have to include the library which is given below.
Schematics
Schematic of Fire Alarm System Download
Results
How our project look likes ! Download
Code
CODE FOR FIRE ALARM SYSTEM C/C++Follow the code below .
Copy and paste it to avoid mistakes!
//Blynk Fire Alarm Notification
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
char auth[] = "m0ZDt4tpS5PXLWa3VMCQ-ghytredsdg"; //Auth code sent via Email
char ssid[] = "none "; //Wifi name
char pass[] = "123456789"; //Wifi Password
int flag=0;
void notifyOnFire()
{
int isButtonPressed = digitalRead(D1); // falme sensor connected D1 pin
if (isButtonPressed==1 && flag==0)
{
Serial.println("Fire DETECTED");
Blynk.notify("Alert : Fire detected");
flag=1;
}
else if (isButtonPressed==0)
{
flag=0;
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(D1,INPUT_PULLUP);
timer.setInterval(1000L,notifyOnFire);
}
void loop()
{
Blynk.run();
timer.run();
}