Zen’s Treat Box

Zen is a rescue, and as best anyone knew when I got her, she was picked up as a stray and it’s likely she was born and spent her early months on her own.

As such, it doesn’t seem like she really knows how to play super well. She loves other dogs, and people, but is so gentle and submissive she just gives the ball/rope/toy/etc to the person or dog tugging on it. And she doesn’t even like to fetch!

So I designed and built this wooden “treat machine”:

The box is simple, the “bowl” on top is where Zen will drop a tennis ball, many of which are scattered around the house. When a ball is dropped in, the box drops a treat for Zen!

Inside the box is also pretty simple:

On the lid is a PVC elbow attached to the bowl on the top of the box, on the other end of the elbow is a 3d printed tube holding a microswitch, which is what “detects” the ball being deposited into the box:

Opposite of that is the treat “carousel” and electronics:

The hardware is also really simple, it’s just a cheap ESP32 board, mounted on a breakout panel, and the treat carousel is turned by a 28BYJ-48 stepper motor.

Treats are loaded into the carousel, which has 18 holes, and a small stepper motor underneath spins 1 treat slot each time:

Here’s a video of the carousel moving, and well really a quick view of the whole internals:

The hardest part of the whole thing was getting Zen trained to return the balls to the box.

First was the problem that she just isn’t very interested in the tennis balls to begin with, which I expected. She’s not big into fetch or playing, so getting her interested was the biggest challenge. We started by simply doing a treat routine with the tennis balls, I show interest in the ball, place it near Zen, and treat as soon as she shows any interest in it.

Once that initial interest was shown, she quickly picked up that “ball” equals “treat”. She quickly got the hang of it, within a few days we were getting balls back to the box and bowl, but it was still a little confusing:

A few more days of training and rewards and she really has gotten the hang of it!

She’s such a smart dog, she’s even realized that if a treat gets stuck or the box runs out, she can get my attention to figure out what’s wrong and give her the treat. This has also slightly backfired in that she has also realized I will “test” the box and make it drop a treat out, which she grabs before I can stop her lol.

As a fun aside, she has also seemed to make her own rule, if the tennis ball starts out in the room the box is in, the ball has to leave the room first. She does this almost every single time!