Madison TrejoDaniel Law
Published

Lane Tech PCL Room Notifier

Do you ever just want to know if your pets have entered your room?

BeginnerShowcase (no instructions)81
Lane Tech PCL Room Notifier

Things used in this project

Hardware components

Argon
Particle Argon
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Alexa Skills Kit
Amazon Alexa Alexa Skills Kit
Used the Voice Monkey skill and IFTTT
Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Breadboard, 170 Pin
Breadboard, 170 Pin
10 Pc. Jumper Wire Kit, 5 cm Long
10 Pc. Jumper Wire Kit, 5 cm Long

Story

Read more

Schematics

Motion Sensor Schematic

Code

Motion Sensor Code

C/C++
int led = 13;                // the pin that the LED is atteched to
int sensor = 2;              // the pin that the sensor is atteched to
int state = LOW;             // by default, no motion detected
int val = 0;                 // variable to store the sensor status (value)

void setup() {
  pinMode(led, OUTPUT);      // initalize LED as an output
  pinMode(sensor, INPUT);    // initialize sensor as an input
  Serial.begin(9600);        // initialize serial
}

void loop(){
  val = digitalRead(sensor);   // read sensor value
  if (val == HIGH) {           // check if the sensor is HIGH
    digitalWrite(led, HIGH);   
    Particle.publish("Motion");
    delay(100);                // delay 100 milliseconds 
    
    if (state == LOW) {
      Serial.println("Motion detected!"); 
      state = HIGH;       // update variable state to HIGH
    }
  } 
  else {
      digitalWrite(led, LOW); // turn LED OFF
      delay(200);             // delay 200 milliseconds 
      
      if (state == HIGH){
        Serial.println("Motion stopped!");
        state = LOW;       // update variable state to LOW     
    }
  }
}

Credits

Madison Trejo

Madison Trejo

1 project • 0 followers
Daniel Law

Daniel Law

46 projects • 8 followers
Teacher. Maker. Citizen of the planet.

Comments

Add projectSign up / Login