In this article we interface Flame Sensor with NodeMCU and learn all the steps to build Fire Alarm notification using Blynk IoT Platform.
Circuit diagram
Components Required
ESP 12E- NodeMCU - 1 no
IR Flame sensor module - 1 no
Buzzer
Flame Sensor
The flame sensor detects and responses to the presence of fire or flame. The module is based on the IR receiver and basically detects the presence of flammable gases likes nitrogen, hydrogen, carbon mono oxide. The sensor can be directly interfaced with I/O pins of processors and controllers. It works in the wavelength of the range between 760 nm to 1100 nm in the light source.
Specification
Voltage supply: 3.3-5V
Signal detection capacity: adjustable
Wavelength range: 760 nm-1100 nm
Detection angle: up to 60 degree
Fast response time
Easy to use
Applications of flame sensors
Fire alarm
Firefighting robot
Home security system
Blynk
Is an IoT platform to connect your devices to the cloud, design apps to control them, analyze telemetry data, and manage your deployed products at scale.
Blynk IoT Setup:
First of all, open the blynk application.
Click on the create a new project
Click on Choice Tools and select NodeMCU ESP8266.
Make sure the connection type is set to WIFI.
Watch video for further setup.
Finally, click on the create button, a verification token will be sent to your email ID, which will be used in the Program CODE.
Click anywhere on the screen, and search for the Notification Widget. Now Your designed IoT Fire
Control application is ready to use.
Installing Library
Download these libraries from the given links.
Blynk Download - Blynk Library can connect any hardware over Ethernet, WiFi, or GSM, 2G, 3G, LTE, etc.
After downloading the .zip files, add the libraries in Arduino IDE by clicking on
To install the library navigate to the Sketch > Include Library > Manage Libraries… Wait for Library Manager to download libraries index and update list of installed libraries.
Subscribe and download code.
Arduino code:
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
//SSID and Password of your WiFi router
const char* ssid = "xxxxx"; // replace with your SSID
const char* password = "xxxxx"; // Replace with Wifi Password
char auth[] = " xxxxxxxxxxxxxxxxxxxxxxxx"; //Auth code sent via Email
int flag=0;
void notifyOnFire()
{
int isButtonPressed = digitalRead(D1);
if (isButtonPressed==1 && flag==0)
{
Serial.println("KY-026 : Fire Detected");
Blynk.notify("Fire Alert Message: Take Action Immediately");
flag=1;
}
else if (isButtonPressed==0)
{
flag=0;
}
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, password );
pinMode(D1,INPUT_PULLUP);
timer.setInterval(1000L,notifyOnFire);
}
void loop()
{
Blynk.run();
timer.run();
}
Then, upload the code to your NodeMCU board. Make sure you have selected the right board and COM port. Also, make sure you’ve inserted your WiFi Credentials in the code.
After a successful upload, open the Serial Monitor at a baud rate of 9600.
Kommentare