William Bethke
Published

Lane Tech - PCL - Motion Detector

Using a Particle Argon and a motion sensor I created a device that sends me a message whenever someone enters the house.

BeginnerWork in progress507
Lane Tech - PCL - Motion Detector

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
Resistor 220 ohm
Resistor 220 ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
IFTTT

Story

Read more

Schematics

motionSensor Schematics

Code

motionSensor

C/C++
The Finished Code
int ledPin = 3;                  // LED pin
int sensorPin = 5;               // Sensor pin
int tempSensorInput = 0;        // ths reads the motion status
 
void setup() {
  pinMode(ledPin, OUTPUT);      
  pinMode(sensorPin, INPUT);    
 
}
 
void loop(){
  tempSensorInput = digitalRead(sensorPin);     //reads the input value
  
  if (tempSensorInput == HIGH) 	 //checks to see if their is an input. If there is: the led turns on, the argon publishes an event to trigger IFTTT, waits 5 seconds, and finally turns the LED off.
  {            
    digitalWrite(ledPin, HIGH);
    Particle.publish("IntruderAlert", "Uh oh");
    delay(5000);
    digitalWrite(ledPin, LOW); 
    
  } 
}

Credits

William Bethke
3 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.