tehcwan_canel
Published © LGPL

Smart Home Monitoring

Motion detected of thieves using motion sensor

AdvancedFull instructions provided499
Smart Home Monitoring

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
PIR Sensor, 7 m
PIR Sensor, 7 m
×1
Mobile Phone
×1
Jumper wires (generic)
Jumper wires (generic)
×2

Software apps and online services

Arduino IDE
Arduino IDE
Android Studio
Android Studio

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Schematics

Arduino + PIR + Bluetoth

Code

PIR Code

Arduino
#define pirPin 7

long unsigned int lowIn;
long unsigned int pause = 5000;
boolean lockLow = true;
boolean takeLowTime;

#include <LiquidCrystal_I2C.h>
#include <Wire.h> 

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display


void setup() {
  Serial.begin(9600);
  pinMode(pirPin, INPUT);


  lcd.init();                      // initialize the lcd 
  lcd.backlight();
  lcd.begin(16,2);
  lcd.setCursor(0,0);
  lcd.print("Welcome To :");
  lcd.setCursor(0,1);
  lcd.print("Techwan Canel");
  delay(3000);
  
}

void loop() {
         

    PIRSensor();
  
   
}

void PIRSensor() {
  
   if(digitalRead(pirPin) == HIGH) {
      if(lockLow) {
         lockLow = false;
         Serial.println("Motion detected");
         lcd.clear();
         lcd.setCursor(0,0);
         lcd.print("Check Motion");
         lcd.setCursor(0,1);
         lcd.print("Motion Detected");
         delay(50);
      }
      takeLowTime = true;
   }
   if(digitalRead(pirPin) == LOW) {
      if(takeLowTime){
         lowIn = millis();
         takeLowTime = false;
      }
      if(!lockLow && millis() - lowIn > pause) {
         lockLow = true;
         Serial.println("Motion ended");
         lcd.clear();
         lcd.setCursor(0,0);
         lcd.print("Check Motion");
         lcd.setCursor(0,1);
         lcd.print("Motion Ended");
         delay(50);
      }
   }
}

Credits

tehcwan_canel

tehcwan_canel

0 projects • 0 followers

Comments