Malva Nitsa AmadeaIrham Maulana Hakim
Published © GPL3+

Laser protection security system with ESP32 And BLYNK

A security system that uses a laser sensor with ESP32 and BLYNK. When object passes in the area, the buzzer and LED will be turned on.

IntermediateFull instructions provided5 days1,020
Laser protection security system with ESP32 And BLYNK

Things used in this project

Hardware components

ESP32
×1
Buzzer
×1
Jumper Wires
×1
Laser Sensor Module
×1
LDR Sensor Module
×1
LED
×1
Micro USB
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk
Windows 10
Microsoft Windows 10

Story

Read more

Schematics

Schematic

-

Code

Code

Arduino
-
#define BLYNK_TEMPLATE_ID "TMPL6KOECKvpL"
#define BLYNK_TEMPLATE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "nAfLey2jiWxsoD4Q1GlVrRXbbmi2jO6p"

#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
int LASER = 4;
int led = 19;
int Buzzer = 18;
int read_LDR = 0;
int hold=0;

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Wifiku "; //nama hotspot yang digunakan
char pass[] = "PargoyDong"; //password hotspot yang digunakan
#define LDR 21
 BlynkTimer timer;

void setup(){
    pinMode(LASER,OUTPUT);
    pinMode(LDR,INPUT);
    pinMode(led,OUTPUT);
   Serial.begin(115200);
  Blynk.begin(auth, ssid, pass, "blynk.cloud", 8080);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
  
 
}

void LDRsensor() {
  read_LDR = digitalRead(LDR);
  
  if (read_LDR == 0 && hold==00) {
   Serial.println(" AMAN");
    Blynk.logEvent("AMAN"," AMANNN !!!");
    hold=1;
     Blynk.virtualWrite(V0, " AMANN ");
     } 
     
     else if (read_LDR == 1 && hold==1){
     Serial.println(" WARNING !!! ");
     Blynk.logEvent("WARNINGG","WARNING !!!");
    hold=0;
      Blynk.virtualWrite(V0,"WARNING !!!");
  } 

}

void loop(){
  digitalWrite(LASER,HIGH);
  Blynk.run();
  timer.run();
  LDRsensor();

int kondisi_LDR = digitalRead(LDR);

      if (kondisi_LDR == 0){               
        digitalWrite (Buzzer,LOW);
        digitalWrite (led,LOW);
      }
      else  {
          digitalWrite(Buzzer ,HIGH);
          digitalWrite(led ,HIGH); 
          }
  
}

Credits

Malva Nitsa Amadea
1 project • 0 followers
Contact
Irham Maulana Hakim
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.