DIY Halloween Candy Dispenser

by nataliewang in Circuits > Raspberry Pi

105 Views, 0 Favorites, 0 Comments

DIY Halloween Candy Dispenser

0.jpg

We aimed make trick-or-treating more appealing to children.

Supplies

Materials

  1. 15" x 15" foam board (4)
  2. Raspberry Pi (1) + USB-C cable
  3. 3D printer filament
  4. Paint (Oil and Watercolor) *
  5. VEX 393 motor (4) + 12V battery
  6. VEX 15x30 base plate (6)
  7. VEX 2x2x20 U-channels (4)
  8. 17.5cm metal rod (4)
  9. 4mm screws
  10. Keps nuts
  11. Hot glue sticks
  12. Capsules
  13. Assorted candy
  14. Tape
  15. Breadboard
  16. FTM, MTM, FTF, MTF wires
  17. Keyboard
  18. Computer

* optional

Tools

  1. Ruler
  2. Clamps
  3. Scissors
  4. Box cutter
  5. Safety goggles
  6. Pliers
  7. Philips screwdriver
  8. Drill
  9. Hot glue gun
  10. 3D printer


Applications

  1. Tinkercad
  2. Python

Making the Main Structure

Collecting Platform.png
IMG_1311.jpeg
IMG_1312.jpeg

Enclosure:

Gather four 15x30 VEX metal base plates and four 2x2x25 metal angle pieces. Screw two angle pieces into one baseplate and the other two onto another baseplate. Attach a motor to each angle piece with a bearing. Screw those in and align them so that the angle pieces touch each other and the metal base plates are vertically upright. Connect the base plates using a long screw between the two angle pieces. Lay the enclosure on its side and attach the last two base plates to each side of the enclosure. The final dimensions should be 30x30x48.


Ramp and Collecting Platform:

Connect two 15x30 Vex metal base plates together to form the ramp. Position the ramp so one end is on the bottom of the enclosure. Adjust the other end so that the capsules can easily roll down and not get stuck. Attach the ramp to the sides of the enclosure with screws. Using foam, create a platform for the dispensed capsules to collect on the bottom. Ensure that it is stable then hot glue the platform at the bottom of the ramp. The dimensions of the collecting platform are on the image (not drawn to scale).

Electronics

IMG_2140.jpeg

Attaching the Motors

Attach the VEX motors in the middle of the extensions, 7 away from the sides. Attach the rods and cross so that they fit through the dispensers. Connect the motors to the H-bridges. If the motors are not spinning towards the dispenser, reverse the output wires to flip the motor directionality. 


Raspberry Pi (RPi)

Attach the GPIO extensions from the Raspberry Pi to the breadboard. All of the electricals will be stored underneath the ramp on the bottom foam board. The back foam board should have a flap for the power cables connecting the Raspberry Pi and the HDMI cable for the monitor. 

Connect the RPi to the breadboard, then connect two H-bridges to the breadboard. Each H-bridge can control two motors at a higher voltage than the RPi can work with. The RPi controls the H-bridges with the GPIO pins, while the H-bridges are powered by a 12 volt power source off screen. 

The H-bridges have 4 inputs and outputs. The ENA and ENB pins are connected to themselves, while a bridge occupies the 12V enable pins. When considering motors, Input 1 and Input 2 should be treated as one whole, as should Input 3 and Input 4, since the Outputs are also in pairs. The input wires should be connected to both the breadboard and H-bridge. 

The breadboard should have wires connecting to the power source, while also connecting the red and blue lanes, indicating power and ground. The RPi should connect with the special extension for ease, labeling the GPIO pins. The breadboard should have wires between the GPIO pins of the RPi and the Inputs of the H-bridges. From there, scripts will tell the RPi to turn on and off the motors. 

The script on the RPi was written in Python for ease and accessibility. 

Downloads

CADing + 3D Printing

IMG_1310.jpeg
IMG_9687.jpg

Files:

The STL files for the tube and the cross are attached below. Print 4 tubes and 4 crosses.

Adding Each Dispenser:

Drill a hole through each “cross” dispensing mechanism for the rod. Insert the rod into the four mechanisms. Position the mechanisms inside the designated spot on the CAD outer structure. Insert each in their respective spot on the metal angle piece by attaching the rod into the motor. To improve stability, add a back support using thick foam (or any other sturdy material) behind the dispensers. Hot glue the back support to both the dispenser and the metal base plate.

Downloads

Decorating

IMG_1308.jpeg
IMG_9693.jpg

Foam exterior:

Cut out foam boards: two 30x48, two 30x30 and 30x15 boards. Decorate the one 30x48, two 30x30, and 30x15 foam boards with desired decorations to give it a spooky feeling. For our foam boards, we painted the foam boards using black oil paint, used the box cutter to slash the foam, and filled in the cuts with red watercolor to mimic blood. Attach one 30 x 48 board to the bottom of the enclosure. Hot glue it there. Once the motors are connected to the electronics, the electrical components will be on the foam platform. On one 30x48 board, slightly slit the middle and fold it. This side will have a flap to give an opening to the electrical components. Hot glue the 30x30 boards to the metal enclosure. Hot glue the last 30 x 48 board to the backside of the enclosure, where the ramp is the highest. Lastly, glue the 30x15 foam board to the frontside of the enclosure, near the top. It should not interfere with the movement of the capsules.


How to Use the Dispenser

IMG_9683.jpg

(Re)filling the Machine:

Put candy in your capsules and put the capsules gently into each of the tubes.


Operating the Machine:

Open the Python file on your computer. Connect the dispenser to the monitor via HDMI cable. Once you are connected, the different tubes will dispense capsules depending if you type 1, 2, 3, or 4.