10-23-2012 02:55 PM
Hi all:
I need to measure heart rate in BPM from ECG signal.
I am using LabVIEW 2009 and NI USB-6009 DAQ to acquire ECG signal referenced to ground after amplifying and filtering with hardware.
Once acquired ECG signal, so I programmed Labview:
1. Bandpass filter applied between 14.5 Hz and 19.5 Hz for the QRS complex.
2. Multiplied by 8 the filtered signal.
3. Square raised to the previous signal.
4. Compare the above signal with a value (0.5) to convert to pulses. These pulses contain ECG frequencies.
5. This should integrate the signal pulses for each QRS complex cigar, but any kind of comprehensive Labview works because I always integral approaches infinity.
I request your help to measure heart rate for 1 minute and per beat an LED lights up on the display and you hear a beep.
Attachment VI file and a screen of what I wear.
Thank you very much.
Jorge Q.
10-23-2012 10:49 PM
Hi,
Here are some suggestions:
1. I found in your screenshot that your filtered signal has ripples of large amplitude, which will affect your extraction of QRS complexes through threshold. You can try to change the configurations in the Filter Express VI to decrease the ripples. You can try to enlarge the passband to, for example, 10-25 Hz. You can also try other filter type such as FIR filter. Adjust these parameters until you get a satisfied filter.
2. The data acquired in your VI is in a dynamic data type, which is actually a waveform in this case. So after comparing the signal with a threshold, you cannot connect the signal to a boolean directly. You can convert this to a numeric array by Convert from Dynamic Data VI under Express->Signal Manipulation. Then you can find the position of "1"s in this array and get the time of QRS complexes. Then you can measure the heart rate through the results.
3. In order to lighten the LED when you get a QRS complex, you need to have a enough high loop rate. In your VI, the main loop is mainly driven by the DAQ Assistant VI. Thus you should decrease the signal length every time you acquire, for example, 0.02s, to increase the loop rate.
10-24-2012 06:04 AM
First of all your ECG looks very good as is. why do you apply the bandpass filter between 14.5 Hz and 19.5 Hz at all. Can you elaborate what you will achieve by this I am puzzled. And why this narrow pass-band even more puzzled.Just drop the latter filter. Instead of using basic and simple Labview functions you use and abuse those pesky Express VIs. For the most simple task. For your own sake you should avoid the dynnamic data type. It do more bad than good.
The good news is that you have good signal to do some work on. And I can see your problem solved used standard Labview functions. I guess this is schoolwork. So I will not serve you a solution on a silver plate. But show some effort and I will give a bone with some meat on. To give you a push in the correct direction then needed