Jump to main content

Build an Automatic Dog (or Cat) Treat Dispenser

Abstract

Does your dog get bored when you are not home? Do you ever toss them a few treats right before you head out the door? What if you could keep them busy by automatically dispensing treats throughout the day? What about training them to sit in a certain place or even press a button by automatically rewarding them with treats? In this project you will build your own automatic dog (or cat, or other pet) treat dispenser that you can customize to react to different sensors. 

Summary

Areas of Science
Difficulty
 
Time Required
Short (2-5 days)
Prerequisites

Previous experience with Arduino is required to do this project. See our How to Use an Arduino tutorial page if you are new to Arduino.

Material Availability

A kit is available from our partner Home Science Tools. See the Materials section for details.

Cost
Average ($50 - $100)
Safety

The dispenser design in this project is not pet-proof. Do not leave it on the floor unsupervised where your pet might chew through the materials to get to the treats inside. 

Credits
Ben Finio, PhD, Science Buddies

Note: If you have never used an Arduino before, please do at least the first six tutorials on our How to Use an Arduino page before attempting this project.

Objective

Build and customize an automatic treat dispenser for a dog or other pet.

Introduction

Does your dog get bored during the day while you are at school? Do you ever have to feed your dog dinner late because you had an afterschool sports practice or club and got home late? Do you wish there was a way to automatically feed your dog (or other pet) when you were not home? If you search online you can find a variety of automatic treat dispensers. Some of them work on basic timers and others connect to a smartphone so you can control them remotely. Some even react to a button press or an electronic sensor that can detect when a pet is nearby. 

In this project you will build an automatic treat dispenser like the one in Figure 1. The dispenser has a mechanical hopper, or rotating set of compartments made from popsicle sticks. A servo motor rotates the hopper so that one compartment at at time moves over a hole, allowing treats to slide down a ramp. The servo motor's motion is controlled by an Arduino. You can use a real-time clock (RTC) with an Arduino to keep track of the time and dispense treats at certain times of day. You can also use sensors like a passive infrared (PIR) sensor, which detects motion using body heat, or an ultrasonic distance sensor, which measures distance using ultrasonic sound waves. You can find tutorials for real-time clocks and many different types of sensors on our How to Use an Arduino page. Exactly how you customize your treat dispenser is up to you!

automatic dog treat dispenserImage Credit: Ben Finio
Figure 1. Automatic dog treat dispenser. 

Terms and Concepts

Questions

Bibliography

Materials and Equipment Buy Kit

Recommended Project Supplies

Get the right supplies — selected and tested to work with this project.

View Kit

This is an engineering design project, so your materials list may vary depending on what features you want to include with your dispenser. Parts may be available in different quantities and prices from different vendors.

Experimental Procedure

Note: This engineering project is best described by the engineering design process, as opposed to the scientific method. You might want to ask your teacher whether it's acceptable to follow the engineering design process for your project before you begin. You can learn more about the engineering design process in the Science Buddies Engineering Design Process Guide.

  1. Build your dispenser. Figures 2 through 4 show several different views of the device. You can choose to make your dispenser using craft supplies or 3D-printed parts if you have access to a 3D printer. Your assembly procedure may vary depending on the materials you use. Please note that this dispenser is meant for demonstration purposes or to be placed on a counter or shelf where your pet cannot reach it. Even if you add a lid to the dispenser, many pets may chew through it to get to the treats. You would need to build a much sturdier dispenser using stronger materials (like hard plastic) if you want to leave your dispenser on the floor. 
    1. Cut a hole in a piece of cardboard so the top of the servo motor fits through.
    2. Glue the servo to the bottom of the cardboard, so the top sticks through the hole.
    3. Build legs to support the four corners of the cardboard.
    4. Place a circular wall on top of the cardboard, centered around the servo. A cardboard tube from the inside of a roll of duct or masking tape works well.
    5. Make dispenser compartments by gluing popsicle sticks together. Use a protractor if you want to measure exact angles. You will need to decide how many compartments you want, which in turn will determine how far the servo should rotate.
    6. Attach the servo horn to the motor (do not use a screw, just push it on) and carefully glue the popsicle sticks to the servo horn. Be careful not to use too much glue, you may need to pull the servo horn off later to make adjustments. 
    7. Cut a pie-shaped wedge in the cardboard, the same size and shape as one of the dispenser slots. 
    8. Build a ramp under the hole so the treats will slide down into a tray (omit the tray if you want the treats to fall off a counter or shelf onto the floor).
A rectangular stand with four legs and a pie-wedge shaped pill dispenser on topImage Credit: Ben Finio
Figure 2. Top view of the mechanism. 
 
Square piece of cardboard with four cylindrical legs and a servo motor glued to the center of the cardboardImage Credit: Ben Finio
Figure 3. Bottom view showing the servo glued to the underside of the cardboard.
 
Top view of the pill dispenser platform with the pie-wedge-shaped dispensing mechanism removed from the servoImage Credit: Ben Finio
Figure 4. Top view with the servo horn removed.
  1. Assemble the circuit as shown in Figures 5 and 6. You will need to know how to use a breadboard. Make sure your Arduino is not plugged into USB power as you build the circuit. That will give you a chance to double-check all of your wiring before powering the Arduino on. Note that this diagram assumes you are using an Arduino UNO R4 with a built-in real-time clock. If you are using an external RTC, you will either need a bigger breadboard, or you will have to remove some components (like the buzzer) from the breadboard to make room for the RTC. See our external RTC tutorial for instructions on wiring an external RTC. You will need to modify the circuit if you are using other sensors.
    1. LCD connections. Note that pin labels may vary depending on where you bought your board. Pin numbers go from left to right when viewing the screen horizontally, but from bottom to top in Figure 6 since the screen is rotated.
      1. Pin 1 (VSS or GND) to GND
      2. Pin 2 (VDD or VCC) to 5V
      3. Pin 3 (V0) to potentiometer center pin
      4. Pin 4 (RS) to Arduino pin 12
      5. Pin 5 (RW) to GND
      6. Pin 6 (E) to Arduino pin 11
      7. Pin 7 (D0) - not used
      8. Pin 8 (D1) - not used
      9. Pin 9 (D2) - not used
      10. Pin 10 (D3) - not used
      11. Pin 11 (D4) to Arduino pin 5
      12. Pin 12 (D5) to Arduino pin 4
      13. Pin 13 (D6) to Arduino pin 3
      14. Pin 14 (D7) to Arduino pin 2
      15. Pin 15 (LED or A) to current limiting resistor to 5V
      16. Pin 16 (LED or K) to GND
    2. Potentiometer
      1. One outer pin to 5V
      2. Center pin to pin 3 (V0) on LCD screen
      3. Other outer pin to GND
    3.  LED
      1. Positive (longer) leg to Arduino pin 7
      2. Negative (shorter) leg to current limiting resistor to GND
    4. Buzzer (optional)
      1. Positive pin to Arduino pin 8
      2. Negative pin to GND
    5. Pushbutton (optional)
      1. One side to 5V
      2. Other side to GND through 10 kΩ pull-down resistor and to Arduino pin 9
Breadboard diagram for automatic pill dispenserImage Credit: Ben Finio
Figure 6. Breadboard diagram. Click here to view the circuit in Tinkercad where you can zoom. Note that the Tinkercad circuit does not contain code so nothing will happen if you run the simulation. 
 
Circuit schematic for automatic pill dispenser circuitImage Credit: Ben Finio
Figure 7. Circuit schematic.
  1. Download the treat dispenser example code. Read through the commented code so you understand how it works.
    1. This code is written for the internal RTC on an Arduino UNO R4 Minima. If you are using an external RTC module, you will need to modify the code. We have example code for an external RTC here.
    2. This code is written for a dispenser with four compartments. It automatically rotates the servo 45° once every 15 seconds. This works well for testing the device, but you will need to change the code to make it dispense treats at different times of day.
    3. You will need to change the code if you want to activate the motor based on another sensor instead of (or in addition to) the RTC.  
  2. Upload the code to your Arduino and test it. Watch the motion of the dispenser. You may need to pop off the servo horn (this is why we said not to attach it with a screw earlier) and adjust it so the compartments align with the hole in the cardboard. 
  3. If your device does not work as expected (the servo does not rotate, the LCD screen does not display correctly, etc.) you will need to troubleshoot or debug your circuit. This is a complicated circuit with a lot of parts. It is easy to misplace a wire on the breadboard, which can prevent one or more parts of the circuit from working properly. You will need to carefully double and triple-check all of your connections. It also helps to have someone else double-check your wiring, just like you might ask someone else to proofread your writing. Sometimes it can be hard to spot your own mistakes. If you get stuck or frustrated, take a break from working on your circuit and come back to it later. You might notice something that you did not notice before. 
  4. Load some treats into your dispenser compartments and test it again. Make sure there are no issues with your ramp or tray, such as the treats getting stuck or sliding down too fast and bouncing out of the tray. Make adjustments to your ramp and tray if needed. 
  5. Once you have the device working with the example code, it is time to customize your code. The example code dispenses treats once every 15 seconds, which works well when testing or for a demonstration at a science fair. There are many things you can change and customize in the code:
    1. How often it dispenses treats. The example code does this once every 15 seconds, but for real-life use you will need to set different times of day. You can do this by adjusting the condition(s) in the if statement that detects the time.
    2. How far the servo rotates. The example code rotates the servo 45° at a time, which works for four compartments. You will need to change the angleIncrement variable if you have a different number of compartments.
    3. The messages displayed on the LCD screen (useful for debugging or to display the time for a human, assuming your pet cannot read!).
    4. Whether you use the flashLED alarm function to alert your pet that a treat has been dispensed using a buzzer and/or LED.
  6. Once you have completed testing your device and customizing the code, try some real-world testing if possible.
    1. Remember to put your dispenser up high on a counter or shelf where your pet cannot reach it, so it will drop the treats onto the floor.
    2. If you have any sort of motion-activated camera (home security camera, pet cam, trail cam, etc.), set it up with a good view of your treat dispenser before you leave for the day.
    3. Review the footage when you get home. Did your treat dispenser work as intended? Did it help give your dog something to do during the day? Does your dog learn to expect the treats (for example, do they start sitting near the dispenser waiting for the next one)?
    4. Based on your testing, what changes could you make to your treat dispenser to improve it?
icon scientific method

Ask an Expert

Do you have specific questions about your science project? Our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

Variations

  • Build a dispenser with a larger hopper so you can automatically dispense entire meals instead of just a few treats. Now you can feed your dog in the morning without getting out of bed!
  • Look up a Bluetooth tutorial for Arduino. Can you build a treat dispenser that you can control with your phone?
  • Build a sturdier treat dispenser that you can safely leave on the floor with your dog. Note that some pets might still try to chew through hard materials to get to the food, so get help from an adult for this variation of the project.

Careers

If you like this project, you might enjoy exploring these related careers:

Career Profile
Have you watched "The Transformers" cartoon series or seen the "Transformers" movies? Both shows are about how good and evil robots fight each other and the humans who get in the middle. Many TV shows and movies show robots and humans interacting with each other. While this is, at present, fantasy, in real life robots play a helpful role. Robots do jobs that can be dangerous for humans. For example, some robots defuse landmines in war-stricken countries; others work in harsh environments like… Read more
Career Profile
Just as a potter forms clay, or a steel worker molds molten steel, electrical and electronics engineers gather and shape electricity and use it to make products that transmit power or transmit information. Electrical and electronics engineers may specialize in one of the millions of products that make or use electricity, like cell phones, electric motors, microwaves, medical instruments, airline navigation system, or handheld games. Read more
Career Profile
Have you always loved art? Do you have a good eye for beauty, balance, and form? How would you like to see your designs show up in toy stores? Or in a sporting goods store? Or at a car dealer? Commercial and industrial designers create the shape and form of every type of manufactured good that you can think of—from toys, sporting goods, and medical equipment to high technology products, furniture, toothbrushes, and toasters. They design the form of new products that are as beautiful and… Read more

Contact Us

If you have purchased a kit for this project from Science Buddies, we are pleased to answer your questions.

In your email, please follow these instructions:
  1. What is your Science Buddies kit order number?
  2. Please describe how you need help as thoroughly as possible:

    Examples

    Good Question I'm trying to do Experimental Procedure step #5, "Scrape the insulation from the wire. . ." How do I know when I've scraped enough?
    Good Question I'm at Experimental Procedure step #7, "Move the magnet back and forth . . ." and the LED is not lighting up.
    Bad Question I don't understand the instructions. Help!
    Good Question I am purchasing my materials. Can I substitute a 1N34 diode for the 1N25 diode called for in the material list?
    Bad Question Can I use a different part?

Contact Us

News Feed on This Topic

 
, ,

Cite This Page

General citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.

MLA Style

Finio, Ben. "Build an Automatic Dog (or Cat) Treat Dispenser." Science Buddies, 18 Apr. 2024, https://www.sciencebuddies.org/science-fair-projects/project-ideas/Elec_p106/electricity-electronics/automatic-dog-treat-dispenser. Accessed 2 May 2024.

APA Style

Finio, B. (2024, April 18). Build an Automatic Dog (or Cat) Treat Dispenser. Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/Elec_p106/electricity-electronics/automatic-dog-treat-dispenser


Last edit date: 2024-04-18
Top
We use cookies and those of third party providers to deliver the best possible web experience and to compile statistics.
By continuing and using the site, including the landing page, you agree to our Privacy Policy and Terms of Use.
OK, got it
Free science fair projects.