Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
ElectronicsLovers
Published © CC BY-NC

Fire and motion Alarm Notification on your smartphone

It will send a push notification to a smartphone when Motion or fire detected by sensors viva esp8266 IOT module.

IntermediateFull instructions provided2 hours403
Fire and motion Alarm Notification on your smartphone

Story

Read more

Code

Code snippet #1

Plain text
//Blynk Fire and motion Alarm Notification
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
//Auth Code, Wi-Fi and others.
char auth[] = "SBDRfyDqqbkLA0kaV86LX5DuGEDZSGCG"; //Auth code sent via Email
char ssid[] = "C24888"; //Wifi name
char pass[] = "67391066";  //Wifi Password
int flag=0;
void notifyOnFire() //Flame Sensor Code
{
  int isButtonPressed = digitalRead(D1);
 if (isButtonPressed==0 && flag==0){
    Serial.println("Fire in the House");
    Blynk.notify("Alert : Fire in the House");
    flag=1;
}
  else if (isButtonPressed==1)
  {
    flag=0;
  }
}

void notifyOnSmoke() //SMOKE Sensor Code
{
  int isButtonPressed = digitalRead(D2);
  if (isButtonPressed==0 && flag==0){
    Serial.println("Alert!!! MOTION is Detected");
    Blynk.notify("Alert!!! MOTION is Detected");
    flag=1;
}
  else if (isButtonPressed==1)
  {
    flag=0;
  } 
}

void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  pinMode(D1,INPUT_PULLUP);
  pinMode (D2,INPUT_PULLUP);
  timer.setInterval(1000L,notifyOnFire);
  delay(100);
  timer.setInterval(1000L,notifyOnSmoke); 
}

void loop()
{
  Blynk.run();
  timer.run();
}

Github

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

Credits

ElectronicsLovers
8 projects • 33 followers
Electronicslovers started in July 2011 with the mission to produce ideas to students and hobbyist to learn electronics practically.
Contact

Comments

Please log in or sign up to comment.