SparkFun Forums 

Where electronics enthusiasts find answers.

Questions &/or issues related to products in the Biometrics category should be posted in this forum.
#202304
Hello,

I'm trying to use Sparkfun's Single Lead Heart Rate Monitor AD8232 (https://www.sparkfun.com/products/12650) module to record the ECG signal. I need to have a frequency around 360Hz, but the maximum I get at 9600 baudrate is around 194 on Arduino, if I read the signal through the serialPort using serialport.io it's even smaller. To get more speed I have increased the baud rate, to 57600 but the signal gets very noisy.

I do not understand why it happens and I do not find the specification in Arduino or in the AD8232 specifications. Somebody could help me?
#204483
I had the same noise issue. Be sure the electrode leads are not laying flat along your body and not near other electronic devices. Also, I changed the processing sketch to clean it up. Kudos to Processing Forum for giving me education on how this works. My processing sketch below. It automates the serial port identification and places code in sections where it belongs. Note the line: xPos = xPos += 2; It adds 2 pixels to each new reading and smooths out the line at 38400. Hope it helps:

import processing.serial.*;

Serial s; // The serial port
int xPos = 1; // horizontal position of the graph
float height_old = 0;
float height_new = 0;
float inByte = 0;
static final int PORT_INDEX = 0, BAUDS = 38400;
String hrNumber = "";


void setup () {

noLoop();
final String[] ports = Serial.list();
printArray(ports);
new Serial(this, ports[PORT_INDEX], BAUDS).bufferUntil(ENTER);
size(1900, 400);
}

void serialEvent(final Serial s) {
hrNumber = s.readString().trim();
redraw = true;
println(hrNumber);

}

void draw ()
{
// background(0xff);
if (hrNumber.equals("!")) {
stroke(0, 0, 0xff); //Set stroke to blue ( R, G, B)
inByte = 200; // middle of the ADC range (Flat Line)
}
// If the data is good let it through
else {
stroke(0xff, 0, 0); //Set stroke to red ( R, G, B)
inByte = float(hrNumber);
}

//Map and draw the line for new data point
inByte = map(inByte, 0, 1023, 0, height);
height_new = height - inByte;
line(xPos - 1, height_old, xPos, height_new);
height_old = height_new;

// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
background(0xdd);
} else {
// increment the horizontal position:
xPos = xPos += 2;
}
}