Mari MastJordan Radcliffe
Published

The Food Thief Catcher

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

BeginnerWork in progress3 hours1,810
The Food Thief Catcher

Things used in this project

Hardware components

Photon
Particle Photon
×2
Piezo Sensor
ControlEverything.com Piezo Sensor
×1
Jumper wires (generic)
Jumper wires (generic)
×5
Breadboard (generic)
Breadboard (generic)
×2
aluminum foil
×2

Software apps and online services

Maker service
IFTTT Maker service
Microsoft Excel

Story

Read more

Schematics

Alarm

A piezo buzzer receives a signal from the photon when the switch sensor is disconnected.

Switch

The switch seen here is representative of the aluminum foil, two wires and adhesive strips that were used instead.

Code

Switch Code

C/C++
int PIRSensor = D1;
//int state=0;
void setup(){
pinMode(D7,OUTPUT);
pinMode(PIRSensor,INPUT_PULLUP);
}

void loop() {
    
  if (digitalRead(PIRSensor) == HIGH)
  {
       digitalWrite(D7,1);
       Particle.publish("pesky_thief","caught");
       //state = !state;
       delay(900);
       digitalWrite(D7,0);
  }
    delay (500);
}

Buzzer Code

C/C++
int buzz = D0;
int state = 0;
int led = D7 ;
void setup()
{
    pinMode(buzz,OUTPUT);
    digitalWrite(buzz,LOW);
    
    Particle.subscribe("pesky_thief",peach,"2f002e000a47333439313830");
}
void peach (const char *event, const char *data)
{
    
    if (strcmp(data,"caught")==0)
    {
        digitalWrite(buzz,HIGH);
    delay(100);
    digitalWrite(buzz,LOW);
    }
} 
void loop()
    {
        
    }

Credits

Mari Mast

Mari Mast

1 project • 1 follower
Jordan Radcliffe

Jordan Radcliffe

1 project • 0 followers

Comments