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.