Things used in this project

Hardware components:
Photon new
Particle Photon
in my case I used a Particle/Spark Core
13285 01
PIR Motion Sensor (generic)
Adafruit industries ada1536 image
active buzzer thats makes "peep"
09590 01
LED (generic)
Mfr 25frf52 1k sml
Resistor 1k ohm
11026 02
Jumper wires (generic)
counted around 7
12002 04
Breadboard (generic)
Software apps and online services:
IFTTT Maker service


Mypir sensor informs me via ifttt sketch steckplatine meuqxjhews


Ingos CodeC/C++
// PIR Sensor triggers IFTTT-Services to inform a motion detection

// Ingo Lohs, v1.0 - 17.05.2017

int inputPin = D0;              // choose the input pin (for PIR sensor)
int ledPin = D1;                // LED Pin
int buzzerPin = D2;             // Sound in case of motion detected
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status
int boardLed = D7;              // photon onBoard LED
int calibrateTime = 10000;      // wait for the thingy to calibrate

void setup() {

  pinMode(boardLed,OUTPUT);     // on-board LED 
  pinMode(ledPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(inputPin, INPUT);     // declare sensor as input
     // Now flash the D7 LED on and off 
  digitalWrite(boardLed,HIGH); // Start der Kallibrierung mit D7 on
  Particle.publish("Nicks Security Project","now online",100,PRIVATE);
  digitalWrite(boardLed,LOW); // Start der Kallibrierung mit D7 off

void loop() {
  // if the sensor is calibrated
  if ( calibrated() )
  // get the data from the sensor

    // report it out, if the state has changed

void readTheSensor() {
  val = digitalRead(inputPin);

bool calibrated() {
  return millis() - calibrateTime > 0;

void reportTheData() {

  // if the sensor reads high
  // or there is now motion
  if (val == HIGH) {

    // the current state is no motion
    // i.e. it's just changed
    // announce this change by publishing an eent
    if (pirState == LOW) {
      // we have just turned on
      Particle.publish("Nicks Security Project", "Motion detected", PRIVATE);

      pirState = HIGH;
      setLED( pirState );

  } else {
    if (pirState == HIGH) {
      // we have just turned of
      // Update the current state
      pirState = LOW;
      setLED( pirState );

void setLED( int state )
  digitalWrite( ledPin, state );
  digitalWrite( buzzerPin, state );


Img 6554 3ywwumwxbh
Ingo Lohs

I am well over 40 years and come from the middle of Germany. You can contact me also in German. Donation for add sensors:



Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback


Similar projects you might like

Control Adafruit NeoPixels using Python and JQWidgets
  • 917
  • 8

Full instructions

In this tutorial, we'll see how to control an Adafruit NeoPixel ring via mobile using Python and JQWidgets.

What's My I2C Address?
  • 241
  • 4

The story of how to make a clock through using a LCD 1602 or LCD 2004 over I2C.

I Keep My Cucumber Growing Conditions Moist - Part 3
  • 260
  • 3

Full instructions

This is the next step with an Particle Photon and softAP integration: cucumbers go online.

MyHumidity Controlled by BME280 and Photon
  • 514
  • 6

Full instructions

Checks if humidity threshold is reached and informs the user by using Blynk/IFTTT-services with softAP integration.

Study Buddy
  • 2,844
  • 141

Full instructions

Know when an assignment is coming up!

Study Buddy

Team Alexa and Shannon

MyLCD20x4 clock with value-added information
  • 39
  • 0

Full instructions

Use a Particle Photon, a BME280 sensor and a cheap LCD20x4 to start your own clock-project.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login