Hello Guys , Welcome To Another Post , In This Post We Will Help In Making NodeMcu Based Smoke Detector Notification Gauge Using Smoke Sensor. We Have Given You The Circuit Diagram And Source Code Below. Please Subscribe To Our Blog To Get Awesome Project From Us , And Remember That You Don't Miss Any Update From Us.
Material Required-
Material Required-
1-Node Mcu
2-Smoke Detector
Connections-
1- D0--D0
2-GND--GND
3-VCC- 3v3
Source Code-
//Micro Electronics
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
char auth[] = "----------------"; //Enter Authentication code sent by Blynk
char ssid[] = "---------"; //Enter WIFI Name
char pass[] = "---------"; //Enter WIFI Password
SimpleTimer timer;
int mq2 = A0; // smoke sensor is connected with the analog pin A0
int data = 0;
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, getSendData);
}
void loop()
{
timer.run(); // Initiates SimpleTimer
Blynk.run();
}
void getSendData()
{
data = analogRead(mq2);
Blynk.virtualWrite(V2, data);
if (data > 700 )
{
Blynk.notify("Smoke Detected!");
}
}
Comments