Soldering our way from USB Type B to micro USB A | Processing plots for AD8232

We borrowed a USB isolator, but it has a Type B connector, and neither of our boards (MSP432 / Beaglebone) are happy about that (the Uno got burnt out.)

If I had an adapter, we could plug everything together and proceed with testing our new AD8232 kit! But no, we don’t have an adapter, so we soldered one.

Helpful pinouts:

[ source ]

[ source ]

The next step was to sample AD8232’s output using the MSP432. The quickest way forward was to go with CCS cloud and Energia. CCS cloud kept hanging on my computer, so here are Energia links:

[ Energia 16 ] [ xds110 drivers ]

Then I just went with the analog read example (basic.)

The [ hookup guide ] used Processing to plot the sampled data. I couldn’t get their processing sketch to give me a plot (blank screen, map complaining about NaNs.) So, after searching around, I found this alternative that plots lines inside of the draw call:

[ example online ]

I modified this slightly, based on the hook up guide, to only plot a line:

import processing.serial.*;
 
Serial myPort;        // The serial port
int xPos = 1;         // horizontal position of the graph
 
float fValue;
float height_old = 0;

boolean newVal = false;
 
void setup () {
  size(1040, 240);
 
  // println(Serial.list());
  myPort = new Serial(this, Serial.list()[1], 115200);
// change the index [1] to match the serial port being used
  myPort.bufferUntil('\n');
  background(0);
  stroke(127, 34, 255);
}
 
void draw () {
  if (newVal) {
    line(xPos, height_old, xPos, height - fValue);
    if (++xPos >= width) {
      xPos = 0;
      background(0);
    }
    newVal = false;
    height_old = height - fValue;
  }
}
 
void serialEvent (Serial myPort) {
  String inString = myPort.readStringUntil('\n');
  if (inString != null) {
    inString = trim(inString);
    fValue = float(inString);
    fValue = map(fValue, 0, 1023, 0, height);
    newVal = true;
  }
}

Here’s another alternative to try out: [¬†plotly arduino API ]

The plot I am getting at the moment:bad_output

This is clearly NOT my ECG. I think the AD8232 isn’t messing up, but the sampling on the MSP432 (based on just a delay call), and the plotting itself in Processing 3 need to be optimized.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s