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?
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)?
> 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)
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.
>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.
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.
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).
- 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?
>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;
if (micros() >= LoopTimer)
LoopTimer += LoopTime;
outputValue += 4;
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
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.
Oh, I am so sorry. The video is here: https://www.youtube.com/watch?v=jjHevfBGmcQ
>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;
if (micros() > LoopTimer)
LoopTimer += LoopTime;
sensorValue = analogRead(analogInPin);
sensorValue = sensorValue >> 2;
Reattach your Olimex shield with the following settings:
Ref E Closed
3V/5V 3.3 V
AIN SEL A5(11,12 Closed)
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.
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.
> 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.
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
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.
Here is another image that came from ElectricGuru using a Leonardo board:
For grins I'm going to try to include the ElectricGuru image in this e-mail, but it might not work.
>It can be a cable problem?
Is the connector bent upward(see arrow)? It is flat on my shield.
The link to Google Photos does not work :( Now, I try to re-upload the video!
>The link to Google Photos does not work
Can you see this?
No :( It appear as a prohibition symbol.
Are you able to download this image?
Do you know if it's possible to apply EMG gel on the skin with SHIELD-EKG-EMG-PA electrodes?