Samantha Charlotte FehlMichael Wagner
Published

LED Photon Motion Sensor

Detects when something is moving in a room and sends warnings to owner via LED lights, an alert noise, and a text message.

EasyWork in progress346
LED Photon Motion Sensor

Things used in this project

Hardware components

Photon
Particle Photon
×2
Breadboard (generic)
Breadboard (generic)
×2
Jumper wires (generic)
Jumper wires (generic)
×5
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Piezo Sensor
ControlEverything.com Piezo Sensor
×1

Software apps and online services

Maker service
IFTTT Maker service

Story

Read more

Schematics

Buzzer Circuit

Screen shot 2017 11 15 at 7 19 50 pm udkcw7tijx

Code

Motion Sensor

C/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);
    }
}

Buzzer

C/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

Samantha Charlotte Fehl

Samantha Charlotte Fehl

2 projects • 0 followers
Michael Wagner

Michael Wagner

2 projects • 0 followers

Comments

Add projectSign up / Login