3

A project I am working on currently is to create a heart beat sensor using a finger plethysmograph. It returns a signal to my ucontoller that only includes positive peaks. For example, the ideal signal it will sent to my ucontroller would be

1 1 1 5 1 1 1 5 1 1 1

Where the numbers represent the amplitudes. There ideally will be no negative components to the signal. My goal is to detect these peaks and count the number of milliseconds between the peaks and use that to calculate the bpm accurately. I could use a slope detection method but it would probably only be accurate for an ideal signal with no noise.

For the real implementation and not so ideal case, I was thinking that I could use an FFT. Theoretically the highest bpm of a human heart is approximately 4Hz, my nyquist rate would be 8Hz. With a 16 point FFT, each bin would contain real and imaginary parts in sections of 8/16 Hz. I could calculate the magnitude for each bin. Im guessing the bin with the highest magnitude would be frequency of the peaks??

Is my approach correct?? Can I only detect differences of .5Hz using a 16 point FFT? Also, do I use the FFT in a window shift method or only perform the FFT after 16 points of a signal??

  • 2
    A phase locked loop (PLL) would probably be a better idea. – Paul R Aug 23 '12 at 20:27
  • @DragoonWraith will keep that in mind. all the questions on this site seem to be way over my head though.

    Would you be able to elaborate paul?

    –  Aug 23 '12 at 20:36
  • @maknelly: see http://en.wikipedia.org/wiki/Phase-locked_loop – Paul R Aug 24 '12 at 09:15

1 Answers1

1

If the signal is truly as "clean" as you present it, then an FFT is overkill (and perhaps computationally prohibitive, depending on the microcontroller.)

I would compute a linear regression over a sliding window of samples, say 16. Given the signal you present above, this should generate a more-or-less horizontal line that can then serve as a threshold. Sum the number of points exceeding this threshold, divide by the time-normalized window size to obtain the BPM.

  • Yes good solution. I did this to perform a proof of concept demo. But that would be an ideal case with a generated input signal using a function generator. An implemented finger plethysmograph is extremely sensitive and produces a lot of noise. So in a real life implementation, I think an FFT would be the ideal solution. –  Aug 23 '12 at 20:36
  • Commercial plethysmographs typically use predictive filtering (think Kalman filter) "upstream" of any sort of physiologic metric estimation. This sort of strategy limits the amount of noise your beat counter would have to overcome. You might have a convincing case for filtering in the frequency domain (FFT, suppressing coefficients, then IFFT) and then counting. But I have reservations about relying solely on FFT for counting. – Throwback1986 Aug 23 '12 at 20:40
  • I see. I am working with a friend and we are actually creating the finger plethysmograph from scratch. We are working on using a bandpass filter to get frequencies between about .5 - 4.5 Hz. Then amplify and feed the signal into the microcontroller and try to use that for filtering. I will take a look at predictive filtering though. In that case, do I perform a 16 point fft for every incoming sample or just every 16 samples? I fear that doing an FFT, coefficient suppression, IFFT and then counting will be too much work for the ucontroller between the 8Hz samples –  Aug 23 '12 at 20:46
  • 1
    Don't use the FFT for filtering. DO your filtering in the time domain. http://blog.bjornroche.com/2012/08/why-eq-is-done-in-time-domain.html –  Aug 24 '12 at 01:20
  • Also the frequency is the reciprocal of the period, so once your signal is filtered find the average time between peaks. If you find that's too sensitive to noise, even after filtering, better solutions are phase locked loops and autocorollation. –  Aug 24 '12 at 01:22
  • 2
    Here's a how-to for filtering: http://blog.bjornroche.com/2012/08/basic-audio-eqs.html –  Aug 24 '12 at 04:16
  • Would you be able to provide an example of a time domain filter that would fit my case? I am interested after reading your blog. However, a downside to using the moving average filter. When the sensor is moved, it outputs incomprehensible signals and im afraid that the average filter would introduce inaccurate data points for the first few calculations of these signals. It would be difficult to then detect these spikes/signals. I did find an interesting technical paper doing almost exactly what I am trying to do. http://ejournals.uofk.edu/index.php/engineering/article/view/149 –  Aug 24 '12 at 05:52