LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ECG beats per minute help please

Thank you for the offer to help on the circuit but I was referring to the VI.  Our circuit works perfectly.  The beats per minute portion of my VI is not accurate with the tone measurement.  I asked the professor for help and he suggested using the spectral analysis to get an array of data then look for the peaks of that array. I tried that.  attached is what I have so far with that.

0 Kudos
Message 11 of 21
(1,243 Views)

There's something I don't understand here.  You say that you know what the EKG signal looks like, but then seem to be modeling it by "running a signal generator on triangle wave" and "it works".  Do you think a triangle wave is a good model for an EKG signal?  Please run your EKG_4 routine with the EKG hooked up to one of your team members (could be yourself) and post it here -- maybe this is the source of your problem!  [Some of us will be able to recognize an EKG ...]  In four seconds, you should be able to get a few heartbeats ...

 

Incidentally, do you know IBM's Famous Slogan?  (You could look it up ...)

 

Bob Schor

0 Kudos
Message 12 of 21
(1,242 Views)

Hmm... I had to google "IBM Famous Slogan" too

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 13 of 21
(1,237 Views)

Per request.

0 Kudos
Message 14 of 21
(1,227 Views)

You have posted several versions of your code and one image of the data displayed on the front panel.  Unfortunately, we cannot combine the two to see how the data is processed by your code.  Please perform the following steps.

1. Run the VI

2. Select Edit -> Make Current Values Default

3. Save the VI

4. Attach the updated VI

 

Once you have saved the data inside the chart, we could easily run the last block of data through your analysis code. We could then suggest specific changes or tweaks to improve your results.

 

The peak detector should provide the best detection of your waveform.  The output is in samples/peak and would have to converted to peaks/minute.

Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 15 of 21
(1,217 Views)

@Brad750 wrote:

Per request.


Wow!  Look at that plot!  Nine peaks, values much larger than anything else, data that stick way up there, a few points that are way above 95%, maybe 99% of the rest of the data.  Hmm, where have I heard values like 95%, or like 99%?  Let's employ the Famous IBM Slogan and see if we make any progress in solving this (fairly simple, if you stop and IBM about it ...).

 

Bob Schor

0 Kudos
Message 16 of 21
(1,207 Views)

Bob

What on earth are you taking about. I’m well aware that the peaks have a higher amplitude. That’s why I used the peak detector vi. But the damn thing is so inaccurate the values it outputs are all over the place. Sometimes they’re right at 70bpm and sometimes it says 25346 or some other arbitrary number. 

Did you come here to ridicule me or help?

0 Kudos
Message 17 of 21
(1,204 Views)

Well, there is not much help to give until you post a VI where you have the raw data saved.

 

At least now you are giving a big of a clue as to what is going wrong when you say it is a crazy number like 25346.  However the last VI you posted EKG6 doesn't show how it could be coming to such a crazy number.

0 Kudos
Message 18 of 21
(1,196 Views)

Well, I tried to give a "hint" by talking about 95%.  Have you ever learned about Probability or Statistics, and encountered the phrase "95%", maybe with the word "confidence" near it?  Honestly, if you employ the Famous IBM Slogan and just look at your data, you might realize that you can reduce the problem to the very simple one of asking "in this subset of points, which one is the maximum" (and, yes, There's a LabVIEW Function for That).  No Express VI, no Peak Detector, no FFT, Frequency Analysis, etc.

 

Bob Schor

0 Kudos
Message 19 of 21
(1,179 Views)

So to recap:

  • You have some electrical circuit that produces a voltage output with the form you showed a few posts ago in Untitled.png
  • You are able to capture this input in LabVIEW, without using any "disqualifying" tools, e.g. DAQ Assistant
  • Your only further requirement is that you calculate BPM from the signal.
    • BPM is the number of the big peaks in that graph, within one minute
    • You're presumably willing to calculate an average period, and then do 60/period to get BPM (rather than just counting for a minute)
    • You can recognize from your data all of the points that you'd like counting, along with all of the points that whilst perhaps local maxima, are not what you'd like to consider "peaks".
    • There is a clear difference in amplitude (height) between the peaks you want to count, and the peaks you don't want to count.

I would probably have used the Waveform Peak Detection for this, with an appropriate threshold value and width.

 

Dr. Schor's post about avoiding peak detectors makes wonder what better methods might be available. I'd consider whether just a boolean comparison with scalar value and then checking for number of changes in the boolean value within the array is a better method (probably susceptible to noise at the threshold value, but that'd be true for the Waveform Peak Detection VI too...). Finding the indices of local maxima is simple, but I can't work out how to do it (simply) without a suitably set window size (which requires some pre-knowledge about the expected BPM value) and then repeating the check for maxima (since as far as I know, you'd need multiple indices).


GCentral
0 Kudos
Message 20 of 21
(1,173 Views)