Greetings Makers, builders, hackers, diyers, and any other self-described user!
No need for extensive explanation here - it's pretty clear what's going on: LEDs, glasses, wires, code, and a bunch of other people incredibly impressed by your technical prowess. The best part? LEDs shine outwards, so no light shines back into your eyes, and the LED strips are relatively translucent, in that its quite easy to see through them! Let's get started right away then:
Individually Addressable NeoPixel LED Strip - can be ordered from Adafruit by the meter for ~$25/m
Arduino - Uno is preferred, simply because that is the one that is used in this instructable, though it is quite likely that other arduino microcontrollers will work as well. I can't testify to those, however, since I have never used any other.
Step 1: The Glasses
This was, in my opinion, the trickiest part of the entire project, simply because it can be difficult to find a pair of glasses that have a wide enough bridge to allow an LED strip to pass over it. In my opinion, it's rather rare to come across exact same set of glasses that I used, which I found laying around my house.
Other options involve 3D printing a pair, or ordering a pair that are used with Cyclops (from the X-Men) costumes. Or using the popular shutter-shades glasses and trimming shutters to get it to the desired size.
In any case, for preparing the glasses for the strip, I screwed out the lens and painted the frame black. You're free to paint it any color you'd like. My reasoning was that when the wires went along the frame, I wanted them to blend into the color of the glasses so they would be less visible.
Step 2: Soldering and Testing
This aspect of the project is the most technically-intensive, in that if you are not familiar or comfortable with soldering, it can be quite tricky and frustrating. Especially as this is an object which will move around and the connections will often get stressed. I'll break down the process as I see it, but perhaps the biggest piece of advice I can give is to not give up on it. Not every connection will be perfect the first time, and its likely it won't be perfect the last time you make it, but it will only work if you keep trying here.
The LED strip has 4 pads on it: 5V, DATA, CLOCK, and GROUND. The 5V and GROUND supply the power, and the DATA and TIME pass along the information about which LED to turn on for which color at which time. The benefit of this individually addressable strip is that each LED functions independently from the rest, and thus can be controlled independently from the rest as well.
My tip on soldering the wires to these pads is priming the pads first by tinning them. Also, wrap the finished connection in electrical tape.
The other ends of these wires go into respective pins on the Arduino: 5V to 5V, GROUND to GROUND, and DATA and CLOCK to any 2 different digital pins.
For the code, I've attached the LPD8806 library which should be moved into the libraries folder for your Arduino. The data and clock pins are listed in each program.
Step 3: Glasses Code
For those of you who just want to go ahead and make it and get it working, I've attached my version of the code for my glasses. Feel free to take it and use it as is.
For those of you who want more of an understanding of what's going on, I'm going to explain some of functions and key things to note about coding the Arduino for controlling this LED strip. The first time I got started with it, I used the same set up as the test file that Adafruit provided. Over the months, I've gained a better understanding for what each of these parts do.
1) To an Arduino, the LED strip is an "object," in the entire computer science sense of the word. It instantiates it in the beginning with the number of LEDs and the digital pins that the strip has been connected it.
This has a lot of implications for what you can use it for. What I've been working on more recently is using several of them and creating an array of these "strip objects" to handle several of them at once.
2) strip.begin() basically turns it on
3) strip.show() is incredibly important. You might think that simply by setting the pixel color of an LED, the LED turns on. Instead, strip.show() is the function that updates the status of the LED strip, and thus even if you set a pixel color, it won't "show" on the strip until strip.show() has been called.
This makes placement of the function rather important. Not only is it crucial to include it after changing the strip color, but moreover, placing it in the right place can have an effect on how quickly the lights seem to change. As an example, suppose you wanted to turn all the LEDs of the strip on to a particular color at the same time. If you set the color of a single LED and then use strip.show(), and then iterate that until you reach the end of your strip, you will see a small delay between one LED turning on and the LED next to it turning on, because it takes some small but finite amount of time for strip.show() to run. The optimal thing to do would be to change the color of all of the LEDs one by one, but use strip.show() at the end so that they all turn on at once rather than one at a time.
4) strip.setPixelColor(int p, uint32_t c) This one is rather clear--it sets the pixel color given a position p along the strip and a color c. The phrase "uint32_t" denotes the "type" that it accepts, and means that the color value is 32 bits.
5) colorChase(uint32_t c, uint8_t wait) bounces a light on the LED strip from side to side. "c" is the color, and "wait" is the amount of delay between each LED.
6) colorPong(uint32_t c, uint8_t wait) bounces a light from opposite ends of the strip and has them bounce off each other at the middle.
7) chaseBlack(uint32_t c, uint8_t wait) There's no real way to have the strip flash a "black" light, so basically its the inverse of the colorChase function in that it turns on all the lights except for a pixel that is off and seems "black."
8) strobeLight(uint32_t c) It's a strobe light.
Step 4: Update!
So recently, Adafruit has updated their LED strip stock and come out with a better NeoPixel strand. It's not as wide, and the LEDs are more compact. All of this means that all of a sudden the gap I had on the glasses can hold two LED strips, and so all of a sudden the LED glasses can go from a 1D strip to a 2D array!
More space for more activities!
In other words, there are a host of new functions you can write to get the full usage of a 2D LED array.
The flip side to this is that its a new library to install, and the syntax is marginally different. Thankfully, Adafruit has what they call an "uberguide" to using this new technology, and its incredibly useful.