Security alarm system

you can not using two analog sensors with the ESP8266 boards. the ESP8266 only supported one analog pin. I thing your smoke and water dominant sensor is analog ! so you must using an Arduino board to supporting more analog pins.

i use now esp8266 nodemcu

He could use an analogue multiplexer, but a better option would probably be to use multiple ESP devices.
In reality, these sensors aren’t likely to be in the same physical place within the house, so multiple devices, with each located next to the area where the sensor is needed, is probably a better solution.

However, it seems that @ykilicaslan needs to invest some time in learning how to code, and how best to use Blynk, so I doubt that his alarm system will actually materialise.

On the subject of alarms, I came across this YouTube video the other day:


It seems like a really neat solution to adding IoT notifications to a standard battery powered alarm. If I was doing this then I’d probably go with the MQTT notification as described in the video, but it would be just as easy to add a Blynk notification, or use a Blynk API call.

Pete.

2 Likes

hi this code is for 1 sensor. I have added it to the water and gas sensor, when the sensor detects the ALARM MESSAGE, when it detects the gas sensor, I want to write GAS ALARM. Could you help
my board : esp8266 nodemcu

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

char auth[] = "7b2f0486955b41b2aecfb2551f5f2975";
char ssid[] = "okhan";
char pass[] = "atakan2009";


#define ledPin 14 
#define pirPin 12
#define gazPin 13
#define suPin 15

int pirState;
int val;
int x;

SimpleTimer timer;

BLYNK_CONNECTED() {
      Blynk.syncVirtual(V0);


  }

BLYNK_WRITE(V0){
 x = param.asInt();
 }

void PIRval(){
val = digitalRead(pirPin);
digitalRead(gazPin);
digitalRead(suPin);
    if (val == HIGH) {
      digitalWrite(ledPin, HIGH);  
      }
      else {
        digitalWrite(ledPin, LOW); 
      }
   }

  void pir(){
  if (x == 1){
    if (digitalRead(pirPin) == HIGH){
 Blynk.notify("ALARM!!!");




 }
    }
  }

void setup(){
 // Blynk.begin (auth, ssid, pass, server, 8080);//local server
   // You can change server:
  
  
  Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);

  pinMode(ledPin, OUTPUT);
  pinMode(pirPin, INPUT);
  pinMode(gazPin, INPUT);
  pinMode(suPin, INPUT);
  
Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  timer.setInterval(1000L, PIRval);
 timer.setInterval(1000L, pir);
   }

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

Hello… We try to teach about Blynk, we do not write your code for you, that is up to you to learn.

You are trying to run both of these function at the exact same time every second… if you need then to run together, then combine them into ONE function, otherwise stagger the timers so they runs separately without convergence… e.g. 1000 = every second for one and 1300 = every 1.3 seconds for the other.

1 Like