Walker HallTucker Merriman
Published

Kitchalarm

The kitchalarm notifies you when your kitchen is empty so that you don't have to stop working to check for yourself.

IntermediateShowcase (no instructions)10 hours59
Kitchalarm

Things used in this project

Hardware components

Photon
Particle Photon
×2
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
AA Batteries
AA Batteries
×4
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
SmartThings service
IFTTT SmartThings service
Google Sheets
Google Sheets

Story

Read more

Schematics

Kitchalarm Schematics

This schematic file shows different versions of the proper wiring diagram for our Photons, as well as the specific components that were used.

Visual Schematic

This image shows what the circuit could look like
Laundralarm wiring diagram 2p1tmsd4pf

Code

Photon 1 (Sensing)

C/C++
Once flashed to the photon this code detects if there is input from the PIR Motion sensor and once motion is detected it publishes an event stating such. It also is designed to turn on an LED for 10 seconds once it has received confirmation of the event being used in our second photon.
int ledPin = D7;                 // choose the pin for the LED 									//
int inputPin = D0;  // choose the PIR sensor pin												//
int trigger = LOW;                                                                              //
int ledPi = D4;                                                                                 //
int counter = HIGH;                                                                             //
int stop = HIGH;                                                                                //
bool available;                  // status of conference room			                 		//
                                                                                                //
void setup() {																					//
  pinMode(ledPin, OUTPUT);       // set LED as output											//
  pinMode(inputPin, INPUT);      // set sensor as input											//
  pinMode(ledPi, OUTPUT);                                                                       //  
  Particle.subscribe("1", myHandler, "4b003e000751353530373132");                               //
}                                                                                               //
//////////////////////////////////////////////////////////////////////////////////////////////////
void loop() {																					//
  if (digitalRead(inputPin) == HIGH){                                                           //
    Particle.publish("Occupied");                                                               //
    digitalWrite(ledPin, HIGH);                                                                 //
    trigger = HIGH;                                                                             //
    delay(5000);                                                                                //
  } 	                                                                                        //
   	if (digitalRead(inputPin) == LOW && (trigger == HIGH)){                                     //
        digitalWrite(ledPin, LOW);                      //digitalWrite(ledPin, LOW);            //
        Particle.publish("tuckersphoton", "empty");                                             //
        delay(3000);                                                                            //
        trigger = LOW;                                                                          //
        stop = LOW;                                                                             //
        counter = HIGH;                                                                         //
   	} 	                                                                                        //
  }																								//
//////////////////////////////////////////////////////////////////////////////////////////////////
void myHandler(const char *event, const char *data)                                             //
{                                                                                               //
  if ((counter == HIGH) && (stop == LOW)){                                                      //
  digitalWrite(ledPi, HIGH);                                                                    //
  delay (1000);                                                                                 //
  digitalWrite(ledPi, LOW);                                                                     //
  counter = LOW;                                                                                //
  }                                                                                             //
                                                                                                //
}                                                                                               //
//////////////////////////////////////////////////////////////////////////////////////////////////

Photon 2 (Notifier)

C/C++
Once flashed to the photon, this code will look for the publication from the first photon, and promptly trigger an event, and then turn on an LED for 10 seconds, and send a text notification using IFTTT, finally this code will then publish an event back to the first photon for confirmation that the triggering event was made.
//                 Tuckers Code

int led = D7;
int counter = HIGH;



void setup() {

pinMode(led, OUTPUT);
digitalWrite(led, LOW);
Particle.subscribe("tuckersphoton", myHandler, "230041000c47363330353437");
Particle.subscribe("Occupied", nogo, "230041000c47363330353437" );


}

void myHandler(const char *event, const char *data)
{
  digitalWrite(led, HIGH);
  delay (3000);
  digitalWrite(led, LOW);
  Particle.publish("1", "Kitchen Empty");
  counter = HIGH;
}
void nogo(const char *event, const char *data)
{
    if (counter == HIGH){
    delay(3000);
    Particle.publish("Occupied", "Kitch");
    digitalWrite(led, HIGH);
    delay(1000);
    digitalWrite(led,LOW);
    counter = LOW;
    }
}

Credits

Walker Hall

Walker Hall

1 project • 1 follower
Tucker Merriman

Tucker Merriman

1 project • 1 follower

Comments

Add projectSign up / Login