# Signal Peak Detector Circuit for Heart Beat (Help!)

#### alesnick

Joined Feb 11, 2009
10
I am looking for help designing a circuit that detects the peak of a low frequency (1-2Hz) periodic signal (the amplified pulse of the heart acquired via plethysmography -- basically just an amplified/filtered led/photodiode couple on the fingertip).

The circuit must output a TTL signal for x amount of time (10-50ms) when the peak of the pulse occurs. It must also be dynamic in detecting the peak as it will be used on many different people, so simple static thresholding to a comparator will not work. I have decided I want to stay away from a pot to adjust the threshold for each individual. The constraints are that this needs to stay analog -- nothing beyond say an A/D or the likes if necessary.

The output from my plethysmography signal is very clean, but varies between individuals from as low as 1Vp-p all the way up to 5Vp-p. Scope shot and circuit is attached (this shot was when my gain was set a little higher, but I had problems with saturation in my first amp stage in some individuals so I have sinced reduced gain). I would very much like to leave my first amplifier stages intact, tack on a follower, and go from there.

The problem with sample-and-hold is that even from heartbeat to heartbeat the magnitude of the peak can change and I need to still be able to trigger on the peak of a following, lower amplitude peak. I've tried many different things, but I'd LOVE some input.

Fixed-decay sample-hold doesnt work so well because everyone's heart rate changes . . . you get the idea. One other implementation that would work that I would still need help with would be turning my original amp stages into Automatic Gain Control amplifiers so that static thresholding afterward would in fact equate to variable thresholding in real-life. Except I am under the impression that would not work so well for such low frequency signals? (1-2Hz?)
Minimizing/eliminating false positives is a priority.

Also, I know I may get flamed for this, but I am also willing to make it worth anyone's time monetarily who is kind enough to help me towards a working end product. My next step is posting on freelance sites.
Sorry for the long post . . .

#### Attachments

• 21 KB Views: 196
• 82.4 KB Views: 150

#### mik3

Joined Feb 4, 2008
4,843
You can use a precision rectifier followed by a capacitor in paraller with a resistor on the output of your circuit.

#### thatoneguy

Joined Feb 19, 2009
6,359
Are you looking for an automatic gain control? The "Background" DC bias could be whacked out with a highpass filter.

While on the topic, do you know how to get %SO2 With that setup? It is related to color of blood, just not sure how they can get so accurate about it in a thumb-sized unit.

#### alesnick

Joined Feb 11, 2009
10
mik3,

i appreciate the input, but as i mentioned, the sample-hold configuration will not work (as i am aware) because it will only give me the DC value of the peak of the entire acquired signal, not the time point at which the local peak occurs . . . i understand that i could do some work to reset the sample/hold or to decay it but that is precisely what i am asking help for -- a way to do it intelligently and adaptively because a sample-hold circuit will not register the maximum of a heartbeat pulse lower in magnitude than a pulse before it (if a user shifts positions, the envelope of the signal can suddenly decrease, and a sample-hold would miss the following lower-amplitude pulse.)

thatoneguy,

my second-order filter is a band-pass filter and already takes out DC bias very, very well. the problem is that the actual physiological signal amplitude can change from patient-to-patient as well as within each patient with time due to shifting position of the patient, etc.

If I could normalize the amplitude even though the amplitude of the pulse changes from patient to patient, and along the time axis, that would allow me to use a simple comparator with a DC value to trigger my TTL signal. Any means to do this would be greatly appreciated (if this means AGC, then, yes, I am looking for automatic gain control!!)

Shifting of the patient's arm with respect to the heart (pressure change) results in a change in the envelope of the signal. If the envelope increases, a sample-hold circuit as described by mik3 would help, but if the envelope decreases, i'm not in luck . . .

as far as %SO2 goes, at least two wavelengths are necessary for the comparison of oxygenated/deoxygenated blood. A crude way to do it would be: build the same circuit as above for a red and infrared LED (the values work excellently for filtering in this application), then build an integrator to integrate the area obtained under each pulse, and then build a circuit to compute the ratio of (oxygenated blood [red band])/(oxygenated + deoxygenated blood [ir band]).

blah.

#### alesnick

Joined Feb 11, 2009
10
mik3,

you suggest using a resistor to decay the sample-hold and i've thought the same, then i could use this as one input to a comparator and my signal as the other -- the maximum amplitude would slowly decay thereby acting as a peak detector on the output of the comparator.

The problem lies in the fact that the heartrate changes as a function of time and from person to person, therefore the constant rate of decay would end up triggering the peak detector at different points in the pulse.

For a normal application, this would be acceptable. However, my application is a trigger for image acquisition, therefore it is critical that the peak be detected at the _same_ point every pulse.

any ideas?

#### Ron H

Joined Apr 14, 2005
7,014
I was intrigued by this, so I designed what I think is a circuit that will work. Below are the input and output waveforms. Let me know if you want to know more.

#### Attachments

• 17.4 KB Views: 172

#### alesnick

Joined Feb 11, 2009
10
Of course! I'll be PMing you in a bit, Ron . . .

Thanks!

although you haven't exactly agreed to me help just yet . . .

#### thatoneguy

Joined Feb 19, 2009
6,359
Your response was essentially asking for an Automatic Gain Contol, yes, sorry for not expounding on that.

After re-reading your post, it seems you need to output a 5ms pulse every time $$\frac{\delta V}{\delta T}$$ is greater than 1 V per 100mS or so (1-5V p-p during a pulse)

A differentiator based on an op-amp would give you a full voltage output when that threshold was met/exceeded.

Differentiator

Ron H's output seems to be triggered on the negative trend, which may be the most reliable method. Maybe a blood pressure estimator could be added by measuring the slope of that line, but that would require Digital Signal Processing and a high sample rate for anything accurate between different people...

--ETA: Seems to be a matter of removing cap from feedback of 2nd op-amp in your circuit, and adjusting input capacitor value and feedback resistor. (?)

#### Ron H

Joined Apr 14, 2005
7,014
Your response was essentially asking for an Automatic Gain Contol, yes, sorry for not expounding on that.

After re-reading your post, it seems you need to output a 5ms pulse every time $$\frac{\delta V}{\delta T}$$ is greater than 1 V per 100mS or so (1-5V p-p during a pulse)

A differentiator based on an op-amp would give you a full voltage output when that threshold was met/exceeded.

Differentiator

Ron H's output seems to be triggered on the negative trend, which may be the most reliable method. Maybe a blood pressure estimator could be added by measuring the slope of that line, but that would require Digital Signal Processing and a high sample rate for anything accurate between different people...
My design is based on a differentiator...
The output pulse actually begins at the peak (plus a little propagation delay, which can be reduced). It looks late because the width is about 20mS or so.

Last edited:

#### alesnick

Joined Feb 11, 2009
10
The closest design that I had was actually based on a differentiator/zero crossing detector setup. The problem with that setup was that any little blip in the original signal led to a false positive in my setup.

A more robust differentiator that actually measures the degree of dv/dt i suppose would be a more fool-proof solution, however I am unaware of how to implement a slope detector.

It seems as if Ron may share with us the wonders of his wisdom when he figures things out.

With my differentiator setup, I couldnt decide whether or not to rectify my output and feed it into a negative edge-triggered-type circuit (like a flip-flop) or to use a zero-crossing detector, or what. All i knew is that the differentiator looked promising!! I felt like i was 99% there and just didnt know what to do next . . . I'm glad I came to the right place.

Thanks so much, guys.

#### alesnick

Joined Feb 11, 2009
10
thatoneguy,

modifying the 2nd stage of my amp circuit (removing the feedback cap and input resistor) to make a differentiator out of it effectively removes its function as a second order filter (the resistor/cap values need to be the same values as the first stage in order to increase the decade values at the corner frequencies). As i said originally, for simplicity purposes, I'm just going to add a voltage follower for buffering purposes (if necessary) and then feed it into whatever differentiator stage Ron finalizes.

After all, I have a few quad op-amp packages, and if slew-rate isn't an issue (read: if i don't have to order special op-amps for this application), I don't mind using two quad-chips for this circuit. It should still be pretty small in the end. Not the most efficient design, yes. But i'll work on making the design the most efficient once i get functionality down first .

#### KL7AJ

Joined Nov 4, 2008
2,225
The closest design that I had was actually based on a differentiator/zero crossing detector setup. The problem with that setup was that any little blip in the original signal led to a false positive in my setup.

A more robust differentiator that actually measures the degree of dv/dt i suppose would be a more fool-proof solution, however I am unaware of how to implement a slope detector.

It seems as if Ron may share with us the wonders of his wisdom when he figures things out.

With my differentiator setup, I couldnt decide whether or not to rectify my output and feed it into a negative edge-triggered-type circuit (like a flip-flop) or to use a zero-crossing detector, or what. All i knew is that the differentiator looked promising!! I felt like i was 99% there and just didnt know what to do next . . . I'm glad I came to the right place.

Thanks so much, guys.
I believe what you may be looking for is a slope detector:

http://www.cgs.synth.net/modules/cgs62_sd.html

This may not be the simplest implementation, but it may be worth a shot.

Eric

#### Ron H

Joined Apr 14, 2005
7,014
Have patience. I'm looking at noise immunity on my design.

#### alesnick

Joined Feb 11, 2009
10
take all the time in the world.

Thanks KL7AJ, I have been looking for a simple explanation of the implementation of a slope detector for _quite_ some time now. I very much appreciate it. It is incredibly helpful!

#### Ron H

Joined Apr 14, 2005
7,014
I've been waylaid by my wife. We're going on a trip, and she seems to think there are certain things that have to be done in preparation.
I still think I'll have time do the frequency shift test and post it sometime today, or maybe tomorrow.

#### alesnick

Joined Feb 11, 2009
10
good luck!

it has waited this long, it can surely wait a little longer.

have a wonderful time!

if before you leave you're certain you won't be able to post the product, could you maybe give a sentence or two about the differentiator to give me something to experiment with in MultiSim while you're gone?

I've gotten some great ideas from all of you and I just found a great little falling-edge pulse generator to to top of the last stage of the design in my head from Horowitz & Hill (The Art of Electronics) . . . I think my vision has actually started to solidify, but with a little bit of a guiding hint I may be able to improve my design.

then again i know how (loving ) women can be . . . so good luck, and i understand if posting is even treacherous territory

#### alesnick

Joined Feb 11, 2009
10
one more thing, Ron, could I at the very least have an IC/special parts list (resistor/cap values not necessary) so I can order any parts I may need while you're on vacation?

Thanks!

#### thatoneguy

Joined Feb 19, 2009
6,359
Have patience. I'm looking at noise immunity on my design.
I'll wait. My design got 3/4 to your output, I was working with a static 1V/10ms "trigger", which, by the way, is NOT the optimal solution, though you do get random width square waves from it on each analog pulse....

#### Ron H

Joined Apr 14, 2005
7,014
OK, here it is. This is a schematic derived from the simulation. The simulation included a couple of sine pulse generators and some stuff to switch between frequencies (which worked great, going from 120 to 60 and back, abruptly), to add "noise", and to change amplitude abruptly. I did a lot of editing on that, and didn't save all the various test setups, but if anyone wants me to post my most recent .asc file for SWcad, I can.

#### Attachments

• 30.4 KB Views: 102

#### thatoneguy

Joined Feb 19, 2009
6,359
Nice work!

It drives me nuts when I see an elegant solution, then say "Wow, that's simple". I started out with an idea, and when it didn't work, I stopped.

Thanks Ron! Now to detemine blood pressure... There should be some sort of correlation betwen slope and pressure, or am I totally off on that assumption?