Systems administrator Shawn Parr and his family were recently invited to a fancy hat party. While for most people this would mean buying a new hat or perhaps rifling through a closet, Par had a different idea, and embedded a strip of WS2812B LEDs under a straw hat’s hatband. This creates a great diffuse effect that shines nicely on the brim as the LEDs loop around.
Control is handled via a Teensy LC dev board inside the hat, along with a Bosch BNO055 inertial measurement unit. This allows it to sense the wearer’s head position — when you tilt your head down it speeds up, while tilting up changes direction, and tilting to either side changes colors. Finally, if it detects an impact it reacts by flashing all the LEDs in quick succession.
Code for the project can be found on GitHub, and be sure to check it out in action in the video below. While it looks like a lot of fun, the DIY hat option likely won’t save you any money. Parr freely admits that he went a “little overboard,” spending around $80 on the build. On the other hand, if you’re going to attend a fancy hat party, you might as well go all out!