We held an informal evening hackathon at work the other day and I set to work finally doing something interesting with my Raspberry Pi and a sweet-dispensing ‘thing’ I’ve had on my desk for a while. You can see the end result below, I basically ended up with a device that continuously monitors our builds at work, and should one ever succeed, it dispenses some smarties/M&Ms on to my desk whilst updating a number of LEDs showing the current build status. In addition it uses a Flask-based web server to allow me to change the current build project it monitors.


So how was it done?

The root of it all is my raspberry pi, running nothing but the supported debian image from the Raspberry Pi site. Attached to that is an assembled Gertboard, connected to the Pi’s GPIO pins.  I’m using the Open Collector driver component on the Gertboard, which allows me to switch the on-board motor in the sweet dispenser whilst using it’s own power supply. In addition, I’m using three of the buffered I/O pins from the Gertboard to control the red, green and yellow LEDs. Once it’s all wired up, a Python/Flask app controls the Open-collector and Buffered I/O using Gordon Henderson’s WiringPi library.