4 months ago

Dog Treat Dispenser: Raspberry Pi canine biscuit machine

With motion detection and video capture, is this the ultimate dog treat dispenser?

While pondering what to get Shirin, his fiancée, for her birthday, Eric Page realised how much she misses her dog Pickles while she’s at work. He decided to build a Dog Treat Machine to allow her to serve treats to Pickles remotely. “She uses it almost every day! Usually once a day when she is at her office. When she’s travelling, she probably sends him three or four treats every day. I think it helps her feel closer to home.”

There are four ways to trigger the Pi-powered device: email, MQTT, IFTTT, or Alexa. It then plays a sample of Shirin’s voice, dispenses some dog treats, and checks for motion using OpenCV analysis of the view from a Raspberry Pi Camera Module. If motion is detected, it captures a photo and video of Pickles, which are sent to Shirin in an email with a randomised cute comment. If no motion is detected, it sends an ‘I’m not home but will enjoy the treats later’ message, along with a couple of photos of Pickles playing outside.

Building a Dog Treat Dispenser

Dog Treat Machine

Eric says motion detection was an important addition. “I didn’t want to send my girlfriend a video of a floor full of treats. Even if Pickles was home, if he walked over to the treats more quickly or slowly than expected, the video would be blank for a period of time. So I built a motion detection system using really good code from Adrian at PyImageSearch. This ensures that the video always starts with Pickles entering the area, and Shirin can see him trotting up with excitement.”

Far from being a seasoned maker, Eric reveals “this was my first attempt at anything DIY in probably 25-plus years since junior high, so it took some trial and error.” After starting the project with an Arduino, he soon realised that it lacked the processing power and storage required for video and other complexities. “After I switched to the Pi, it took 30-45 days to get to a version that would reliably deliver treats via email. After that, I periodically tinkered with it for four to five months, adding additional delivery mechanisms and improving the reliability of the code, e.g. reconnecting everything if the WiFi went down.”

Dog Treat Dispenser Fast Facts

  • There are four ways to trigger the device
  • Dog Treat Machine can dispense treats of different sizes
  • Eric has added a ball launcher
  • He intends to extend it further
  • Dog Treat Machine challenges

Eric says the most difficult part of the project was getting the device to deliver a small number of treats (not zero or too many) by gravity from its plastic cylinder, when rotated by a stepper motor. “The design went through several iterations before I hit on the concept of a cylinder with a central storage area, with an adjustable opening to a smaller section that holds and dispenses one serving.”

Make a Dog Treat Dispenser

Following the success of the treat dispenser, Eric has extended the project by building a ball launcher using RFID-tagged balls, which he’s trained Pickles to retrieve and place in a receptacle equipped with an RFID reader. “Now Pickles can get his own treats by putting those balls in the receptacle. He loves it. Now, he even sits by the ball launcher making funny noises – his way of saying ‘Dad, launch a ball!’.”

>Step-01: Cutting the parts

Eric used a laser cutter at a local makerspace to create the plastic stand and cylinders. The inner cylinder is divided into two compartments; one for storage and one for dispensing.

Dog Treat Machine

>Step-02: Dispensing mechanism

To make sure the desired number of treats falls into the dispenser compartment, acrylic semicircles reduce the size of the opening. One of these is attached by Velcro and can be adjusted.

Dog Treat Machine

Step-03: Stepper motor

A stepper motor with driver board is used to rotate the cylinder, causing the treats to fall out of the opening, while allowing more treats to drop into the dispenser compartment.

Dog Treat Machine

Click here to win a Raspberry Pi 3 signed by its creator, Eben Upton!