Automatic Candy Dispenser
Thousands of people each Halloween leave out bowls of candy with a "Take one only" sign only to have children grab palms of candy and steal their sign as well. We wanted to limit how much candy one person could get while also having a more fun and interactive way of obtaining said candy compared to pressing a button or grabbing it out of a bowl.
We came up with an idea that could dispense one piece of candy at a time, while also preventing people from coming back and taking more. It starts as soon as someone steps within range. Regardless of costume or design, our distance sensor detects when someone is nearby and activates our dispensing mechanism when someone moves their hand or other object in-front of the machine. Grabbing from a funnel that can hold an estimated 200+ pieces of candy, a TPU wheel rotates from an MG995 servo through a VEX shaft and drops one piece down a hole into the mouth of the dispenser, letting the trick-or-treater grab it.
After the candy is dispensed, the machine goes on a 5 second cooldown timer until it can run again. Additionally, if the distance sensor detects that someone is still standing nearby after a candy has already been dispensed, it will prevent another trigger of the mechanism until the person leaves. This decreases the amount of candy a possible thief could take if not prevent it outright while letting you rest on Halloween night.
Supplies
List of all components:
- ¼”-20 thread size, 4” long screws (x4)
- HC-SR04 distance sensor (x1)
- PLA filament orange (x1)
- PLA filament black (x1)
- Classic Arduino Nano with USB-C Port (x1)
- USB-C Cable (x1)
- MG995 servo (x1)
- Soldering Kit (x1)
- 7.4V Litho Battery (x1)
- 8-32 thread size, 0.25” installed length heat-set (x8)
- 20” x 5” black fabric (x1)
- On Off Rocker Switch (x1)
- Jumper wires (Female-Male)
- ¼”-20 x 6mm length x 8.0 mm heat-set (x4)
- VEX Axle (x1)
- Buck converter (x1)
Tools:
- Allen Keys
- Soldering Kit
Software Used:
- Fusion360
- BambuLab Studio
- Arduino IDE
Downloads
Print Out All the Necessary Parts
- Print out TopMouth, BottomMouth, TopLid, and ElectronicsBay in orange PLA filament.
- Print EyeSideA&B in black PLA filament
- Print Wheel in TPU
- Print ServoMount, Adaptor, BackSpinning, and AdaptorPT2 in any PLA filament
Attached below are the necessary STL files.
Gather All Non-Print Parts
List of all components:
- ¼”-20 thread size, 4” long screws (x4)
- HC-SR04 distance sensor (x1)
- Classic Arduino Nano with USB-C Port (x1)
- USB-C Cable (x1)
- MG995 servo (x1)
- Soldering Kit (x1)
- 7.4V Litho Battery (x1)
- 8-32 thread size, 0.25” installed length heat-set (x8)
- 20” x 5” black fabric (x1)
- On Off Rocker Switch (x1)
- Jumper wires (Female-Male)
- ¼”-20 x 6mm length x 8.0 mm heat-set (x4)
- VEX Axle (x1)
- Buck converter (x1)
Construct and Wire the Top Mouth
- Put heat-set inserts into their designated holes towards the back of the part.
- Put heat-set inserts into the holes on the funnel.
- Insert both eyes into their slots.
- Wire all the electrical components (servo, distance sensor, battery, switch, micro-controller, etc.)
- Slot the distance sensor into its mount at the front of the part.
- Attach the servo to the servo mount.
- Screw the servo mount into the part using two screws and nuts.
- Screw lock the adaptor together and then fit it onto the servo.
- Push the vex shaft through the backspin attachment and add on the wheel with shaft collars if necessary
- Slot the vex shaft into the adaptor and then place the funnel around the backspin attachment, rotating may be necessary.
- Screw in the funnel through the attachment as well.
Upload Code
Download the code from supplies.
- Open the code with Arduino IDE
- Change the Processor to ATmega328P (Old Bootloader) by going to Tools > Processor > ATmega328P (Old Bootloader)
- Connect the Arduino board to your computer via USB-C (Make sure the battery is switched off whenever plugging your computer into the Arduino)
- Upload the code to Arduino
Attach Additional Parts
Screw in the bottom mouth first, then followed with the electronics bay and finally the top lid if all systems are functional.
Set It Outside
Switch it on and let it sit for Halloween night.