In this project we can add some fun to a unique hat for parties or just looking cool as you go about your day.
You will need:
- A cool hat
- Adafruit NeoPixel Ring (16x RGB LED ring)
- 3x Jumper wires to connect LaunchPad to Ring
- AA or AAA battery Pack with JST connector for easy powering
This is a fairly simple activity. A lot of the creativity will come in how you wish to mount the hardware to the hat. You can proudly show off your LaunchPad on your brim or hide it away inside your hat. You can use some type of adhesive (glue, tape, putty, velcro) or fastener (string, thread, wire) to mount the hardware securely.
You also need a battery power source for your electronics. I highly recommend using a simple 2x AA battery pack with a JST connector, you can get these from sparkfun or elsewhere. You can also incorporate a coincell holder breakout if you prefer. A battery holder with a switch makes it convenient so you can turn it off when not in use and save battery.
The LaunchPad will be providing VCC (3.3V), GND, and Data In signals, so we will need three wires to get the signals from the LaunchPad to the Neopixels. I used 3x M/F jumper wires. For Data In you can use any GPIO on the LaunchPad. I picked pin 11 for no reason. Connect your JST connector from your battery pack to your 3 pin power rail on the bottom right of the LaunchPad (red wire to VCC, black wire to GND).
Ok now we are just going to be using the default Adafruit_NeoPixel library sketch strand test for the Software on the LaunchPad. You will need to Download Energia IDE and set up your drivers for your LaunchPad. Next you can get the NeoPixel library for MSP430 from here courtesy of ILAMtitan https://github.com/ILAMtitan/WS2811Driver. The Arduino library from Adafruit, does not port directly over to MSP430 because it uses specific timing from the Arduino, so just use the Energia version from ILAMtitan. Note: Another way to fix this is to use the DotStar LEDs which are very similar to the NeoPixels but don't rely on complicated timing (Uses SPI instead). I don't think Adafruit offers rings currently (subject to change), but they do have strips.
Copy the library into your Energia libraries folder and restart Energia. Then go to File > Examples > Adafruit_NeoPixel > strandtest. Flash that to your MSP430 LaunchPad and you should see a bunch of LED lighting happening if you hooked everything up correctly. Double check your pins in the code match your wiring hook up.
That should get you started with a fun hat. Lots more to customize and plenty of other LEDs (strips, rings, matrices) you can integrate on a hat to make cool patterns and effects.