Arduino Controled Dog Food/treat Dispenser

141,148

145

49

Posted in TechnologyMicrocontrollers

Introduction: 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 :)



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

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

Step 3: Build the Servo Holder

Cut the parts for the servo holder and glue them together using hot glue, super glue and acrylic don't mix :( it causes the acrylic to go white)

Cut the parts for the back and front acrylic sheets.

Mount the servo holder to the back plate (horizontally centered ), and approximately 1 inch from the bottom

Glue the back piece to the outside box

*Notes* - don't use super glue!! i made this mistake :( it was the first time i have used acrylic in a project

Step 4: Cut Out the Servo Wheel

Cut the circles out of acrylic. Use a cd to trace out the size of the circle. I used a pare of wire cutters and very carefully cut out a rough circle which i then sanded to a smoother circle as shown in the pictures.

*Notes* -  This takes a little while to get right, i recommend practicing on some scrap pieces or use a band saw if you have one (on my wish list :) )

Step 5: Build the Wheel

Attach the servo arm to one of the circles making sure it is centered.

While that is drying cut out the rest of the pieces for the in the wheel. Fit one piece into the other to create an X and glue this to the wheel (see pictures).

Once the wheel is built use a 2L coke bottle to cover 3 of the 4 quadrants of the wheel as represented by the red in the picture. This leave one segment open for the food to fill

*Notes* - I didn't screw the servo arm back into the servo which allows me to remove the wheel, so far it hasn't fallen off yet (touch plywood:), this also helps when it has to be cleaned

Step 6: Mount Arduino Board and Connect Servo

Drill holes (carefully) to mount the Arduino board.

Attach the 9V battery holder to the side wall with a little hot glue and connect it to the arduino via an old ac adapter end piece

You can either create a servo harness out of some old rc parts laying around (see picture) or cut the connector off the end of the servo wire

Attach the black wire from the servo to GND on the Arduino, the red wire to VCC or 5V, and the white wire to pin 3 on the arduino

Optional: attach the led to pins 10 and 11 (the long pin or anode to pin 11 and the short pin or cathode to pin 10)
(see picture)

*NOTES* - You can install a switch by splicing the 9V battery wire and mount it to a hole in the side (see pics for the addition)

Step 7: Install Top Ramp

Mount the wheel to the servo

Cut out the parts for the top (feed) ramp.

With the wheel mounted on the servo carefully position the pieces for the top ramp (the two square ones) and glue them (see pictures)

Once these have dried glue the third piece

*NOTES* - you may have to sand down some pieces to create a snug fit

Step 8: Install Exit Ramp

Attach the 9V battery clip/holder as shown
(i used a 9v clip and attached it to an old ac adapter end)

Install the exit guard that guides treats to the hole, also install the exit ramp which help prevent treats getting stuck on the ledge as shown in the pics

*Notes* - Make sure to fit everything before you glue it, also test it with the wheel on to make sure it doesn't get stuck

Step 9:

Mount the potentiometer to the front acrylic piece. (i used some hot glue)

Attach the leads from the potentiometer to the Arduino. The first pin should go to pin 4, the middle pin should go to A0 (analog 0 ) and the third pin should go to ground (GND)

You can attach the front piece to the unit using either tape or glue. I'd recommend using tape or adding a set of hinges to give easy access to the Arduino board for reprogramming of testing. However be careful as the acrylic can crack very easily when drilling it

*NOTES* - you may not want to glue on the front piece as this may make getting into the box to modify the code difficult

Step 10: The Code

Connect the Arduino to your computer  via USB ( if you don't know how or are not sure as to how to do this see http://arduino.cc/en/Guide/HomePage )

Download and open the Arduino IDE from http://arduino.cc/en/Main/Software

Copy and paste the code below:


//BEGINNING OF CODE
//Author: Shane Halse
//Email: ShaneHalse@gmail.com
//Date: 02/11/2011
#define fill 155 //the position in degrees to fill the hopper
#define empty 20 //the position in degrees to empty the hopper
#define potPin A0 //this is the pin (must be analog) that the middle of the potentiometer is connected to

#include <Servo.h> //this is a library used to control a servo (for more information see www.arduino.cc for more info)

//variables
Servo mainServo; //declare the main servo
int trigger = 0; //this is used to switch between fill and empty
int potIn = 0; //this is the data read from pin A0 (the potPin)
int count = 1; //used as a time muliplier
void setup()
{
//basic setup
mainServo.attach(3); //tell arduino which pin the servo is on (the white wire from the servo)
//set the pin modes
pinMode(4, OUTPUT); //used to output 5V or High to the potentiometer
pinMode(10, OUTPUT); //used for the led
pinMode(11, OUTPUT); //used for the led

digitalWrite(4, HIGH); //set pin 4 high
digitalWrite(10, LOW); //set pin 10 low
}


void loop()
{

potIn = analogRead(potPin); //read the position the potentiometer is at
//if the trigger value is 0 fill the hopper
if(!trigger)
{
mainServo.write(fill);//move servo to fill position
//this is used to setup the delay
//count = 171 //uncomment this to set the max delay to 3 hours
//the delay below is calculated using potin (which can be 0-1024) as delayinseconds ~= 0 - 64 seconds
for(;count>=0;count--)
{
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);
}
}
count = 1;
trigger = 1; //change trigger to 1 to setup empty
digitalWrite(11,LOW); //set led off
}
else if(trigger)
{
mainServo.write(empty); //set the servo to empty position
delay(1000); //delay while servo sets position
trigger = 0; //change trigger to 0 to setup fill
}
}
//END OF CODE


Connect the Arduino to your computer 
click the compile button
Upload the compiled code to the board and it should start working automatically

You can then mount the unit to the wall, place a bowl under the unit and let the fun ensue!

*NOTES* - If you want you can add some sort of button your dog presses to get a treat rather than waiting and you will have just made the famous Skinner box!

4 People Made This Project!

Recommendations

  • Casting Contest

    Casting Contest
  • Make it Move Contest

    Make it Move Contest
  • Woodworking Contest

    Woodworking Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

49 Comments

Can u give me the schematic circuit?

Would it be possible to set this up with a motion sensor?
I'd like a cat feeder were the cat would have to activate motion sensor to release a few bits of kibble each time to slow down there eating.
Is this possible I have never seen anything like this?

1 reply

Hi.
I did an automatic trash can with arduino and ultrasonic senssor, it would be the same, when cat gets near senssor, motor willopen dispenssor and let fall few drops evertime

Hi, have you the wiring schematic also, could i get it. Thanks so much.

Does anyone have the "Timer.h" Code?

Can you use a stepper motor? And if so what changes in the cose?

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

6 replies

I would recommend using a DS3231 Arduino real time clock. This allows you to drop food at one or multiple precise times a day (ex: dispense at 8:00pm and 7:00am)

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

user

Is there a way to get the feeder to drop a variety of portion sizes? Say, anywhere from 1/4 cup to 1cup?

Make the segment the size of the smallest segment and make each portion a multiple of that size. Then, just have it dispense multiple times depending on how much you want.

If this doesn't work, ask yourself why you need such granular control over pet food portions. Then use a screw-type feed mechanism and a weighing scale...

I'd say change the thickness (height) of the wheel dividers so that a quarter segment is the largest portion size you wish to drop. If you wish some segments to drop smaller sizes, install filler panels so the quarter segment only accepts a smaller portion size.

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

Hi, thanks so much for sharing this project. I'm in the works to building this and making my own adjustments here shortly. I did have a question. In Step 5 when you're building the wheel, I'm having a hard time grasping how you attached the wheel element to the actual rotating servo gear. Did you have an X shaped servo arm and glue that the acrylic circular cut out, or did you do this another way?

Any help making this respond to email?

im sorry can u make it without using potentiometer ???

1 reply

im sorry can u make it without using potentiometer ???

Any advice how to interface this with twitter?