Pulse Necklace 29Sept2009

From Noisebridge
Revision as of 15:45, 10 June 2012 by 31.172.30.4 (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

[edit] Hack Notes, pulse choker, Sept 29th, 2009

[edit] LED Wiring Lesson

We got a lesson from Mitch on how to wire up LEDs.

Good: each LED has it's own resistor to ground Sorta Good: two LEDs in series, resistor to ground BAD: LEDs in parallel, resistor to ground

Unfortunately, we did BAD. This resulted in us not being able to turn on both of the outer control lines at the same time. To fix it, we have simply desoldered the second LED from the outer lines.

We have a new design for a stencil that will allow us to have a large number of LEDs on the outer control grounds. Basically, provide a non-connected trace between the PWR and GND traces, so that we can solder the LED to the non-connected trace, and then a resistor from non-connected to GND. Have that non-connected trace split into as many parts as you want LEDs on the outer control line.

[edit] Problem with Connecting Fabric to Wires

We're still having serious problems with the connection between the fabric and the wires which go into resistors and then into the Arduino. Basically the wires move around, and end up tearing out from their solder job to the fabric. We need some strain relief. Mitch recommends that we try hot glue. We used some conductive thread to try to tie the wires down and re-wire them into the conductive paint (esp. for wires where the solder job is no longer conducting). But this didn't work all that well - the conductive thread really needs to be tight to connect with the paint/solder, and it doesn't stay tight. We think once we have acetone and can paint over the thread that will make this awesome again. In the mean time the power rail isn't working very well.

[edit] Arduino Code Improvements

We added the new pins and some signal-averaging for the ECG signal. We also added a 100-point rolling average with stdev calculation. The LED flicker threshold now triggers based on the average and stdev - this should be more robust for person-to-person changes in ECG output.

// Pulse Choker
// Chung-Hay and Eric
// Sept 29th, 2009

// Control 5 different lines of LEDs based on EKG
// Center top line is 5V shared across all LEDs
// EKG input pin = pin 2

int OuterTwosLeft = 13;
int MiddleLeft = 12;
int CenterGrd = 11;
int MiddleRight = 10;
int OuterTwosRight = 9;
int val = 0;
int minval = 10000;
int maxval = 0;
float avg = 160;   // common value, better than initing to zero
float stdev = 40;
int i;

void setup() {
  pinMode(OuterTwosLeft, OUTPUT);  
  pinMode(OuterTwosRight, OUTPUT);
  pinMode(MiddleLeft, OUTPUT);
  pinMode(MiddleRight, OUTPUT);
  pinMode(CenterGrd, OUTPUT);
  digitalWrite(OuterTwosLeft, 1);
  digitalWrite(OuterTwosRight, 1);
  digitalWrite(MiddleLeft, 1);
  digitalWrite(MiddleRight, 1);
  digitalWrite(CenterGrd, 1);  
  
  Serial.begin(57600);          //  setup serial
}


void loop() {
/*   digitalWrite(OuterTwosLeft, 1);
   delay(500);
   digitalWrite(OuterTwosRight, 1);
   delay(500);
   digitalWrite(MiddleLeft, 1); 
   delay(500);  
   digitalWrite(MiddleRight, 1);  
   delay(500);
   digitalWrite(CenterGrd, 1);
   delay(500);
   
   digitalWrite(OuterTwosLeft, 0);
   delay(500);
   digitalWrite(OuterTwosRight, 0);
   delay(500);
   digitalWrite(MiddleLeft, 0); 
   delay(500);  
   digitalWrite(MiddleRight, 0);  
   delay(500);
   digitalWrite(CenterGrd, 0);
   delay(500);
*/

  val = 0;
  for (i=0; i < 8; i++)
  {
    val += analogRead(2);    // read the input pin
  }
  val = val/8;
  if (val > maxval)
    maxval = val;
  if (val < minval)
    minval = val;
  avg = avg*99.0/100.0 + (float)val/100.0;
  stdev = sqrt ((stdev*99.0/100.0)*(stdev*99.0/100.0) + ((float)val-avg)*((float)val-avg)/100);
  Serial.print(val);
  Serial.print("  ");
  Serial.print(minval);
  Serial.print("  ");
  Serial.print(maxval);             // debug value
  Serial.print("     ");
  Serial.print(avg);
  Serial.print("  ");
  Serial.println(stdev);
  
  if (val < (avg-stdev))
  {
   // Serial.println(val);             // debug value
    digitalWrite(OuterTwosLeft, 0);
    digitalWrite(OuterTwosRight, 0);
    digitalWrite(CenterGrd, 0);
    digitalWrite(MiddleLeft, 0);
    digitalWrite(MiddleRight, 0);  
  }
  else
  {
    digitalWrite(OuterTwosLeft, 1);
    digitalWrite(OuterTwosRight, 1);
    digitalWrite(CenterGrd, 1);
    digitalWrite(MiddleLeft, 1);
    digitalWrite(MiddleRight, 1); 
  }
  //Serial.println("test");
}

[edit] Equipment to Bring Next Time

Needles & Thread

Acetone

Fabric scissors

Softer silkscreen fabric

Snaps

Personal tools