Welcome, Guest

Author Topic: Olimex EKG bad signal acquisition and other stuff  (Read 5557 times)

youngz

  • Newbie
  • *
  • Posts: 13
  • Karma: +1/-0
Olimex EKG bad signal acquisition and other stuff
« on: January 13, 2017, 08:52:52 PM »
Hi, I am trying to reveal the ECG with the Olimex shield (EMG-EKG). Using the demo Arduino application (I am using an arduino leonardo, anyway on mega or uno, I have the same problem), I have a signal with only noise (see the video uploaded on https://youtu.be/-rJKjkUQp48). In order to reveal a correct signal, I place the electrodes on the wrists and left ankle. You can see the electrodes configuration and the shield settings on this album https://goo.gl/photos/jLXR38x648ZLSrWD7.

Can you sudgest how can I improve the performance in order to reveal a good ECG?

Regars

Edit: I have to ask another information. On the Olimex shield, there is a potentiometer, what is it use? And what is the use of the pins D4/D9? And the REF and CAL pins (those close to the jack)?

A last thing, what is the color correspondence between this https://www.olimex.com/Products/Duino/Shields/SHIELD-EKG-EMG-PRO/ and this https://www.olimex.com/Products/Duino/Shields/SHIELD-EKG-EMG-PA/open-source-hardware?
« Last Edit: January 13, 2017, 09:21:11 PM by youngz »

svan

  • Newbie
  • *
  • Posts: 45
  • Karma: +9/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #1 on: January 14, 2017, 10:16:24 AM »
> Can you sudgest how can I improve the performance in order to reveal a good ECG?

This application works for me: https://github.com/vsquared/ECG_UNO_Processing3_2_3

youngz

  • Newbie
  • *
  • Posts: 13
  • Karma: +1/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #2 on: January 14, 2017, 12:06:15 PM »
This software has the same results on my case. I think that I missing something in the electrodes settings or similar. What kind of electrodes cable are you using?

In addition, I do not understand why in this code the analog signal is shifted by 2.

svan

  • Newbie
  • *
  • Posts: 45
  • Karma: +9/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #3 on: January 14, 2017, 06:30:22 PM »
>What kind of electrodes cable are you using?

I used passive electrodes just like you did (blue wrist straps).  Make sure the connector end is inserted all the way in.

>I do not understand why in this code the analog signal is shifted by 2.

This is done to create 'byte' sized data.  Right shift by 2 is the same thing as dividing by 4.  Arduino output is 0-1023.  Serial communication transmits bytes, 0-255.   Furthermore, the output in a lower range plots nicely.  Otherwise, we would have to combine a high byte and a low byte to transmit larger numbers.

Other things that you can try:

1. Move as far away from the computer as you can.  Try using a longer USB cable if you are using a short one.

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1712
  • Karma: +42/-2
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #4 on: January 16, 2017, 01:43:35 PM »
The values that you get are very bad. There is something fundamentally wrong in your hardware setup. It is interesting to test what happens with the readings if there is no electrode connected at all - the graphic should be a straight line. This would also determine if the problem is more likely in the board-shield setup or in the electrode (or electrode placement).

I would highly recommend using only the Arduino UNO board for your initial testing (hopefully it is an Arudino UNO board with ATmega328). Make sure that the shield is properly inserted over the Arduino board using the Arduino shield headers.

Make sure to use our library and examples initially.

>>> I have to ask another information. On the Olimex shield, there is a potentiometer, what is it use? And what is the use of the pins D4/D9? And the REF and CAL pins (those close to the jack)?

Potentiometer can be rotated to lower or increase the amplification. Pins D4/D9 change the pin related to the bottom board that is responsible for the calibration signal that comes from the main board and the calibration signal is available at the CAL pins - you can ignore D4/D9 and CAL for now, these are used only when you want a number of SHIELD-EKG-EMG boards to be calibrated with the same machine generated signal at similar amplification. During production we calibrate all shields with the same signal.

The state of REF_E jumper, however, is important. If your main board generates analog voltage reference the jumper should be open (the cap would be removed). However, if your bottom board does not generate voltage reference -> you would need to close the jumper so that the shield can generate such a reference. Test with jumper off and then with jumper on.

Consider that there are a lot of videos submitted by customers in youtube that demonstrate the operation of Arduino UNO and SHIELD-EKG-EMG.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

youngz

  • Newbie
  • *
  • Posts: 13
  • Karma: +1/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #5 on: January 18, 2017, 01:42:38 PM »
Unfortunately, I no have any Arduino Uno at the moment. Anyway, I re-try with my Leonardo and standard software as you suggest.

Here there is the video.
  • Between 0-1:10 minutes, there is no electrode connected (is normal that the line does not stay in the middle, but near the bottom?)
  • Between 1:10-1:45, I connect the electrodes (only at the device, but not at my body)
  • Between 1.45-1:54, I move the shield
  • Between 1:54-2:40, I place the electrodes on my body
  • Between 2:40-3:40, I reveal the data with the elecdoder
  • Between 3:40-5:40, I try to adjust the potentiometer
  • Between 5:40-5:46, I move a little bit my body
  • Between 5:46-6:08, I reveal the data
  • From 6:08 to the end, I disconnect the electrode cable

I try also to clean the electrodes with some alcohol, anyway, the problem persists.
In this test, I used a USB extension (3 meters).

In addition, for future work, you think that can I use a jack extension, in order to extend the electrode cable?
« Last Edit: January 18, 2017, 01:46:30 PM by youngz »

svan

  • Newbie
  • *
  • Posts: 45
  • Karma: +9/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #6 on: January 18, 2017, 05:28:15 PM »
>Unfortunately, I no have any Arduino Uno at the moment.  I re-try with my Leonardo

In my tests the Leonardo should also work.

I normally use a one meter USB cable.  The 3 meter cable should be plenty long enough.  No need for a jack extension in my opinion.

There was one time in the video where it appeared that you were getting close; I think that it was when you were adjusting the potentiometer.  The spikes were not very tall however.  I have no experience with the software that you are using.  What is the name of the software?

For testing purposes only, I am curious what you get if you remove the shield and try the following code uploaded to your Leonardo.  The most important thing is to not give up.  It normally is not this difficult, but if you keep working, there should be a solution.

Code: [Select]
unsigned long LoopTimer = 0;
byte outputValue = 0;

const int LoopTime = 20000;

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

void loop()
{
  if (micros() >= LoopTimer)
  {
    LoopTimer += LoopTime;
    outputValue += 4;
    Serial.write(outputValue);
    Serial.flush();
  }
}


youngz

  • Newbie
  • *
  • Posts: 13
  • Karma: +1/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #7 on: January 18, 2017, 08:23:50 PM »
The software is ElectroGuru (is the software suggested by the producer). I try to perform your test and seems that everything works fine. You can see the video here. I used a processing program that you posted some time ago. ElectroGuru does not work with this type of data encode.

The jack extension is only for my comfort (the classic cable is too short).

Lastly, I never give up  ;D

svan

  • Newbie
  • *
  • Posts: 45
  • Karma: +9/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #8 on: January 18, 2017, 10:40:36 PM »
Unfortunately, the link to the video is broken and does not work.  Could you please re-enter it?  I really would like to see the output.

youngz

  • Newbie
  • *
  • Posts: 13
  • Karma: +1/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #9 on: January 19, 2017, 01:19:30 AM »
Oh, I am so sorry. The video is here: https://www.youtube.com/watch?v=jjHevfBGmcQ

svan

  • Newbie
  • *
  • Posts: 45
  • Karma: +9/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #10 on: January 19, 2017, 03:16:14 AM »
>The video is here:

That seems to be working correctly (I can see the sawtooth pattern).  Now try uploading the following code to your Leonardo:

Code: [Select]
const int analogInPin = A5;
unsigned long LoopTimer = 0;

int sensorValue = 0;

const int LoopTime = 10000;

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

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


Reattach your Olimex shield with the following settings:

Ref E      Closed
3V/5V      3.3 V
AIN SEL    A5(11,12 Closed)
D4/D9      D4

I use the following passive electrode lead placement:

L - left mid forearm
R- right mid forearm
D - right wrist

Make sure each electrode is making good contact with your skin.

Using one of the Processing programs connect to your USB port at 9600 baud.  I prefer the second app, because it is easier to use, but it's your choice.

You should see a nice electrocardiogram on the screen.  Please show us a video just as you have been; they are very helpful.

youngz

  • Newbie
  • *
  • Posts: 13
  • Karma: +1/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #11 on: January 20, 2017, 11:12:10 AM »
I try to perform your software, and the result is the same. In the afternoon I post the video about the result.
Anyway, after some tests, I noticed that holding the jack in the shield, the performance improves. It can be a cable problem? I test it on different shields.
« Last Edit: January 20, 2017, 11:16:01 AM by youngz »

svan

  • Newbie
  • *
  • Posts: 45
  • Karma: +9/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #12 on: January 20, 2017, 12:14:42 PM »
> It can be a cable problem?

Yes, it could be.  That's why in reply #3 I recommended that you be certain that the cable connector is pushed all the way in.  It should 'click' when it is fully inserted.  I've also seen the connector crack and split on an older electrode set.  I'm now on my second set.

youngz

  • Newbie
  • *
  • Posts: 13
  • Karma: +1/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #13 on: January 20, 2017, 08:22:03 PM »
Here is the video https://www.youtube.com/watch?v=6K8AYdL_T_0&feature=youtu.be

Anyway, I perform some test and almost all time the signal present a lot of noise. Tomorrow I try to use another cable with mono-use electrodes.

Svan, have you a plot on a revealed signal that you can post? I would like to see the goal to which I aspire  ;D

svan

  • Newbie
  • *
  • Posts: 45
  • Karma: +9/-0
Re: Olimex EKG bad signal acquisition and other stuff
« Reply #14 on: January 20, 2017, 10:17:30 PM »
Unfortunately, the link to the video puts up an error message that says the video is unavailable.  Could you try putting it up again?

>  have you a plot on a revealed signal that you can post

There is an image in the processing folder on GitHub.

https://github.com/vsquared/ECG_UNO_Processing3_2_3

Here is another image that came from ElectricGuru using a Leonardo board:

https://photos.google.com/photo/AF1QipMHUrBVrAn0E0gnck50oeUX376l4kzVDZBHPnlR

For grins I'm going to try to include the ElectricGuru image in this e-mail, but it might not work.