About a year ago I saw that in the States many people decorate their academic caps. Usually they’re full of glitter, some beads and a few words glued onto them. For my graduation I wanted to make something a bit more geeky. I knew that I wanted to have a microcontroller with leds and some sensors attached, but I didn’t know what the story would be about. So I searched on the net and found somebody made a cap with Pacman on it. Great! Now I could add some lights to that concept!
So the whole thing consists of a Chinese Arduino Pro Mini 3.3V knockoff, an ADXL345 accelerometer, an addressable LED strip (WS2812) and, of course, a power source. The power source proved to be a bit of a problem because the adxl works on 3.3V and the strip works on 5. I didn’t have a lot of components and batteries lying around so in the end I took a 5V backup battery for cellphones and connected it to an FTDI breakout board which in turn powered the Arduino (3.3V). I also soldered a wire from 5V of the board to the LED strip.
The cool thing about the ADXL345 is that it has motion detection, tap + double tap sensing and freefall detection all built in. So I utilised that in my project. Double tap to turn it on and off, when the accelerometer senses that you’re active the lights run and when your’re still the lights stay still. When tapped once the cap goes into rainbow mode.
I have to say that it would have been very, very difficult to get this project finished without the help of some libraries. For the LED strip I used the Adafruit NeoPixel library. For the adxl tap sensing I used this library from bildr.org.