The main use for this algorithm is the calculation of Heart Rate and Respiration Rate, though it can also be used to determine the frequency of microphone data, generated voltage signals like saw-tooth waves or even data from a flickering light source. To use the command a data set must first be collected. For example, collect 5 seconds worth of data at a rate of about 50 sample/second if you are using a heart rate monitor. Once the data set is collected, it is just a matter of sending the Advanced Data Reduction command to the LabPro/CBL 2 with the appropriate parameters. The parameters in this command are used to try and isolate the waveform of interest from other noise that may be inherent in the data. The command looks like this:

{10, channel, alg, P1, P2, P3}
channel: integer selecting analog channel on which to perform algorithm
alg: 1 for Heart Rate Algorithm (only current, valid choice)
P1: integer between 0 and 100 corresponding to a percent of the maximum value in the data set. Determines when data transitions from “high” to “low.”
P2: integer between 0 and 100 corresponding to a percent of the maximum value in the data set. Determines when data transitions from “low” to “high.” P2 must be greater than P1.
P3: real value in the units of the channel selected. Determines the minimum difference in data between minimum and maximum values in the data set. The algorithm will return a 0 if the difference between the minimum and maximum values of the data set do not exceed this value.

One approach to fine tuning the parameters is to pick apart your raw data. You want to look at the maximum and minimum voltages in your data set and the difference between the two.

Heart rate data should be fairly easy to analyze because the peaks are generally quite drastic compared to the noise, so we can get the algorithm to easily calculate the rate we are interested in. Typical data from our Exercise Heart Rate Monitor moves from about 0 Volts to 2.5 Volts (at the maximum of each heartbeat.) Here is the command we send to calculate the heart rate data taken from our Exercise Heart Rate Monitor.

{10,1,1,40,50,0.5}

The LabPro/CBL 2 will return a single value. The user program is responsible for taking the result from LabPro and dividing it by the sample time to get the true frequency in Hz. A further conversion can be made to represent the result in units of beats per minute (bpm.)