Custom Light Gloves!

whiterabbit

Sep 14, 2013
90
Joined
Sep 14, 2013
Messages
90
So, this project has been a long(ish) time in the making and was originally what started me on the path of learning electronics- but I’ll skip the backstory and jump right into the fun part.

I’m making a custom set of light gloves. I want to build something jaw-droppingly awesome that I have never seen before.

The light gloves you can buy at shows or online tend to be awkward and are extremely limited in their functions [read: cheap]. I want to build a pair of gloves that runs of a microprocessor, so I can customize the patterns the LEDs display and reprogram it at my convenience.

I have already made several steps towards reaching this goal, but would love community input! On anything, really- circuit design, code, or possible additions I haven’t thought of. I have very limited experience with electronics, and a decent amount of experience with code, but I learn very quickly and that has helped me a lot in the last little while while learning about this kind of stuff.

I figure the best way to start this project is to decide what features I want, and then from there work backwards to see what I will need to do in order to accomplish my goals. So here are some thoughts/features/requirements/design ideas that I have so far:

-needs to be portable, and fairly lightweight (can’t have a massive circuit board or cumbersome batteries)
-batteries should be rechargeable
-microprocessor controlled
-multiple colors of LEDs on the fingertips (see attached photo for something I’ve already worked up!)
-convenient control access (buttons etc. should be located on each hand, probably along the side of the hand/finger between thumb and forefinger) so that you can toggle changes without stopping the light show
-RGB LEDs spaced incrementally every 3-5” along the arms and chest (along power wires, probably) so that you could have the light ‘drain’ from one hand and ‘travel’ over to the other [as an example- think LED chaser]
-accelerometers (gyroscopes?) on each hand (could change the intensity of the LEDs based on movement; maybe even read hand gestures as a method of triggering certain patterns in the LED output
-maybe a ‘sync’ button that you could tap with the beat of the music to set the rate at which some of the LEDs pulsate along with the tunes
-keep the design (of the hand parts at least) open on the palm side of the hand for ventilation and also so phones can be used more readily and whatnot (already have kind of experimented with this by modifying existing gloves and have had some basic success!)

I have some of the parts I’ll need, but I’m sure I’ll need more. I want to hold off on making any orders until I’ve settled on a physical design. I have a Teensy++2.0 and an Arduino sitting around unused, but am open to suggestions on ones that may be better suited to a project like this.

The problems I anticipate include
-finding a power source that is rechargeable and compact and won’t die after a half hour
-keeping the wiring compact so that it won’t be cumbersome
-bridging the joints in shoulders/elbows/wrists so that the wires won’t break
-in fact, durability all around since there will probably be quite a few ways this could break
-programming in complex patterns for the LEDs, especially if reading input from accelerometers or gyroscopes


I know this will be a LOT of work, but I’m very motivated to make this and I would greatly appreciate any help!

Thank you in advance for your thoughts :D

PS
The pic shows a comparison of a 5mm LED to three 3mm leds [what is standard on many gloves] and the small piece of doubled sided board with six surface mounted LEDs on it sharing common ground. Theres a hole through the board under the soldered center, so it can be accessed from the non-lit side. the back is also divided into three strips which connect around the edge of the board via wire I added. This should allow all six LEDs to be connected from one side of the board so the wires can be more consolidated running down the back of the finger.
 

Attachments

  • ledcomparison.JPG
    ledcomparison.JPG
    31 KB · Views: 129

donkey

Feb 26, 2011
1,301
Joined
Feb 26, 2011
Messages
1,301
so its a suit that lights up. very adventurous. I would start small with a string of rgb LEDs and get them to do what you want. the lilypad might be a good start for this
 

whiterabbit

Sep 14, 2013
90
Joined
Sep 14, 2013
Messages
90
Yeah I guess that's the basic idea of it!

Haha, but really more like this:


Tonight I'm going to start playing with some RGBs like you suggested and see where I can get....
 

whiterabbit

Sep 14, 2013
90
Joined
Sep 14, 2013
Messages
90
Benchmark!

Been super busy with work and a couple other projects but I wanted to post an update here just so I can keep track of my progress!

Since the last post I've spent time working with both code and hardware. I found a good fader script that I was able to play around with to better fit my needs.

Pretty much all I did was modify it to work with 3 RGBs instead of just one. Also figured out a few other colors. Definitely still a work in progress, but again- just wanted to post a benchmark.

Code:
// Output
int redPin = 16;   // Red LED,   connected to digital pin 16
int grnPin = 15;  // Green LED, connected to digital pin 15
int bluPin = 14;  // Blue LED,  connected to digital pin 14

int leds[][3]={
  {16,15,14},
  {27,0,1},
  {24,25,26}
};

// Color arrays
int black[3]  = { 0, 0, 0 };
int white[3]  = { 100, 100, 100 };
int red[3]    = { 100, 0, 0 };
int orange[3] = { 100, 10, 0};
int yellow[3] = { 40, 95, 0 };
int green[3]  = { 0, 100, 0 };
int lturq[3] = { 0, 10, 8 };
int turquoise[3] = { 0, 50, 40 };
int blue[3]   = { 0, 0, 100 };
int dimWhite[3] = { 30, 30, 30 };
int lightpurple[3] = {100, 0 ,100};
int pink[3] = {100, 0 , 20};
int purple[3] = {90, 0 , 115};
// etc.

// Set initial color
int redVal = black[0];
int grnVal = black[1]; 
int bluVal = black[2];

int wait = 1;      // 10ms internal crossFade delay; increase for slower fades
int hold = 0;       // Optional hold when a color is complete, before the next crossFade
int DEBUG = 1;      // DEBUG counter; if set to 1, will write values back via serial
int loopCount = 60; // How often should DEBUG report?
int repeat = 3;     // How many times should we loop before stopping? (0 for no stop)
int j = 0;          // Loop counter for repeat

// Initialize color variables
int prevR = redVal;
int prevG = grnVal;
int prevB = bluVal;

// Set up the LED outputs
void setup()
{
  for (int i = 0; i <= 3; i++) {
    pinMode(leds[i][0], OUTPUT);   // sets the pins as output
    pinMode(leds[i][1], OUTPUT);   
    pinMode(leds[i][2], OUTPUT); 
  }

  if (DEBUG) {           // If we want to see values for debugging...
    Serial.begin(9600);  // ...set up the serial ouput 
  }
}

// Main program: list the order of crossfades
void loop()
{

  //crossFade(dimWhite);
  //crossFade(orange);
  //crossFade(purple);
  //crossFade(turquoise);
  crossFade(lturq);
  crossFade(black);
  crossFade(pink);
  crossFade(black);
  crossFade(orange);
  crossFade(black);
  crossFade(purple);
  crossFade(black);
  crossFade(turquoise);
  crossFade(black);
  crossFade(green);
  crossFade(black);
  crossFade(blue);
  crossFade(black);
  crossFade(purple);
  crossFade(black);
  crossFade(red);
  crossFade(black);
  crossFade(orange);
  crossFade(black);
  //crossFade(white);  
  //crossFade(red);
  //crossFade(green);
  //crossFade(blue);
  //crossFade(yellow);
  //crossFade(black);
/*(
  if (repeat) { // Do we loop a finite number of times?
    j += 1;
    if (j >= repeat) { // Are we there yet?
      exit(j);         // If so, stop.
    }
  }
*/
}

/* BELOW THIS LINE IS THE MATH -- YOU SHOULDN'T NEED TO CHANGE THIS FOR THE BASICS
* 
* The program works like this:
* Imagine a crossfade that moves the red LED from 0-10, 
*   the green from 0-5, and the blue from 10 to 7, in
*   ten steps.
*   We'd want to count the 10 steps and increase or 
*   decrease color values in evenly stepped increments.
*   Imagine a + indicates raising a value by 1, and a -
*   equals lowering it. Our 10 step fade would look like:
* 
*   1 2 3 4 5 6 7 8 9 10
* R + + + + + + + + + +
* G   +   +   +   +   +
* B     -     -     -
* 
* The red rises from 0 to 10 in ten steps, the green from 
* 0-5 in 5 steps, and the blue falls from 10 to 7 in three steps.
* 
* In the real program, the color percentages are converted to 
* 0-255 values, and there are 1020 steps (255*4).
* 
* To figure out how big a step there should be between one up- or
* down-tick of one of the LED values, we call calculateStep(), 
* which calculates the absolute gap between the start and end values, 
* and then divides that gap by 1020 to determine the size of the step  
* between adjustments in the value.
*/

int calculateStep(int prevValue, int endValue) {
  int step = endValue - prevValue; // What's the overall gap?
  if (step) {                      // If its non-zero, 
    step = 1020/step;              //   divide by 1020
  } 
  return step;
}

/* The next function is calculateVal. When the loop value, i,
*  reaches the step size appropriate for one of the
*  colors, it increases or decreases the value of that color by 1. 
*  (R, G, and B are each calculated separately.)
*/

int calculateVal(int step, int val, int i) {

  if ((step) && i % step == 0) { // If step is non-zero and its time to change a value,
    if (step > 0) {              //   increment the value if step is positive...
      val += 1;           
    } 
    else if (step < 0) {         //   ...or decrement it if step is negative
      val -= 1;
    } 
  }
  // Defensive driving: make sure val stays in the range 0-255
  if (val > 255) {
    val = 255;
  } 
  else if (val < 0) {
    val = 0;
  }
  return val;
}

/* crossFade() converts the percentage colors to a 
*  0-255 range, then loops 1020 times, checking to see if  
*  the value needs to be updated each time, then writing
*  the color values to the correct pins.
*/

void crossFade(int color[3]) {
  // Convert to 0-255
  int R = (color[0] * 255) / 100;
  int G = (color[1] * 255) / 100;
  int B = (color[2] * 255) / 100;

  int stepR = calculateStep(prevR, R);
  int stepG = calculateStep(prevG, G); 
  int stepB = calculateStep(prevB, B);

  for (int i = 0; i <= 1020; i++) {
    redVal = calculateVal(stepR, redVal, i);
    grnVal = calculateVal(stepG, grnVal, i);
    bluVal = calculateVal(stepB, bluVal, i);

    for (int i = 0; i <= 3; i++) {
      analogWrite(leds[i][0], redVal);   // Write current values to LED pins
      analogWrite(leds[i][1], grnVal);      
      analogWrite(leds[i][2], bluVal);
      delay(wait); // Pause for 'wait' milliseconds before resuming the loop 
    }





    if (DEBUG) { // If we want serial output, print it at the 
      if (i == 0 or i % loopCount == 0) { // beginning, and every loopCount times
        Serial.print("Loop/RGB: #");
        Serial.print(i);
        Serial.print(" | ");
        Serial.print(redVal);
        Serial.print(" / ");
        Serial.print(grnVal);
        Serial.print(" / ");  
        Serial.println(bluVal); 
      } 
      DEBUG += 1;
    }
  }
  // Update current values for next loop
  prevR = redVal; 
  prevG = grnVal; 
  prevB = bluVal;
  delay(hold); // Pause for optional 'wait' milliseconds before resuming the loop
}

Still need to figure out how I'm going to add another hundred plus PWM outputs, heh. Been looking through a lot of projects, most of which have been LED cubes and LED display grids and the like. Also still need to play around with digital input for each RGB to trigger the "color-hold n' fade" and then work out how to loop through the fading LEDs apart from the non-fading LEDs.
 
Top