Home Security

Made by Swati Rajendran

A simple device that alerts you if there is an intruder in your home!

Created: January 29th, 2016

0

Intention

My room-mate and I have been paranoid about home intrusions, ever since a certain incident. So a smart home security device was the first thing she suggested I try making, when I discussed this project with her.
0

Goal

The goal was to create a device that notified us that there had been an intruder at our apartment.

0

How it functions!

The device needs to be switched ON for the PIR Motion sensor to be active. A blue LED indicates this.

When any motion is detected by the  sensor, the Red LED lights up. Also, an email notification is sent to us via IFTTT " Motion detected! Intruder!", on our phones.

0
PIR Sensor : Home Security : circuit
SR SR - https://www.youtube.com/watch?v=Pf0Z83Rck7Q
0

Process

Components used:


Particle Photon

LED (red) : Motion Indication

LED (blue) : ON/OFF Indication

2 Resistors 1k ohms

Jumper wires


I decided to use a Motion Sensor to build the device. I began working on a basic circuit with just the PIRsensor. I then decided to incorporate a switch to disable the device manually, to avoid unnecessary alerts when we were at home. I also added an indicator LED that light up when the device was activated. The next thing was to connect it to the cloud. Once I checked the data on the Serial monitor was correct, I connected the 'event' captured on the device to IFTTT so that it gave sent me a notification (e-mail alert in this case)  on my phone.

The system would be switched ON just before we left home, and switched OFF when we were back home.

Once the device is switched ON, and the PIR Sensor senses any movement and sends us notification.

The code used is a slightly modified version of a code provided in the PIR sensor guide by Adafruit. https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/how-pirs-work





0
/*
 * PIR sensor tester
 */

int ledPin = D0;                // choose the pin for the LED
int inputPin = D1;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // assuming no motion detected
int val = 0;                    // variable for reading the pin status
  

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input

  Serial.begin(9600);
}

void loop()
{
  

  val = digitalRead(inputPin);  // read input value
  digitalWrite(ledPin, HIGH);  // turn LED ON
  Serial.println(val);
  if (val == HIGH)
    {            // check if the input is HIGH
        if (pirState == LOW)
            {
            // we have just turned on
              Serial.println("Motion detected!");

              Particle.publish ("motion-detector","motion detected! Intruder!", PRIVATE);
            // We only want to print on the output change, not state
              pirState = HIGH;
            }
    }

  else {
        if (pirState == HIGH)
            {
            
              pirState = LOW;
            }
        }

        digitalWrite(ledPin, pirState ); // turn LED OFF
        

}
Click to Expand
0

Reflection :

Being my very first experience with embedded circuits and related programming, and introduction to connected systems in general, this was a very engaging first project. I spent a substantial amount of time warming up to the project; spent most of class time trying out various sensors. It was exciting! But as I tweaked around with various components, the coding soon got quite challenging for me as a beginner. I did require a lot of help from Steffen, some of my proficient classmates and friends while trying to keep up with the iterative and rather frustrating process of coding and debugging and rewriting.

I am however excited about working on more creative projects as I get better with the programming and circuitry!

x
Share this Project

Courses

49-713 Designing for the Internet of Things

· 4 members

This course charts the emergence of the now "connected world" to explore the possibilities for future products and connected spaces.


About

A simple device that alerts you if there is an intruder in your home!