Sharifdeen Ashshak
Published

Iot based fire alarm system

Through this tutorial I made fire alarm notification System Using Iot technology. wherever you are in the world you can get the notification

BeginnerFull instructions provided2,187
Iot based fire alarm system

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Grove - Gas Sensor(MQ2)
Seeed Studio Grove - Gas Sensor(MQ2)
×1
UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Story

Read more

Code

Code for this project

C/C++
//for more project visit:www.blackkeyhole.com

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
char auth[] = "";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";//your wifi name
char pass[] = "";//your wifi password

int buzzer = D2;
int smokeA0 = A0;

// Your threshold value. You might need to change it.
int sensorThres = 300;//you can change the value as your wish

void setup() {
 Serial.begin(115200);
 delay(10);
 Blynk.begin(auth, ssid, pass);
 pinMode(buzzer, OUTPUT);
 pinMode(smokeA0, INPUT);
 
}

void loop() {
 int analogSensor = analogRead(smokeA0);

 Serial.print("Pin A0: ");
 Serial.println(analogSensor);
 // Checks if it has reached the threshold value
 if (analogSensor > sensorThres)
 {
   tone(buzzer, 1000, 200);
   Blynk.notify("Alert: Fire in the House");  
 }
 else
 {
   noTone(buzzer);
 }
 delay(100);
 Blynk.run();
}

Credits

Sharifdeen Ashshak

Sharifdeen Ashshak

34 projects • 39 followers
Ai, IoT, embedded enthusiast

Comments