Raspberry Pi Costume Automatically Dispenses Candy

Raspberry Pi
(Image credit: Yinglish119)

There are no tricks with this Raspberry Pi project—only treats available on demand thanks to this amazing, wearable project created by maker Yinglish119. Instead of just creating a simple candy dispenser, Yinglish119 has turned his idea into a totally portable and wearable Nerds costume that looks just like the candy it provides.

Yinglish119 himself is dressed in suspenders and bowtie combo while sporting a huge Nerds candy box which contains all of the Pi-powered goodness we love. To get the candy to dispense, users wave their hands in front of an ultrasonic sensor which triggers the mechanisms inside to dispense a box of candy out of the bottom of the giant Nerds box.

According to Yinglish119, the candy is magazine loaded and pushed through the bottom thanks to a continuously rotating servo motor. When the sensor detects a user, it initiates a wheel inside the suit which picks up a box of candy and moves it down the channel, guiding it out to the platform at the base of the costume.

The candy dispensing suit is powered by a Raspberry Pi 4 connected to an ultrasonic sensor and servo. The sensor is definitely an HC-SR04, and the breadboard suggests that a potential divider is being used to drop the voltage from 5V to 3.3V for the Raspberry Pi's GPIO. You can get 3V versions of the HC-SR04, namely the HC-SR04P and the HC-SRO4+, which we have used with the Raspberry Pi Pico.  In addition to the electronics, Yinglish119 built a wooden frame and internal mounting components that help load the candy to the dispensing platform. Everything is hidden behind a shell that resembles a box of Nerds—albeit on a giant scale.

The Nerds costume is not only programmed to detect when it’s time to dispense candy, it also has a sensor to confirm that candy was delivered. In addition, Yinglish119 added an additional bit of code to prevent any jamming that might occur during the dispensing process.

If you want to get a closer look at this Raspberry Pi project or maybe even recreate it yourself, check out the original thread shared by Yinglish119 to Reddit and visit his official YouTube channel for videos of it in action.

Ash Hill
Freelance News and Features Writer

Ash Hill is a Freelance News and Features Writer at Tom's Hardware US. She manages the Pi projects of the month and much of our daily Raspberry Pi reporting.

  • Conor Stewart
    Why do people continue using raspberry pis for projects like this? This is an ideal application for a microcontroller, using a pi for this is totally ridiculous. I get sticking to what you are used to, but if you can program the pi to do this you should be able to program a microcontroller to do it too.
  • yinglish119
    First, I found this page because my friend send me this link via chat. I have used Tom's hardware since like the early 2000's. I didn't realize there is a forum until I saw the comment section.

    To answer question around hardware, all design choices were made because I had 3 weekends to finish the project. Including coding/building/testing/painting/etc. These were parts I had available or available in my local microcenter. The Servo was a FS90R which required 4.8-6V input, the break beam sensor is an Adafruit sensor(https://www.adafruit.com/product/2168). The ultrasound sensors are HC-SR04. The only downside I found is that bright light messes with the IR sensor(not a problem for me since it functions perfectly after 4:30pm local time).

    As for why the RPI4, because the next goal is to have Nodejs running Express so I can monitor the state of the device on a webpage(i.e. jam, boxes left, boxes given, error rate, sensor failure, etc). I don't have enough experience with microcontroller to know how to do that. My background is CS with API work.