# ECG/ DC Offset

Discussion in 'The Projects Forum' started by jdp323, Apr 7, 2013.

1. ### jdp323 Thread Starter New Member

Apr 7, 2013
2
0
I'm doing an ECG project where I've built most of the front in circuit and once finished I want to sample with an ADC and then either plot or calculate heartbeat from.

Set up
This is the set up right now. Its running off two 9 volt batteries in series for positive and negative voltage. The diff amp's gain is set to 125 and the non inverting op amp is set to 19.5. This gives me a signal around -1 to 3.5 V's.

ECG wave
This photo is when the gain was a little higher for testing but shows the general wave.

The problems, I'm having are that the signal "moves"; its not always centered around 0. This is an example of when it drifted down Then I only have the peaks being read by the ADC. The second problem is the negative part of the wave. I've tried to add in a DC offset by a voltage divider on the output but just lose my signal. Any idea why the signal moves besides noise and only being a 3 lead electrode and more importantly can someone tell me what I need to do to add some DC offset to this configuration.

I'll either be using the arduino's or the mbed's ADC to sample the signal. Any help is greatly appreciated!

2. ### kubeek Expert

Sep 20, 2005
5,381
1,020
I think that the 0.03Hz high pass is a problem, as it basically makes the system take 30 seconds to correct the change in dc offset. Wouldn´t say 5hz be a more appropriate value?
The offset can easily be set by instead of grounding the 5.1M resistor you connect it to a potentiometer divider that sets the desired dc level, with a cap to ground on the viper. Or a simple resistor divider for a set offest.

Last edited: Apr 7, 2013
3. ### #12 Expert

Nov 30, 2010
18,076
9,676
Low frequency limit of .03HZ? Get rid of that 5 meg resistor and get into real world numbers for frequency. You're practically begging a temperature induced offset drift in the first stage to perpetuate into the second stage.

Capacitive coupling intentionally centers the waveform across the zero line. This is how you do a DC offset such that the offset is not amplified but the AC component is.

File size:
8.7 KB
Views:
113
4. ### Ron H AAC Fanatic!

Apr 14, 2005
7,018
682
The problem is, a high pass filter causes undershoot after the QRS complex. A 5Hz filter is WAY too high. See the attached simulation.

Many commercially available instrumentation amps (e.g., INA118 fig. 9) have application schematics for EKG amps with DC common-mode feedback, which should eliminate the drift. Other inamps have variations on this circuit. I would not try to reinvent the wheel.

File size:
603 bytes
Views:
38
File size:
27 KB
Views:
68
5. ### t06afre AAC Fanatic!

May 11, 2009
5,936
1,226
Hi Jdp323
If you go to web site for the major producers of electronics and search for ECG you will find a lot stuff like these
http://focus.ti.com/pdfs/vf/medeq/in...plications.pdf
http://www.ti.com/lit/an/slyt226/slyt226.pdf
In the last application note(both actually ). Note how the make use of an tntegrator. To make a DC coupled AC amplifier.
Also try
http://www.analog.com
In Some of the circuits, they may have used exotic components. But use the design principals. We may help finding replacement ICs.
The recommended bandwidth for ECG is 0.01 to 250Hz. But if you only are looking for heart beat measurements. You can perfectly well set your lower bandwidth to 1Hz. As you will be using the R wave, and the interval between R waves.

6. ### jdp323 Thread Starter New Member

Apr 7, 2013
2
0
Thanks for all the great replies.

As for the reason I chose the .03Hz filter is that I'm using Analog's AD620 for the instrumentation amp. I'm was somewhat following their suggested set up, I'm going to try adding in the leg driven circuit for DC Common mode feedback to see if it will help with drift as suggested!

Thanks for showing me the correct way.

What are the real world numbers? In circuits theory it was just use fc = 1/2piRC and plug and chug for values you want.

I'll look into this! Thanks for the great links!

7. ### #12 Expert

Nov 30, 2010
18,076
9,676
Real world numbers?

Let's see, whose heart beats at .03 Hz? "The usual heart rate of large whales is from 10 to 30 beats per minute." Nope. Still too fast for .03 Hz.

Better question: Considering that most of the information is in the fast movements, what is the slowest movement I might want to see? Something that takes a whole second of conduction? That would set your time constant at 1Hz or 1 second.
You can decide or you can use the excellent circuits that are DC coupled and offset by integration that T06 was telling you.

8. ### Ron H AAC Fanatic!

Apr 14, 2005
7,018
682
Here is what a 1Hz high pass filter does to the QRS complex.

EDIT: I gotta confess that I totally missed post #6.
The feedback to a leg is probably the solution to the drift problem.
I also see that this is where the .03Hz HPF came from.

• ###### EKG with 1Hz HPF.png
File size:
14.4 KB
Views:
54
Last edited: Apr 8, 2013
9. ### t06afre AAC Fanatic!

May 11, 2009
5,936
1,226
This is a more realistic simulation. And in order to cope with some drift. And given that we are only looking for HR measuremnts. A 1 Hz high pass filter will be more capable to handle drift problems. At least to some extent. But well by using the instrumentation amplifier as DC coupled AC amplifier You will not have far less problems with filter distortion.

File size:
20.6 KB
Views:
63
10. ### Ron H AAC Fanatic!

Apr 14, 2005
7,018
682
But my point is, I don't think the filtered waveform is acceptable for much, other than measuring pulse rate, and you don't need an ADC for that.

How did you create those waveforms?

11. ### t06afre AAC Fanatic!

May 11, 2009
5,936
1,226
I used an ECG simulator made in Labview for those. So the filtering was digital. In this case I used a second order bessel hi-pass filter 1 Hz. 500Hz sample rate

Ron H likes this.