This Candy-Throwing Robot Dispenses Treats From a Safe Distance

Chuck a handful of candy bars at trick-or-treaters from a safe distance away with this spooky robotic project.

Motivation for creating the robot

Every Halloween night tends to bring out some of the most innovative and interactive displays, and best of all, many of them can operate with little in the way of human intervention. Conveniently for SparkFun's own Creative Technologist Rob Reynolds, he too was looking for a way to dispense candy in a socially-distanced manner this year. But rather than using a simple piece of PVC pipe or bucket, he wanted something, in his own words, "complicated, possibly effective, potentially dangerous, [and] definitely ridiculous." This potential device would need to be accurate, involve some kind of IoT-enabled microcontroller, and utilize motorized components that can fling candy from a minimum distance of at least six feet away.

Sketching potential ideas

The first idea for this candy-dispensing system was a trebuchet that could launch candy across a vast distance. However, getting the candy in the pouch, engaging the hook, and constructing a release mechanism quickly proved to be far too complicated for a fully-autonomous build. After considering a more dangerous crossbow design and a contraption that uses a pair of counter-rotating wheels to launch candy projectiles, Reynolds settled on a basic arm-style pitching machine that could hold candy in a sort of "hand" and throw it.

The basic mechanism

To build this robot, Reynolds started out by fashioning a basic structure from a series of steel and aluminum plates, along with the necessary screws and brackets to hold it together. At the base is a pair of feet that distribute the weight and keep it stable when the arm moves. As for the throwing mechanism, a 68 oz. in. NEMA17 stepper motor was selected for its ability to hopefully apply enough torque on the chain-and-sprocket linkage that rotates the arm. The stepper motor is driven by a SparkFun ProDriver Stepper Motor Driver board which is, in turn, controlled by a SparkFun Thing Plus ESP32 WROOM board.

For more information about the initial design phase and early prototype, you can read its project writeup here.

Making some upgrades

Although the first prototype seemed to work, it encountered a few difficulties along the way that necessitated some modifications. The biggest problem was the stepper motor's being inadequate for driving the chain and arm, so Reynolds swapped it out with a larger 125 oz. in. NEMA23 stepper motor which required a slight change to the mount. A second change occurred when it was decided that an exposed chain moving at a high speed and with great force probably isn't the best idea near children, so it was hidden behind some additional plating.

Triggering a throw

In order to get the robot to throw candy, Reynolds wanted a wireless solution that would allow him to remotely trigger the arm. The solution he came up with uses Espressif's ESP-NOW protocol which lets multiple ESP32s communicate directly with each other devices to send messages. The robot contains an ESP32 running the receiver code that listens for a packet that tells it to throw. The transmitter is just a large red button attached to a secondary ESP32 that sends a packet when the button's state becomes active.

Using it

As can be seen in SparkFun's video, this candy-throwing robot is a lot of fun to use. With its attached skull and zombie-themed shirt, any trick-or-treater who approaches it will be in for a big surprise. Reynolds even added a servo motor that automatically nudges a new candy bar into the bot's hand after the current bar has been launched. In the future, Reynolds wishes to add a small hopper which can be filled with candy and then line it up in an accurate and repeatable fashion that minimizes the need for human intervention while it is in operation.

Evan Rust
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.
Latest articles
Sponsored articles
Related articles
Get our weekly newsletter when you join Hackster.
Latest articles
Read more
Related articles