Example Code

Build Your Own Heart Rate Monitor: Example Code

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • LabVIEW

Code and Documents




This article contains the Heart Rate Monitor example program that is part of the Build Your Own Heart Rate Monitor series. The program is an example application that collects real world data from a photoresistor and processes the data to identify and count peaks that are used to determine a heart rate.

Front Panel

The front panel of the Heart Rate Monitor VI provides a graph where the user can see the signal that is coming from the hardware filters. Plotted against the signal (red) is the value of the threshold that is used for the peak detection algorithm and it can be seen how the threshold varies in order to calibrate to the signal amplitude. In addition, the user can switch to a simulated signal which uses Express VIs to create signals with noise and a filter VI to perform software based filtering of the input signal.

Block Diagram

The block diagram of the Heart Rate Monitor VI shows a common design pattern in LabVIEW consisting of collecting data, processing data, and displaying data. The user is given thorough documentation about each stage of the application and is able to see the progression from one stage to the next. In addition, the SubVIs used for custom data processing are fully documented to give the user thorough insight into the function of the application.

Articles in this Series

  1. Build Your Own Heart Rate Monitor: Sensor Design
  2. Build Your Own Heart Rate Monitor: Example Code

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.