Calculating BPM using either Peak Detection point by point or FFT

Hi Guys
Im new to Labview and have absolutely no idea on programming and stuff. Im doing a project on Heart Rate monitor.
I'm using labview to read the analog input to an Arduino Mini. In my attached VI im using Peak Detection Point by point to calculate the BPM but it doesnt seem to work. I took references from several VIs to arrive at my VI. 
My instructor told me I could try using FFT to calculate the BPM as well but Im not sure how to carry it out in Labview.
Hope you guys can help me with this.
Thanks alot!
Attachments:
heart signal.jpg ‏43 KB
Heart Monitor.vi ‏24 KB

Ok, we have some problems here.
1.  The Data Bits property is the number bits for a single character that is being transmitted.  You should not use that.  Since you are using an Arduino, it should be sending the termination character.  So just tell the VISA Read to read maximum number of bytes you expect from a single message or just some large number (like 25).  The VISA Read will stop reading the port when it encounters the termination character.
2. The String Subset is not doing anything.  Just remove it.
3.  You should move your  Wait to be outside of the case structure.  As is currently written, if you are not taking readings you will use up all of your CPU.
4.  You should have labels for all of your controls and indicators.
5.  Your time calculation is completely wrong.  You want to subtract the time of the previous peak from the current peak.  I recommend you use a Feedback Node to do this.
Here's a slightly cleaned up version of your code.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
Heart Monitor_BD.png ‏42 KB

Similar Messages

  • Need Help with peak detection

    Hello,
    I am in need of some help using the peak detection. I have an array of values that I need to find the centroid (peak) of. I am only interested in finding the centroid of a large peak. The problem I keep having is that the peak detection VI finds every little peak above the threshold when I really want the overall average peak. Please look at the graph in the picture file to see what I mean.You can see that the main peak has jagged edges. The peak detection in Labview will find every one of these jagged edges and report the location back as a peak. I am only interested in the overall shape of the peak. How can I filter out the multiple peaks and only report the centroid of the desired shape? There is an example program in the labview package called "advanced peak detection point by point" but I cannot figure out how to employ it in this application.
    Thanks in advance for any help.
    -Mark
    Attachments:
    Array values.PNG ‏9 KB

    If I were you, I wouldn't even use peak detection.
    The point of peak detection is to find multiple peaks, like in a sine wave, etc.
    If you just want the maximum:
    Just use 'Array Max & Min'
    The 'max value' equates to your y-value.
    The 'max index' can be used to find your x-value
    Message Edited by Cory K on 05-07-2009 11:52 AM
    Cory K
    Attachments:
    Peak.PNG ‏3 KB

  • Peak detection in C

    Hi All,
    I am looking at implementing or using the peak detection function in C. I require the same in C since, I would be later porting this application on microcontroller.
    However, the function implemented in LabVIEW calls the lvanlys.dll for performing the peak or valley detection. Hence, I would not be in position to use the same and later port it on the controller.
    Essentially I am looking for similar function inputs (threshold and width) implemented in C.
    Thanks in advance.
    Regards.

    http://www.nr.com/
    http://en.wikipedia.org/wiki/Numerical_Recipes
    Numerical Recipes in C. The Art of Scientific Computing, 2nd Edition, 1992, ISBN 0-521-43108-5.
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

  • Graph peak detection problem

    For surface analysis of a sample, I did signal processing and peak detection using inbuilt peak detector .vi . But the problem is in shown peak/valley location... I have attached the screenshot of one run. See there are some peaks(valleys) which are fairly away from the actual graph. I am confused. What might be the reason of this fault? Any idea?
    red blocks--> peaks
    green blocks--> valleys 

    I have used the peak detection function in several application. The peak detections will sometimes be inaccurate in amplitude. The reason for this is as I think covered by Kolan and Alain S. I have found the that the locations is more accurate than the amplitudes parameter. So use the locations parameter to pick values from your wave data. This will improve your accuracy
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Regrading peak detection Vi input

    I would like to use this peak detection but i would like to remove the signal source and use my own input instead. Could anyone teach me how to do it? thanks^^
    Attachments:
    Peak Detection and Display1.vi ‏37 KB

    The input to the peak detector VI is a simple DBL array.  I would recommend you use Peak Detector.vi instead of the unexposed subVI in your code (from the biomed toolkit?).
    Where are you getting your data?  How you get from there to the peak detector will depend on this, since your data type could be dynamic data type, waveform, or simple array.  When in doubt, search the LabVIEW help first.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Peak detection method

    Hi,
    Can anyone recommend the best method to use for peak detection incoming
    array of data (represents ECG).
    I would like to use the 2nd deriviative method, any ides if its
    recommended, and how best to use it?
    Thanks

    There is a vi called "Waveform peak detection.vi". You set a threshold to detect peaks or valleys.
    www.vartortech.com

  • How to use peak detection in labview to detect peaks from data acquisition information

    Hi
    I am a university engineering student who is working in a team to develop a coin detector, its purpose is to recognize different coinage and detect fakes.
    For this we are using LabVIEW 8.5.1. I am relatively new to labview and have had no experience of using to before. We are trying to integrate four voltage signals produced by an electromagnet, straingauge, optical sensor and a proximity sensor. We have already developed signal conditioning for these tests and now wish to put them into labview.
    Our plan is to use peak detection on each of the tests so that labview can detect peaks which correspond to different coin types, provided they meet set criteria for each coin. Then to combine these either using logic or mathscript to produce a Boolean output for each coin.
    One of our advisors helped us develop a peak detection program for a simple simulated sine wave however we are struggling to adapt this for data acquisition information and itegrate it with mathscript and to be honest it does not make much sense. I have attached the program below. Thanks in advance for your assistance. 
    Attachments:
    Strain 2.vi ‏25 KB

    Chris,
    Here are several ways to help  you get started with peak detection:
    1. On your functions palette, you can search for "peak detect" and you'll find several different variations of VIs that will do peak detection.
    2. You may also want to take a look at this tutorial: Peak Detection Using LabVIEW and Measurement Studio
    3. There's an example in the example finder called "Peak detection and display" that will probably be useful. 
    Hope this helps, 
    Misha

  • Looking for function or vi to calculate 1/2 power points of data obtained from peak detection vi

    I am analyzing vibration data and need a function or vi that will operate on peak data returned from the LabView Peak detection function and provides 1/2 power points or sideband frequencies. These are needed to compute a "Q" factor. So far I have not been able to find anything.
    Thanks, Fran

    The sound and vibration toolset may help here.  there are several vibration level measurements including peak.  With the advanced FFT functions in the Sound and Vibration tools, the zoom FFT can be used to identify and find sidebands and associated amplitudes. 
    here is a link to the manual
    http://digital.ni.com/manuals.nsf/websearch/1F8691E94728BDF5862570490058C3B2
    here is a link to the toolset
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/10521
    please note the bullets on the above page (about half way down) noting peak detection, etc.
    Preston Johnson
    Principal Sales Engineer
    Condition Monitoring Systems
    Vibration Analyst III - www.vibinst.org, www.mobiusinstitute.com
    National Instruments
    [email protected]
    www.ni.com/mcm
    www.ni.com/soundandvibration
    www.ni.com/biganalogdata
    512-683-5444

  • Problem in peak detection

    Respected sir/madam,
    i am actually processing human radial artery pulse signal... i acquired that signal and linearised that by using filter...
    there is a problem in peak amplitude detection and location...by manually we can say there is more number of peaks ..but peak detector shows only 25 peak's amplitude and their locations...i can't understand about locations that shows..i attached the data which is in .lvm extension and the vi
    please help me to rectify the problem..
    thank you
    Attachments:
    Untitled 2.vi ‏100 KB
    Untitled 2.vi ‏100 KB

    Once again the Dynamic Data Type (DDT) generated by the Express VIs hides the real problem.
    The data segments are too short to reliably detect the peaks - not every segment has a peak and some peaks may be partly in one segment and partly in the next. By combining all the data into one waveform before filtering and peak detecting, it is possible to get reliable matching between the "eyeball" peak detector and the software peak detector.
    Note that the large transients at the beginning of the data set are detected as peaks. These transients are due to the real transient in the data and the transients of the filters. I did not attempt to remove them. You could use Array Subset with either manual selection of the end of the transient or some automated process based on the larger amplitude and lower frequency of the transient compared to the real signal.
    There is  a lot of "stuff" in this VI - things I tried and did not remove and multiple ways of doing things.  The enabled diagrm of the Diagram Disable structure has a constant with the data from your file so that I did not need to read and process the file repeatedly while working on the filters and peak detector.
    Comments in no particular order regarding what I did and how the posted VI works.
    1. The DDT data from Read from Measurement File.vi is converted to an array of waveforms. The Waveform data type is well docmuented and the internal data structure is readliy accessible.
    2. Each element of the array of waveforms from Read from Measurement File.vi is appended to the corresponding element from the previous iteration to form one array of waveforms containing all the data in the file. This is displayed on Array of Waveform, Array of Waveform 4, and Signals total. Note that these are graphs, not charts.  The data is also put into 2D arrays as Array of Waveform 2 and Array of Waveform 3.
    3. I do not have Advanced Peak Detector PtByPt.vi, but I think the data is not truly point by point so this may be a poor choice.
    4. I used the standard filter VIs (rather than Express VIs) to stay away from DDT. The outputs are slightly different, but the Express VIs do not give you complete control or knowledge of what the filter setup is. I used Butterworth filters for both filters and adjusted the cutoff frequencies slightly to get similar waveforms.
    5. I used the standard Peak Detector.vi from the Signal Processing >> Signal Operations palette. It reliably finds 104 peaks over a wide range of widths and some variation in thresholds.  That count includes the transients at the beginning as mentioned above.
    The .2 VI contains all the junk code I described above. The .3 VI is a cleaned up version.
    Lynn
    Attachments:
    Untitled 2-9.2.vi ‏760 KB
    Untitled 2-9.3.vi ‏183 KB

  • Peak Detect

    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!
    Solved!
    Go to Solution.
    Attachments:
    A-LV HR Prototype.vi ‏982 KB

    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.
    Attachments:
    HR Graph.png ‏122 KB

  • Smart peak detection

    Hello,
    I have signal of valve acceleration. My present task is to detect all important peaks for other calculation. At firs I tried to use derivative and look for points where it crosses zero (local extreme - relative extreme), but this is not useful because it detects all even the smallest one. I think about any kind of filtration but I don’t know any.
    Does anybody know how to at least smooth the line to eliminate no important peaks? Or any other advices?
    I marked all important peaks in signal (peaks2.png) and attached VI with the signal.
    Thanks, I appreciate all comments.
    LV 2011, Win7
    Attachments:
    peaks.vi ‏31 KB
    peaks.PNG ‏68 KB

    I know that this is very subjective. I want to chose these peaks that are big and "keen" (acute). In the light of these facts I changed the picture with the important peaks. In addition I care only about the peaks that are between 200 and 300 (x axis) and theit direction is up (peaks4.png).
    My main problem is how to eliminate small deviation like in the picture peaks4 - with red colour is highlight area, that is considered to be one peak. But when using derivative it will find many small extrems.
    Thanks for all ideas.Message Edited by ceties on 02-21-2006 03:01 AM
    LV 2011, Win7
    Attachments:
    peaks5.PNG ‏60 KB
    peaks4.png ‏65 KB

  • Using javascript to detect JVM

    Hi all.
    I'm trying to use javascript to detect whether the JVM (either j2sdk or j2ee) has been installed and take the user to SUN web page if not.
    The original MS JVM is not useable for my purposes (does anyone use it?).
    I know how to detect browsers and plug-ins but not JVM.
    Can anyone help out please ?
    TIA :-)

    If you use the classid and codebase attributes of the <object and <embed tags, it will download automatically. Easiest is to use HTMLConverter. You can change codebase to point to somewhere on your network if not everyone has internet access. See [url http://java.sun.com/j2se/1.4.1/docs/guide/plugin/developer_guide/using_tags.html]here

  • Peak detection in a xy graph

    Hi,
    I have plotted the spectral data in XY graph indicator using a .txt file. Now I need to detect the peaks present in this spectrum, their locations and amplitude. I have used Peak Detector .vi in the code. However, it is not generating relevant peaks but displaying approximated values with wrong locations(x values). Is there a better and accurate way to detect the peaks? Please refer attachments for the code.
    Let me know.
    Thank you.
    Attachments:
    data1.txt ‏28 KB
    read_spectrum_1.vi ‏62 KB

    Have you read the LabVIEW Help file (when looking at the BD, type Ctrl-H, then go to the "Detailed help" at the bottom of the popup) about the peak detection function?
    "Locations contains the index locations of all peaks or valleys detected in the current block of data. Because the peak detection algorithm uses a quadratic fit to find the peaks, it actually interpolates between the data points. Therefore, the indexes are not integers. In other words, the peaks found are not necessarily actual points in the input data but may be at fractions of an index and at amplitudes not found in the input array.
    To view the locations in terms of time, use the following equation.
    Time Locations[i] = t0 + dt*Locations[i] ...
    ... This Peak Detector VI is based on an algorithm that fits a quadratic polynomial to sequential groups of data points. The number of data points used in the fit is specified by width."
    Your input data is so noisy that getting as results the actual points from this function that visually seem to be "peaks" is virtually impossible. Not to mention that there is such an offset at the begining of the data that you are getting gazillions of false positives here. You really need to clean things up before you let LabVIEW loose (at least the Peak Detector VI) on it if you want meaningful answers.
    BTW, setting "the threshold slightly below [7379.18]" would not necessarily result in a peak depending on your definition of "slightly," because your data has no points below 180.041, making the highest possible peak 7199.139.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • Peak Detection with Base package

    Hello,
    I'm constrained by a budget so I can't purchase the analysis package
    just for peak detection. Does anyone have any hints on how to search a
    1-D array for peaks without using the pre-made VI's? I've been pulling
    my hair out over this one for a week!
    Thanks in advance.

    Labviewguru wrote in message news:<[email protected]>...
    > Jason,
    >
    > I would suggest looking online for a "peak detection" algorithm.
    > There are a number of ways to do it. The LabVIEW peak detector using
    > a least squares quadratic fit to find the peaks, with a filter of
    > amplitude and width. This can also be done much simpler ways. You
    > can try applying a smoothing filter (use a moving or windowed average)
    > and then look for peaks that way.
    >
    > Please post if you need more assistance. Also, what are you trying to
    > do with the peak detection. This would be helpful in providing
    > further assistance.
    >
    > Good luck
    Labviewguru
    Thanks for the advice. Yeah, the NI home page tells me that th
    ey use a
    least square quadratic fit to find the peaks. I'm not sure on how to
    implement that. I'll do a web search on that one. I'm not dealing with
    a very noisy signal so I don't think that I need to do a moving
    average. The amplitude filter seems pretty easy, I just compare each
    point to a preset threshold. However my peaks are composed of more
    than one sample so each peak gives me a bunch of "true" values. I only
    want one count per peak. The way I thought of doing it was using
    hysteresis and starting a subroutine when the upper limit boolean went
    hi, then resetting the subroutine when the lower limit boolean went
    hi. So essentially i need to have labview look for a high, THEN look
    for a low, THEN reset over and over again until the sample array is
    finished. I'd love to work on this for days but I've already put too
    much thought into it.

  • Waveform peak detection ...Please have a look

    Hi folks,
               I am trying to acquire 2 signals and then detect the peaks of each of them and divide the peaks and display it in a waveform chart.But my Peak detection doesnt work at all...I tried plugging in values from 3 to 10000 but it just doesnt work...Please have a look at my VI and feel free to point out any errors in my VI..
    Thanks
    Attachments:
    slope 2 channels3.vi ‏51 KB

    Hi,
    Had a look at ur VI
    tell me, do u need a single peak for every iteration or a series of peaks above a certain threshold?
    If it is a single peak for each acquired waveform , then extract y array from the waveform cluster( you have already done it in ur VI) and connect it  to 'find array min max' function found in array functions palette and u get the single peak for each waveform.
    If it is a series of peaks u are interested in, then compare all these values inside a for loop.
    Index each element inside a 'for' loop, check it for threshold using a conditional case structure and put it inside a shift register.
    regards
    Dev

Maybe you are looking for

  • I did a trial on CS6, then did not continue with it, but now my CS4 bridge is malfunctioning and raw has completely stopped working.

    I tried support chat, but they just said to try here. I bought CS4 under an old defunct email address and under my new address I do not even have a product registered. Adobe knows it is purchased in my name and I have the registration number, but sin

  • Patch 7690975 for EBS 11i

    Hi hussein, I am applying patch 7690975 on our 11i instance, but I encountered "worker failed" error. The patch process is telling me to resolve it using "adctrl" "tell the worker to restart a failed job", but still the error persist and it is stocke

  • F4 on selection screen in BDC

    can you tell me how to get a file from desktop to selection screen. iam using the KD_GET_FILENAME_ON_F4 function module . F4 functionality is not getting. regards RAj.

  • Error in XML compiling

    Hi, I am trying to complie my class directly on the server, which access an XMLParser class. When i am trying to do so. I am getting the following errors at the compile time: error: Can't write: ./XMLParser.class error: Can't write: ./XMLParser.class

  • SWC_SET_ELEMENT CONTAINER

    Hello, I have got a requirement to change a method of any object type, i am new to BOR i find these statements in the methods: swc_set_table container 'Sequential_Approvers' sequential_approvers. swc_set_element method_container 'Status' status. Coul