Space Ghost Glove
Ingredients
You'll need the following:
Arduino board (I used an Uno during prototyping but would probably go with a Lilypad, Micro, etc.)
LED strips (Neopixel strips would be cool too but I used standard strips so they'd all light at once)
Pull-up button
Wire
Battery
Battery harness
Glove
Soldering iron and wire
Wire strippers
Wiring It Up
The most difficult part of this build is the soldering. The LED strips require a delicate touch. I recommend you apply some solder to the contact pads first and then solder the wires to the pads. It's probably a good idea to try to protect these confections, maybe use electrical tape or hot glue. I didn't make mine as a long term project so I didn't do this.
The strips I used are common anode but it was easier for me to wire them up backwards and reverse the code. In other words to light the strips I used digitalWrite LOW. To turn them off use digitalWrite HIGH. this also means that we use analogWrite 0 to make each color full brightness. (at least I think this is why I had to change the programming haha)
After you solder the strips you should solder the R, G, B, and + wires together in groups (all the Rs, etc). Now you can connect them to the Arduino.
Connect + to the + of the battery. The - of the battery to ground. Or if you will run the Arduino off the same battery then spice the + from the battery harness so you can run one lead to the lights and plug the other end in.
Connect Green to Pin 6 or suitable PWM pin.
Connect Red to Pin 5 or suitable PWM pin.
Connect Blue to Pin 3 or suitable PWM pin.
Connect one side of the button to one of the GND pins and the other to Pin 2
My strips are also 12v so I used a 9v battery, it also powers the Arduino.
Programming
I borrowed code from Adafruit (https://learn.adafruit.com/rgb-led-strips/example-... and (https://github.com/adafruit/Adafruit_NeoPixel/tree... and mashed them together. I made a few changes and this is the result:
// color swirl! connect an RGB LED to the PWM pins as indicated
// in the #defines
// public domain, enjoy!
#define REDPIN 5
#define GREENPIN 6
#define BLUEPIN 3
#define BUTTON_PIN 2
#define FADESPEED 5 // make this higher to slow down
bool oldState = HIGH;
int showType = 0;
int r = 255;
int g = 255;
int b = 255;
int f = 0; // counter for flashing lights
void setup() {
pinMode(REDPIN, OUTPUT);
pinMode(GREENPIN, OUTPUT);
pinMode(BLUEPIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP);
}
void loop() {
bool newState = digitalRead(BUTTON_PIN);
// Check if state changed from high to low (button press).
if (newState == LOW && oldState == HIGH) {
// Short delay to debounce button.
delay(20);
// Check if button is still low after debounce.
newState = digitalRead(BUTTON_PIN);
if (newState == LOW) {
showType++;
if (showType > 4)
showType=0;
startShow(showType);
}
}
oldState = newState;
}
void startShow(int i) {
switch(i){
case 0: digitalWrite (REDPIN, HIGH); // Black/off
digitalWrite (BLUEPIN, HIGH);
digitalWrite (GREENPIN, HIGH);
delay(500);
for (f = 0; f < 4; r++) {
digitalWrite (REDPIN, LOW); // White - blink 3 times
digitalWrite (BLUEPIN, LOW);
digitalWrite (GREENPIN, LOW);
delay(200);
digitalWrite (REDPIN, HIGH); // Black/off
digitalWrite (BLUEPIN, HIGH);
digitalWrite (GREENPIN, HIGH);
delay(500);
}
break;
case 1: digitalWrite (REDPIN, LOW); // White fade to red
digitalWrite (BLUEPIN, LOW);
digitalWrite (GREENPIN, LOW);
delay(500);
analogWrite (REDPIN, 255); // Red
delay(2000);
digitalWrite (REDPIN, HIGH); // Black/off
digitalWrite (BLUEPIN, HIGH);
digitalWrite (GREENPIN, HIGH);
break;
case 2: digitalWrite (REDPIN, LOW); // White to green
digitalWrite (BLUEPIN, LOW);
digitalWrite (GREENPIN, LOW);
delay(500);
analogWrite (GREENPIN, 255); // Green
delay(2000);
digitalWrite (REDPIN, HIGH); // Black/off
digitalWrite (BLUEPIN, HIGH);
digitalWrite (GREENPIN, HIGH);
break;
case 3: digitalWrite (REDPIN, LOW); // White to blue
digitalWrite (BLUEPIN, LOW);
digitalWrite (GREENPIN, LOW);
delay(500);
analogWrite (BLUEPIN, 255); // Blue
delay(2000);
digitalWrite (REDPIN, HIGH); // Black/off
digitalWrite (BLUEPIN, HIGH);
digitalWrite (GREENPIN, HIGH);
break;
case 4: // fade from blue to violet
for (r = 0; r < 256; r++) {
analogWrite(REDPIN, r);
delay(FADESPEED);
}
// fade from violet to red
for (b = 255; b > 0; b--) {
analogWrite(BLUEPIN, b);
delay(FADESPEED);
}
// fade from red to yellow
for (g = 0; g < 256; g++) {
analogWrite(GREENPIN, g);
delay(FADESPEED);
}
// fade from yellow to green
for (r = 255; r > 0; r--) {
analogWrite(REDPIN, r);
delay(FADESPEED);
}
// fade from green to teal
for (b = 0; b < 256; b++) {
analogWrite(BLUEPIN, b);
delay(FADESPEED);
}
// fade from teal to blue
for (g = 255; g > 0; g--) {
analogWrite(GREENPIN, g);
delay(FADESPEED);
}
break;
}
TEST!
make sure everything is working correctly and fix any problems you might have
Stitch It Up
once everything is tested you can stitch it up and take it out and play! For more fun you could add a buzzer to get that PEW! PEW! PEW! sound
It shouldn't be that hard. It might be easier with half-finger gloves or starting from the end of the LED strips back towards the wrist.