Instructables
Picture of Arduino controled dog food/treat dispenser

In this Instructables I will be describing how to build an automatic dog treat/food dispenser using an Arduino Duemilanove (the Uno is the newest version of the same board). The timer interval can be adjusted via a potentiometer and can be set to any min or maximum value in the code. This project does not require extensive coding knowledge knowledge and leaves a lot of space to be modified. It is also designed to use as few parts as possible while trying to keep costs down and dogs happy :)



 
Remove these adsRemove these ads by Signing Up

Step 1: Parts Needed

Step one is to gather the parts needed.

Parts:

1 or more dogs (these are imperative for quality control and testing purposes! Cats can be used as a substitute in a pinch but results cannot be guaranteed)

Electronics:
1 Arduino board (any arduno board will work i used an older Duemilanove )
1 Standard servo
1 potentiometer (any valued potentiometer will work, i used a 50kohm)
1 9v battery and holder

*Optional*
1 switch
1 LED (not required but fun for blinking)

Hardware:
1 1/4 (6mm) x 3.5" x 36" Plywood
2 sheets of acrylic 11" x 14" (you can use any thickness or even substitute it with plywood however you wont be able to see into the case)
wire
hinges
screws

Tools:
Wire cutter/Strippers
Saw
Soldering Iron
Drill
Glue gun

*NOTES* - templates are provided as a reference when cutting the various parts however always double check as they may not be 100% accurate.

Step 2: Build the base box

Picture of Build the base box
DSC_0699.JPG
Cut the parts for the outside box out of the 1/4 (6mm) x 3.5" x 36" Plywood sheet. Glue the bottom and the two sides together but don't add the top piece yet.

*Notes* - Acrylic can be used here for a fully clear box

scotchcollege2 months ago
Thanks for the detailed response Stuart.
scotchcollege8 months ago
Can someone please explain the purpose of the potentiometer?

The potentiometer is used to set the delay in dispensing treats. The relevant code is

for(;potIn>0;potIn=potIn-20)
{
//this is to make the LED flash every 100+potIn miliseconds
digitalWrite(11,HIGH); //set led to on
delay(100+potIn);
digitalWrite(11,LOW); //set led to off
delay(100+potIn);
}

potIn is the value read from the potentiometer (0-1024) at the beginning. So the code works like this:

1) Read potentiometer value (that code is not shown here, but lets say you crank it all the way to 1024

//----------------------------------------start Cycle----------------------------------//

2) Turn LED on

3) Wait 100 + 1024 (value from potentiometer) x milliseconds

4) Turn LED off

5) Wait 100 + 1024 (value from potentiometer) x milliseconds again

6) set the new value from potentiometer as the original value (1024) - 20 or 1004

7) if this new value is greater than 0, go back to step 2 using the new value from step 6.

//----------------------------------------end Cycle----------------------------------//

So basically the code takes the reading once (step 1) and then cycles between steps 2 and 7, subtracting 20 each time until you get to 0 which then triggers the treat to be dispensed.

Cycle 1: potentiometer value = 1024

Cycle 2 potentiometer value - 20 = 1004

Cycle 3: potentiometer value - 40 = 984

....

Cycle N: potentiometer value - 1024 = 0

Dispense treat

The more you turn the potentiometer, the higher the starting value in step 1 (up to 1024) and the longer it takes to get down to 0. I'm not exactly sure why he set it up this way but there you go. Hope that helps.

P.S. In case it's not clear, even though he calls it potIn (and I call it the potentiometer value) in each cycle, that value is only read once prior to the first cycle.

how can i make to activate it every 8 hours?

demonking1 year ago
Hey...great tutorial...!
But i want to change the interval to 4 hrs.....?
LIKE!
Hello, I am trying to build this dispenser with my son and have a question regarding the servo wheel. What is the purple part? Do we cut an inner circle also?
On The 3dge2 years ago
is it possible to make this dispense once a day say at 8 o'clock and if so what would the code be after this change, i'm a novice when it comes to arduino so i would really have no idea
crazydeadmoth (author)  On The 3dge2 years ago
Yes, but you'd probably have to make it a digital timer (not analog with the potentiometer) and you would have to use the time library found at: http://arduino.cc/playground/Code/Time
what is the longest time that you could run the intervals without having to change the components loads or otherwise do you know how i would incorporate a digital timer into arduino because like i said i have never used it before, thanks
zxcvbm2 years ago
Is it possible to use a DC motor instead of the servo?
mstomel2 years ago
I want to put multiple treat dispensers that are controlled by a (human controlled) button, is that possible?
CJSudduth3 years ago
This reminds me of a smaller version of a deer feeder ...
Jeff Broske3 years ago
THANK YOU !!!

I have been using the arduino for about 2 years now and NEVER seen a tutorial this will constructed and put together.

you are a very good teacher and maker and I appreciate you taking your time to help others.

- Jeff
roncee3 years ago
That is a very nice work!!!... But can you be able to make it to dispense food two times a day? For example one in the morning and one at night time? Maybe add a timer code to andruino. Is that possible?
crazydeadmoth (author)  roncee3 years ago
yes, you can by using millis(); to figure out how much time has passed in miliseconds since the arduino was swithched on. It'll reset to zero after about 50 days, how ever you could do somethng like this:

startTime = millis()
if(milis() - startTime > 4320000) //12 hours
{
//run the code to drop a treat
}

see this site for a reference: http://arduino.cc/en/Reference/Millis
cool thank you! i will start ordering my arduino and other parts. oh, by the way, i have two dogs (one small and one large) and i have been thinking if i can split the wire to run two servo for individual food servings at the same time. is that possible also?
crazydeadmoth (author)  roncee3 years ago
You sure can. You have two choices here, you could either buy a "Y" servo harness which will split 1 servo output in to to, however the servos will do the exact same thing.

The better option (although slightly more complicated) is to use the Arduino. The Arduino Uno board provides up to 6 PWM (pulse width modulation) signal which means you could control up to 6 servos independently.

You would use the second option like this: in the sample declare the new servo with the code Servo servoName; using the built in Arduino library. Where it says mainServo.attach(3); you would type servoName.attach(pinnumber);
thanks again!
ChrysN3 years ago
Cool, nicely done!
Very nice instructible! The construction is clever and has a good balance of simplicity and function. The only change that I would make, would be to install a pin to support the food wheel on the side opposite the servo. This would make the design stronger by reducing the strain caused by the overhang of the wheel.  You have my vote. Good luck.
crazydeadmoth (author)  Doug Paradis3 years ago
Thanks for the input :)

I did think about adding a pin to support the front of the wheel, however i am still thinking of a way to have it somewhat removable from the front panel. i guess i could figure out some sort of clasp attached to the front panel that is easily removed.

It didn't seem to be a problem when i tested it as the wheel is only a few millimeters from the front panel which prevents it from falling off, however i am sure given enough time it will scratch up the front panel.