Pavlov's Electronic Treat Dispenser
I've wanted to make something for the dogs for awhile now. I've also wanted to try my hand with Arduino. Why not combine the two and see what happens. The result is a Pavlov esq treat dispenser that will randomly pick a number and if it matches will then sound a buzzer to get the dog's attention and dispense a tasty treat.
Parts used (some things changed during the assembly and are not in this picture, but will be noted).
- Arduino Nano
- 28BYJ-48 stepper motor (ULN2003 driver is pictured but not used)
- Easy Board driver (not pictured)
- Piezo buzzer
- Mason jar
- 3D printed spinner (updated version used in project)
- 3D printed jar mount (updated version used in project)
- Wooden box
- 5vdc 2amp power supply
- connector for the power supply
- DuPont connectors
The 3D files are on Thingiverse
Step 1: Internal Part Assembly
1. Attach the stepper motor to the motor mount. I used 5 minute epoxy to attach the stepper motor. The brackets are in the wrong position in this version the STL file has been updated and should be in the right position for the 28BYJ-48 motor.
2. I super glued a washer to the bottom of the spinner to provide a gap between the motor mount and the spinner.
3. Before the spinner is epoxyed to the stepper motor shaft, I placed some parchment paper around the motor shaft so the epoxy wouldn't glue the motor in place. Once the epoxy cured you can remove the parchment paper.
4. I cut some scrape wood to act as a spacer between the motor mount and the jar attachment part. The filament I used was a Wood PLA filament. Of the several test parts I printed there was some shrinkage, so the spinner and jar attachment parts had to be trimmed and sanded so they would fit together but not rub against each other. The 28BYJ-48 stepper motor would stall if the friction is to much.
5. Once the epoxy had cured I inserted the 3D printed parts inside the wooden box and traced around the "spout" that the treats would dispense from. Then I drilled a hole and used a rotary tool to widen and smooth the opening.
I had originally made a smaller box, but as I began to assemble everything it was evident that the box was to small. The new box dimensions are 4.25"H x 4.25"W x 4.25"D. Its just a simple box made with 45 degree miters. You could make this using butt joints, just be sure to make one side wider so the box is square. The wood is .5" thick.
Step 2: Electronics
Since this was a prototype I made all connections using DuPont wires. Once everything was verified to work, I used hot glue to secure the connections. On version 2, I'll solder wires to each connection.
1. Connect the + wire of the piezo buzzer to pin 7 and the NEGATIVE wire to the ground on the NANO.
2. Connect pin 16 and 17 of the NANO to the STEP pins on the EASY Driver and the ground pin on the EASY Driver to a ground pin on the NANO.
3. Connect the 28BYJ-48 pins to the A (orange and pink) & B (blue and yellow) motor pins on the EASY Driver. The 28BYJ-48 motor is a Unipolor motor, but if you don't connect the red wire it "becomes" a bipolar motor. That's why the EASY Driver is used and not the ULN2003 driver. During testing the ULN2003 driver didn't provide enough torque to spin, the EASY Driver works well but there are still times when the treats get stuck and stop the spinner from moving.
4. The EASY driver is capable of providing 5v output to the NANO, but during testing there was to much of a drop in power to keep everything running. So the + leg of the 5v was split off to the NANO and the EASY driver, with the ground going to the EASY driver. Remember the EASY Driver is grounded to the NANO.
Step 3: Arduino Programming
This was my first attempt at programming an Arduino. So there might be room for improving this code, but it works. Open the PET_Dispenser.ino file in Arduino IDE.
This is how the programming works.
1. A number is randomly picked from 0-50
2. Then it will wait 15 minutes (900000ms).
3. If that number matches a number you picked, default is 10
3a. Then the piezo buzzer sounds (200hz for 750ms) to get your pets attention.
3b. The spinner will rotate about 1/3 of a turn, dumping the treats down to the spout and out the front.
4. The process (loop) will start again.
Step 4: Final Assembly
I taped off the top, bottom, and the treat dispenser opening and sprayed the wood enclosure with two coats of Shellac, sanding in-between coats.
I thought the final assembly was a bit boring so I printed off a couple bones, paw prints and a dog silhouette for the back. All of these files are also available on Thingiverse.
Participated in the