Showing results for 
Search instead for 
Did you mean: 

Heart Rate and Blood Pressure Monitor

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 Smiley Happy


Peter D

0 Kudos
Message 1 of 16
duplicate post in Life Science Board
0 Kudos
Message 2 of 16

I felt that I'd been using the wrong board, as it's more of a LabVIEW issue than

Life Science.


I would remove that thread if I could find the option to do so.


Peter D

0 Kudos
Message 3 of 16

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,


0 Kudos
Message 4 of 16

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 LabviewI 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

Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 5 of 16

@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



Peak Detector


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.




Peter D

0 Kudos
Message 6 of 16


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

Message Edited by t06afre on 03-16-2009 03:21 PM

Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 16

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"


     if (heartrate < 80)

          play "Song2"


          play "Song3"


Obviously once I know how to implement it I can add more songs & if statements.


Peter D

0 Kudos
Message 8 of 16

PJayD, you are working too hard.  Let your DAQ board and LabVIEW help you.  I would recommend the following:

  1. Use the counter input of your DAQ board for the heart rate input.  This has both frequency and period modes, so you can get this directly from the board instead of having to calculate it yourself.
  2. Use one of the analog inputs for your blood pressure.  Depending on what is easier for you, this could be in a different loop than the heart rate input.
  3. Create a separate user interface loop with contains an event structure to handle UI things like button presses.
  4. Create a separate utility loop to handle commands.  Use a queue to give it commands.
  5. Create a separate loop to play your songs.
  6. Use queues to communicate between the loops.
Yes, you will have four or five loops.  LabVIEW handles this well (and will even run them on different processors if your computer has them).  Look at the LabVIEW examples for the event structure, queues, and a producer-consumer architecture before you attempt this or you will just get frustrated.  Good luck.
Message Edited by DFGray on 03-17-2009 08:05 AM
0 Kudos
Message 9 of 16

@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.



Message Edited by PjayD on 03-19-2009 10:09 AM


Peter D

0 Kudos
Message 10 of 16