Why the reading of AD8232 is noisy when sending data to more than 9600 baud?

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?

Why not try 19200 since it’s not only double 9600 but double your 194 which puts you at 388Hz?

Don’t know what would cause this, but you might try dropping a 10uF cap across 3.3V and GND and see if that helps clear things up.

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;

}

}