A couple of years ago, my parents bought me a Google AIY Voice Kit as a birthday present, and I never used it. This year, though, since proper COVID safety precautions would be so important during Halloween, I saw these socially distant candy slides pop up on the internet: https://blog.adafruit.com/2020/10/25/make-a-candy-slide-for-trick-or-treaters/ And I realized I could make good use of the AIY kit if I made a voice-activated, socially-distant candy dispenser. The benefits of this project:
- Promotes social distancing
- Will not spread COVID-19
- Encourages proper Halloween etiquette (you need to say "Trick or Treat" properly)
- Brings joy to neighborhood children
- Helps me learn about Raspberry Pi and Google Cloud services
- Fun
Since I got the AIY Voice Kit a couple of years ago, the version I have is V1. The most recent version of the AIY Voice Kit is V2. This may change the GPIO pin used to activate the relay, and you don't have to do any soldering to connect to the GPIO pin in the new version, as I had to.
I started by following the tutorials to set up the Google AIY Voice Kit. You can find instructions and purchasing information here. https://aiyprojects.withgoogle.com/voice/
Once the Voice Kit was up and running, and I could successfully run the Google Assistant app and do a basic voice recognition program, I wanted to modify it so recognizing the phrase "Trick or Treat" would activate a motor. My first attempt was a stepper motor, but the stepper motor I had was too weak to drive my candy dispenser and it would clog often. I had a geared DC motor that was given to me by a friend; I can't find the same DC motor online, but the one I have is not too different from the geared motor suggested in the components list. My motor is very slow and powerful, running at 8-10RPM. I connected this motor to a relay, which is triggered by one of the Raspberry Pi's GPIO pins.Accessing the GPIO pins on the Google Voice Kit V1 is quite an operation. The Raspberry Pi is covered with a shield called the Voice Hat (the new version is called the Voice Bonnet), and the Voice hat breaks out some of the GPIO pins and labels them as "Servo" outputs. I soldered headers to these Servo outputs along with a GND wire, and attached 10-foot-long wires to the headers. The Voice Kit sits at the end of the candy slide, and it trips the relay to drive the motor which sits at the top of the candy slide.
I opened the box, soldered stuff on, and closed the box again so many times that it's more tape than box now. The only pins I ended up needing were Servo0 (GPIO26) and GND. On the new Voice Bonnet, the GPIO pins are labeled PINA through PIND and they even have their own Python API, so that's a little easier to deal with.
I wrote a little code to have the kit recognize the phrase "Trick or Treat" and then switch the relay on to drive the motor for a few seconds, and it worked beautifully.
Next, I had to design a dispenser and decide on candy to dispense. I was inspired by this video describing how a gumball machine works, and decided to model mine after a gumball machine.
I decided this project was going to work a lot better if I had regular-shaped candies to dispense, instead of the odd assortment of Skittles and Starbursts I usually give out. So I ordered a huge box of Squishimals in 2-inch capsules from a vending machine supply company. These almost-spherical things would be less likely to clog my machine! https://www.candymachines.com/Squishimals-Vending-Capsules-P6915.aspx I 3D printed a mount for the end of my motor, and a dispenser wheel like the one shown in the gumball machine. To put the whole thing together, I bought cheap Halloween buckets from Walmart and cut similar holes in both. I put the motor axle through the bottom bucket, attached the motor mount and dispenser wheel, put in a couple of BBQ skewers to support the top bucket, and then placed the top bucket on that. This is what it looks like.
The candy dispenser was absolutely the hardest part of the whole project, and the dispenser I made works most of the time, but does need monitoring because it still clogs.
Here's what it looks like up close when it's working.
I mounted a 3-inch toilet flange to a piece of plywood for the dispenser to sit over, and then bought some sections of 3-inch PVC pipe to assemble the slide. "Street" type elbows were useful to get the slide to descend at the proper angle. The plywood is zip-tied to a standing desk, which will be on my porch on Halloween.
For fun, I added a library of dad jokes to the Voice Kit. If you say "trick or treat", the dispenser sends a candy down the slide. If you say "tell me a joke", the Voice Kit tells you a stupid Halloween joke.
And, because nothing is complete without some NeoPixels, I made a quick Arduino program to cycle a NeoPixel strip between orange/purple and rainbow colors, and attached the lights to the slide. They are not driven by the Voice Kit, just a separate Arduino.
Here's a video of the whole thing working!
After adding some decorations, I'm really pleased with how it came out and can't wait for the trick-or-treaters to enjoy it.
Thanks for reading! Have a safe and happy Halloween!
Comments