Introduction: NeoPixel LED Headband
When my seven-year-old daughter got a look at the LED strip I was testing for a project, she instantly started to think of other things we could make. She's very happy with the result.
This dazzling headband uses a 15-LED portion of a 60-LEDs-per-meter NeoPixel Strip from Adafruit. The strip is controlled by an Arduino-compatible Trinket micro controller (also from Adafruit) and powered by a 150 mAh lithium polymer battery. (Yes, also from Adafruit. Starting to see a pattern?*)
Our circuit design uses the LED strip as a power bus, allowing us to attach the Trinket to one side and the battery to the other. Although this approach requires a little more soldering, it produces a slimmer, more balanced product.
Battery life is more than four hours with LED brightness set to one third (85). It's pretty bright - you may want to dial it back to one quarter (64) or below.
Total cost is about $20, depending on the materials you already have on hand. (Note that NeoPixel strips are sold in one meter units ($25), and you'll only need about one quarter meter ($6.25) for this project. Don't worry, you'll find something fun to do with the leftovers.)
This project isn't very difficult, but it does require soldering and at least basic familiarity with Arduino programming. If you can solder a few wires and load code, you should be able to complete this project in an afternoon, though you'll need to let the adhesive cure overnight before wearing it.
* I have no connection to Adafruit, except as a delighted customer and unabashed fanboy. In addition to making fantastic products like the NeoPixels and Trinket and Gemma micro controllers, Adafruit sells a carefully curated selection of electronic parts, tools and supplies at reasonable prices. Best of all, their tutorials are a gold mine: step-by-step instructions with tons of photos, code, and links to more information. If you're not already a fan, check them out.
Tags: NeoPixel, Trinket, Arduino, Wearable, Adafruit
Step 1: Gather Materials
- Fabric-covered 1" plastic headband, with a felt liner strip inside. (~$1)
- Adafruit NeoPixel strip - we used about 9" worth of the 60 LED/meter strip (~$6 - Note that you'll need to buy a full meter, at $25)
- Adafruit Trinket microprocessor. (~$7)
- LiPoly battery (~$6)
- JST socket (~$1 - Note that you'll need the female half of a $2 extension cable)
- (Optional) Power switch (~$2)
- Measuring tape
- Wooden clothespins
- E6000 adhesive or hot glue
- Soldering iron and solder
- 26 AWG stranded wire
- Wire strippers
- Masking tape
- LiPoly battery charger
Step 2: Measure and Cut
You'll probably want to avoid placing LEDs below ear level - so they'll be more visible, and less likely to poke.
Put the headband on your model, and mark it with a pencil just above the tips of her ears. I wrapped masking tape under the pencil lines to make it easier for me to see the no-go zone.
Measure the headband between the pencil marks. Ours was about 10", perfect for a 9" strip of LEDs with enough room for a power switch and battery jack.
Remove the NeoPixel strip from its silicone sheathe, measure it to the length you want (we used 15 LEDs, about 9"), and cut it with a pair of scissors or snips. Be sure to cut in the center of the copper pad - there's a tiny drawing of a pair of scissors to guide you.
Cut three short (~4") lengths of insulated wire and strip 1/4" off each end.
Step 3: Solder It Up
Note that the NeoPixel strip is directional: the three copper contacts on one end will be marked "GND", "Din" and "5v" (this is the INPUT end), while the other end will be marked "GND", "Do" and "5v" (the OUTPUT).
First, solder power, signal and ground wires to the NeoPixel 5v, Din and GND pads on the INPUT end.
TIP: The NeoPixel contacts are small, and the strip itself is very light. To keep it from dancing around while you solder, tape it down with masking tape or stick a lump of art gum/poster putty underneath.
I find it easiest to apply a little solder to each of the pads, then tin the stripped ends of the wires, then "marry" them.
If you're using a power button, solder it inline to the JST socket wire. Use electrical tape or heatshrink to make sure the switch terminals don't short.
Next, solder the power and ground wires of your JST socket to the NeoPixel 5v and GND pads on the OUTPUT end.
Before you solder the Trinket to the strip, check to make sure it will fit comfortably. Using masking tape, temporarily attach the NeoPixel strip to your headband. Find a handy spot on the INPUT end of the NeoPixel strip, and secure the Trinket to the headband with masking tape. Put the headband on and check to see whether the Trinket rubs against ears or makes an uncomfortable bulge. When you're satisfied with the Trinket's placement, cut the INPUT wires to length.
Finally, solder the NeoPixel INPUT power, signal and ground wires to the Trinket BAT, GND and #0 pins.
Step 4: Load Code and Test Your Circuit
Load the NeoPixel_Headband code on your Trinket. You'll also need to download and install the NeoPixel library from Adafruit, if you don't already have it.
If you used a Trinket pin other than #0 to connect to your NeoPixel Din, you'll need to edit the following line:
#define PIN 0
Change the "0" to your port.
If you used a NeoPixel strip with more (or fewer) than 15 pixels, you'll need to edit the following line:
Adafruit_NeoPixel strip = Adafruit_NeoPixel(15, PIN, NEO_GRB + NEO_KHZ800);
Change the "15" to your number of pixels.
Feel free to modify the code to display your favorite colors or routines. To change the brightness, edit the following line:
strip.setBrightness(85); // 1/3 brightness
Brightness values are 0 (off) to 255 (blinding). Higher brightness values drain your battery more quickly.
When the code is loaded, your NeoPixels won't light up. Don't panic - the NeoPixel strip is powered from the battery, not the Trinket. Plug your battery into the JST socket on the NeoPixel strip. You should see the strip light up and begin its programmed routines.
Step 5: Glue It Together
Once the circuit is working to your satisfaction, it's time to put everything together.
Apply a thin bead of adhesive to the headband, and press the NeoPixel strip into place, securing it with clothespins as you go. Check to make sure that the strip isn't crooked - you'll only have a minute or two to reposition it before the adhesive starts to set.
If you're confident that you know where you want to position the Trinket and battery, go ahead and glue them in place, as well. I experimented with several locations, but found that the Trinket was just a bit too chunky to fit on the inside of the headband; I ended up taping it to the outside. Likewise, finding a comfortable spot for the battery took several tries. Once we found a suitable place, I gently pried up the felt lining on the inside of the headband and slipped it inside. I put a dab of adhesive on either end of the slot, to keep the felt from creeping up.
When you've finished gluing, set the headband aside to dry overnight in a well-ventilated place.
Step 6: Wear It!