Wednesday, November 1, 2017
Halloween Raspberry Pi project
The Rπ0 controls a IIC-connected OLED display (128x32) and 9 LEDs via the GPIOs. I could theoretically have used an Arduino - but the OLED display is 3.3V only, and I only have 5V Arduinos (I know I can just underclock them, but not during development). Thickness was also a factor - the Rπ0 is VERY flat.
The panel is built mostly of Moosgummi (craft foam rubber), and I mounted my Raspberry Pi 0 into it. The Rπ0 and all the other stuff is mounted in a sandwich of Moosgummi sheets with strips of Moosgummi around the edge. Power and development (eg. changing the scrolling message or the blink pattern) is done trough a gap, through which a (short) USB cable is fed. The LEDs are connected trough 150 Ohm resistors directly to the GPIOs.
Raspbian Stretch Lite on it, to which I added the Adafruit SSD1306 Python library. The Python script (placed in a Gist here) running the display and the LEDs sits in the (FAT-formatted) boot partition, and is called from rc.local. Once that was all in place, I used the Read-Only Raspbian script to make the system read-only; this way I can just pull the power once the trick-or-treating is done. The script on the boot partition can still be edited at will by remounting /boot read-write (or pulling the SD card and editing it on a different computer!) The Rπ0 acts as a USB Ethernet gadget, and I can just ssh into it.
Life lesson learned: Mounting blinking LEDs on your kids makes them very easy to find at night! Note to self: next time, add lights to the back (of the kids) as well.