Electronics Btrieve Motorcycling Software If you find this site useful and want to support, click on few ads to throw some money into hat.

Battery powered automatic pet feeder with programmable schedule


I built this automatic cat feeder for our two cats to keep them fed while we are away for few days. Depending on what materials you have at hand, this DIY version may work out quite cheap, but you can also easily spend more than on store-bought machine. The big thing for me was that I wanted to to be battery powered because we dont have electrical outlet available at suitable location. This is what I ended up with feature wise:

  • completely stand-alone unit, configurable from control panel and battery powered
  • battery voltage can be checked from control panel
  • up to 10 feedings per day, amount of feed separately settable for each feeding
  • emits short beeps when batteries need replacing
  • plays a ringtone (in very common RTTTL format) before starting a motor to avoid spooking

Mechanical parts

The feeding mechanism is auger based. I used auger screw model from Thingiverse Cat Feeder project by kitlaan. I downloaded a printed out auger_screwplate.stl, auger_tubemount.stl, and auger_servoshim.stl. My 3D printer setup produces a bit elephant footed output, so the two halves of the auger came out a bit squished and afer gluing together the spiral was not quite round, this was easy to tweak with a file later. The thingiverse project is assuming that you are using store-bought PVC tubing for building the rest of it, but the tubing we have here in Estonia does not quite work so I opted for printing the external body of the auger as well. And while at it, I also printed the faceplate for control board. I only had white filament at the time, so I smoothed the printed component with abrasive paper a bit, and then spray-painted it black.


I made the outside tube tight fit for the tube mount piece, and after a little bit of tweaking it is a good friction fit. It has mount flange with screw holes, so mounting it to enclosure is very easy.

For a motor I used a cheap china-made Towardpro MG996R servo that I modified for continuous rotation. See my servo motor use and modification instruction or just get a continuous drive servo.


I made the enclosure mostly out of 15mm baltic birch plywood pieces that I already had, and one piece of 6mm plywood because I did not have enough. For the lid I used a scrap piece of prelaminated white pine board. For hiding the plywood edges I cut the enclosure piece edges at 45 degrees, and I made the entire enclosure so that the bowl that we use for our cats fits exactly between the legs and stays put there. Here is the inside view of most of it with one side removed:

There is a compartement for dry food with a hole in a bottom, and the auger tube monts directly under it. As I want the food to drop roughly in a center, there is an angled piece of wood to guide the food pellets backwards, and the same piece also prevents easy access to auger opening. On the back there is a rectangular hole, control board goes there after being attached to faceplate, and faceplate is simply attached to case with screws. The upper part of electronics compartment is for the battery holder. The battery holder needs to have wires long enough so that it can be taken out for replacing the batteries. The lid covers both the electronics and food compartments, and should be a good fit to prevent your pets from getting to the food.

In actuality I used the above model as reference and adjusted as dictated by available pieces of material. I also added tilted floor pieces to food compartment, so that more food would actually be usable. The entire inner part is one piece that can be easily removed, and is held in place with two small screws through small pieces of wood under it. The rest of the enclosure is glued and pin-nailed together. Here it is with an interested customer:


The control board is based on Atmega168 although at the current code size ATmega88 would also work, and obviously you can use Atmega328. The user interface consist of 3 digit 7-segment LED display and 3 buttons. DS1302 is used as a real time clock with its own backup battery. (click on diagram for full size view)

Being battery powered, the idle current consumption has to be kept to minimum. The servo is powered directly from battery, but Q1 is used to disconnect it from ground while idle, as the servo's control circuit would consume significant power even if the motor is not running. D2 protects the controller I/O pin from direct battery voltage coming through servo, and also prevents the I/O pin acting as ground connection for servo. As the diode only allows the microcontroller to drive the control signal high, R4 is needed as pulldown resistor for pulling it low when not driven. The microcontroller itself is powered by low power, low dropout linear 5V regulator LP2950. If powered by 4 NiMH cells the controller would probably survive the supply voltage without it but the added cost is insignificant. The C3 is mostly for helping batteries to cope with high current peaks caused by servo motor. SG1 is a small piezo speaker for rudimentary sound output.R5,R6 are a voltage divider for measuring battery voltage for showing on display and low battery detection.

In the first revision I did not have auger movement sensor input, and the food delivery was just based on counting servo pulses. Depending on size of food pellets this made food delivery erratic, even though the software moved auger back and forth to dislodge stuck pellets. In the second hardware revision I added sensor input. The IC4 is single inverting schmitt trigger, unfortunately these only come in tiny surface mount packages but can be soldered directly on breadboard pads with 4 pins that are needed here. The resistors and capacitor are arranged for noise suppression, but this makes singal raise and fall slow and potentially fluctuating on contact bounce, so schmitt trigger is a good thing here. The entire sensor input circuit is powered from PB7, and the actual input read from PB6. This is a bit of an overkill because the current consumption of that part of circuit should be in 50 microamp range.

The buttons and display are mounted on bottom side of the board, so that tall buttons and display itself can protrude through the faceplate when the board is mounted to it. When building on prototyping board you'll want to position and secure these first, then drill mounting holes to board so that these align with faceplate mounts, and only then position and solder the rest of the components.

This is how my first revision looked from 'solder side' of the board. After taking these pictures I painted the LED display red with permanent marker to make it less of an eyesore on black case and faceplate. I usually try to place components so that I can use the component leads for connecting things together as much as possible, and then wire the missing connections with wire-wrap wire. Two thicker yellow wires are servo power connections.

The height of components on the component side is not critical, you just have to make sure that the thickness of back wall plus depth of electronics compartement in enclosure is deep enough.


The user interface is an experiment for minimalism. There are up and down buttons, and an OK button. There is no back/escape button, instead of that all data entry has a 10 second timeout after which the UI takes a step backward in menu structure.

Normally the control board is in power-save mode with display off. To turn it 'on' you need to press any of the buttons. The main menu has:

  1. BAT - shows battery voltage in 10mV units (510 is 5.1V)
  2. CLK - for setting date and time
  3. SCH - for configuring feeding schedule
  4. TST - test feeding
  5. CAL - calibrate battery voltage reading

In date and time menu, you get

  1. HRS set hours (00-23)
  2. MIN set minutes (00-59)
  3. DAY set day (01-31)
  4. MON set month (01-12)
  5. YEA set year (00-99)

Setting minutes or hours resets seconds to 0, all other unchanged values are set to what they were. This may make setting the exact time value a bit tricky, but pets wont mind if the time is a minute off either way.

In the feeding scehdule menu you have 10 'feeding slots', from 'F 1' to 'F10', and for each you can set time of day (hours, minutes) and number of 'servings' to deliver. Serving is basically an amount of time the motor will be run, and is defined as SERVINGSIZE in code. It is a count of 20 ms servo ticks to run the motor.

Once you have built the feeder, you will need to measure how much each serving weights on average, and calculate the amount to deliver depending on your pet and type of food. This is what the TST item is for - it delivers 10 servings of food. You'll need to do it couple of times, weigh the total delivered food and divide it with number of servings to get an average serving size.

To avoid the need for precision components, battery voltage reading needs to be calibrated to adjust for resistor value variation. Use the BAT menu entry to get a reading of battery voltage, then measure the actual battery voltage. If the displayed value is too much different from actual value, go to CAL entry in menu. Read the current value, then calculate new_value=(calibration_constant*actual_voltage)/displayed_voltage, and adjust the calibration value. For example, lets say your actual battery voltage is 5.01 V, but 4.86 V is shown on display and calibration constant is 770. You need to change the calibration constant to (770*501)/486=793.


The code for the microcontroller is available in my pet_feeder repository at github. For building you need a working make, avr-g++, and avrdude. I have only built on OSX but the makefile should work without problems on Linux too. Pre-built .hex and .eep files are included in case you do not want, or are unable to build.

For building, just type make, and you should get hex and eep files. make flash will try to write the code to microcontroller using avrdude with usbtiny compatible programmer. make clean will clean the clutter from directory, and make erase will try to erase microcontroller's flash memory.

Copyright © Madis Kaal 2000-