First off, the picture :)
Circuit diagram
Here is the scheme, I am using the typical instrumental amplifier(ins amp) and then another op amp to get some more gain. An ins-amp is like an op-amps but with a huge CMRR, I am using a AD8221 which comes in a tiny small package, it's lead pitch is only 0.65mm, if you want to know what I did to create a simple breakout board please follow this link.
I'm using a single supply for the amps that comes from the arduino 5V pin, and I am creating a buffered virtual ground, this is really important.
Here is, a bit dark, a pic of the setup in the breadboard.
Tricks of the trade:
This is what makes the difference between a working ECG and a non working one :)
The main problem is that the device is so sensitive that it get interference from almost everywhere, specially the mains hum at 50hz). As you can see I got a clean signal, and I am not using any kind of serious filtering, note that xoscillo has a low pass filter and I am not even using it, so what are the tricks?
- Run it from a laptop and unplug the charger!
- Don't use a second monitor, the HDMI port will cause all sorts of high frequency interferences
- Get about 1 meter away from the laptop
- Buy some serious ECG electrodes, mines are "H124SG * Ø 24 mm", they come in a box of 50 and should cost about 11 euros.
That's all, if you like it or build it or need help feel free to write a comment, it will encourage me to write more articles :)
Hi, cool project. But I have a small remark to your schematic: As it's drawn, the 2nd OP does not add any gain at all.
ReplyDeleteAll the components around the LM324 in the upper right are completely insignificant compared to the impedance of the opamp inputs, it's just operating as a 1:1 voltage mirror (the leakage of the 10uF probably is likely enough so that there's no noticeable voltage shift).
Also, instead of generating the 2.5V from the +5V supply voltage, you might be able to use the 1.1V stabilized reference of the ATMega on the analog reference pin (if you configure it right). It might be more stable than your Vcc supply (especially if you drive some additional loads).
http://goo.gl/eVg7o
Will you please give full corrected figure?
DeleteDoh! Good catch! Actually I made a mistake when I wrote down the circuit, thanks for pointing it out! I have just corrected it now.
ReplyDeleteGood tip about using the 1.1V I'll give it a go.
thank for your remarks!
Can this be ported to run on a Raspberry Pi a computer/laptop isnt needed? The HDMI/Power issues will need resolving but a "TVcg" would be a powerful tool for "Doctors without Borders", etc.
ReplyDeleteI am impressed my friend! Very clean signal. Props!
ReplyDeleteare you having electrolyte imbalance issues? it appears your re-polarization phase is elongated. you might be calcium deficient.
ReplyDeleteThanks for the comments! This project ca be used with anything that has an ADC so a raspberry PI woudl be a good candidate too.
ReplyDeleteTheVirus911, you mean the biphasic T wave? Yep I was told is technically abnormal and I may be getting a proper one to see what's up.. it could be that my ECG is distorting the signal somehow too.. thanks for pointing it out though!
Very nice work !!! i'll try it soon :D
ReplyDeletedoes it works bro?
DeleteThis comment has been removed by the author.
ReplyDeleteNice rhythm, though you have a very pronounced T wave.
ReplyDeleteAnother cool project! Keep up the great work, I love reading this blog !
ReplyDeleteHi,
ReplyDeleteas I understand, there are two filters: first is the high pass filter for 3.18 Hz, and second is the low pass for 49.8 Hz. Am I right?
If yes, the question is: why in high pass filter the resistor and capacitor are connected in serial whereas in low pass they are connected parallel? And why 3.18Hz for high pass filter? I am new to electronics and I just found your website -it is great!
how to use the Xoscillo
ReplyDeleteHi Raul,
ReplyDeleteI'm trying to replicate your project but I have some problems...
First of all I had to replace the AD8221 you wrote with an AMP04F either because I didn't find the part and because is much easier to plug in a breadboard (it's a DIP packaging!)
Using your fantastic Xoscillo I can see only a lot of noise , as you can see here
https://docs.google.com/file/d/0B43ENY9K5_IvZmFSLVB1aFRBbVk/edit?usp=sharing
and nothing that seems like an ECG...
To avoid external interferences I wrapped the breadboard with aluminium foil... but the result is the same...
Thanks a lot for your time!
Simone
Hello Raul,
ReplyDeleteI have designed just like yours, I took ECG signal from an ECG simulator and used an Instrumentation amplifier AD620 ann filtered using low pass filter. Then I will convert the signal into a square wave by using an analog comparator. This wave will be provided to arduino uno R3 which count the beats (high) from the signal and displays heart rate per min on a LCD.
Now I want to display the ECG signal on my PC through Arduino, Plz help me in this regard..
Thanks
This comment has been removed by the author.
ReplyDeleteSimone,
ReplyDeleteSorry for the delay. Did you unplug your laptop from the mains? It should be running on the batteries. Are you sure your circuit is running as intended? I'd try to lower the gain lets see what happens too.
Mehwish Iqbal,
ReplyDeleteAs for displaying the signal in oscillo you need to set the settings is xoscillo exactly as I did and you should see a curve. Use a low sampling rate that is the main thing.
Hi Raul - this looks like a great project I want to try this weekend. Is the arduino source code availabe ?
ReplyDeleteThanks
hello
ReplyDeletecan I have the cording of this ecg project.I have stuck with it
thank u
This comment has been removed by the author.
ReplyDeleteHi, really cool project. I am trying to emulate your project and see what kind of output I get. Have you changed to circuit or values of the caps and resistors any further ? If so could you please update the new schematic or reply to this comment with details ? I would really appreciate it.
ReplyDeleteHi, really cool project. I was trying to emulate your project to see what kinda output I get but I couldn't get good results. I used the exact values for caps and resistors like you had in your schematic. I also used the exact same op amps and inst amps. Did you update the schematic any further ? I do not know what am I doing wrong.
ReplyDeletecoding please!!!
ReplyDeleteWill you please give final corrected circuit figure?
ReplyDeleteVery nice article. I recommand it to my friends, visit here ALOKA UST-52101
ReplyDeletethanks for this useful article,I,ll recommand it to my friends and I,ll be back again and again,Visit Our blog for more info.
ReplyDeletedo u have anr code fr dis....if have plzz snd it
ReplyDeletedo u have anr code fr dis....if have plzz snd it
ReplyDeleteVery nice post, impressive. its quite different from other posts. Thanks for sharing.
ReplyDeleteTOSHIBA PVM-375AT
code plzz :)
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHello Raul,
ReplyDeleteI just discovered this Minimal ECG project of yours.
I have a question. In the pics with breadboard there are three sensor pads. On the schematic I can see two pads from the chest connected to the inputs + and - of the AD8221. The question is where is the third pad maked on the body as "REF" connected to in the schematic? There is a "REF" marked in the schematic, but I am not sure if that is the same "REF" on the body that does not have a line to show where it connects on the schematic.
Thanks,
John
P.S. This is a repost of my last post as I do not seem to be able to edit it to correct what was not that bad typing. The site seemed to have moments of unannouonced interaction as I typed. Same challenges with unannounced interactions as I typed this PS after correcting the errors occurred as well. Opps, now the site shows I can delete my last post that had some typo errors that were a bit messy. I will delete so only this corrected post shows. John
please give schematic and coding to amuthaece79@gmail.com
ReplyDeletecould you send the code too?
ReplyDeleteIs the reference electrode, which is the third electrode, attached to the leg and is this electrode attached to the reference electrode in the circuit? What if we put him in a coke?
ReplyDelete