Make your pet dishes tweet
You give your pets everything: Food, water, a home, toys, and love. Why not give them a twitter account?
This project allows you to monitor your pets’ eating habits and receive alerts when their supplies are low. It’s also a cute, fun way to learn how to interact with the Arduino, Twitter, sensors, and Ethernet.
Let’s get started!
Step 1: The Parts
- An Arduino Uno (available at Adafruit here )
- An Arduino Ethernet Shield (Also at Adafruit here )
- A cheap digital kitchen or postal scale ($20 at Bed Bath and Beyond) for the strain gauge.
- An instrumentation amplifier to boost the strain gauge output. I used a $3 INA126PA from Jameco.
- A water level sensor. For ease of use, I chose the this one from Jameco.
- A prototyping board, prototyping shield, or ability to create circuit boards.
- A 5V USB power supply and USB A-B cable.
- Something to protect your kit from the pets. I used a cheap plastic storage bin.
- A couple resistors, some spare parts from around the house, and some creativity.
There are alternatives to using the Ethernet shield posted by other entries to the Make it Tweet challenge. Check those out and see which method you like more. If you like their projects, vote for them!
Step 2: Science break: What is a strain gauge and amplifier?
The change is so miniscule that the Arduino cannot detect it by itself. That is why the INA126PA amplifier was used. The amp can detect the tiny changes and boost them to levels that the Arduino can read.
In my code, it’s obvious that I “cheated” at much of the math. Instead of trying to detect the actual number of grams present in the bowl, I simply captured the analog data from the amplifier and watched how it changed between an empty bowl and increments of weight up to a full bowl. At these levels, the readings reported a linear result from 587 to 599. While this is very low resolution, it’s enough to report a relative percentage from “empty” to “full” using the map() function in the Arduino IDE.
In this project, I used a metal tray “lid” from an IKEA storage bin and screwed it to the plastic base after removing the glass. This holds the bowls.
Step 3: The Water Sensor
I used pieces of an Erector set and a zip-tie to hook the sensor to the bowl.
Step 4: The Wiring
- Arduino pins (labeled on the Arduino)
- Scale (Red, white, blue, and black are typical from these)
- The INA126PA (There’s a notch near Pin 1 and then count up counterclockwise)
- The Water Meter (Red/white/black)
Instead of providing a big schematic that takes a while to read, I’ll just give a simple device-by-device wiring.
The Amplifier and Water Sensor both have datasheets explaining each pin. See Step 1 for those links.
(1) Red labeled E+ (to +5V)
(2) White labeled V+ (to INA126PA pin 2)
(3) Blue labeled V- (to INA125PA pin 3)
(4) Black labeled E- (to ground)
(1) Resistor to 8 (to set sensitivity – I used 220 ohm)
(2) V+ on INA126PA
(3) V- on INA126PA
(4) to ground
(6) Output (Arduino A0)
(7) +5V from the Arduino
(8) Resistor to 1
Red: to +5V on the Arduino AND to a 10k resistor to ground.
White: To Digital 3 on the Arduino
Step 5: Arduino + Twitter + Ethernet fun
A neat character named Neocat made the Arduino Twitter Library. Instead of storing your user ID and password in Arduino code, it issues a token to use the Twitter API. This token can be revoked at any time which is good if you accidentally post your whole code WITH the token to somewhere. Yes. I did that. Oops.
The difficulty I found is that it only accepts char arrays as tweets, so a character array must be declared then populated. Since my code generates Strings, I had to convert the String to a character array before passing it off to my Twitter function.
Here’s what I added to the example code to make it a function. The Serial.print lines are there just to help with debugging. I also initialized the variable at the top of the sketch with char msg; // make a nice fat buffer (125 characters) for tweets
For more detail: Make your pet dishes tweet
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
Cheapest PCB Prototype: Only $2 for 10pcs 10×10cm PCBs, 24 hours Quick Turn, DHL Delivery in 3 Days