From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Signal analysis using spirometer

Hello there! I am new in LABVIEW and I just struggling with this code: Basically what I need is to analyze two signals from two different biosensors and if the signals reach their threshold (i.e. # exhalation and beats per minutes) a song will play. The problem is that I want to collect data for one minute and then reinitiate the counter of exhalations and beat per minute after analyzed one minute of data. Do you know how can I do that?

 

I attached my code Thanks so much. I have been trying this for weeks without any good result. 

0 Kudos
Message 1 of 4
(3,017 Views)

You can use Elapsed Timer or use the attached VI which will do same function of Elpased Timer , provide the target as 1 Minute and The output of Elapsed will give whther one min is crossed or not based on that do action and then you can reset timer.Timercontroller.png

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 4
(3,008 Views)

Thanks for your message. However, I tried the elapsed function but I  did not work. Every time that I run the program the code still keep counting and even if the signals reach the thresholds the music does not play

0 Kudos
Message 3 of 4
(2,969 Views)

When I give my "Introduction to LabVIEW" talk to students, one of my slides is titled "Concept of Time", where I mention that "Time is an intrinsic element of LabVIEW".  There are Time functions and structures, and LabVIEW has a lot to do with Data Acquisition and Control, where the concept to Time (often expressed as its reciprocal, Sampling Frequency) is vital.

 

One problem with the use of Express VIs (which forms the bulk of your code) is that it effectively "hides" Time, and often also hides loops inside itself, making the flow of the program impossible to visualize (you must have access to the code and "dive deep into" the Express VIs to figure it out).  They are great for really simple "Do One Thing" tests or examples, but when you are trying to design a larger, more complex, utility, not having Time available can quickly doom you to failure.

 

One other consideration is that it is not clear what you really want to do, and how Time relates to this.   One suggestion would be to open your favorite text editor (Word?) and write a short document to yourself saying what it is you want to do.  Specify the timing and frequency considerations, and be sure to clarify what gets done when.

 

Part of my confusion, for example, is not knowing the sampling frequency, nor the time interval over which you do the analysis.  Are you sampling for an entire minute, making a decision, then repeating?  Are you sampling and analyzing "on the fly", say, every 5 seconds?  How often do you compute # exhalations and beats per minute?

 

An Organization Principle that might help you is to say "I want to do this thing for a minute" (namely sensing, computing, playing songs), and then saying "... and I want to repeat this until I say Stop".  This suggests a sub-VI for "I want to do this for a minute" inside a While Loop that is "... and repeat until I say Stop".  Similarly, inside the sub-VI, you might say "I want to collect 1 second of data and make a decision" -- if you make a sub-VI out of this, then simply by putting this sub-VI inside a For Loop run 60 times (with some way of preserving the current state of your data), you now have your one-minute code.

 

Anyway, when you try to describe what you want to do (without worrying about the details of how you are going to do it), you can often see the Big Picture and can organize your code better.

 

Bob Schor

0 Kudos
Message 4 of 4
(2,960 Views)