Olimex Support Forum

DUINO => SHIELDS => Topic started by: youngz on January 13, 2017, 08:52:52 PM

Title: Olimex EKG bad signal acquisition and other stuff
Post by: youngz 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 (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 (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/ (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 (https://www.olimex.com/Products/Duino/Shields/SHIELD-EKG-EMG-PA/open-source-hardware)?
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: svan 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  (https://github.com/vsquared/ECG_UNO_Processing3_2_3)
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: youngz 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.
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: svan 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.
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: LubOlimex 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
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: youngz 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 (https://youtu.be/_64yorxz71I).

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?
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: svan 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.


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();
  }
}

Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: youngz 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 (http://ttps://youtu.be/jjHevfBGmcQ). 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
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: svan 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.
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: youngz on January 19, 2017, 01:19:30 AM
Oh, I am so sorry. The video is here: https://www.youtube.com/watch?v=jjHevfBGmcQ
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: svan 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:


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.
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: youngz 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.
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: svan 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.
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: youngz 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
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: svan 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
(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
(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.
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: svan on January 21, 2017, 04:01:13 AM
>It can be a cable problem?

Is the connector bent upward(see arrow)?  It is flat on my shield.

https://photos.google.com/photo/AF1QipMzXaZ29bitcgXCJN8xijaqhnIJIGUr57KkSAQJ
(https://photos.google.com/photo/AF1QipMzXaZ29bitcgXCJN8xijaqhnIJIGUr57KkSAQJ)
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: youngz on January 21, 2017, 12:55:42 PM
The link to Google Photos does not work :( Now, I try to re-upload the video!
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: svan on January 21, 2017, 01:50:52 PM
>The link to Google Photos does not work

Can you see this?

Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: youngz on January 21, 2017, 02:47:50 PM
No :( It appear as a prohibition symbol.
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: svan on January 21, 2017, 03:12:16 PM
Are you able to download this image?

https://www.dropbox.com/s/4jz3fidrq4jc3qf/ecg_noise.zip?dl=0
(https://www.dropbox.com/s/4jz3fidrq4jc3qf/ecg_noise.zip?dl=0)
Title: Re: Olimex EKG bad signal acquisition and other stuff
Post by: marinix on January 30, 2020, 09:54:50 AM
Do you know if it's possible to apply EMG gel on the skin with SHIELD-EKG-EMG-PA electrodes?