Intelligent Dog Crate

Made by John Soh

The dog crate latch must be locked every time the dog is crated, or he might get out and hurt himself in an accident. Intelligent Dog Crate will let the owner know if he/she has stepped away from the crate without locking it.

Created: January 29th, 2016

0

Note: No dog or any other animals were harmed during the development and testing of this project.

0

Intention

Every time the house is empty, our dog Sherlock is put in his crate for his safety and our piece of mind. However, there have been occasions where he was put in the crate but the crate was not locked, leading to us coming home to Sherlock exploring the empty house. This multi-sensor IoT will sense that Sherlock is in the crate, that theres no one near the crate, and that the latch lock is not locked, which makes it send out an alert to our phones
0

Goal

The IoT has to do two things with 3 sensors and 1 LED.

1. If the dog is in the crate,  there is someone in front of the crate, and the latch is locked the LED lights up to notify that the latch has been locked. 

2. If the dog is in the crate, there is NO ONE in front of the crate, and the latch is NOT LOCKED, the IoT publishes an event which sends a notification to the smartphone.

0

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. 

0
//Created by John Soh
// January 29, 2016
// IoT Spring 2016, Carnegie Mellon University

//This code will use a combination of sensors to either confirm that the latch lock on the dog crate is locked or send a notification if it's unlocked.


//crate weight to see if sherlock is in the crate
int dog = A1;
//range finder to see if theres a person
int person=A0;
//hall sensor to see if its been locked
int hall = D4;
//led to show that the latch has been locked
int led = D1;

int lock = 0;

void setup() {
  //FSR reads
  pinMode(dog, INPUT);
  //range finder reads
  pinMode(person, INPUT);
  //led writes
  pinMode(led, OUTPUT);
  //hall sensor reads
  pinMode(hall, INPUT);

  //serial to check
  Serial.begin(9600);


}

void loop() {

//read button variable-digital
int crated = analogRead(dog);
//read range finder variable-analog
int presence = analogRead(person);

lock = digitalRead(hall);


//if the dog is in the crate and someone is in front of the crate
if (crated >= 500 && presence > 700 && lock == LOW){
    //check hall sensor to see if its been locked

      digitalWrite(led, HIGH);}
      // if the latch has NOT been locked, turn led off
      else digitalWrite(led, LOW);{

      }

// if the dog is in the crate, no one is in front of the crate, and the latch is not locked
if (crated >= 500 && presence < 700 && lock == HIGH){
  //publish notice to IFTTT to notify phone
Particle.publish("Crate_Latch","UNLOCKED!!");
}

//Serial to check
Serial.print(crated);
Serial.print('/');
Serial.print(presence);
Serial.print('/');
Serial.println(lock);

//delay every 5 seconds to not overload the phone.
  delay(5000);
}
Click to Expand
0

Outcome

0
Intelligent Dog Crate
sohjjw - https://youtu.be/H-KQ3CCiauw
0

Reflection

Hall effect sensor and IR rangefinder worked flawlessly for this purpose. However, the FSR reading varied widely depending on where on the floor it's placed, and dog's movement/position in relation to the FSR position. Three things could be done to remedy this, one being diagonally placing two FSR and getting an average read between the two as the variable. The other is to use a flex sensor, taking advantage of the plastic tray flexing as the dog sits on it. Finally, a larger FSR could be used and placed on top of the tray (and under the cushion). The last option might be the most accurate, but it runs the risk of dog digging it out and destroying it. 

x
Share this Project

Courses

49-713 Designing for the Internet of Things

· 4 members

This course charts the emergence of the now "connected world" to explore the possibilities for future products and connected spaces.


Focused on
About

The dog crate latch must be locked every time the dog is crated, or he might get out and hurt himself in an accident. Intelligent Dog Crate will let the owner know if he/she has stepped away from the crate without locking it.