Arduino Controlled Pet Feeder
This project allows pets to be fed at a constant rate that does not involve you lifting more than a finger. There is a ramp in the box that allows food to enter the wheel that is powered by a servo that distributes food to your pet.
Supplies
You will need:
-arduino uno
-servo
-9 volt battery
-wires
-computer
-plywood
-2 CD's
-glue/screws
-hot glue gun
Box
You will need to cut 4 pieces of wood to build the box.
-The bottom piece will be 8" by 7 3/4"
-The back piece will be 7 3/4" by 10 3/4"
-The two side pieces will be 10 3/4" by 9 1/16"
This box holds all of the devices that distribute food to your pets.
Ramp
Next you build the ramp.
- On the back ramp, the bases will be 5 3/4" and 3 5/16" by 2"
-The two side ramps will be 3 1/2" by 3 3/4"
-The back ramp will be balanced on three pieces of wood that are 3" by 5/8"
This ramp allows food to enter the wheel that distributes the food to your pet.
Base
You then cut the base for the dog food to exit to the size of your liking. This opening allows the food to exit the box into your pet's food bowl.
Attach
You then attach all of the pieces of wood together by either glue of screws. This creates the box that holds and distributes food to your pet.
Wheel
Next, you out out four 2" by 2 3/8" pieces of wood then attach them in a X like pattern on a CD. You then connect the remaining CD to the servo then glue the CD with the wood glued to it to the CD connected the the servo. Now you have the wheel that distributes the food.
Arduino
To attach the servo to the arduino you need to:
-connect the white servo where to 3
-connect the red servo wire to GND
-connect the black servo wire to 5V
You then attach the arduino to the battery. Doing this gives the arduino a power source making it able to turn the wheel, delivering food to your pet, once the code is uploaded.
Final Attachment
Connect the wheel to the back of the box using glue or screws. Then attach the battery and the arduino to the box but out of the way of the wheel. This allows the wheel to move freely making it easier for your pet to receive the food.
Code
This is the code for the arduino:
//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 //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
Copy and paste the code in the arduino program. Then connect your arduino to the computer and the wheel should begin moving. Have fun!