Sound responsive LED baseball cap

Flash Hat DemoThis is my first foray into wearable electronics. It is a sound activated hat. There is a microphone below the bill of the hat that picks up the voice of the wearer as well as ambient noise. The sound is converted to light using a small board sewn into the back of the hat. The light patterns in the animated image to the left are random flashes triggered by sound. The intensity of each flash varies with sound level.

Most of the material used was purchased from Adafruit. The microphone is their MAX4466 microphone amplifier. The controller is a an Adafruit Gemma, and the lights are NeoPixel digital RGB LED’s on a strips. The LED’s are individually addressable which makes it possible program very complex patterns using just one pin on the Gemma board. I chose the randoms flashes for this project, but more informative light responses to sound could be used. In fact, after I completed this project, I found a very similar sound responsive baseball cap on Adafruit’s website. The sound/light relationship in their project shows a more informative equalizer pattern.


The Gemma board has a small Arduino compatible chip and can be programmed using the Adafruit IDE for Arduino. This makes programing a breeze. The Gemma Attinny85 chip is not as versatile as larger Arduino chips, but it is perfect for small, simple projects like this.

There is no one, perfect place to put the microphone. I chose to put it facing down along the underside of the bill. This makes it much more responsive to the wearer voice, while still allowing to to pick up ambient noise as well. Of course if you wear this hat near any kids, be ready to be yelled at. They love seeing their voices making the lights flash.

The electronics can be easily powered by a small 3.7 volt LiPo battery. The appeal to this is that the battery can fit snuggly and unobtrusively into the inter lining of the cap. In the first version of the hat I used a LiPo battery, but after using to for a while and having my kids ask if they could bring it to school, I decided that I’d like to power it with something less reactive than a LiPo battery. I know that many people use LiPo batteries in wearable projects, but I want my kids use this as often as they want and without supervision. The idea of having them running around with a LiPo battery in the brim of their hat on a hot – and possibly sweaty – summer evening did not appeal.

The Neopixels need more than 3 volts to run, so I had to come up with a way to attach 3 AAA batteries to the hat. After a bit of trial and error I settled on designing and 3D printing a custom plastic case for a round 3 x 1.5V AAA battery holder. The internal holder is the kind found in many small LED flashlights. The holder I used was scavenged from an old flashlight but similar ones are readily available online.


This round holder is perfect – it is compact, all of wiring between batteries is done within the casing, and the circuit is easy to complete by connecting positive and negative leads to the pads at either end.

The 3D printed battery case I came up with is round and has removable, threaded caps on either end. The threads allow for the ends to be tightened enough to ensure that the internal battery holder is held securely and that the circuit is reliably completed.


To complete the circuit I included one through hole and one partial hole in each cap. By running a wire through the full hole and securing it in the partial hole, the positive and negative leads are pushes against the connections on the battery holder when the caps are tightened.


This holder is much bulkier than the LiPo batteries, but I don’t have to worry about my kids head catching on fire.

The battery case was designed in OpenSCAD using the Poor man’s OpenSCAD screw library available on Thingiverse. An .stl file for the battery case is available on github.