Pulse Necklace 01Oct2009

From Noisebridge
Revision as of 01:28, 2 October 2009 by SpammerHellDontDelete (Talk | contribs)

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

Contents

[edit] Hack Notes, pulse choker, Oct 1st, 2009

[edit] Assembling Choker

Eric was busy tonight, so I’m filling in on the notes. This evening I cut out our prototype #2 choker and added a fastening at the back. The fabric was just long enough to fit around my neck, so I needed to add an extension. We originally planned on fastening the choker with snaps, but since an extension was necessary, I opted for Velcro.

To cover up the wiring a bit, I added fabric extensions at the bottom where the silver painted traces met the wires.

[edit] Reinforcing Connections

I attempted to make the connection between the silver traces and wires better, but it didn’t alter the final result: only 2 of the 5 LEDs light up. The additions I made were to properly sew conductive thread around the wire up into the silver traces. Since that relied on tension in the thread to bridge the gap between the silver paint and wire, I coated it with some silver conductive epoxy. The epoxy improved one of the two problematic connections we had from Tuesday’s hack session. In the end, the multimeter read out ~80 ohms for the power line (3rd trace counting from the left of the ‘T’) and ~15 ohms for the ground line of the center LED (4th trace counting from the left of the ‘T’).

[edit] Problematic Lighting of LEDs

Eric dropped off his programmer board, so I linked my laptop up to our breadboard. Not all of the LEDs lit up, so I went through our code to power each LED alone. The OuterTwosLeft, CenterGrd, and MiddleRight LEDs were not and still are not working. The OuterTwosLeft does light up though, if you push down on where the wire meets the fabric.

[edit] Finicky Reading of Heart Rate

After testing out the LEDs, I proceed to stick a couple red dot electrodes on my chest. Upon uploading the code, the two functional LEDs blink in time with my heartbeat. But shortly afterward, perhaps 20 seconds later, the LEDs resort to flickering like a candle flame. It’s not a consistent signal as with Eric. =(

I tried moving the electrode in different positions around my heart, but that didn’t decrease the flickering. More work will be needed.


[edit] Code

I didn’t alter the code aside from adding a couple comments. In any case, the current version of our code is below:

// Pulse Choker
// Chung-Hay and Eric
// Oct 1st, 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; // Left, right w/r/t to viewer, not wearer
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);   // 0 = lit  // this LED not working, unless you push down at wire connection area
    digitalWrite(OuterTwosRight, 0);
    digitalWrite(CenterGrd, 0);  // this LED not working
    digitalWrite(MiddleLeft, 0);
    digitalWrite(MiddleRight, 0);  // this LED not working  
  }
  else
  {
    digitalWrite(OuterTwosLeft, 1);  // 1 = off
    digitalWrite(OuterTwosRight, 1);
    digitalWrite(CenterGrd, 1);
    digitalWrite(MiddleLeft, 1);
    digitalWrite(MiddleRight, 1); 
  }
  //Serial.println("test");
}

Personal tools