Michael WagnerSamantha Charlotte Fehl
Published

Intruder Alert System

Rest your worries about someone coming into your living space without your knowledge and receive an alert straight to your phone!

BeginnerFull instructions provided4 hours984
Intruder Alert System

Things used in this project

Hardware components

Photon
Particle Photon
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Buzzer
Buzzer
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Maker service
IFTTT Maker service

Story

Read more

Schematics

Buzzer Circuit

Code

Motion Sensor Code

Arduino
int PIRSensor =D0;
int state = 0;
int Motion = 0;


void setup() {

    pinMode(D7,OUTPUT);
    pinMode(PIRSensor,INPUT);
    
    }


void loop() {

    Motion = digitalRead(PIRSensor);

    if (Motion == HIGH) {
        
        digitalWrite(D7, HIGH);
        Particle.publish("motion-detected","light");
        
    }
    else if (Motion == LOW) {
        digitalWrite(D7, LOW);
    }

    
    }

Buzzer Sensor Code

Arduino
int buzz = D0;
int state = 0;
int led = D7 ;

void setup()
{
    pinMode(buzz,OUTPUT);
    pinMode(led,OUTPUT);
    
    digitalWrite(led, LOW);
    
    
    Particle.subscribe("motion-detected", myAlert, "2e0027000b51353432383931");
}

void myAlert(const char *event, const char *data)
{       
    if (!strcmp(data,"light"))
    {
        digitalWrite(led, HIGH);
        delay(500);
        digitalWrite(led, LOW);
        
        digitalWrite(buzz,HIGH);
        delay(200);
        digitalWrite(buzz,LOW);
        
    
}}

Credits

Michael Wagner
2 projects • 1 follower
Samantha Charlotte Fehl
2 projects • 1 follower
Thanks to Samantha Fehl.

Comments