Instructables

Twitter Controlled Pet Feeder

Picture of Twitter Controlled Pet Feeder
IMG_3303 copy.jpg
peanut.jpg

A great project for busy pet owners. This Twitter-Controlled pet feeder automatically dispenses food in response to activity on your Twitter account. The project is controlled by an Arduino and uses the Arduino Ethernet shield to receive data from Twitter. I hacked this automatic Pet Feeder from Amazon to build this project, but you could easily modify your own motorized feeder to work.

Parts List:

(1x) Automatic Pet Feeder Amazon
(2x) 10K Ohm 1/4-Watt Carbon Film Resistor (1 package) Radioshack #271-1335
(1x) Arduino Ethernet Shield Radioshack #276-130
(4x) CdS Photoresistors 5 pack (1 package) Radioshack #276-1657
(1x) Grid-Style PC Board Radioshack #276-147
(2x) White Super-bright LED Indicator Radioshack #55050633
(1x) Male Header Pins 40 Position Jameco #160882
(4x) "D" Alkaline Batteries (1 package) Radioshack #23-865
(2x) 4.7K Ohm 1/4-Watt Carbon Film Resistor (1 package)
(2x) current limiting resistors, see the sample calculation below

from the specs of the LEDs I used:
"Continuous forward current: 30mA"
"Forward voltage: 3.6V"

using the following relationship:
V(volts) = I(amps) * R(ohms)
rearranged to:
R = V / I

we can calculate the resistance as follows:
voltage across resistor = 5V - 3.6V = 14V
1.4V / 0.03A = 47ohms

I used 100 ohm 1/4W 5% Carbon Film Resistors Radioshack #271-1311 so that the LEDs wouldn't be operating at their maximum ratings. Check the datasheet of the LEDs you use to calculate these values.

Additional Materials:
drill
Solder Radioshack #64-013
22 Gauge Wire Radioshack #278-1224

 
Remove these adsRemove these ads by Signing Up

Step 1: Open pet feeder

Picture of Open pet feeder
IMG_3104 copy.jpg
Unscrew 8 screws from the base of the pet feeder and carefully lift the bottom panel of the feeder open.  There are some wires which permanently attach the bottom panel to the body, be careful not to put too much strain on them.

Step 2: Unscrew pcb

Picture of Unscrew pcb
IMG_3117 copy.jpg
Remove six small screws from control pcb.  One of the screws is hidden under a small pcb on top of the main pcb.  Once all the screws are removed, the pcbs should easily lift off the plastic enclosure.

Step 3: Schematic

Picture of Schematic
Screen shot 2012-05-04 at 5.36.44 PM.png
The schematic is shown above, I've also attached a fritzing document for your reference.  This feeder is programmed to manually dispense food when the "set" and "volume" buttons are depressed at the same time.  By wiring light sensitive resistors across these buttons we can simulate the mechanical pushbutton action as follows:
When the photoresistors are not exposed to light their resistance will be very high and the processor in the feeder will think that the buttons aren't being pressed.  By telling the arduino to light up some LEDs near the photoresistors, the resistance will decrease low enough for the feeder's processor to think that the buttons are being depressed.
I've also attached two pushbuttons in the circuit so that I could manually turn the LEDs on for troubleshooting purposes.  These buttons are not essential to the project (but useful).
I also be diverted some power from the feeder's four D batteries to power the arduino.

Step 4: Drill holes in pcb

Picture of Drill holes in pcb
IMG_3124 copy.jpg
IMG_3133 copy.jpg
Locate the "volume" and "set" buttons on the pcb (compare with the labels on the outside of the feeder enclosure).  Remove the tape and small circular metal covering from these buttons (figure 2).  You will see two exposed traces on each button.  Each outer trace has two holes drilled in it (see figure 1).  Drill two additional holes in the pcb, one in each of the inner circular button traces (figure 3).

Step 5: Solder wires to pcb

Picture of Solder wires to pcb
IMG_3135 copy.jpg
Solder four wires to the control pcb so each of the four exposed button traces has one wire electrically connected to it.

Step 6: Screw pcb back onto enclosure

Picture of Screw pcb back onto enclosure
Screw the control pcb back onto the feeder enclosure.

Step 7: Solder header pins on protoboard

Picture of Solder header pins on protoboard
IMG_3142 copy.jpg

The protoboard will house the circuitry that allows the arduino to interface with the feeder's control pcb. This board will attach directly to the pins on the arduino ethernet shield. Solder header pins to the protoboard so that it can snap into the power, analog, and digital 0-7 pins on the arduino ethernet shield.

Step 8: Solder white LEDs and current limiting resistors

Solder two 100ohm resistors to the protoboard.  One resistor should be electrically connected to the header pin for arduino digital pin 2 and the other resistor to digital pin 3 (figure 2).  Bend the leads of two white LEDs and solder to the copper side of the protoboard as shown in figures 3 and 4.  Solder a (red) jumper wire between each of the 100ohm resistors and the anodes of each of the white LEDs (figures 5 and 6).  Solder two (black) jumper wires between the cathodes of both LEDs and the to arduino ground (figure 7 and 8).

Step 9: Solder resistors and photoresistors to protoboard

Solder one large and one small photoresistor (from the set of five) in series on the protoboard (make sure they are on the same side as the LEDs).  Bend the leads of the photoressitros so that they are pointed directly at one of the LEDs.  Solder a 4.7kOhm and 10kOmh resistor in series with these two photoresistors (fig 4).

Repeat these steps for the second LED.

Step 10: Attach to feeder PCB

Picture of Attach to feeder PCB
IMG_3166 copy.jpg
IMG_3167 copy.jpg
Screen shot 2012-05-04 at 5.11.57 PM.png
Attach the leads from the "set" button to the protoshield so that the four resistors/photoresistors are in series between them (see notes on schematic if this is unclear).  Repeat this for the "volume" button leads.

Step 11: Attach control buttons

Picture of Attach control buttons
IMG_3170 copy.jpg
IMG_3171 copy.jpg
Attach two tact switches to the protoboard so that each delivers 5v to the LED and current limiting resistor circuit (bypassing the need for a 5V signal from arduino pins 2 and 3).

Step 12: Wire power

Locate the red and black leads on the underside of the feeder battery compartment.  Solder a (red) jumper wire from the red lead to the arduino Vin and another (black) wire from the black lead to arduino ground.

Step 13: Attach arduino and ethernet shield

Picture of Attach arduino and ethernet shield
IMG_3172 copy.jpg
IMG_3173 copy.jpg
IMG_3174 copy.jpg

Stack arduino, ethernet shield, and protoboard on top of each other.

Step 14: Drill holes in enclosure

Picture of Drill holes in enclosure
Drill two holes in the feeder enclosure.  The holes should be large enough to fit an ethernet cable and a usb cable through.

Step 15: Connect USB and ethernet

Picture of Connect USB and ethernet
IMG_3297 copy.jpg
IMG_3298 copy.jpg
Plug a usb cable and an ethernet cable to the ports on the arduino and the ethernet shield.  Thread cables through the holes you've just drilled in the project enclosure.

Step 16: Reassemble enclosure

Picture of Reassemble enclosure
Reattach bottom of enclosure using six screws.  Attach food compartment and lid.

Step 17: Batteries

Picture of Batteries
Insert 4 D batteries into feeder battery holder, and flip switch on bottom of feeder to off position for now.

Step 18: Firmware

Picture of Firmware
This firmware will read incoming twitter data so that if you tweet "feed me!" from the username omnomnom the arduino will light up the two LEDs attached to pins 2 and 3 for 1 second, causing the food delivery sequence to start.

I am using Arduino 1.0 for this project, I recommend downloading this version (or later) for this project.  If you do not want to use the new version, make sure you have the following Arduino libraries (they are bundled with v1.0):
- Ethernet (for the Ethernet Shield)
- EthernetDHCP (for self-configuring the IP address is you use DHCP at home)

Turn on the power switch on the bottom of the feeder, the LCD should flash 12:00 and the motors should run through the food delivery sequence once.  Refer to the manual if you would like to set the clock or set additional food timers, this won't be necessary for the project.  Press the rec button and record a personalized message for your pet, this will play at the end of each food delivery sequence.

Here is the Firmware:

You will need to make a two edits before this firmware is ready to use.

1.  Insert your IP address in the following line at the top of the firmware:
IPAddress ip(190,298,34,132); //<< ENTER YOUR IP ADDRESS HERE!!!
if you don't know your IP address open File>>Examples>>Ethernet>>DhcpAddressPrinter, upload this code to your arduino with the ethernet shield plugged in (and ethernet cable connected), and open the serial monitor Tools>>SerialMonitor

2. Change the username of your twitter account in the following line (from the function connectToServer():
client.println("GET /1/statuses/user_timeline.xml?screen_name=nomnomnomfeeder&count=1 HTTP/1.1");

Upload firmware on your arduino board, plug in the ethernet modem/router.  Tweet "feed me!" from your twitter account and you should see your pet feeder dispense food in a minute or less.  The feeder will not receive any further tweets for four hours (to prevent over feeding), during this time, tweet another message to replace "feed me!" as your most recent message.

Step 19: Try it out

Picture of Try it out
Connect the Ethernet shield to an Ethernet cable connected to the internet.  Turn on the feeder.
Set up a Twitter account and tweet the password you set in the firmware.  Within a minute you should see the pet feeder dispense food.
vetta5 months ago

Hi Amanda,

Could I ask you some questions in private?

Lover951 year ago
Hi Amanda, great project! I thought I would do this for my senior project at school. Instead of using photoresistors and leds, using a simple transistor with a 2.2K resistor on the base, connecting the emitter to the ground side of the button pad and the collector to the positive side of the button pad would be a more cost-effective and time sparing solution. Also, I would put in piece of code that would post a tweet after the feeding procedure was completed to prevent overfeeding. But thank you, great idea, and this instructable will certainly come in handy.
Dylon124 Lover958 months ago
That's what I was thinking, why not some transistor, maybe because of the power flowing through it to control the pet feeder.
rgivs1 year ago
I have gotten to the step where you attached the Ground from the D Battery on the feeder to the PCB board. I must have put it on the wrong area as one of the LEDs is constantly lit. Do you have an exact spot to put it?

Also, do you have a part number for the Test Buttons? I can't find them. Great project though!!! I am almost done with mine.
Is the USB cable just for the initial program load? You can disconnect it after that, right?
sciencetor22 years ago
Definitely a cool project, but 1 question, why use photo resistors and LEDs in stead of just straight transistors or some form of switching circuit? Seems like a bit of a roundabout solution
JoeMurphy2 years ago
I would love to see more of an explanation of how the arduino code works. Great project!
This is a nifty bit of work......however......I would NEVER be too busy to get home to your dog! I love English Bull Terrriers. Sadly ours died last year but we are now ready to invite another Bully into our home.

If it isn't an English Bull Terrier......it's just a dog!

Apologies to owners of other breeds, I'm sure you feel just as passionate about yours.
TobbaBK2 years ago
Great project! But what prevents the dog from shredding it into pieces? :P
inkfzz2 years ago
just dont loose your phone or your dog might famish:-)
rrkrose2 years ago
This is too cool! I am really bad with electronics but I will have to learn the basics so I will be able to make this soon.
leeski2 years ago
that is one awesome project! My dog Buckley would love this.
i have been wanting to do something like this