Introduction: CheerLights Internet-Connected Hat (with Particle Photon)
This festive e-Textile hat combines the magic of CheerLights with a Particle Photon, a microcontroller that can connect to the cloud to help you with all of your Internet of Things projects! The result of my tinkering was an internet-enabled wearable that changes colors in sync with lights all over the world, in response to Twitter messages mentioning @CheerLights and the name of a desired color.
According to CheerLights' Twitter bio, "CheerLights is an #internetofthings project by @scharler to synchronize lights to the same color at the same time all around the world." If you haven't tried it, prepare to be dazzled and amused by this charming global phenomenon!
Step 1: Useful Tools & Supplies
1. a soft fabric hat
2. a rotary leather punch or Japanese screw punch (to make holes in the hat)
3. an eyelet setter (prefer a universal setter over the squeezable variety)
4. eyelets
5. hammer or mallet
6. glue gun with a supply of glue sticks
7. soldering iron with third hand
8. Photon microcontroller with headers & a micro USB cable
9. Spark Fun Photon Wearable Shield
11. 500 mAh Lipo cell battery (or larger)
12. 10 X SMD RGB LED's (or sewable Adafruit NeoPixels)
Note: NeoPixels are much easier to solder, but the SMD RGB LED's are more affordable and compact.
13. stranded silicon wire (I used red, black, and yellow)
14. Five male to female jumper wires (2 black, 2 red, 1 yellow)
Step 2: Getting Started With Photon
I am working under the assumption that you already know how to set up a Photon and upload code using the Particle IDE. If you need help, visit this Particle Guide.
Step 3: Upload Firmware From Github
I used code/ firmware that was shared by Matt Holmes in his NeoPixel reindeer project on GitHub. If you are new to the Photon, you might want to spend a little time reading the tips Matt Holmes shares to help you get started with the proper libraries.
1. Upload the CheerLights code to your Photon using the Particle IDE. (You'll need to set up a free account if you haven't already done so).
I modified the code so that the PIXEL_PIN is D7 instead of D0 and the PIXEL_COUNT is 12 instead of 1.
#define PIXEL_PIN D7
#define PIXEL_COUNT 12
Step 4: Solder Jumper Wires
Solder the male half of a black jumper wire to the ground pin of the Lily Pad Simple Power and the male half of a red jumper wire to the positive pin.
Solder the female half of a black jumper wire to one of the ground pins on the Spark Fun Photon Wearable Shield and the female half of a red jumper wire to the VIN pin on the shield.
Solder the female half of a red jumper wire to the 3V pin of the Spark Fun Photon Wearable Shield.
Solder the female half of a yellow jumper wire to the D7 pin.
Solder half of a male black (I used brown) jumper wire to the other ground pin.
Insert the jumper wires attached to the Lily Pad Simple Power into their corresponding male jumper wires on the Spark Fun Photon Wearable Shield.
Step 5: Prepare Your Hat
Find an old hat that could use a makeover.
Select an appropriate eyelet setter for your project. A universal eyelet setter may be easier to use than the squeezable type if you plan to place eyelets far from the hat's brim.
Use the leather rotary punch or Japanese screw punch to create holes in your hat that are slightly smaller than the eyelets you're using. Set the eyelets so that the finished sides are visible from the front of the hat and the rough edges are on the inside.
Step 6: Reinforce Solder Joints
Use a glue gun to protect the solder joints on your SparkFun Photon Wearable Shield and Lily Pad Simple Power.
You can Velcro the shield, power, and battery to the hat now or later.
Step 7: Prepare to Solder the LED's
If you're using SMD RGB LED's, take note that one corner has a notch in it which denotes ground.
If using Adafruit's sewable NeoPixels, take note of the data-in and data-out markings on the PCB as you work.
I cut and tinned the ends of several pieces of yellow stranded wire before soldering my data lines.
Using a set of third hands, I secured each SMD RBG LED by the notched corner (ground), to ensure that all of the lights were oriented properly.
Step 8: Solder the LED's
Solder the SMD RGB LED's (or Adafruit NeoPixels) together with stranded wire, ensuring that the data wires are long enough to reach each of the holes that you made.
I used black wire for ground, red for power, and yellow for data. If you're using Adafruit stranded silicone wire, the coating is pliable enough to tear with a fingernail. Or, if you prefer, you may use a pair of scissors to make incisions in the silicone to expose the wire for soldering.
Step 9: Solder Jumper Wires
Solder the female halves of a red, black, and yellow jumper wire to matching wires soldered to your light strand.
Protect the joints with electrical tape or heat shrink tubing.
Step 10: Test & Reinforce Your Light Strand
Switch on the switch to the Lily Pad Simple Power.
Once your Photon connects with the Internet, you should be able test your light strand. After ensuring that all of your LED's are working properly, protect the solder joints with hot glue.
Step 11: Glue the LEDs to the Inside of the Hat
Insert the female jumper wires attached to the light strand into their corresponding male jumper wires on the Spark Fun Photon Wearable Shield.
Glue your LED's into position, centering them within the eyelets before the glue cools. I found it helpful to detach the Spark Fun Photon Wearable Shield, Lily Pad Simple Power, and the battery while I was gluing. I began by gluing the last light in the strand first and working my way towards the Photon.
It's not pretty on the inside, but it's not uncomfortable to wear. I did, however, have to be careful to position the shield in a place where my head would not accidentally touch the reset or setup buttons on the Photon.