LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Peak Detect

Solved!
Go to solution

 

Hello,

 

I am trying to make a heart rate monitor using LabVIEW and arduino. The basic hardware uses an LED and a photocell. You place your finger on the LED, with the photocell above, and the photocell detects changes in the amount of light in your finger whenever your heart beats.

 

My design work okay and is able to detect changes in light. However, I am having trouble calculating those changes and converting the data into a heart rate. One of the problems is the peak detect, into which you set a threshold value and the detector looks for amplitudes above or below that value. The problem is, the amount of light coming through one's finger varies wildly, so even though a pulse is clearly observable, you can't just set a value for the threshold to look for.

 

I tried to solve this by making the threshold vary, so that it would be slightly below the average, however my code still fails to detect a pulse. Does anyone have any idea how I could resolve this issue, or if there is a better method than using the default peak detect?

 

I have attached a copy of my code, and would be very grateful if anyone could provide input. Thank you very much!

0 Kudos
Message 1 of 29
(5,768 Views)

For example, here it detected a significant drop in light intensity 6 times over a 6 second period, so BPM should be 60, but it doesn't display anything.

 

Other times the BPM shoots up to 200 in a second then just stays there. I can't figure out why, or if there's a better way to do it.

 

0 Kudos
Message 2 of 29
(5,762 Views)

If you post the waveform data, we can have a go.

Since "Photocell Read" returns a scalar, one way to start is by getting rid of the Collector and Statistics express VIs and using "Array Max & Min PtbyPt.vi" and "Peak Detector PtByPt.vi".

0 Kudos
Message 3 of 29
(5,749 Views)

This isn't right, but it's a possible starting point:

A-LV HR Prototype_BD.png

0 Kudos
Message 4 of 29
(5,746 Views)

Thank you for your reply!

 

So I tried out your suggestions, and now it just spews out numbers indefinitely. I tried changing the value which I use to set the threshold, but it doesn't help. Are there any better ways to detect peaks and valleys?

 

Thanks!

 

 

0 Kudos
Message 5 of 29
(5,720 Views)

Wire the intensity data to the edge of the while loop and create an indicator outside the loop. Run it for a "little while", press the stop button, and attach that data to this forum post. Then we can play with the data.

Or run it then stop it, change the indicator to a control, save the default data in the control, and attach the VI again.

0 Kudos
Message 6 of 29
(5,712 Views)

 

Is this what you mean?

0 Kudos
Message 7 of 29
(5,705 Views)
0 Kudos
Message 8 of 29
(5,704 Views)

Yes. Now right-click on Waveform Graph, choose "Change to Control".

Then right-click on it again and choose "Data Operations" -> "Make Current Data Default".

Save the VI and attach it. Then when someone opens it, the data from the previous run will still be there.

0 Kudos
Message 9 of 29
(5,693 Views)

 

Okay, I made those changes.

0 Kudos
Message 10 of 29
(5,689 Views)