Process
How the crate looks before the hack.
Components Used
1 - Hall Effect Sensor
1 - IR Range Finder
1 - Red LED
1 - Force Sensitive Resistor
1 - AA Battery Pack
1 - Particle Photon Microcontroller
2 - 10K Resistor
1 - 1K Resistor
2 - Alligator Clips - The leads on FSR was too short and could not be secured into the jumper cable.
Jumper Cables
Wiring Diagram
Original plan was to use the following sensors and components but was replaced for accuracy.
- PIR was planned to be used to sense the presence in front of the crate. However, testing showed that PIR was only reactive to motion, which does not always equal to presence. Hence it was replaced with IR rangefinder.
- Push button was to be used to sense the crate in use (i.e. dog is in the crate). The crate has a floor tray which is separate from the metal crate itself. Every time the dog is in the crate, the tray would be pushed down, thus pushing the button. But the weight of the tray itself would constantly be pushing the button, which led to the change to FSR to detect the actual difference in weight.
Complete Final Set Up
Hall Effect Sensor, IR Range Finder, and LED Set Up
IR Range finder was tied to face the front of the crate. A neodymium magnet was attached to the latch male end while the hall effect sensor was attached to the female end. Red LED was placed facing front as lock status checker.
Breadboard and Battery Pack Set Up
Breadboard was placed on the site of the crate with the battery pack connected to it to the power the entire set up.
FSR Set Up
FSR was placed under one of the feet of the crate, allowing the force to be put on it if the dog is in the crate.
Code
Three different sensors had to be giving the right reads for certain actions to be taken. To do this, 'if' function was used with boolean qualifiers for each of the sensor variables. When the condition is met, event will be published to IFTTT, which will push it to the smartphone.