Meeting at Barbara’s

26-06-2008 from 11-15.30 @ Barbara’s, present: Anja, Barbara, Danielle (from 11:45)

We had a great time testing the new heart-rate sensorand combining our results into a graph. Our heart-rates varied from 61 to 84 (we had the Suunto watch as a back-up) but although the graphs looked very different when we counted the dents the values seemed the same. So in the train I started to program a little program to count the differences in the values. This is what it looks like:

// process_data.pde look for differences between numbers
int counter = 0;          // count the differences
int old_val = 0;          // stores previous value in csv file
int current_val;          // stores current value in csv file
int dif = 1;              // difference between 2 readings, change the number to look for bigger difference between numbers
//
// read csv file
String lines[] = loadStrings("output_org.csv"); // change the name of the file to read from
//println("there are " + lines.length + " lines");
for (int i=1; i < lines.length-1; i++) {
  //println(lines[i]);
  current_val = int(lines[i]);
  // look for difference
  print("dif= ");
  print(current_val - old_val);
  print(", ");
  if (abs(current_val - old_val) >= dif){
    print("counted dif= ");
    println(abs(current_val - old_val));
    counter++;
  }
  // make current value the old_value
  old_val = current_val;
}
println("bpm: ");
print(counter);

What I discovered is that you look for a difference of 1 the count is too high and when you look for a difference of 2 or more the count is too low. When you add these two counts together you and divide them by 2, 2 out of 4 times you get the right value!?
I now want to change the program so that the size of the difference is taken into account.

Here you can download the xls files with our data and here you can download the program above with text files which you can import.

The next step will be to

  • Improve the counter program
  • Make a design/prototype for the sensor
  • Change the potmeter to a resistor

Our next meeting will be either the 24th of July or the second half of August.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.