Harold

The Backstory

Before we get into the circuitry and coding behind HAROLD, I’d like to provide just a bit of background. The best starting point I can think of is April of 2014, accepted students open house day at RIT. It was that day I got my first tour of CSH (Computer Science House) and decided I wanted in. As I got my tour I was told of the projects members had completed and were currently working on: Drink, Multi Touch, Custom Arcade Cabinets, and Harold.  

If you read the description of Harold on the CSH website you will read what I was told that day. It is a system that reads a user’s iButton ID and plays a song set by the aforementioned user. Looking back I remember seeing a drink dropped from Little Drink and other demonstrations, but Harold wasn’t played. Of course, I didn’t notice it then, but at that point Harold no longer worked.

Now, onto the project!

Harold, an acronym standing for Heralding Arrival by Really Obnoxiously Loud Device, was originally started years before I even knew CSH existed by, now alumni, Drew Stebbin. Over time Harold went through many iterations at the hands of several CSHers, each in a new language and with a different way of fulfilling Harold’s purpose.

My goal in taking on this project was to create an easy to maintain and update model that could be built upon by not only myself, but any other member. With this said, I chose to write the software side in Python; a popular language that is easy to learn and even a great springboard into programming. The code is running on a Raspberry Pi B+, which is housed within a custom 3D printed case I modeled and printed for this project. Also included in this iteration is the addition of RFID identification.

The current flow of information is as follows: As a user touches their iButton (or an RFID signal is returned) their IDs are transferred over USB from a Teensy 2 to the Raspberry Pi. From there the Python code (link below) uses an internal service to query CSH’s LDAP server to translate the iButton or RFID ID into a username. Once Harold has a user’s name, it then (over SSHFS) searches their home directory for either a harold.* file or a harold/.harold folder. If the singular file is present Harold will write the file to /tmp/mplayer.fifo where an mplayer process set to slave mode is waiting to play the file. If Harold finds a folder it will list the contents and pick a random song from the directory. The python script also limits the length of the song, if it is over thirty seconds, and fades it out at the end.

The iButton readers in the elevator lobby also have LEDs, meant to aid in nighttime use. Harold though, uses the GPIO on the Raspberry Pi to control these lights and provide status to the user. Currently the lights are turned off when music is being played and the readers are deactivated and back on when Harold is ready to receive input. This is one of the areas I would like to see Harold advanced in. There is a lot that could be done with PWM (pulse width modulation) to create even more user friendly status indicators and even error codes.

The code can be found on GitHub.