Samnul_KH
Published

Get on information of fire danger and gas in your home

The main of purpose of my project, it works a message to send to you. You get some information of fire danger and gas in your home.

IntermediateProtip26
Get on information of fire danger and gas in your home

Things used in this project

Hardware components

Grove - Gas Sensor(MQ2)
Seeed Grove - Gas Sensor(MQ2)
×1
Gravity: Analog Flame Sensor For Arduino
DFRobot Gravity: Analog Flame Sensor For Arduino
×1
Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1
5 mm LED: Green
5 mm LED: Green
×1
High Brightness LED, White
High Brightness LED, White
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Wemos D1 Mini
Espressif Wemos D1 Mini
×1

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Get on information on your phone

Schematics

Its work

Completed

Diagram of my project

Code

My code is very simple

Arduino
//Blynk Fire Alarm Notification
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
char auth[] = "......"; //Auth code sent of blynk via Email
char ssid[] = "samnul"; //Wifi name
char pass[] = "samnul";  //Wifi Password
int flag=0;
int flag1=0;
int redled = D6;
int greenled = D7;
int Flame = HIGH;
int whiteled = D5;


void notifyOnFire()
{
  int isButtonPressed = digitalRead(D1);
  if (isButtonPressed==1 && flag==0) {
    Serial.println("Fire in the House");
    Blynk.notify("Fire in the house. Pls come on samnul");
    flag=1;
  }
  else if (isButtonPressed==0)
  {
    flag=0;
  }
  
/// MQ_2 GAS

 int isButtonPressed1 = digitalRead(D2);
  if (isButtonPressed1==1 && flag1==0) {
    Serial.println("Alter: MQ_2 Gas ");
    Blynk.notify("Gas detect PLC or Smoke in the house. Pls come on samnul");
    flag1=1;
  }
  else if (isButtonPressed1==0)
  {
    flag1=0;
  }

  
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(D1,INPUT_PULLUP);
pinMode(D2,INPUT_PULLUP);
timer.setInterval(1500L,notifyOnFire);
pinMode(redled, OUTPUT);
pinMode(greenled, OUTPUT);
pinMode(whiteled, OUTPUT);


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

  Flame = digitalRead(D1);
  if (Flame== LOW)
  {
//    digitalWrite(buzzerPin, HIGH);
    digitalWrite(redled, HIGH);
    digitalWrite(greenled, LOW);
    digitalWrite(whiteled, LOW);
  }
  else
  {
//    digitalWrite(buzzerPin, LOW);
    digitalWrite(greenled, HIGH);
    digitalWrite(whiteled, HIGH);
    digitalWrite(redled, LOW);
  }
}

Credits

Samnul_KH

Samnul_KH

0 projects • 0 followers

Comments

Add projectSign up / Login