PPG method for calculating heart rate and heart rate variability (HRV)


Mindbreath app PPG

Photoplethysmography (PPG) is commonly used in determining heart rate. PPG is a non-invasive technology that uses a light source and a photodetector at the surface of the skin to measure the volumetric variations of blood circulation.

PPG signals can reflect changes in blood volume below underlying body tissues which are then analyzed to determine heart rate activity.

In the case of a mobile phone as a heart rate measuring device, it's back camera acts as a PPG sensor (photodetector) with the camera's flash acting as a light source. Mindbreath app uses the same principles to detect heart rate and further analyze heart rate variability. The app will analyze the variation of blood flow at the fingertips as do other apps with similar functionality.

PPG signal

Here is a sample of signal-

This is a sample obtained after analysis of a video stream captured by a mobile camera. Sample length-15 seconds

Waves formed are based on variations in the intensity of light captured by the mobile's camera when placed on a user's fingertip. That is the light that is reflected back after being absorbed by the skin. 

As you can see, there are clear peaks obtained in the signal, the distance between two peaks is known as R-R interval, which translates to interbeat period or the distance/time between two successive heartbeats. 


By measuring the time between two successive peaks, heart rate for that particular time period can be obtained.

For example: if the time between two peaks is 1000 milliseconds, Heart rate will be 60 beats per minute. 500 ms will be 120 bpm, 750 ms will be 90 bpm and so on. Shorter the R-R interval, faster the heart beats, and vice-versa.

Good quality R-R interval is the bedrock for heart rate variability analysis, we will have a look at that later.

Now with the basics of PPG and how it calculates heart parameters defined, let's dive into more details.










ppg heart rate waveform hrv.jpg
ppg peak detection heart rate waveform hrv.jpg
Mindbreath ppg block diagram heart rate 2.jpg

Mindbreath app utilizes both FFT and peak detection methods to determine heart parameters.

The most important piece of this puzzle is signal quality analysis, a PPG signal can be affected by various factors such as but not limited to movement, temperature, ambient light, phone video processing filters, etc. While the app has tolerances and measures taken to minimize the effect of those factors, ultimately, determining the quality of the received signal is paramount.

The app's heart monitor program has built-in algorithms which are tested extensively in-house to determine signal/data quality.

Signal/data quality below a certain threshold is eliminated from the readings. The amount of data eliminated at the end of the reading is mentioned at the bottom of the screen after each reading is completed.

A 60 seconds reading with less than 45 seconds of good data quality is also eliminated and the session's results are considered invalid.

Mindbreath app PPG test

It took us around 8 months to develop our algorithms, during the process we used many benchmark devices and applications including the Polar H10 chest strap. Below is a little sample test we did to understand the accuracy coefficients of our method.

Aim: to understand the accuracy tolerance of the Mindbreath app's mobile heart rate and R-R interval with respect to Polar H10 chest strap.



-Individuals were asked to take readings from the Mindbreath app's camera PPG method and Polar H10 device at the same time. Polar H10 would be strapped to them while a mobile phone would be used at the same time to take PPG readings.

-Polar H10 would be connected to the Mindbreath app.

- Heart rate and R-R interval of both methods would be recorded.

Results of both would be plotted on a Bland-Altman plot.

We have attached four separate readings of 4 healthy individuals with no known health ailment.

Subject 1  Age-23, weight-60 kg, height-175cm, Male. Mobile device-iphone7

Subject 2  Age-28, weight-74 kg, height-172cm, Male. Mobile device-iphone7

Subject 3  Age-22, weight-58 kg, height-169cm, Male. Mobile device-iphoneX

Subject 4  Age-29, weight-80 kg, height-179cm, Male. Mobile device-iphone12

Bland-Altman plot: Heart rate

HR Ankit Subject 1].jpg
HR Utsav Subject 2].jpg
HR Meet Subject 3].jpg
HR Kaival Subject 4].jpg
RR Ankit Subject 1].jpg
RR Utsav Subject 2].jpg
RR Meet Subject 3].jpg
RR Exp Kaival Subject 4].jpg

Result: From the analyzed datasets-

The maximum standard deviation (SD) in Heart rate was 2.09%, whereas in R-R interval was 2.74%

These are healthy results in favor of the app's PPG method and encourage us to deploy the method for wider usage in a published app.