03-16-2009 06:41 AM
Hi there,
I am required to build the software for a heart rate and blood pressure monitor using
the following software and equipment;
- LabVIEW 8.5.1
- NI PCI-6221 Card
- CB-68LP I/O Terminal Block
The inputs are as follows;
Heart rate - Square TTL wave which changes level on every beat of the heart.
Blood pressure - Continuous voltage signal relating to pressure.
The program is required to take a sample of heart rate OR blood pressure and
depending on the result play a certain song (ie healthy heart rate could play ''Stayin'
Alive", high blood pressure "Under Pressure" - you get the idea!). Although I
understand the results could be calculated continuously, I think because of the
requirement to play a song it would probably be best to have a button to start taking
the sample and then play the audio once the bpm or blood pressure is obtained.
I have very basic knowledge of LabVIEW; I know how to use the DAQ board with
"Measurement and Automation" to feed the signal into LabVIEW, and I have limited
experience of using Structures and other basic functions (numerical, etc).
I think the first issue to overcome is obtaining the average frequency of the square
wave over a given period of time (6 secs).
Any and all help greatly appreciated!
Peter
03-16-2009 06:45 AM
03-16-2009 06:55 AM
03-16-2009 07:02 AM
Hello...... please wait
After sometime when you manage to solve the problem, just mark the solution and give a link to the solution so that it will help people searching for same kind of issues. Hope you understand.
Thanks for your patience,
Mathan
03-16-2009 07:24 AM
I agree this is a labview question. And in this case I also think it was the correct thing to post your message here. You will have a larger audience in this forum, and your topic is more or less signal processing and Labview. I do not Labile like duplicate postings my self. But I also think it is unnecessary to pedantic comment on everything that might resemble a duplicate post.
But let us get back to your problem. I know your signal is digital, but you may still deal with it Labile as it was a analog signal. It is a matter of selecting an adequate sample rate. If I was you I would have added an extra analog channel for the "digital" heart rate signal. Then I would have used the "Threshold Peak Detector VI" on this signal. If you apply this function correct you will be able to count the number of high to low changes in the signal for a given time. This number will also reflect your heart rate
03-16-2009 08:58 AM
@mathan - I hope you don't mind if I continue using this thread as it is the correct
category and I can't move the original.
@t06afre - Hello again! Thanks for replying. When you say "I would have added an
extra analog channel for the "digital" heart rate signal" what do you mean? I've
combined the example VI you suggested with my simulated square wave to give the
following.
It is ALMOST operating correctly. Although I notice because my square wave's initial
value is 1 it misses one beat, yet it's returning a count of 7 for a 60 bpm heartrate.
I need to go to a lecture just now, I just thought I'd let you know how I'm getting on.
Pete
03-16-2009 09:20 AM - edited 03-16-2009 09:21 AM
Hi
This is very simple. In your picture it has been counted 7 valid peaks. This implies you have a frequency equal to (number of samples*dt)/7. Multiply this with 60 and you have the heart rate in BPM
03-16-2009 12:23 PM
Thanks t06afre, got that sorted. So I now have a functional VI which can calculate the
frequency of the square heart rate signal.
The next stage is to improve the program so that the loop is operated by a user
selected button, it should be able to run multiple times..
Playing an audio file is proving to have 2 issues;
1 - How to call audio files using LabVIEW, I've noticed a 'windows media player' tool
although I'm unaware of its capabilities.
2 - Programming the IF statement to allow for selection
I've done a bit of C++ programming so I had something like the following in mind;
if (heartrate < 60)
play "Song1"
else
if (heartrate < 80)
play "Song2"
else
play "Song3"
Obviously once I know how to implement it I can add more songs & if statements.
03-17-2009 08:04 AM - edited 03-17-2009 08:05 AM
PJayD, you are working too hard. Let your DAQ board and LabVIEW help you. I would recommend the following:
03-19-2009 10:07 AM - edited 03-19-2009 10:09 AM
@DFGray –
Thanks very much for your reply!
Your method sounds a lot better than the route I was taking before. Although I
have no experience of queues and some of your steps (creating separate loops
for UI and commands, for example) are a little unclear to me. But I’m studying
the examples you suggested so hopefully that will provide me a better grounding.
If you have any more advice I’d really appreciate it.
Peter