Introduction: LED Scarf

Wearable technology is an emerging fashion that takes both a mind for electronics and an eye for fashion. Luckily, it's becoming more and more maker-friendly with cheap batteries, power-efficient LEDs, and readily available embedded computers.

This is an introduction on how put together these parts to create a glowing scarf.

Once you understand the basic principles, it's easy to make wearables as complex as you like by adding more strips, different cloth, or sensors to control your patterns.

Wearables are not just for raves anymore: they're a a practical solution to being seen if you're biking or walking at night, and a fashion statement to wear to parties and events. Plus, it's customizable: just reprogram the microcontroller, and it'll match any outfit or occasion.

Step 1: Acquire Materials.

HARDWARE.

- Microcontroller. I use a Teensy, because it's small and well-suited for LED strips, compared to Arduinos, Pi's, etc.
https://www.pjrc.com/teensy/

- LED strip. This Instructable uses the three-wired WS2811 series (2812 and 2812B work too). I highly recommend sourcing your LEDs from Ray Wu's eBay store, as it's consistently the best quality I've seen so far.
http://www.aliexpress.com/store/product/5m-DC5V-WS...

- Wire: Three colors of wire to connect all the bits.

- USB cord: chop an old phone charging cable up, or buy one from the 99c store. All you need is power and ground, no data.

- USB phone charger: these lipstick batteries spit out 5V, perfect for all your LED projects. Alternatively, you can get a disposable battery case, which is cheaper, but in the long run this rechargeable system will save you money, and is way more convenient: just hot-swap and go.
http://www.ianker.com/product/79AN3K-PKA

- Resistors: 100 ohm, one for each LED strip.

- Heat shrink (or electrical tape, if you're desperate)

- Mini-zipties for wire management

- MicroUSB (for programming, NOT to cut!)

- Wire strippers

- Soldering kit

- Blade (to cut trace, wires)

- Multimeter (for debugging purposes)

- Hot glue gun

SOFTWARE.

- Arduino environment

- The OctoWS library (http://www.pjrc.com/teensy/td_libs_OctoWS2811.html). Alternatively, especially if you only want to drive a single strip, use the Adafruit library (https://github.com/adafruit/Adafruit_NeoPixel).

- Teensy driver (http://www.pjrc.com/teensy/td_download.html).

- There is some default code that comes with each of the libraries, but if you're running the Octo library, you can borrow some of mine.
Basic Functions: https://github.com/agentcupcake/LEDs/blob/master/...
Star Pattern: https://github.com/agentcupcake/LEDs/blob/30eaf5ae...

FUZZYWARE.

- Material. I use white fur, as it acts as a very nice, textured diffuser, but other white cloth will work as well.

- Needle and thread (white preferable)

- Sewing machine (for the long stitches)

- Safety pins

Step 2: Prepare the Teensy.

Usually, the Teensy and its attachments are powered through the microUSB port. Since we want to power it from an external battery, however, we need to split the power away from the data I/O. Do this by cutting the trace found between the microUSB connector and the PWR pin. Take a thin blade and scrape the small gap between the two pads to break the thin wire underneath, then test for continuity.

Next, we attach the wires. What you absolutely need is:

- Power (red on PWR pin)
- Ground (black on GND pin)
- Data (green on pin 2), with a resistor
- A wire between 15 and 16

Each additional LED strip you attach will need its own data pin, but can attach to the same GND and PWR lines. The next LED strips should be attached like this:

pin 2: LED Strip #1
pin 14: LED strip #2
pin 7: LED strip #3
pin 8: LED strip #4
pin 6: LED strip #5
pin 20: LED strip #6
pin 21: LED strip #7
pin 5: LED strip #8

Make sure there is no exposed wire; heat shrink the resistor, and any naked wires.

Step 3: Prepare the USB Cable.

This is how the strip will be powered. It can be plugged into you computer, or the wall via adapter, but for wearables, plug it in to the rechargeable battery.

There are build-your-own USB kits you can get, but an old phone cable works just fine. Cut off the not-USB end, leaving your desired length. Power and ground should be red and black or white and black, respectively, but it's not always that intuitive. You may need to use your multimeter to find which ones they are.

Step 4: Attach the Strip.

I attached the Teensy to one end and the battery to the other, but if you want, you can attach both of them on the same end. Just make sure the Teensy is connected to the data IN, not OUT side.

Once everything's soldered up, if your strip has a plastic waterproofing sheath on it, I highly recommend backfilling each end with hot glue to stabilize the joint: otherwise, the wires really, really like popping off.

Slide the plastic down so it extends a little past the end of the strip (you may want to sacrifice a single LED to make this work; cut between the pads and you'll be fine). Squeeze hot glue in the top and bottom until it fills it solid. I had some caps for the ends as well, but if you don't have them, the glue itself should be just fine. Do both ends.

It's a good idea to either make an enclosure for the Teensy or use zipties to give it some strain relief as well. Just make sure it's accessible later for repairs or reprogramming.

Step 5: Test and Program.

Now that the hardware is all done, it's time to test it. Plug the USB into a power source (your laptop is fine), AND your second USB cable from the Teensy's microUSB port to your computer.

Make sure your environment is set up, your libraries are installed, and the Teensy driver is working. Under file--> examples --> OctoWS811 (or such) there should be some samples. Upload them to see if it works.

If you want to make your own, I recommend experimenting with some 'sparse' patterns: the fewer LEDs you have on at a time, the longer your battery will last.

Once your sketch is working, you can disconnect your data line, and connect the power to the battery, and the pattern should continue running.

Step 6: Sew the Scarf.

Measure the length of your LED strip, and decide how wide you want your scarf. Don't make it too wide, or it'll be floppy and ungainly; Don't make it too narrow, or it will be impossible to turn inside out and stick the LED strip in.

Cut the shape out, and sew it inside out so the seams will be hidden inside. Sew around both ends, but leave a few inches on the long side open on each end: this is so you can access the Teensy and the battery, but they won't slide out while you wear the scarf.

Step 7: Insert the Strip.

Turn the scarf inside-out (in this case, fuzzy side out), and slide the strip in. If the cloth is loose enough, you might be able to put the strip in battery-first and hold the scarf up so it slides all the way to the bottom. If it catches, grab a coat hanger or rod, slip that through the scarf first, hook it to the strip, and pull it through.

Once the strip is in place, shake it a bit so it settles, and tuck the battery and teensy into each end. If it's done right, each one should be easy to pull out for recharging or reprogramming, but should nestle comfortably away while you wear it. If sliding occurs, use some safety pins or tack stitches to hold it in place.

Congratulations! You did it! Now, bask in the 'glow' of your accomplishment!