Electrocardiography is the study of the electrical signals produced by the heart during the cardiac cycle. Doctors monitor a person's electrocardiogram (ECG) in order to assess how the heart is functioning and can be used to diagnose a variety of cardiac diseases. The ECG is thought to have first been discovered by Alexander Muirhead[1] and has become a hallmark in patient care. It turns out that an ECG is very easily obtained with a few common circuit components. I'll show you how to build a "Super Simply Electrocardiogram (ECG) Circuit."

This Instructable assumes that you know a few basic concepts of circuit design and analysis such as:
Nodal Analysis
Operational Amplifiers
If you are a bit shaky on these topics, please consult the links provided for additional information.

[1] "Electrocardiography." Accessed: November 5, 2016. <https://en.wikipedia.org/wiki/Electrocardiography>

Warning: Please do not connect your ECG circuit to a wall outlet or any instrument powered through the wall outlet for safety reasons.
Warning: This is not a medical device.

Step 1: Gather Your Tools

Instrumentation Amplifier
1 x AD623

1 x 1k

Power Supplies
(2 lithium polymer batteries are suggested. That would give you +/- 3.7V.)
Warning: Please do not connect your ECG circuit to a wall outlet or any instrument powered through the wall outlet for safety reasons.

3 x ECG electrodes
3 x Test leads

Step 2: Instrumentation Amplifier

The Instrumentation Amplifier is probably the hallmark amplifier for bioelectrical measurements for a number of reasons, most notably: (1) high input impedance and (2) very good common mode rejection. High input impedance ensures that we do not draw current from the system that we are measuring. Since we are connected to a biological system, drawing current from that system can actually be dangerous in some instances. Additionally, electrodes are often used to interface the biological system with the circuit. We usually use metals as electrodes, which are very good conductors of electricity. Unfortunately, the impedance of an electrode can vary unpredictably when placed into a biological system for a number of reasons. Using a high input impedance amplifier helps us nullify the effects of changing electrode impedance and maintain signal integrity.

Common mode rejection allows us to diminish the effects of background signals that distort our measurement, often called common mode noise. Instrumentation amplifiers are specifically designed to ensure we reject as much common-mode noise as we can. This parameter is reported in the amplifier's "datasheet" which is essentially the amplifier's spec sheet produced by the manufacturer of the device. You will typically find CMRR (Common Mode Rejection Ratio) or CMR (Common Mode Rejection) reported as a function of frequency and is given in units of "dB." dB stands for "decibels" and is a logarithmic relationship of voltage gain.

CMRR and decibels are a bit out of the scope of this Instructable. Please see the links for more information.

Step 3: Electrode Connections and Powering the Amplifier

There are many places on the body to put your electrodes to record the ECG. For this demo, I placed electrodes on my right wrist, my left wrist, and my right ankle. The right wrist electrode is "Electrode 1." The left wrist electrode is "Electrode 2." The right ankle electrode is attached to ground.

Additionally, power the op amp by placing +5V at "+Vs" (pin 6) and -5V at "-Vs" (pin 4).

Step 4: That's It!

For the most part, that's all you need. The rest of this tutorial adds a few components based upon how you decide to configure your instrumentation amplifier.

Step 5: Gather Your Tools

For the rest of this Instructable, I will use a modified circuit to use a "single supply" with my amplifiers. We need a few more components.

Instrumentation Amplifier
1 x AD623

Op Amps
1 x MCP6002

1 x 1k
1 x 10k
1 x 820k
1 x 1.47M

3 x 470nF

Power Supplies
(1 lithium polymer battery is suggested. That would give you +3.7V. I powered mine through 5V on the Arduino, however, with my Arduino disconnected from mains.)
Warning: Please do not connect your ECG circuit to a wall outlet or any instrument powered through the wall outlet for safety reasons.

3 x ECG electrodes
3 x Test leads

Step 6: Modifying Our Instrumentation Amplifier With a Vref Generator

I often use "single supply" amplifiers for convenience. Many amplifiers are powered with a "bi-polar supply" meaning that you have to give the amplifier a positive and a negative voltage for it to operate correctly. Some amplifiers are specified for "single supply" operation meaning you only need a positive voltage and ground to operate the amplifier. This is really convenient because it allows us to operate amplifiers with very small batteries such as lithium polymer battery (3.7 V) or even a few AAA batteries (1.5 V). Single supply operation is even more convenient when using a microcontroller with our amplifiers. Microcontrollers most often work with a single voltage supply (for example, the Arduino UNO runs off 5 V).

Single supply operation poses a bit of a problem, however, for using our instrumentation amplifier for measuring ECG. Our ECG waveform is AC (alternating current) and will alternate between positive and negative voltages. As a result, we will use a Vref (voltage reference) generator, that will provide an offset voltage for the output of our instrumentation amplifier. This ensures that the output voltage of the instrumentation amplifier will never be negative. We will set our Vref generator to 1/2 of the positive supply voltage. In my case, I powered by circuit with 5V. My Vref generator is then 2.5V.

Step 7: Electrode Connections and Powering the Amplifier

Electrode connections are the same as Step 3. The right wrist electrode is "Electrode 1." The left wrist electrode is "Electrode 2." The right ankle electrode is attached to ground.

However, the power connections for our amplifier change slightly. Power the op amp by placing +5V at "+Vs" (pin 6) and Ground at "-Vs" (pin 4). Also, place the output of the Vref generator at "REF" (pin 5).

Step 8: Additional Gain Stage: Active Highpass Filter

You may find that your signal is not big enough, even after putting a bit of gain on the instrumentation amplifier. If you do, an additional amplifier circuit will do the trick. Any number of amplifier configurations will work, but for reference sake I used an inverting amplifier. Notice from the diagram, we are also doing a bit of filtering in this stage as well, making this stage an "active highpass filter."

You may notice a few deviations from the typical inverting amplifier configuration that you may be familiar with. First, instead of placing a ground at the non-inverting pin, we actually place our generated reference voltage from step 6. Secondly, we include a high pass filter at the input of our inverting amplifier. This filter has a pretty specific purpose. Even though we used a Vref generator for our instrumentation amplifier to ensure that our output is maintained at a specific voltage level, small deviations from this level can occur. (Reasons for the deviations will be explained in Step 10). As such we use a high pass filter to block the unstable voltage level and re-center the signal at our generated reference voltage. Recall from op amp rules that the voltage at the inputs of our op amp are equal. Therefore, if the voltage at the non-inverting pin is Vref, then the voltage at the inverting pin is also Vref. Furthermore, because we use a high pass filter at the input of the amplifier, there will be no DC gain by our inverting amplifier and our output voltage will also be centered around Vref.

Step 9: That's It! (Again)

You're done! No matter how many times I do this project (and it's a lot), I still get a kick out of it. It think it's pretty cool. Anyways, until next time. Enjoy!

Step 10: A Few Pitfalls

The above video demonstrates what my ECG signal looked like when a number of the following guidelines were not followed.

Electrode connections

  • Electrode placement and contact is essential for obtaining a stable ECG signal. Please ensure that your electrodes have very good contact with the skin and are not drying out. Please use electrode gel to ensure your electrodes remain moist.
  • We usually pick up small DC voltages with our electrodes that will subsequently be amplified by our Instrumentation amplifier. If you notice that the output of your instrumentation amplifier goes to the maximum or minimum voltage, please decrease the gain of the amplifier. You can also check the DC offset voltage on your electrodes by measuring the DC voltage at each of inputs of the instrumentation amplifier. If the difference in the DC voltage of each of your inputs multiplied by the gain of your amplifier is very large, then your signal is will be distorted by causing a strong deviation from our bias point that we set in Step 3. Try adjusting the electrodes to ensure firm contact with your skin and/or apply electrode gel to ensure a good connection.

Amplifier Considerations

  • I have noticed that any resistance smaller than 1k for Rg causes unstable behavior in the amplifier.

Power-on Sequence

  • I suggest connecting all your electrodes to your circuit, including ground, before turning your circuit on. If the inputs of your instrumentation amplifier are not connected to a reference point before the amplifier is turned on, they could "float" unpredictably causing the output of your amplifier to be unstable. Immediately connecting your electrodes may not solve this problem as the amplifier has to re-adjust quickly and may not have a proper path to discharge the its output.

General Guidelines

  • Stay still. Moving around will distort your signal.
  • Stay relaxed. Tensing your muscles will causes distortion by picking up electrical signals from skeletal muscles instead of the heart.

Step 11: Going on Further

There is MUCH, MUCH more we can do to this circuit to make it robust. The purpose of this Instructable was to provide the minimal circuitry necessary to obtain a reasonable ECG signal. I have presented the circuit I used to do just that. I attached screenshots of a mock-up of a more involved circuit design. Please note that this design was simulated and not built. I have also included the magnitude vs. frequency response of the circuit.You can modify the simulation on Circuitlab.com. Please feel free to search the web for more sophisticated implementations of the ECG circuit, but what I have presented should get you going. Have fun!

<p>There's an inconsistency here. If you build yourself an ECG, heart-monitoring machine, ie a kit of parts with wires to wrists and ankles, you all worry you might get electrocuted by your 5v mains PSU. But if you instead built say a radio or anything else powered by that same PSU, you would not be in the slightest concerned if you touched live wires during the construction process because its only 5v. But thats the same 5v, connected to your hands. Its either dangerous in both circuits or safe in both circuits - completely irrelevant that one happens to be measuring your heart.</p><p>I suggest to you that this circuit is perfectly safe, unless your mains adaptor is faulty - then it is dangerous whatever the circuit you construct!</p><p>The body has a high resistance and is immune to low voltages like this. I am not in the slightest concerned to grab the terminals of a 12v car battery one in each hand.</p>
<p>It's not the same thing - here you are deliberately connecting the terminals to the skin in such a way that the heart is on the path between them, and likely leaving the connection in place for some time. So the consequences of your mains adaptor developing a fault, unlikely as that may be, can be far worse.</p><p>I pull the cord out of my lawnmower before clearing the blade, even though there's very low likelihood the power switch will fail closed while I'm doing it.</p><p> There is no failure mode of a battery, as far as I know, which can cause it to generate 110V AC or similar by itself.</p>
<p>Great point. Thanks for posting this. For a small battery, 9V, I would say the risk is relatively minimal. Plus mains is AC which crosses the body a lot easier due to the capacitance associated with the body model and electrode-electrolyte interface. Oh and the obvious fact that 110V AC is MUCH higher than 9V from a battery. Lol.</p>
<p>Hola amigo me gustaria saber como realizo ese proyecto. Gracias</p>
You're welcome dude. Thanks for the compliment.<br><br>De nada. Aprecio su cumplido!
<p>Hello</p><p>Nicely done and something close to my heart (no pun).</p><p>As an ICD (Implanted Cardiac Device) patient , I owe a lot to ECG's not only for the diagnosis of my condition (complete heart block, so no natural pacemaker function) and to the wonderful device that keeps me ticking over.</p><p>The ICD is a wonder of micro-electronics and presumably has all the circuitry you describe plus a lot more to store events, be interrogated contact-free and decipher what remains of my natural pacemaker before administering the correct electrical pulses. I am on ICD number two, the old one failing after 11-years use.</p><p>I often wonder what patients did before basic electronics were invented.</p><p>Much as I like the project, I don't think I will be trying it out, too risky.</p><p>I measured a cheap PSU output and although it showed 12-V dc across the LV side, it was 120-V relative to ground, safer to stick with batteries.</p>
<p>how about the V1 to V5 derivates? is that possible to monitoring these derivates ?</p>
<p>If i do remember well, V1-V5 are measured against a fake ground composed of left hand, right hand and left foot connected through 1Mohm resistors in a star configuration. The center point is the fake ground. Hope this helps. (A bit of googling will help too... ;) (Image stolen from Electrocardiografia.es)</p>
<p>It's V1 to V6 actually - the electrodes placed across the left front of the chest wall.</p><p>This circuit is in effect displaying Electrode 2 (left arm) (ie the heart as viewed from left shoulder - where the left arm joins the body!), using Electrode 1 as reference and Electrode 3 as a ground.</p><p>So to view V1 to V6, simply move the Electrode 2 from left wrist to the desired place on chest wall and that will do the trick. Maybe not medically perfect, but close enough.</p>
<p>Yep. V1-V6. My bad. The circuit that you describe is called aVL, the &quot;a&quot; stands for&quot;augmented&quot;. They are unipolars, like Vx, and they fake ground against the other arm/foot (Same thing for aVR, aVF.). Moving the electrode to the six points on the chest can give you readings, but they will be better with the &quot;fake ground&quot; circuit. Making medical diagnosis is a tricky thing, and it depends heavily on the quality of the signals. A little up or down of the baseline and you can do the wrong diagnosis. Other than this, i do agree with you.<br>Best regards</p>
<p>I described a chest lead, not aVL.</p><p>Your 'fake ground' is properly called 'Goldberger's Central Terminal'. It's all described nicely in the Wikipedia linked from the original article - ie <a href="https://en.wikipedia.org/wiki/Electrocardiography" rel="nofollow">https://en.wikipedia.org/wiki/Electrocardiography </a> </p><p>For measuring the the chest leads V1-V6 the exact ground does not really matter, and using the two wires connected to right arm and a leg will be quite OK.</p><p>The main quality issue with this circuit is that the author has not implemented a low-pass filter to get rid of the 50 Hz mains hum (60 Hz if you are unlucky enough to be ruled by Mr Trump!).</p>
<p>Well. I must agree with you... mainly. Calling it 'fake ground' was just a simplistic way to kickstart the original question. But, I must quote Wikipedia:&quot;Leads aVR, aVL, and aVF are the augmented limb leads. They are derived from the same three electrodes as leads I, II, and III, but they use Goldberger's central terminal as their negative pole which is a combination of inputs from other two limb electrodes&quot;.</p><p>Being picky, you said &quot;Electrode 2 (left arm) (ie the heart as viewed from left shoulder - where the left arm joins the body!), using Electrode 1 as reference and Electrode 3 as a ground&quot;.</p><p><br>Speaking strictly, we measure an electric potential against a reference, being this reference a simple one for bipolars (the other limb), or a compound reference for augmented (the other two limbs) or precordials (the three limbs of the Einthoven's triangle). Not a ground. Well. I do know. A ground lead most often does exist, but is connected to equipment's ground. On some (weakly designed) electrocardiograph, is used to improve mains hum rejection.</p><p>Quoting Wikipedia again: &quot;The precordial leads lie in the transverse (horizontal) plane, perpendicular to the other six leads. The six precordial electrodes act as the positive poles for the six corresponding precordial leads: (V1, V2, V3, V4, V5 and V6). Wilson's central terminal is used as the negative pole&quot; and &quot;The common lead, Wilson's central terminal VW, is produced by averaging the measurements from the electrodes RA, LA, and LL to give an average potential across the body&quot;.<br>Wikipedia said things better than i can.</p><p>On a personal note, I am a electronic hobbyist, from more than 40 years now. Yes. You are right, I'm not an engineer (surely you are).<br>I developed this same thing for personal amusement more than 25 years ago, with opamps, and it was a pain, and a pleasure. The output was connected to an osciloscope with no persistence, so it was a pain to read. A trigger signal was also sent to a Commodore 64 to read heart's rate. Changing from bipolar to augmented to precordials was done with pushbutons. It was just fun and not for real use, even if it worked OK.</p><p>But also I am an ICU M.D, for more than 30 years now. I can tell you first hand the huge difference between a weak or good designed electrocardiograph when you are in a RCP, massaging a heart, with all this movement interfering the readings, and you do need to distinguish what is happening inside the chest. And close enough is not enough when it defines if someone will live or die. (Yes. It is embarrasing. Is V1-V6, not V1-V5.)</p><p>So, in my own opinion, for what is worth, for precordials you need what is properly called Wilson's central terminal.</p><p>Ok. This is Instructables and i am being too much picky. But someone was enthusiastic about expanding this to be used on the field, so i think is better to say thing right.<br>Anyway, you spotted a very weak design point: no low-pass filter. For any serious use is a must have.<br><br>I enjoyed your other post. Maybe the article you was unable to find was &quot;DIY EEG (and ECG) Circuit&quot; by cah6, here at Instructables?. The link you posted &quot;DIY ECG with 1 op-amp&quot; is amazingly simple!<br>Also, i do agree. 5v (or 12v) will do nothing to you (or me, or anybody). But discovering a just-starting PSU leakage when you connect your ECG machine to a patient can be... well... shocking. Because disaster strikes when no one expect this. So, for safety reasons, is better to stick to a battery source. Not because 5v will kill you. Because a PSU can fail after some time of use, and this kind of thing cant be prevented. (Safety First. A principle by which to live)<br><br>By the way: I'm lucky enough to be NOT ruled by Mr Trump :) (I hope you do not either). But we live in the same planet. This is unlucky. Whatever happens on USA, repercutes on the entire world.. :(<br>Be well.</p>
<p>Our chat is getting too long. My comment meant &quot;good enough for experimentation use&quot; not medical diagnostic use. </p><p>The article I was unable to find wasn't on Instructables after all. It's at <a href="https://blog.adafruit.com/2016/08/31/electrocardiography-for-cheap-diy-ecg-uses-one-lm741-op-amp-five-resistors-and-penny-electrodes/" rel="nofollow">https://blog.adafruit.com/2016/08/31/electrocardio...</a> </p><p>I am a physician too, not an engineer, British but now live in Switzerland. I do Patient Safety in the pharma industry. My best claim to fame is that I nearly invented Windows, but unfortunately didn't realise how revolutionary it was - things could have worked out rather differently ...</p>
<p>Well, a colleague after all :-). More to agree than to diverge.<br>Sorry to hear about you lost Windows patent. What a shame. How would you name your company? (When i think of it, I do remember an old Mel Brooks movie. The evil was called &quot;Bite and Devours&quot; or something like that.) Just joking. Dont take me wrong. By the way, i am from Argentina. If somehow i do manage to go to Switzerland (very unlikely, i am afraid), let me buy you a beer.</p><p>You are right. Is getting too long. I am getting too old too... I must shut up.<br>Best regards.</p>
<p>You should take more care specifying the power supply, medical grade supplies have a very low leakage current. Cheap amateur bricks can have very considerable, and potentially hazardous leakage. </p><p>I really you emphasise this project is battery only </p>
<p>Cool. Thanks for the tips. You're right. I should be clear that using mains is a bad idea. I put a warning in the intro, but I'll go ahead and bold the text and also place it again in the &quot;Power Supplies&quot; section in the &quot;Gather Your Tools&quot; steps. Thanks for the comment.</p>
I think in BOLD. I can see people trying this with the leaky USB port on their computer. <br><br>A mains supply isn't just a &quot;bad idea&quot;, its potentially lethal
<p>Great explanation on the electronics - Amp design! Can you tell us more about the graphical interface? What are you using to display the results? How are the analog signals from the electronics converted to allow input to the PC? And where are you putting the input at the PC? Thanks!</p>
<p>You can send the signal to the sound card on your PC, using that as an A/D converter. Then display the result using a Python script. That's all shown at http://www.swharden.com/wp/20160808diyecgwith1opamp/ . It's also presented on here as an Instructable, but I cannot find it just now. His circuit, by the way, is simpler using just a 741 Op Amp and seems to work quite well. He implements a low-pass filter in software (adjustable) to get rid of mains hum.</p>
<p>Link has moved to <a href="http://www.swharden.com/wp/category/electronics/diy-ecg-home-made-electrocardiogram/" rel="nofollow">http://www.swharden.com/wp/category/electronics/di...</a> </p>
<p>That link doesn't appear to be live anymore, but here's a YouTube video from the same individual I think you are referring to. He uses the LM741 and the PC mic input for his project.</p><p>https://youtu.be/AfirWls9Sys</p>
<p>I was actually using a small, pocket oscilloscope. You can easily run this signal through the analog inputs of an Arduino and display the graph through the serial plotter, however.</p>
<p>As a firefighter/EMT and prospective paramedic, this is really cool. I know the concept is rudimentary, but it would be awesome to expand this from 3 leads to 4, or 6, or even a full 12-lead (15 would be crazy awesome). Safety considerations aside, this could go a long way toward making some affordable ECG/EKG analytics tools for training within EMS and the medical field.</p>
<p>Awesome! Glad you liked it. What ECG tools are currently used for training? I really like the idea and it sounds very do-able.</p>
<p>Cool project!</p><p>Suggestions:</p><p>One shouldnt let the amp inputs float.</p><p>Unknown DC voltage on the inputs</p><p>can violate the common mode range spec, and</p><p>produce unpredictable outputs.</p><p>There should be high valued resistors to Vref to prevent this.</p><p>Also, coupling caps on the inputs</p><p>will prevent DC offsets from swamping the amp.</p><p>That way, you can significantly increase the amp gain,</p><p>obviating the need for the additional amp stage.</p>
<p>Cool. Thanks for the comment. I like the suggestions. I didn't realize that instrumentation amps recommended adding extra components to the input. I always assumed that would degrade CMMR, but looking at the datasheet, that is suggested. (Image from the AD623 Datasheet from Analog Devices &lt;http://www.analog.com/media/en/technical-documentation/data-sheets/AD623.pdf&gt;).</p>
<p>Great 'Ible! I have one question: In Step 8 you say, &quot;Reasons for the deviations will be explained in Step 9.&quot;</p><p>I've read Step 9 closely and don't see any reasons. What am I missing?</p><p>Thanks.</p>
<p>Whoops. Sorry about that. I should have said Step 10. Thanks for catching that and for the compliments.</p>
<p>Be very careful, if you can sense millivolts from the heart, a problem with the circuit can send them to the heart which would not be good.</p>
<p>You're totally right. Thanks for the tips.</p>

About This Instructable




Bio: Graduate student at Purdue University, biomedical engineer, electronics enthusiast, educator, trying to learn a little about engineering and programming
More by ohoilett:Super Simple Electrocardiogram (ECG) Circuit PulseSim - Photoplethysmograph (Heartbeat) Analog Simulator Team Valor Light Up Badge for Pokemon GO 
Add instructable to: