How to make an IoT fire alarm.

If you are looking for a nice fire solution in a place where false alarms happen a lot, this is by far the cheapest, best solution I know.

What you will need – Hardware

What you will need – Software

How to create – Step 1: Setting up Blynk

First, make sure you have the app on your phone.

Now create an account or log in.

Click “New Project”.

Give an appropriate project name. I thought that the name “Fire Sensor” would be reasonable.

Choose the device name of “ESP8266” or, more preferably, “NodeMCU”.

An auth token will be sent to your email. Keep this safe, you are going to need it later on.

Drag and drop the “Push Notification” widget and press the play icon at the far top, far right corner.

How to create – Step 2: Getting the hardware right

Here are the schematics:

  • AO on the flame sensor should not be connected to anything
  • G or GND on the flame sensor should go to GND on the ESP8266
  • + or VCC on the flame sensor should go to VIN on the ESP8266
  • DO on the flame sensor should go to D1 on the ESP8266

How to create – Step 3: Getting the software right

First, install the library from this URL:

https://github.com/blynkkk/blynk-library

Now, in the IDE, go to File > Preferences.

When it says “Additional Board Manager URL’s”, paste in this:

URL LIST

https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json

Now go to Boards > Board Manager.

Search “ESP8266” and install “esp8266 by ESP8266 Community”.

Now go to Boards > NodeMCU 1.0 (ESP-12E Module) or more preferably, Boards > Generic ESP8266 Module.

Upload the following code, replacing certain things:

C#, C++, C

#define BLYNK_PRINT Serial
#include 
#include  
BlynkTimer timer;
char auth[] = "No!"; //Replace with auth code sent via Email
char ssid[] = "hacked"; //Replace with wifi name
char pass[] = "123456789"; //Replace with 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();
}

DONE!