An Arduino-Powered Contactless Candy Dispenser

Adam Feil
3 min readOct 28, 2020

Halloween is right around the corner, and with COVID-19 still around, it’s important to deliver all that sugary goodness in a safe and socially distant way. Some have suggested using a long section of PVC pipe as a sort of candy slide, and that’s a great idea, but things are always more fun when they’re over-engineered.

One thing I’ve come to learn is that Arduino and Raspberry Pi-powered gadgets make holidays more fun, so I came up with the Arduino-powered contactless candy dispenser.

Functionality

A distance sensor on the front watches for eager hands or a candy bag to move into position at the bottom of the candy chute. Once activated, a short visual countdown begins, letting the hopeful trick-or-treater know she needs to be patient (I didn’t want the machine to activate upon any incursion into its target zone).

After a brief moment a colorful display on the three eight by eight RGB LED matrices the stepper motor activates, turning a cardboard disk that holds eight candy cylinders. When a cylinder is moved over a hole under the disk, the candy falls out into the eager child’s basket.

Since one cylinder is always open on the bottom, the machine can dispense seven “loads” of candy before it needs to be reloaded. I figure that should let us keep up with demand.

The Parts

The front of the machine (awaiting final decoration). A distance sensor, RGB LED-lined candy chute, and a rotating disk of 8 cylinders (chopped up disposable cups shoved through holes in the disk).
The guts — an Arduino, stepper motor, its controller (the black box on the far side), and the power
  • The brain is a simple Arduino UNO. Any Arduino should suffice.
  • The distance sensor is a common HC-SR04 ultrasonic sensor.
  • The LEDs are relatively cheap 8 by 8 RGB LED matrices.
  • The stepper motor and controller are pretty common Nema 17 motor with a TB6600 controller.
  • I’m using 5V 1.4 amp USB power for the Arduino itself and (separately) for the LED panels, and a 12V 1.5 amp DC power brick for the stepper motor.

Putting it Together

Adam Feil

Educational Psychology Ph.D., business analytics nerd, computer scientist, President @MakeStickers