Things used in this project

Hardware components:
Photon new
Particle Photon
×2
13285 01
PIR Motion Sensor (generic)
×1
12002 04
Breadboard (generic)
×2
09590 01
LED (generic)
×1
Omron b3f 1000 image 75px
Tactile Button Switch (6mm) Single
×1
Adafruit industries ada1536 image
Buzzer
×1
11026 02
Jumper wires (generic)
×1
Software apps and online services:
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service
Google sheets
Google Sheets

Schematics

PIR Motion Sensor Schematic
Senses motion
Anqcifduupiz1zhelgqz s1oqlsurtz
BUZZER Schematic
Buzzer sounds until button is pushed
Screen shot 2017 04 12 at 10 49 32 am ornef1wgdl

Code

PIR Motion Sensor CodeC/C++
int inputPin = D0;              // choose the input pin (for PIR sensor)
int ledPin = D1;                // LED Pin
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status

int calibrateTime = 10000;      // wait for the calibration

void setup()
{
  pinMode( ledPin, OUTPUT );
  pinMode(inputPin, INPUT);     // declare sensor as input
}

void loop()
{

  // if the sensor is calibrated
  if ( calibrated() )
  {
  // get the data from the sensor
    readTheSensor();

    // report it out, if the state has changed
    reportTheData();
  }
}

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 event
    if (pirState == LOW) {
      // we have just turned on
      Particle.publish("designingiot/s17/jadam125");
      // Update the current state
      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 );
}
Buzzer CodeC/C++
int refill = 0;
int buzz = D0;  //pin call out for the buzzer
int buzzer = D3; //pin call out for the pushbutton

 int  x, minX;
void setup() {
    pinMode(D7, OUTPUT);
    pinMode(buzzer, INPUT_PULLDOWN);
    pinMode(buzz, OUTPUT);
    digitalWrite(buzz, LOW);
    Particle.subscribe("designingiot/s17/jadam125", myHandler, "36003a000347353138383138" );  //id for the particle


}
void myHandler(const char *event, const char *data)
{
    
}


void loop() {

 digitalWrite(D7, HIGH);
    
    if (data)
         digitalWrite(buzz, HIGH);
        refill = refill+1;
        Particle.publish("refill",String(refill)); //publishes to IFTTT to send text message and graph data
   delay(2000); //2 second delay
   digitalWrite(D7, LOW);
   
 if(digitalRead(buzzer) == HIGH)
        digitalWrite(buzz, LOW);  
        
     delay(1000);   
 
}

Credits

Replications

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

Comments

Similar projects you might like

Well House Temperature Manager
Easy
  • 210
  • 6

Full instructions

Monitors the temperature of the well house to prevent the well from freezing.

The Food Thief Catcher
Easy
  • 108
  • 4

Work in progress

Are you tired of all of your pesky roommates stealing your food? Me too, thats why we have the Food Thief Catcher!

Using the mcPlug for IoT applications!
Easy
  • 332
  • 7

Full instructions

Using MQTT, Losant, IFTTT and the mcThings IoT platform to create feasible and real IoT automation solutions with the mcPlug

Happy Wife =  Happy Life
Easy
  • 187
  • 3

Full instructions

Wife not a morning person? Improve your life by improving your wife's temperament in the morning. Fresh coffee makes wife happy!

Happy Wife = Happy Life

Team We Are Not Coders

Temperature Sensor
Easy
  • 297
  • 5

Full instructions

A photon that measures the temperature and humididty with a DHT 22 sensor and communicates the temperature data to another photon.

IFTTT's Android SMS Service with PHPoC Blue
Easy
  • 276
  • 7

This project shows how to use IFTTT Maker channel.

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback