Introduction: Internet Enabled Raspberry Pi Pet Feeder

Picture of Internet Enabled Raspberry Pi Pet Feeder

This is a dog feeder powered by a Raspberry Pi.

If you want:

  • an easy way to feed your big dog
  • keep track of when you feed
  • control how much and how often you feed
  • and optionally be able to feed remotely through email when you are not around

this is a project for you :)

If you have all the parts around, it should take a couple of weekends to get this done.
Please feel free to modify and share your mods.

Step 1: Parts Needed

Picture of Parts Needed
  1. Raspberry Pi 2 Model B
  2. Breakout board. cobbler and cable for Raspberry Pi
  3. 16x2 backlit LCD
  4. 12V high torque DC motor
  5. Zevro WM100 Cereal Dispenser
  6. Wireless dongle for Raspberry Pi
  7. 1/4" D-shaft for dispenser
  8. 1/4" to 6mm coupler for motor
  9. Two pushbutton switches
  10. 12V power supply for DC motor
  11. Mini USB power supply for Raspberry Pi
  12. Wood for box
  13. Jumper cables
  14. Tube to make the kibbles flow to the bowl (optional)

Step 2: Breadboard Assembly: Switch Controls

Picture of Breadboard Assembly: Switch Controls

The switches provide controls to operate the feeder. There are two pushbutton switches in this design.

One for controlling the feed motor. The other to reset the feed timer.

  1. First connect the cobbler to the Raspberry Pi using the ribbon cable. Take care to orient the red line on the cable to the corner of the Raspberry Pi
  2. Place the cobbler on the breadboard
  3. Connect one terminal of the feed motor switch to pin #6 on the cobbler. The other terminal goes to ground on the cobbler
  4. Connect one terminal of the reset switch to pin #13 on the cobbler. The other terminal goes to ground on the cobbler.

All the switches are done!

Step 3: Breadboard Assembly: LCD

Picture of Breadboard Assembly: LCD

The LCD panel is programmed to have a clock, a feed countdown timer and status messages while feeding, resetting etc.

Here are the steps to connect the LCD panel to the Raspberry Pi through the breadboard and cobbler.

  1. Solder header pins to the LCD panel and a small PCB to the other end of the header pins. I used an old PCB and cut it to size. This makes taking the cables out to the breadboard easier
  2. Place a 10K Ohm potentiometer on the breadboard
  3. Connect +5V and ground to the left and right legs of the potentiometer
  4. Connect the following pins from the LCD to the cobbler:
  • Pin #1 (VSS) connects to ground (black wire)
  • Pin #2 (VDD) connects to +5V (red wire)
  • Pin #3 (VE) connects to the middle leg of the potentiometer
  • Pin #4 (RS) connects to the cobbler #25
  • Pin #5 (RW) goes to ground (black wire)
  • Pin #6 (EN) connects to cobbler #24
  • Skip LCD Pins #7, #8, #9 and #10
  • Pin #11 (D4) connects to cobbler #23
  • Pin #12 (D5) connects to cobbler #17
  • Pin #13 (D6) connects to cobbler #21
  • Pin #14 (D7) connects to cobbler #22
  • Pin #15 (LED +) goes to +5V (red wire)
  • Pin #16 (LED -) goes to ground (black wire)

There is a very nice detailed write up of the LCD wiring at modmypi.com

We will use the Adafruit library for programming the LCD (more details on that later)

Step 4: Breadboard Assembly: DC Motor

Picture of Breadboard Assembly: DC Motor

The high torque DC motor is a 12V 3.5 RPM motor with a 6mm D-shaft on it.

It is a simple transistor based circuit with the raspberry PI pin # 19 providing the control signal

Connect as shown in the diagram.

Note that the 12V power supply is a separate power supply just for the motor.

The ground for the 12V power supply and Raspberry Pi's ground will connect together.

Essentially the transistor acts as a switch control by the HIGH on the Raspberry GPIO pin to switch the motor on/off

Step 5: Programming the Raspberry Pi

Here's the basic idea of the pet feeder

  1. Should be able to press a button and get a measured amount of feed in the bowl
  2. No overfeeding. Disable the feed button for 8 hours after feeding
  3. Over-ride the disabled feed button with a reset button
  4. Accidental press of feed button, while disabled, should pop up friendly message on LCD
  5. Display a clock and the time left for the next feed as a countdown
  6. Trigger the feed through an email to a gmail account
  7. Trigger a query to know when the last feed and next feed can be using email to a gmail account
  8. Do some fun replies with Chuck Norris jokes and/or numbers trivia :)
  9. Make the system immune to reboots by starting the program automatically on reboot, saving state to files etc.

Step 6: Connecting the Zevro Dispenser to the DC Motor

Picture of Connecting the Zevro Dispenser to the DC Motor

The Zevro is pretty cool since it takes care of dealing with large kibbles for the dog.

It comes with a mounting kit and a knob. Discard the knob and its attached plastic D-shaft.

  1. Use the metal 1/4" D-shaft cut to size for your motor position. It might a tiny bit loose on the Zevro side. Nothing that a cut up credit card shim can't fix :)
  2. Mount the motor securely (I used an L bracket)
  3. Connect the D-shaft from the Zevro to the motor using a 6mm to 1/4" coupler
  4. Mount the Zevro to one of your panels

Step 7: Optional - Dispenser Chute

Picture of Optional - Dispenser Chute

Didn't want to bend down to press the button and didn't want the dog to knock off the clear plastic container with the food. But a high mounted Zevro ends up in kibbles dropping from too high and bouncing off the feeding bowl

Hence the dispenser chute

Essentially a cheap 3" drain pipe and an elbow joint.

Some duct tape to make sure kibbles are directed into the bowl.

Step 8: Box and Paint

Picture of Box and Paint

Make a small box to put it all together and paint it

Make a hinged door to keep things serviceable, if needed

Operations Manual :)

  • Just press the button to feed
  • Or send an email with the subject "When" to query when the last feeding was done
  • Or send an email with the subject 'Feed" to feed the dog!

Here's a video of the project in action. Enjoy!

Step 9: Adding a Camera

Picture of Adding a Camera

The pet feeder has been working pretty flawlessly for the past several months.

The one thing that is missing is positive confirmation that the dog is actually eating the food once remotely fed.

Raspberry Pi camera to the rescue!


Here's where to get the camera and installation instructions:

https://www.adafruit.com/products/1367

Once physically installed, here's a code snippet you can add to the original code to get your camera integrated into the pet feeder. This code takes a time-stamped picture and saves it to a file. You can take this file and email it if you like.

In the sendmail function in the earlier code simply substitute the "attach=None" argument with "PICFILE" and you should be able to receive the file.

Comments

alarmed23 (author)2017-10-19

can i use an i2c backpack for the lcd?

and what do i hav to cange in the code?

alarmed23 (author)2017-10-19

can i use an i2c backpack for the lcd?

TimG163 (author)2017-05-23

Any idea on how well the electronics will work in colder temperatures? -18C (0F)?

Great idea, very inline with what I have been meaning to build for a while now.

krishsdoit (author)TimG1632017-05-23

The electronics should be fine. I would worry about moisture condensates and freezing of the mechanical parts.

TimG163 (author)krishsdoit2017-05-23

It will be going into an insulated but unheated garage so temp should be relatively stable ie not much condensation. Last feeder I had was a store bought one that would stop running around -10c. As long as the motor you used is stronger than the last one I tried then all should be well.

TimG163 (author)TimG1632017-09-22

Me and my brother have been working on this project. A bit has changed since the original was made. Just got the email aspect working, now for the LCD and then power to the motor.

TimG163 (author)TimG1632017-10-08

Well crap. Have everything tested and ready to put in a box and suddenly the Pi wont even boot up. Cracked memory card. So now I need to setup another operating system and re-modify the petfeeder program. ARGHHH

VenusB5 (author)2017-09-15

is the code working?

JoshH236 (author)2017-06-08

I love the idea of this project. I cannot get it to work for me though. No matter what I try the software will not run. I realize this project is intended for more experienced DIY'ers or coders, but I did not think it would be this difficult.

I am running into a few errors when trying to run the script. The IMAPClient won't install properly (more likely its operator error)

I have tried: sudo apt-get install imapclient, apt-get install imapclient, pip install imapclient, and the easy install function. Those either result in a partial install that says several files or directories were missing, or a bunch of red error messages and aborting. The error I get with the script is an import error saying no module named imapclient, seen exists (or something similar).

I also get errors with the adafruit_charlcd module. When I run the script it gives an error regarding 9 arguments needed, 1 given. I would give the exact wording but I am currently reflashing my sd card in hopes that a fresh install will help me get this project up and running.

Any help would be greatly appreciated!

inshyrp (author)2017-05-09

the transistor PN2222? can I use 2N222? is that same?

krishsdoit (author)inshyrp2017-05-23

Yes you can. The covers are different between the transistors but for this application they work the same.

CaptainLlamas (author)2017-04-29

I have two cats and want to make this but i don't want to buy two zevros, so what do you suggest i do? I was thinking maybe split the stream of food right after the dispenser, that might work

krishsdoit (author)CaptainLlamas2017-05-23

You could do a split but keep in mind the food comes in little spurts with each impeller from the zebra pushing it. So there won't be a guarantee that each path gets the exact same quantity,

Twitchr made it! (author)2017-01-09

I made this, however cannot get the code to work. I updated all the calls to the libraries (rpi.gpio, adafruit_char_lcd) that gave errors when the code ran. I need to debug the python script more, its running but nothing was actually working. I ended up making some custom script myself just to say "if button press, activate LED, wait for 4 hours, at 4 hours, cycle motor for 20 seconds, turn led off"

OP, anyway we can get updated python code?

krishsdoit (author)Twitchr2017-01-28

@Twitchr, could you let me know where the code is stuck for you?

Twitchr made it! (author)krishsdoit2017-02-09

So the first error i get is the adafruit one below. After some researching i'm guessing the repositories have been updated. I was able to remedy that error with the following lines dictating each pin for communication. Had to change a couple references of SetCursor to Set_cursor. After that, it runs for about 30 seconds, then the last error. Pictures should be in order. Thanks for looking at this :)

Twitchr (author)Twitchr2017-02-11

Slight update- fixed the error I was seeing. It runs now, without crashing..... however nothing actually happens. When sending emails, it does not feed. and Display/button dont work. I'll have to try to step through it

Moe A (author)Twitchr2017-01-26

Can you please share some hints or even things to avoid which executing this project because am about to start making it probably in the next couple of days. I just received all items needed. I will be using Rasp Pi 3 module 3 + Camera Pi.

Congratulation on your achievement !

Twitchr (author)Moe A2017-02-09

Hardware wise, everything went pretty smooth. I was able to get most things on Amazon/Ebay. Software wise, i'm still debugging :/

sirdronealot (author)2017-02-08

Hi, new here, first time jumping into a project, i've done some stuff with the raspberry pi before but nothing major really. I'm having alot of trouble with connecting the dc motor to the raspberry pi, i've never done any wiring in my earlier works, so completely new. diagram isn't really helping, any way you can dumb it down for me? :(

gabrielle.martinfortier made it! (author)2017-01-27

Mine is for a rabbit and the food is kept on the wood box. I also added two leds for status (green when ready to feed and red when there is almost no food left) and I have 3 buttons : feed, reset, and fill the reservoir.

i tried to run the code of this project but i ended up getting some errors, here is the error i got.

Traceback (most recent call last):

File "/home/pi/final.py", line 16, in <module>

from imapclient import IMAPClient, SEEN

ImportError: No module named 'imapclient'

can you tell me if you got this type of error and how you solved it?

Hi!

It looks like you didn't install all your packages, maybe make a quick google search on how to do that in the linux command prompt.

I did have problems with the imapclient package, and I ended up using imaplib, you may want to look into that as well!

I think I have installed that package, and I saved it into my pi 3. I gotta find out who to import these libraries inside the code. I dunno what is better for running the code either Terminal or Python IDLE?

Congratulations! No more hungry rabbit! :)

Moe A (author)2016-11-11

Is it going to be fine to apply this project on Raspberry pi 3 to run this system, I really like your project and I want to do it !!

jablake (author)Moe A2017-01-26

Got your message. I'd love to collaborate on this. I've got a Pi 3, Pi camera, 2x16 LCD, motor, Zevro (a bigger one for dog food), shaft, coupler, etc. email me at jablake53@gmail.com Thanks

jablake (author)Moe A2016-11-18

I'm building one with a Raspberry Pi 3. I'm sure it will work and you don't have to buy a wifi dongle. I can't program so I've been doing Python tutorials to help understand his program. When I get the hardware done I'll have to ask friends for help with the software. For instance, at this point I don't even know how to make the program auto start once the pi boots up.

Moe A (author)jablake2017-01-26

Hello Friend,

Any updates regarding your Pets' feeder, am about to start very soon like in 2 days.

Please let me know, lets share ideas and help !

Moe A (author)jablake2016-11-18

thanks for your input. Am still did not get what you meant by you can't program. I mean the software part is available in this project, why don't you use it?

for me, I have never used Raspberry pi, but I do have some experience with Arduino and Beaglebone Black.

jablake (author)Moe A2016-11-19

I am modifying and using his program code. But, I would like to understand more about what is making it work, so I'm trying to learn Python. Also I'm not familiar with Linux as far as loading libraries, or even verifying that they are installed, creating an autoexec batch file, etc. I installed the display on my breadboard and was using someone else's program to run a test display which I got to work but would sometimes just display gibberish. Also, when I tried to run the same guys program that was supposed to display the ip address I kept getting and error message about indentation and was not able to figure it out.

Moe A (author)jablake2016-11-20

As I told before, i have never put my hands on Rpi, but I have some little experience on Python language using it to program a beagleBone Black board. Let me till you this, Python language is really sensitive in indentations and such structural stuff especially when I use Python IDLE software which is the only software has been provided at my school.

krishsdoit (author)Moe A2016-12-12

@Moe A - yes you can use a raspberry pi 3 for this and it should work fine

lpaddikt made it! (author)2016-12-31

Except I did it with an arduino and will be having my own first instructable soon. Thanks for doing this.

krishsdoit (author)lpaddikt2016-12-31

Congratulations! you should put this project under the "I made it" category on my instructable.

Boost (author)2015-12-29

This looks so much better than the ones I've seen created with big wheels, cardboard boxes and whatnot. This is very professional looking. I would love to see a video of it (and the dog) in action.

krishsdoit (author)Boost2015-12-29

Good idea on the video Boost. Uploaded it.

CristhianP9 (author)krishsdoit2016-12-12

buenas estoy haciendo estre trabajo me gustaria q me brinde la documentacion en mi pais bolivia no hay forma de que pueda pagar para tener acceso premium xfavor si seria tan amable de ayudarme cyp3msc@gmail.com es mi correo gracias de antemano

jablake (author)2016-11-19

Krishsdoit,

Thanks for posting your project it was just what I was looking for. I know that documenting all of the steps for a project can be quite tedious and time consuming, so thanks for taking the time to do such a good job.

jablake (author)2016-11-18

I already have two commercial automatic feeders but they use less powerful 5 volt motors and are prone to jamming from time to time. From my testing of the Zevro and 12 volt high torque motor I don't think that will be an issue now. I bought the larger Dog Food Zevro and I'm using a Raspberry Pi 3 b.

CrystalH56 (author)2016-06-13

When you say jumper cables, do you mean those for a car? I don't see them mentioned again.

krishsdoit (author)CrystalH562016-06-14

No, these are cables that go from one pin on the breadboard to another pin. Typically single strand 22 gauge wire.

CrystalH56 (author)krishsdoit2016-06-14

Great! Thank you!

DanH139 (author)2016-06-04

Hi!

On the motor circuit picture you used a 270 ohm resistor (R1) but there is no such resistor on your Canakit Breakout Board kit. Is that correct? because I only have 220 / 1k / 10k / 100k / 1m / 5.1m resistors.

krishsdoit (author)DanH1392016-06-04

Could be. Various versions of Canakit quite possibly can have different combinations of resistors. If you can rig up 300 ohms instead of 270 ohms you should be fine. All you are trying to do is to make sure that you limit the current through the circuit.

DanH139 (author)krishsdoit2016-06-04

Thank you I will try that ?
And thank you for the post, it's a nice project.

Sean7805 (author)2016-04-24

Can I do this with a servo instead? I don't have a motor and I just need to feed my fish.

Hi!

I'm building a similar feeder at the moment and tried different mechanisms. I started with a servo and an auger, but I decided to go with the Zevro in the end. I decided to switch to a DC motor too, because I couldn't find a way to solidely attach the servo to the zevro (those words go well together). Also I'm not sure the servo's torque would be enough. Let us know if you succeed with the servo, and if you need any help with the servo coding I had it figured out before I switched to the DC motor so I could help you out.

krishsdoit (author)Sean78052016-04-25

You could use a servo. The input into the servo will have to be slightly different since you will have to use PWM to control it.

The reason to use a DC motor in this case was the dog food kibbles are large and it really needs a high torque motor to turn the dispenser. In the case of fish food, I'd expect the torque needed will be much lower and you can come up with a simple open/close mechanism (just rock the servo to open and close). Good luck, let me know how it shapes up.

chad bear (author)2016-04-03

I'm building your Internet Enabled Raspberry Pi Pet Feeder and have a few questions. The picture of your breadboard as it relates to your transistor and diode is different than the schematic in your write up. One has the diode going from +12v to -12v and the other has the diode going from +12v to the collector of the transistor. which is correct? Also, the schematic has resistors, but the picture of the breadboard does not show any resistors. Which is correct?

About This Instructable

40,287views

350favorites

License:

More by krishsdoit:Internet Enabled Raspberry Pi Pet Feeder
Add instructable to: