Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Steven Guzorek
Published © MIT

Mobile Monitored Motion Sensor

Have you ever wanted to remotely monitor if a room is being accessed? With a internet connection you can monitor with ease.

IntermediateFull instructions provided5 hours1,631
Mobile Monitored Motion Sensor

Things used in this project

Hardware components

Photon
Particle Photon
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
SparkFun Solder-able Breadboard - Mini
SparkFun Solder-able Breadboard - Mini
×1

Software apps and online services

Maker service
IFTTT Maker service
Particle

Hand tools and fabrication machines

Hand Drill
Soldering iron (generic)
Soldering iron (generic)
Wire Srippers
Volt Meter

Story

Read more

Custom parts and enclosures

Circuit in Encloser

Schematics

Wire Diagram

Code

PIR Motion Sensor Read and Publish

Plain text
Used with Particle Photon to read a PIR Sensor and publish to IFTTT
// -----------------------------------------
// Publish and Dashboard with PIV
// -----------------------------------------

int boardLed = D7; // This is the LED that is already on your device.
int PIR = D0;

//the setup function.
void setup() {

  pinMode(boardLed,OUTPUT); // on-board LED 
  pinMode(PIR,INPUT); // PIV


  // Now flash the D7 LED on and off 
  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);
  delay(100);
  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);
  delay(100);
  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);
  
Particle.publish("beamStatus","ONLine",100,PRIVATE);
}
// Now for the loop.

void loop() {
  /* 
  Begin LOOP
  */

  while (Particle.connected()) {

    /* 
    While connected check PIV value
    */
  
      if(digitalRead(PIR)==HIGH){
          delay(1500);
      if(digitalRead(PIR)==HIGH){
        // Send a publish to devices...
        Particle.publish("beamStatus","INTRUDER",60,PRIVATE);
        // And flash the on-board LED on and off.
        digitalWrite(boardLed,HIGH);
        delay(1000);
        digitalWrite(boardLed,LOW);
        delay(3000);
      }
      } 
  else {
      // Nothing here wait 5 seconds
      delay(2000);
      }
}

Credits

Steven Guzorek

Steven Guzorek

1 project • 3 followers
Mechanical Engineering Student UNCC

Comments