Pet tracker

Made by Shaan

This project allows for pet owners to become alerted when their pet is moving. Not only that, they receive a text message when their pet is drinking water and eating food.

Created: March 13th, 2017

int pirPin = D2;
int buttonPin = D0;
int ledPin = D1;
int pirState = LOW;
int buttonState = LOW;

void setup()
  pinMode(buttonPin, INPUT_PULLUP);
  pinMode(pirPin, INPUT);
  pinMode (ledPin, OUTPUT);
  Particle.variable ("buttonState", buttonState);
  Particle.variable("pirState", pirState);

void loop()
  buttonState = digitalRead(buttonPin);
  pirState = digitalRead(pirPin);
  if (buttonState == LOW)
  if (pirState == HIGH) //button pressed and movement recognized = light on
    digitalWrite(ledPin, HIGH);
    digitalWrite(ledPin, LOW);

Particle.publish ("Mowgli inside", String(buttonState));
delay (1000);
Particle.publish ("Mowgli is Drinking", String(pirState));
delay (1000);

Click to Expand

Problem Statement: For all the pet owners out there who are wondering whether or not their beloved pet has eaten food or drank water, this is for you. Now, pet owners will be alerted whenever their pet eat food or drinks water, without having to be kept in the dark about whether their pet has eaten until they come home.

Goal: Connect a photon, motion sensor, LED light, a button, the Internet to track movements, and SMS to track pet movements from within a water or food bowl.

Process: Materials used: 7 jumper wires, breadboard, photon, computer, button, motion sensor, LED light, resistor.

The process took a while to complete. Inspired by the roommate project in class, I used data from the motion sensor to have certain things happen. As the button is pressed and the motion detector detects motion, the LED light will come on. This button should be pressed by the pet as he/she steps on the button to drink. The design of the project does not fully allow for this though, as the button is not in a convenient location to be pressed. I ran through several problems as this is my first time coding and dealing with hardware. The biggest problems were the easiest problems that just took a long time to troubleshoot such as the code was not publishing even after a long time looking at the code and double and triple and quadruple (etc) checking. I realized that the code was not publishing because the time on my laptop was a couple minutes ahead, and this difference in time caused there to be no data published since time is one of the variables we are observing here. Having the docs online and IFTTT really helped. 

Outcome: The prototype looks good but could be improved. I could have integrated the breadboard and its components into the water/food bowl its self, making it more aesthetically appealing. Also, the button could have been placed in a better spot so it could be easily and 'unintentionally' pressed by pets thus switching on the LED light. 

Learned: Thanks to Mr. Brockmeyer and his help, I was able to have this up. I learned so much about Python, from what loops and strings are to the basic syntax of python such as indentations, and universal functions. How functions are called. I also learned that coding is easy, but finding out what is wrong with your code is the most stressful and difficult part, especially when you find out that there is actually a problem in the Cloud or Hardware. I had a lot of fun doing this, and I feel like I know so much more than I did coming into this project. I learned about how breadboards work, how sensors work and how the cloud compiles and sends information. I learned that even the amount of power you give to a specific sensor or component should be bounded. 

Share this Project


This project allows for pet owners to become alerted when their pet is moving. Not only that, they receive a text message when their pet is drinking water and eating food.