Internet Enabled Raspberry Pi Pet Feeder

51,583

362

62

Intro: 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

  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

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

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

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

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

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

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

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.

5 People Made This Project!

Recommendations

  • Side Dishes Challenge

    Side Dishes Challenge
  • Audio Contest 2018

    Audio Contest 2018
  • Optics Contest

    Optics Contest

62 Discussions

0
None
ijankeis

Question 6 months ago

Hi,

I am a bit new to Python and slowly learning it through this project.

I am writing the code in Python 3.5. I have used the inbuilt imaplib.py instead of imapclient. While compiling, I get an error in the imaplib.py as follows-

data + b' ' +arg

TypeError: can't concat bytes to list

Can you explain the meaning of this and how to solve it?

Thanks.

1
None
krishsdoitthemisfitgirll

Answer 7 months ago

Step 2 is broken down into the four sub steps. Let me know where you are stuck.

0
None
krishsdoitMarkG369

Answer 7 months ago

There are only three connections in all of step 2.

First is the cobbler, second is the feed switch and the third is the reset switch. Let me know where you are having trouble.

0
None
michaelmandala

9 months ago

Can somebody please send a close up picture of the breadboard because I don't know how to do it. Thanks

1 reply
0
None
krishsdoitmichaelmandala

Reply 7 months ago

There are only three sets of connections to the breadboard.

In Step 2 you connect the switches

In Step 3 you connect the LCD

In Step 4 you connect the motor

Let me know where you are having trouble.

0
None
englewentpro.

10 months ago

This is great! I am going to borrow a lot of ideas from this to help in making my very own. My first go around with a raspberry pi will be a treat dispenser, but this is on my list of "to make". This write up is very detailed and well thought out kudos to you!

1 reply
0
None
krishsdoitenglewentpro.

Reply 7 months ago

Please borrow as much as you need to and customize the way you want. Good luck!

0
None
alarmed23

1 year ago

can i use an i2c backpack for the lcd?

and what do i hav to cange in the code?

1 reply
0
None
JoshH236

1 year ago

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!

2 replies
0
None
krishsdoitJoshH236

Reply 7 months ago

Hi Josh, Let me know if you were able to get the imapclient and the LCD module installed.

0
None
ijankeisJoshH236

Reply 7 months ago

Hi JoshH236,

I have come across the same error. Did you find a solution to this? Help would be appreciated.

0
None
TimG163

1 year ago

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.

1 reply
0
None
krishsdoitTimG163

Reply 1 year ago

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