Git Product home page Git Product logo

catfeederalerts's Introduction

Cat Feeder Alerts

I suspected my Automatic cat feader occassionally failed to dispense scheduled meals. In order to try to prove my suspicions I first set up a motion activated web cam, but found the motion detect wasn't always reliable.

A webcam wasn't the way - I needed to measure actual meal dispensing, there must be a better way. I thought of a few ways...

  • Adding a scale to the machine and logging weight changes (still a very reliable method IMO).
  • Adding a motion sensor to the front of the machine (not a great method at all)
  • Adding a sensor to the motor which dispenses the meals (Bingo!)

That last option seemed like a winner - the motor has a few criteria which made it a good candidate:

  • It has a measurable current change
  • It only activates when a meal is being dispensed
On the down side, a turning motor does not guarantee a meal. I would have to keep an eye out for the food level - but I do that now anyway.

The solution is an automatic monitoring system using nothing more than a $15 Smartthings sensor and a super cheap photo coupler. It sends email and text notifications if a meal is missed.

Wiring The Sensor

I purchased a Visonic MCT-343 E, I have already worked with these before so I knew I could simply solder wires to the points A & B.



Note: Simply slide the battery cover off and pry the top cover off with your thumb (this can be done safely) in order to access the circuit board

Having tested and measured the voltage running to the motor when activated, I knew it was operating around 5 volts. Thanks to the kindly help of internet strangers (exibit A) I was able to get a photo coupler working.

That almost felt too easy! To round things out I added a 2xAA battery pack to my MCT-343 E to keep it going longer.

Building the Monitoring System

Next up was the logic. I used a IFTTT recipe to log all events from the MCT-343 E on Smartthings to a Google Sheet with a timestamp. Again, feels too easy.

Okay, so I'm logging dispensed meals - I could check multiple times every day but that's stupid. Now I need some logic. Thankfully Google makes this ridiculously easy with their "App Scripts".

In the Google Sheet which my IFTTT recipe created I added a second sheet titled "Errors". The following code will automatically insert missed meal entries in "Errors" and send email / text notifications.



In order to accomplish this I created a script on the Google Sheet generated by IFTTT, the full script is included here (make sure to customize "yourEmail" and "yourTextEmail"). To use this you're going to have to add a Trigger, more specifically, a "Time Interval" (you can learn more about that here).

If you would like more information on how to create Google App Scripts in Google Sheets, you can find a walkthrough here.

Note

I know my script is going to draw some ire; it's not beautiful some may say. Others may point out how it's not efficient, and could be done another way. Well... it's easy to read and easy to follow for someone who is relatively new to coding so I think it's pretty darn nice. And most importantly - it got the job done!

Cat Tax


Jazz

catfeederalerts's People

Contributors

stephen-- avatar

Stargazers

Sudarshan Patil avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.