How to make IoT based Fire Alarm System using NodeMCU

In this blog, we will learn how to make a fire alarm system using ESP8266 NodeMCU with the Blynk app, This is the IoT-based project to detects the nearby flame & notify on your Blynk app project.

You will need to use some hardware and software in this project
Hardware components
1) NodeMCU ESP8266 PIN Board ×1
2) Analog Flame Sensor For Arduino ×1
3) Jumper wires male to male × 10
4) Breadboard ×1

Software for programming and services
1) Arduino IDE
2) Blynk Application ( android or Ios)
3) Fritzing IDE


In the Modern era of the World, This is quite obvious that you all are updated with the usage and importance of Fire alarm that how significant a role it plays in every office, Commercial place or you can bank or in special places.
On this topic, we are going to present something unprecedented for you.

This is the IoT project with Blynk App for Fire Alarm Notification System using NodeMCU ESP8266. This is a useful IoT App for all Node MCU types applications.

Fire Alarm System
Fire Alarm System

The NodeMCU ESP8266 collects the information from the fire sensor and sends it to Blynk App every second.
NodeMCU ESP8266 and other versions are best known for IoT open-source platforms which added firmware that easily runs at a low cost.

In this NodeMCU, ESP8266 has even included the hardware based on the ERP-12 module.

Now, how many Pins are used for communication?
There are 6 pins and Name As GPIO, SPI, ADC, L2C, PWM, and last but not least UART.

How to make IoT based Fire Alarm System using NodeMCU
Node MCU ESP 8266 Pin Configuration

How to set up the Blynk IOT application, just follow the below 8 steps :
Open the Blynk app and log in with your mail ID or other available ID.
Create or design a new Project into the Blynk App.
Give a proper project name (In my case it’s a fire alarm Notification).
Select the device name as ESP8266 or NodeMCU.
Copy the Auth Token key which will be sent to your registered mail and Paste it into the code.
Include a “Push Notification” Widget to get notification from ESP.
Press “Play” ( The triangle at the right up corner).
The Blynk application will show NodeMCU is offline.
It’s time to write the full code on your Arduino IDE.
Now, you have to include the Blynk library into your include section of code which is given below.
How to detect the presence of nearby fire? Is this possible?
You just understand about the Flame Sensor then you get to know that there were many types of flame sensors.
This Fire Alarm System circuit module has an infrared flame sensor witch detects flame heat.

Steps to Follow

Just follows these simple step to connect the circuit or take a look and the images below.
1) The first step is to connect the GND pin of NodeMCU to the G pin of Flame Sensor
2) The second step is to connect the Vin pin of NodeMCU to VCC(+) pin of Flame Sensor
3) The Last & the important step is to connect the D0 pin of Flame Sensor to the D1 pin of NodeMCU

Circuit Diagram

How to make IoT based Fire Alarm System using NodeMCU
Circuit Diagram of Fire Alarm system using ESP8266

How to Set up the Blynk App

I will give you full detailed instructions step by step about how to set up your project on your Blynk android or ios application.
First, you need to download the Blynk app on your mobile phone.

How to make IoT based Fire Alarm System using NodeMCU
How to make IoT based Fire Alarm System using NodeMCU

Click here to download the Blynk library from Github :

Code For Fire Alarm System

Follow the code written below.
Copy and paste it to your IDE and replace the same value as per your project concern and avoid mistakes!

//Blynk Fire Alarm Notification

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h> 
BlynkTimer timer;
char auth[] = "hiZDt3t7hjeiuWa3VMCQ-portdfge"; //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");
else if (isButtonPressed==0)
void setup()
Blynk.begin(auth, ssid, pass);
void loop()

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.