I have a minor issue with my ECG. When I poke at the leads, I get a reading. But when I hold the leads or place it near my heart, I don't get anything. I'm pretty sure this is hardware related, but I don't want to completely rule out a potential software problem. I used this YouTube video as a guide: https://www.youtube.com/watch?v=NDjRg-KgIXY, with their circuit show below.

circuit from linked video

My breadboard almost looks exactly the same as that, but with a couple of changes. Instead of connecting the ECG to the computer via a audio cable, I used Bluetooth to transfer it to my phone. Here is my schematic diagram.


Here is my breadboard diagram.


In my breadboard, I used three LM358 op-amps. Here is my Arduino code (if you need it):

const int  signal = 7;    // Pin connected to the filtered signal from the circuit
unsigned long currentBeatTime;   
unsigned long previousBeatTime;

unsigned long frequency;

// Internal variables
unsigned long period = 0;
int input = 0;
int lastinput = 0;

void setup() {
pinMode(signal, INPUT);

previousBeatTime = millis();

void loop() {
input = digitalRead(signal);

if ((input != lastinput) && (input == HIGH)) {
    // If the pin state has just changed from low to high (edge detector)
    currentBeatTime = millis();

    period = currentBeatTime - previousBeatTime; // Compute the time between the previous beat and the one that has just been detected
    previousBeatTime = currentBeatTime; // Define the new time reference for the next period computing

lastinput = input; // Save the current pin state for comparison at the next loop iteration

// Detect if there is no beat after more than 2 seconds
if ( (millis() - previousBeatTime) > 2000 ) 
    if (period <= 0) 
        frequency = 0;
        frequency = 60000/period; // Compute the heart rate in beats per minute (bpm) with the period in milliseconds


Any help regarding this issue is highly appreciated. Thank you!

  • \$\begingroup\$ Can you draw out the circuit like they did in the video, even by hand? The R and C values in your diagram aren't making sense. They determine cutofa frequencies, and you can't use what you happen to have laying around. \$\endgroup\$ – Scott Seidman Dec 31 '14 at 3:05
  • \$\begingroup\$ If I understand you correctly, you want me to copy down the circuit shown in the video down on a piece of paper and post it as a pic. Am I correct? \$\endgroup\$ – user3744439 Dec 31 '14 at 3:06
  • \$\begingroup\$ Not quite. I'd like you to do that, but for the circuit you built, with the values you used. Not for the values they used in the vid. \$\endgroup\$ – Scott Seidman Dec 31 '14 at 3:10
  • \$\begingroup\$ Ah OK, I get what you are talking about. I just found some resistors and capacitors that were lying around and used that. Instead of copying down the circuit on a piece of paper, I'll just tell you all of the values. For C1 on high pass filter, I have a 47 UF capacitor. For R1 on my high pass filter, I have a 470 ohm resistor. I have a different value for my R2 one for my high pass filter. For my capacitor on my low pass filter, I have a 10 UF capacitor. All of the other values are totally wrong, so I'm not even going to bother putting it down. \$\endgroup\$ – user3744439 Dec 31 '14 at 3:31
  • \$\begingroup\$ Worth reading the whole wikipedia article before you go much further. Recommend instead of attempting a homebrew 12-lead EKG/ECG, start with the basic 3-lead setup (circa 1911 they actually used buckets of saltwater as the electrodes for RA, LA, and LL). Three leads should be enough to see the characteristic QRS waveform. See en.wikipedia.org/wiki/Electrocardiography See also en.wikipedia.org/wiki/Einthoven%27s_triangle \$\endgroup\$ – MarkU Dec 31 '14 at 4:05

You actually have a major issue. You're triggering off noise created by dorking with your leads, and not on anything related to the ecg. This is going to be very difficult to debug without an oscilloscope. What are you using for electrodes? Also, a real circuit diagram for the analog portion would be of huge help.

I suggest your input stage should be a modest gain, maybe 10, with an instrumentation amp, then a high pass filter, then a big gain with an op amp and a low pass filter.

The leads don't belong near your heart. Hold one lead in each hand, and ground your ankle to the same ground you use for vref on the instrumentation amp.


1) The circuit in the video is not perfectly suitable to amplify biopotentials. You want a DIFFERENTIAL AMPLIFIER, and this amp is single-ended. Interestingly enough, even if this were never intended to be used for biopotentials (there's no suggestion in the vid that it is), its still sort of a textbook example of students using textbook examples and expecting them to work. They're in the right direction, but there's practical aspects of the circuit that will have a ton of problems. The 7 MegaOhm resistors will prove to big noise sources if you try to crank up the gain, and also those big resistors will cause large offset voltages to to input bias currents that will saturate gain stages beefy enough to measure ecg signals, which are about .1-5mV in amplitude (so you'd like a gain of about 500 or so).

2) Even if the circuit were OK to measure biopotentials, it wasn't implemented right in this case.
a) Although the op-amps you used are fine to power with a single power supply, you should have a positive and a negative power supply for the purposes you're using them for here. You can alter the circuit to use a single supply, but that's more work than you want to take on. b) You can't swap out resistor and capacitor values willy nilly and expect them to work. As luck would have it, the combo you use on the high pass filter stage seems OK, but you haven't provided enough info for me to know about the low pass stage.

To do this right, you should have a modest gain differential stage that won't saturate for an input offset of about 200mV. An instrumentation amp (like your INA128) with a gain of 10 would work if you can supply +/- power. If you need to work with one power supply, then you need an instrumentation amp like the AD623, who's inputs can go below the negative rail, with Vref set at about 2.5V. Then you need a high pass filter to get rid of the amplified offset. After that, a stage with a gain of about 50-100 and a low pass cutoff of about 50Hz. After that, you need some sort of comparator stage to use as a heartbeat detector, but perhaps that's getting a bit too far ahead.

(As an aside, the more modern approach is probably to just have the modest gain first stage and a low-pass filter, then sample it at 24 bit resolution, and do everything after that digitally).

So, bottom line is the circuit you're using won't work, and there's no great way to fix it. If you're going to try this without an oscilloscope to debug, you're going to need to start with an absolutely bulletproof design, and implement it correctly.

I suggest looking at http://www.eng.utah.edu/~jnguyen/ecg/instructions.html (with the schematic at http://www.eng.utah.edu/~jnguyen/ecg/bigsch.gif) for a differential amplifier that works for this purpose.

| improve this answer | |
  • \$\begingroup\$ For leads (electrodes), I'm using jumper wires. I do have speaker wire but that damages my breadboard and it's like 25 ft long. I have a couple instrumentation amplifiers, so I'll see if that'll work based on your edit. \$\endgroup\$ – user3744439 Dec 31 '14 at 2:32
  • \$\begingroup\$ Also, since I am a total beginner at this, can you post a breadboard diagram of what you are talking about (instrumentation amp, high pass filter, op amp and low pass filter). Thank you. \$\endgroup\$ – user3744439 Dec 31 '14 at 2:33
  • \$\begingroup\$ The leads don't need to be near your heart. In fact, hold the leads in each hand, and ground your ankle to the same ground you use for v ref on the instrumentation amp \$\endgroup\$ – Scott Seidman Dec 31 '14 at 2:34
  • \$\begingroup\$ @user3744439 can't do much on a tablet, but I'll try to revisit. Breadboard diagrams won't happen, but circuit diagrams might. \$\endgroup\$ – Scott Seidman Dec 31 '14 at 2:39
  • \$\begingroup\$ Alright, anything works. Thanks for your help Scott! \$\endgroup\$ – user3744439 Dec 31 '14 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.