Sunday, June 8, 2014

Wearable: lighty.. shirty.. thingy

I have a couple of project updates I haven't gotten around to posting, but I wanted to share the one from this weekend first. The neighborhood I grew up in had a midnight 5K which encouraged lights and costumes. I figured this would be a good chance to do some wearable stuff. I spend waaayy to much money at Adafruit and got some EL wire and a decent-sized Neo-Pixel ring. I figured I'd attach these to a hoodie and make some cool light effects (and hopefully win the costume prize! :P ).

I got the aqua EL wire and the cheapest hoodie I could find on Amazon. When I realized the power requirements of the Neo-Pixel and a couple of batteries wasn't going to cut it, I got a decent sized portable charger (10000mAh should power everything for around 1~2 hours) and threw in another strand of EL wire for good measure. This was a different brand and turned out to be much poorer quality. For one thing, it was a log bluer than I expected for aqua. This turned out to be okay, because it's color ended up working better with everything over all, but the two were a lot further off than I expected. The isolation itself was blue; I suspect the wire lights up white underneath instead of lighting the actual color. Also the wire was not as bright and had a "thinner" appearance.

I put off actually putting anything together until the day of the race, so there were some serious hacks. I sewed the Neo-Pixel down to the chest, but broke two needles in the process of threading conductive wire through three through-holes. Then those needed a path to the pouch in the front where the electronics would go. I made the poor choice to "show off" the wires by threading the conductive thread on the outside of the shirt. I did a crappy job in a rush to get it done and it ended up looking pretty bad. One more plug for Adafruit: I had some conductive thread from eBay and it was crap. It was thick and would come unraveled and was generally difficult to work with. That's how I thought all conductive thread was. But I got some more from Adafruit and it was superb: thin and stiff, so easy to thread and tie. I'm not sure how well it would do in a sewing machine, but by hand it was great.

I had planned on attaching this plastic thing (that was actually half of an Easter egg turned upside-down) to act as a partial defuser and weird shape thing to the front, but I had no idea how to attach it. It turned out that hot glue worked much better than expected. Of course, I rushed that too and got some glue where I didn't want it.

As for the EL wire, since the strand from Amazon happened to fit through some holes in the plastic egg thing, I decided to put those on the body, and the Adafruit strand around the hood. This meant that I had to split and solder the cheap wire instead, which was much thinner and an absolute nightmare. The outer wires were a single, crazy-thin strand hidden behind two thick layers of isolation, and I was using a box cutter since I don't own any wire strippers.

I got that down, and realized I needed some sort of bus for the EL wire from the pouch as well. I had some extra EL wire clips so I attached them to some speaker wire (it was easy to tell sides apart and in reach from where I was sitting, so give me a break) and ran that through the inside of the shirt.

I attached the ends of the conductive thread from the LEDs to headers with wire leads. It turns out if you cut away a little insulation and tie the thread around that, it works pretty well. I doused those in too much hot glue and continued on.

At some point, I must have blown out the inverter from Adafruit, because it stopped powering anything. Fortunately the wire from Amazon came with one too. That circuit turned out to be quite resilient. Even though it was designed for 3V, it ran at 5V without anything except an obnoxious high-frequency whine. I after a couple shorts and a couple of shocks (EL wire runs at high voltage AC, if you didn't know), the inverter was happily powering all of the EL wire.

The last physical part was the microprocessor. I used a Teensy 2 since it is my favorite board and I had loaned out all my other boards. At this point it was crunch time, so instead of removing the temporary headers on the Teensy, I just added some more upside down so the female headers from the NeoPixel could plug in. I broke the battery clip on the inverter, so I ended up wrapping the ground from the USB cable to a leg of a BJT. Then I carefully balanced a safety capacitor across it for the LEDs, one leg of which I soldered to a slit in the isolation of the output wire. The battery pack has two outputs, one that maxes around 2A and one that maxes around 1A. I was worried that the LEDs and EL would together pull more than the max of the higher amp output, but it turned out to be okay. I ran the Teensy off the second output (in an attempt to protect it from the sketchy high-power circuit of the other stuff).

With all this working and the rest of the EL wire sewed down, I had about an hour left to program the Neo-Pixel. Fortunately I had played with the library a little bit before. I wanted to make a spinner with a tail of decreasing brightness. The library changes brightness for the entire output, and it is slow and requires a refresh. I tried to write my own function to reduce brightness, but due to some issue with bit shifting and data types that I didn't have time to debug, only the blue worked correctly (since those are the LSBs of the color integer). Blue it is, then. Also, I learned this late that the first LED on the chain doesn't work right. It flashes intermittently and often shows the wrong color. It could be a data/noise issue, but since the rest work, I suspect it is actually just a bad LED. The way it acts is strange, but consistent. I found removing one unrelated test line caused it to intermittently blink blue instead of green. As we say at hackathons: "Fuck it, ship it." I scooped everything up, dug around my closet for running shoes and made it to the race just in time.

One thing I really wish I had more time for was a better way to secure everything. I spent the whole race cradling a few pounds of electronics against my chest to keep them from bouncing around. The LEDs lost data connection early on and froze with a single, off-center white LED on and remained that way the rest of the race. At every bounce, the mode change button on the inverter would get pressed, so the EL wire was blinking randomly, and occasionally the inverter would short and even shock me. I dropped a couple of things and had to go back for them, and that sweatshirt was SO HOT (this is June in Atlanta). I managed to to okay, coming in around 28:02 (and I think I deserve a handicap!).

I didn't win the costume contest, although the judge came by after and said I was his second choice. I managed to put everything back together after the race. I will put the code on GitHub once I've debugged the dimmer issue. A pretty decent way to spend a weekend in my opinion.


By the way, I stumbled across this awesome alternative NeoPixel library for the Teensy 3.0. They made a full display that streams YouTube! Check it. 

No comments:

Post a Comment