Skip to main content

Raspberry Pi Advent Calendar Dispenses Daily Candy

Richard Hayler's choc-dispensing advent Pi
(Image credit: Richard Hayler)

Christmas is a time for giving, and we’re eternally grateful to all-round geek and The Pi Cast guest Richard Hayler (opens in new tab) for gifting us this Raspberry Pi (opens in new tab) project: a chocolate-dispensing advent calendar that will only dispense precisely one treat per day.

Hayler, a programme manager with Raspberry Pi who works on the Astro Pi project, created the treat distribution system using one of the popular single board computers, the Build HAT (opens in new tab), some Lego components, the 3D RGB Christmas tree kit (opens in new tab), and a stash of sweet, sweet candies, plus a bit of Python.
The Build HAT is a collaboration between Lego and Raspberry Pi which enables Lego electronic components, such as motors and sensors, to be used with the popular Python programming language.

A press of a button is all it takes to get this Donkey Kong-like tower of Lego to allow a chocolate to roll, barrel-like, down its sloping paths to the bottom, but it will only work if it hasn’t already handed out a confectionary tidbit that day. If one of the delicious delicacies has already been dispensed, a red light is all you get.

Hayler's YouTube channel (opens in new tab) reveals previous experiments with Pi-controlled Christmas lights, and a fabulous Lego Apollo 11 display case too.

Ian Evenden
Freelance News Writer

Ian Evenden is a UK-based news writer for Tom’s Hardware US. He’ll write about anything, but stories about Raspberry Pi and DIY robots seem to find their way to him.