November 16, 2024, 01:43:47 AM

Need help with EKG/EMG shield

Started by tarancepil7, May 08, 2020, 03:17:08 PM

Previous topic - Next topic

tarancepil7

I bought an EKG/EMG shield from Olimex and am using it to get muscle activity readings from the EMG. Thing is, the Olimex documentation tells me to download a software names ElecGuru, which straight plots the values outputted by the EMG electrode to a graph. I wish to obtain the numerical data of this reading and use it to perform actions such as activating an LED. Does anyone know how I can do that? I'm a beginner to Arduino, so any help would be appreciated. Couldn't find anything online. Thanks!

svan

Arduino sketch (UNO)
const int analogInPin = A5;
unsigned long LoopTimer = 0;

int sensorValue = 0;

const int LoopTime10000 = 10000;

void setup()
{
   Serial.begin(9600);
}

void loop()
{
  if (micros() > LoopTimer)
  {
   LoopTimer += LoopTime10000;
   sensorValue = analogRead(analogInPin);           
   sensorValue = sensorValue >> 2;
  // Serial.write(sensorValue);
   Serial.println(sensorValue);
  }
}

This code may be run in the Arduino IDE (available on their website if you don't already have it) and the data printed out by selecting Tools/Serial Monitor.  Note that the input comes from A5 which requires a jumper across pins 11 and 12 (AIN SEL).  The sensor value does not need to be bit shifted by 2 depending on what you are doing with the data.  The demo does it that way in order to get a smaller number which will allow plotting on a 240 pixel high led screen.  Post back if you need more assistance.