Charles Konkol
Published © Apache-2.0

EASY Motion Detection

Simple motion detection that logs movement into a Google Sheet. Requirements: Photon, PIR Motion Sensor, IFTTT, and Google Sheets,

BeginnerWork in progress1 hour825
EASY Motion Detection

Things used in this project

Hardware components

Photon
Particle Photon
×1
PIR HC--SR501 Body Sensor Module
×1
Multicolored Dupont Wire 40pin Male to Female
×1

Software apps and online services

IFTTT

Story

Read more

Schematics

EASY MONITOR

Code

EasyMonitor

C/C++
//Motion Sensor send to IFTTT and Save to Google Sheet

int ledPin = D7; // we will use D7 LED to monitor sensor activity
int pir = D0; //connect the PIR output to pin D0 of the Electron

void setup() {
    pinMode(pir, INPUT_PULLDOWN);// set sensor as input
    pinMode(ledPin,OUTPUT); // set LED as output
}

void loop() {
    if (digitalRead(pir) == HIGH) {
      digitalWrite(ledPin,HIGH); //show the activity of the sensor with the onboard D7 LED
      Particle.publish("kitchen","HIGH",60); //change event name 
      delay(1000);
        while (digitalRead(pir) == HIGH); // wait for the sensor to return back to normal
    }
    digitalWrite(ledPin,LOW);
}

Credits

Charles Konkol

Charles Konkol

1 project • 1 follower

Comments

Add projectSign up / Login