Deciding that I was better off avoiding subjecting my fellow classmates to my terrible arts and crafts skills, I instead decided to use my skills as a developer to mount an LED matrix to my head. I found inspiration from Jermey Blum’s write up of doing something similar for his own graduation.

Parts

Total cost $194.94

Assembly

Graduating from a public school means an extremely long ceremony; this made power my first concern. Doing some quick math with the consumption specs for the Raspberry Pi and LED matrix, I knew I’d need at least a 10000mAh backup to last the 4 hour ceremony. I’d also need a unit with two USB ports, one of which must output at 2 Amps to meet the power needs of the LED array.

Using a battery backup also allowed me to purchase a device with a smaller form factor that I was able to duct tape to the shirt underneath my graduation gown during the ceremony.

The LED matrix that I chose unfortunately didn’t come with the ability to be powered over USB, so I first had to strip a USB cable. A standard USB cable contains 4 wires, two of which are used for power. Soldering the provided spade terminals to power wires inside the USB cable resulted in an acceptable power cable for the matrix.

Next, I wired up the the Raspberry Pi to the LED panel, following the instructions from hzellers rpi-rgb-led-matrix repo.

Finally, I mounted the panel and Raspberry Pi to the cap, propped up by cardboard to create a better viewing angle for those behind me.

Custom Animations

While hzeller’s repo comes with a few stock animations, I wanted to add animations that would let me display school spirit. The LED matrix takes animations in the ppm file format. Using Pillow, a fork of the Python Imaging Library, I was able to write a python script that would take a static 32x32 pixel image and apply some basic transformations to create an animated file.

Originally, I intended to take tweets containing the string “#UCGRAD14" from Twitter and dynamically creating ppm files of scrolling text. I was able to code an implementation of this, but unfortunately wasn’t able to use this in production due to wifi constraints.

Finally, I knew I wouldn’t have the luxury of a screen with me when it came time to turning the hat on, so I wrote a bash script that would load hzeller’s repo when the Raspberry Pi was booted and cycle through all the animations it found in a folder I’d placed in the shared directory.