Things used in this project

Hardware components:
Photon new
Particle Photon
×2
12002 04
Breadboard (generic)
×2
11026 02
Jumper wires (generic)
×5
13285 01
PIR Motion Sensor (generic)
×1
Adc121c021 pizo 1
ControlEverything.com Piezo Sensor
×1
Software apps and online services:
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service

Schematics

Buzzer Circuit
Screen shot 2017 11 15 at 7 19 50 pm udkcw7tijx

Code

Motion SensorC/C++
This code helps the particle photon detect motion and send an alert signal.
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");
        
    }
    elseif (Motion == LOW) {
        digitalWrite(D7,LOW);
    }
}
BuzzerC/C++
When a signal is received, this triggers the buzzer to alert a noise when motion was detected from the other particle.
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)
{
      digitalWrite(led,HIGH);
      delay(500);
      digitalWrite(led,LOW);
      
      digitalWrite(buzz,HIGH);
      delay(200);
      digitalWrite(buzz,LOW);
      
}

Credits

23380058 10214110599945190 1217020740681591616 n
Samantha Charlotte Fehl
2 projects • 0 followers
Contact
126d9fe459b9346f34a635d378bd1a5a
Michael Wagner
2 projects • 0 followers
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login