PORTFOLIO > Control my Cap

Categories , , ,
When? May 2013
Control my Cap
Sporting my LED Cap and my Raspberry Pi Wrist computer on graduation day

My masters graduation cap sported 16 LEDs, internet connectivity, a full linux computer, a custom PCB, and a 87 Watt-Hr Battery.

Lighting up Graduation

In 2012, when I completed my undergraduate degree at Cornell University, I had a last minute idea to put an LED array on my graduation mortar board. The night before graduation I wired up a bunch of LEDs to a protoboard and an Arduino. The resulting product worked well, and garnered all kinds of excited remarks from friends and onlookers.  But, it wasn’t bright enough in the outdoor sunlight, and it left me yearning to do something a bit more … intense.


Lucky for me, I stayed at Cornell for a fifth year to get my Masters degree in Electrical Engineering, and I therefore got to graduate again.  This time, I was determined to do something over-the-top. Utilizing the super-high-intensity LED circuit board that I had designed for my masters thesis on Hybrid Fiber Optic LED Lighting, I built a web-connected LED graduation cap that would be truly ridiculous.  Graduations can be a bit boring, so I wanted to develop an interactive platform (on my head) that others could fiddle with during the ceremonies. And thus, the “Control my Cap” project was born.

System Capabilities

  • A menu system on my wrist computer (a Raspberry Pi plus an LCD/button interface) allows me to monitor the status of the cap, change the operation mode, toggle the wrist backlight, and adjust the brightness of the cap.
  • The system can automatically connect to a list of pre-allowed WPA-protected WiFi hotspots on boot.
  • The wrist computer will inform me if it has trouble communicating with the Cap interface.
  • I can use the wrist interface to set the cap to web-controlled mode, or I can choose from a static color, or a rainbow color pattern.
  • A mobile website at controlmycap.com (this site is no longer active – it forwards to this page. You can see the interface in the video and screenshots below, and the mobile site code is on GitHub) allows anybody to easily submit colors for the cap’s color queue.
  • In web controlled mode, the wrist computer constantly grabs the 10 most recently-submitted colors from the mobile site, and displays them on the cap.  When a color is shown for the first time, the Raspberry Pi sends out a tweet to the color requester to tell them that their color is now being displayed.
  • The Raspberry Pi communicates with the cap and is powered by a single USB cable, making equipping the unit easy.
  • The Raspberry Pi can be worn on the wrist, and all relevant information is displayed on the screen.


Video Demonstration

The best way to explain the “Control-my-Cap” system is via video, so I suggest you watch this first.  Scroll down for further details about the system, photos, source code, and more!

Breaking down the “Control my Cap” System

My web-connected graduation cap turned out to be a very complex endeavor – I worked on it non-stop for the 4 days before graduation, and finished the last part the morning of graduation. The system consists of several components:

Control-my-Cap System
The complete system includes a battery pack, cap PCB unit, and a wrist-mounted linux computer.
    • The LED Cap PCB and Holder.  I designed and 3D printed a custom holder that would affix my existing LED circuit board safely to my mortar board while simultaneously securing a flash diffuser from a camera above it (to protect the circuit board, and to prevent my cap from blinding people). The circuit board is an Arduino clone, running firmware that responds to serial commands to set the LEDs to any requested brightness.  It is equipped with a total of 16 350mA high-brightness LEDs (4 each of Red, Green, Blue, and White). The PCB is fed 15V and drops it over each of the 4 LED colors in series (4 parallel strings of 4 LEDs).  Each series of LEDs is driven by a constant current driver with PWM control. An on-board switching regulator generates 5V for the logic.
    • The Battery Pack. I bought a rechargable 15V/5V/12V Laptop backup battery to serve as my battery for the system.  It is an 87 Watt-hr capacity battery, enough to keep the cap going on full brightness all day without a problem. It conveniently has a 5V USB port which I used to keep my phone charged.
    • Raspberry Pi Linux Wrist Computer. Controlling the system and connecting to the internet is a Raspberry Pi Linux computer paired with an LCD/5-button Pi-plate from Adafruit Industries.  I won the Raspberry Pi in a contest from the awesome folks at Readyforce (now LookSharp). The whole thing is mounted in a wrist enclosure that I designed and 3D printed on my MakerBot Replicator. For better or for worse, the 5V line on the host USB ports of the Raspberry Pi is connected directly to main 5V supply for the board, so I was actually able to power the Raspberry Pi via the 5V from my LED PCB cap unit using the same USB cable that sends serial commands to it.  So, the only two things plugged into the Pi are a WiFi dongle and a USB-to-FTDI cable that goes to the cap. Running on the Pi are a number of Python scripts that launch at boot, as well as a small MySQL database.  The scripts run concurrently; they mange the on-screen menu, polling the the pushbuttons, checking for updates from the remote webserver, tweeting updates,  managing the WiFi connection, and facilitating control of the cap PCB via serial commands sent over the USB-to-Serial adapter. The local MySQL database maintains simple state information such as the last ID that was tweeted, the present operation mode, brightness settings, etc.
Mobile Site
A Screen Shot of ControlmyCap.com
  • Remote Webserver. A remote webserver hosts the controlmycap.com mobile site (this site is no longer active – it forwards to this page. You can see the interface in the video and screenshots, and the mobile site code is on GitHub), as well as another MySQL database that holds information about all the color requests that have been made to the cap. The mobile website is built using a JQuery Mobile UI front-end, paired to a python back-end via AJAX JSON calls. My wrist computer queries the MySQL database on this remote server for updated commands.
  • WiFi Hotspot. I used the FoxFi app on my Samsung Galaxy S4 smartphone to generate a WiFi hotspot through which my Raspberry Pi could connect to the the internet.

In Practice

During graduation weekend, the “Control-my-Cap” system was a huge success. Approximately 200 color requests were sent to the cap over the course of two days. At one point during the commencement address, the 3G and 4G networks at Cornell crashed for a few minutes due to the insane number of people all on the smartphones at once in the stadium.  This, in turn, caused one of my python web-checking scripts to crash. However, a simple “hat reboot” fixed this.  People very quickly realized that I wasn’t requiring them to sign into twitter to send a color, so they started sending colors from rediculous usernames, including the present of the university, David Skorton, (while he was giving the commencement address), and US president Barack Obama; this gave me a pretty good laugh:

Photo Gallery

Check out these photos of the Control-my-Cap System.

Supporting Documentation, 3D Designs, and Code

You can find even more system specifications within the README files of the project’s git hub repo. 3D Designs can also be found on Thingiverse. This project is licensed via a Creative Commons Attribution-ShareAlike 3.0 Unported License.  Please Attribute and Share-Alike.


Get it on GitHub (Code and Design Files)
Code and Design Files
Download from Thingiverse (Cap Mount)
Cap Mount
Download from Thingiverse (Wrist Mount)
Wrist Mount


Control-my-Cap in the News

Blog Posts about the Control-my-Cap