Heart Rate Variability Recording System Using Photoplethysmography Sensor

Heart rate variability (HRV) is a physiological measurement that can help to monitor and diagnose chronic diseases such as cardiovascular disease, depression, and psychological stress. HRV measurement is commonly extracted from the electrocardiography (ECG). However, ECG has bulky wires where it needs at least three surface electrodes to be placed on the skin. This may cause distraction during the recording and need longer time to setup. Therefore, photoplethysmography (PPG), a simple optical technique, was suggested to obtain heart rate. This study proposes to investigate the effectiveness of PPG recording and derivation of HRV for feature analysis. The PPG signal was preprocessed to remove all the noise and to extract the HRV. HRV features were collected using time-domain analysis (TA), frequency-domain analysis (FA) and nonlinear time-frequency analysis (TFA). Five out of 22 HRV features, which are HR, RMSSD, LF/HF, LFnu, and HFnu, showed high correlation (rho > 0.6 and prho < 0.05) in comparison to standard 5-min excerpt while producing significant difference (p-value < 0.05) during the stressing condition across all interval HRV excerpts. This simple yet accurate PPG recording system perhaps might useful to assess the HRV signal in a short time, and further can be used for the ANS assessment.


Introduction
Human body is interacting between each other where it consists of many different interacting systems. Any changes in human body will generate response to all parts of the body include the autonomic nervous system (ANS) [1]. ANS controls the system that regulates bodily functions such as the digestion, respiratory rate, heart rate, pupillary response, urination, and sexual arousal. Any changes in ANS can be detected by heart rate variability (HRV) since HRV and ANS is directly related.
Heart rate can be defined as the number of heart beats per minute while heart rate variability (HRV) is the fluctuation in the time intervals between adjacent heartbeats. HRV refers to the time series of the interval variation between consecutive heart beats and it can be analyzed in time, frequency and nonlinear domains [2]. The fluctuations in HRV value reflects neurocardiac function of the body as it is generated through heart-brain connection and autonomic nervous system (ANS) dynamics [3,4].
HRV is a common measurement that can be extracted from the physiological measurement and helps to monitor the psychological stress [5]. It is because, HRV has direct connection with the autonomic nervous system (ANS) where any changes that occurred in human body can be directly detected by the HRV. The common methods to get the HRV are by using the ECG. However, there are several difficulties to record the ECG signal. First, it requires at least three surface electrodes to be placed on the skin to get single lead channel [6]. This clearly shows bulky of wires are needed for the recording and might cause distraction and uncomfortable feeling to the patient. Furthermore, it requires several times to set up the ECG before start the recording.
In deriving the HRV signal, appropriate QRS algorithms need to be applied to detect the peaks and its R wave, to obtain the interval of RR, and to find acceptable interpolation and resampling to produce a consistently sampled tachogram. By using the ECG signal, the resultant HRV could have several errors in the HRV signal due to drift, electromagnetic and biological disturbance, and the complicated morphology of the ECG signal [6].
Therefore, a simple recording system in deriving the HRV signal is needed. PPG which is an electro-optical technique that detect the changes of blood volume in the microvascular bed of the tissue is believed able to overcome the problem that faced by ECG signal and has been suggested as an alternative method to derive the HRV signal [7].
The PPG sensor's system is equipped with a light source and a detector, it also developed with red and infrared (IR) light-emitting diodes (LEDs) that commonly used as the light source. The light intensity of the PPG sensor monitor has been changed via the reflection from or transmission through the tissue. Figure 1 shows the signal from ECG and PPG signal. Derivation HRV signal from ECG is calculated from R-R interval, while the calculation of HRV signal from PPG signal is used inter-beat interval (IBI) or pulse interval (PPI) [8].
The light traveling through biological tissue passes many materials, including pigments in the skin, bone, and arterial and venous blood. The changes of blood flow mainly occur in the arteries and arterioles (but not in the veins). For example, during the systolic phase of the cardiac cycle, the arteries contain more blood volume than the diastolic phase. PPG sensors optically detect changes in the blood flow volume, for instance, changes in the detected light intensity in the microvascular bed of tissue through the reflection from or transmission through the tissue [9]. As previously discussed, both ECG and PPG system are able to provide information on cardiovascular activities. While ECG system allow better depiction of real cardiac movement through the measurement of the electrical signals produced by the action potential of the tissue, PPG allow adequate cardiovascular measurements such as heart rate and cardiac output only through pulsatile flow of blood in the arteries. Several studies have shown that the cardiovascular parameters collected through PPG systems are highly correlative and comparable to the measurements taken through standard ECG system [8,10,11]. This proves that despite not being able to illustrate exact cardiac waveforms or ectopic beats, PPG could serve as better alternative for portable heart monitoring device.
In terms of measurement accuracy, there are several factors to be considered to ensure the reliability of data collection. Topographical factor such as position of sensor placement on the body plays an important factor since different area of the body constitutes different accuracy of perfusion readings. The most accurate perfusion readings are recorded in earlobe; however, the wrist does allow perfusion readings with appropriate accuracy [9]. PPG watch is not subjected to electrical interference and drying or dropping-off of electrodes [8].
Therefore, this study proposes a PPG recording system for heart rate variability measurement that can be further used for mental stress assessment.

Method
ECG and PPG signal has been collected from 12 healthy subjects randomly selected with no prior symptoms of autonomic or cardiovascular disorder, ages between 20 and 30 years old. The data was collected with duration of 30 min including 10 min of adjustment, 10 min of rest (baseline) and 10 min of mental arithmetic testing. As a type of mental stress test, participants were needed to conduct an internet arithmetic test for 10 min in order to evaluate HRV under stress conditions such as time constraint. Lead II ECG setup with three electrodes were placed on the skin of the subject. For PPG signal, the wristband was placed on the left wrist. The subject was asked to sit down and make sure they are familiarized with the procedure. The ECG and PPG were recorded simultaneously after device was setup. The data was imported to the MATLAB software for the signal processing ( Figure 2).

Signal processing
The recorded PPG and ECG signals were then pre-processed to extract the HRV using MATLAB software ( Figure 3).

HRV derived using PPG
The PPG signal began with the band pass filter to attenuate noises contained in the signals. The band-pass filter was made of cascaded lowpass and high-pass filters. The cut-off frequencies that have been used 5 and 11 Hz. The low pass filter (LPF) eliminates the noise from other part of body, such as the muscle noise and also 50 Hz power line noise. The high pass filter (HPF) which is used to remove the motion artifacts [12].
After that, the PPG signal undergo the slope sum function (SSF). This method is to enhance the systolic peak of the PPG pulse and to suppress the balance of the pressure waveform by using equation in Eq. (1) [13].
where w and s k are the length of the analyzing window and the filtered PPG signal, respectively. The SSF algorithm initialize the localization of the onset and offset of SSF then the pulse peak is identified as the local maxima within the range. The SSF signal produced coincides completely with the PPG pulse onset and offset and the pulse peaks appeared within the range of SSF pulse [14].

HRV derived using ECG
For ECG processing, Pan and Tompkins algorithm was implemented to get the HRV signal [15]. The Pan and Tompkins procedure are more complex as ECG signal contains superimposition of several waves (P, QRS, and T waves) as seen in Figure 3 [16]. After initial denoising using BPF, the waveform undergoes differentiation process to obtain slope information overcome baseline drift. The next step is to perform signal squaring to emphasize higher frequency signal components (QRS waves) while attenuating components of low frequency. Resultant signal obtained through the squaring phase was then smoothed using moving average filter with a moving window integrator at 80 ms. A thresholding process is required to ensure that only the true QRS complex detected and the adaptive thresholds have been set for the classification of the locations of the detected R points.
The N-N interval was then computed and outliers presented in the signal was removed. Some of the data segment loss through the outlier extraction method was substituted by a new data segment using a linear interpolation method that resulted in NN intervals with nonequivalent moment sampling. However, the use of irregularly sampled NN intervals during HRV analysis characteristics such as frequency and TF analysis would cause generation of additional harmonic components and artifacts in (Figure 4) [16].
Therefore, the HRV signals were resampled at standard sampling frequency of 4 Hz [17]. Finally, the NN interval was passed through detrending process to overcome irregular trends.

HRV feature extraction
The following HRV features ( Table 1) were computed based on the guidelines provided by Task Force of The European Society of Cardiology (ESC) [18].

Time-domain features
In this study, the time domain has been analyzed from HRV signal. Besides that, HRV features were extracted which are standard deviation of the normal-to-normal intervals (SDNN), standard deviation of the average of normal-to-normal intervals (SDANN) and root mean square successive difference (RMSSD). SDNN, SDANN and RMSSD were calculated by using equations in Eq. (2), Eq. (3) and Eq. (4) respectively.
where N is total window length and NN is normal-to-normal time interval.
where N 5 is 5 min window length and NN is normal-to-normal time interval.
where N is total window length.

Frequency-domain features
For this research, AR using the Burg estimation technique has been used to optimize forward and backward prediction errors. The power spectrum of the AR technique using the Burg estimation can be calculated as follows, where ê p represents the sum of both forward and backward prediction errors or the total least square error while p denotes the model order and â (l) indicate p th order of the AR coefficient.

Nonlinear time-frequency features
Nonlinear analysis was performed using Modified B-distribution (MBD) as the technique is capable of providing high resolution TF distribution without crossterms for HRV analysis. [16]. The kernel for the MBD as follows, where Γ defines as gamma function and β is a real positive number between 0 and 1 that regulates the trade-off between component resolution and cross-cutting elimination.

Multiscale HRV comparison and correlation analysis
In order to investigate the statistical significance (p-value < 0.05), Spearman's correlation is conducted between HRV features of multiple length under both resting and stress conditions. It is performed to determine the correlation between the HRV features produced through PPG signal in comparing with standardized ECG signal. A nonparametric Wilcoxon signed-rank test was performed to observe the difference between resting (baseline) and arithmetic stress test.

Result and discussion
This chapter presented the results obtained through pre-processing, feature extraction of HRV and multiscale comparison and correlation analysis along with relevant discussions of the findings.

Signal processing
The results of each pre-processing phase for HRV assessment and the resulting PPG signal HRV are shown in Figures 5 and 6, whereas the resulting ECG signal HRV is shown in Figures 7 and 8. Figure 5 presented the attenuation of the PPG signal pulses after the application of the SSF conversion. The pulse peaks became more distinct throughout the entire signal duration using SSF conversion as lower ectopic beats were also amplified to match ordinary pulse peaks that facilitate peak detection during thresholding method. Figure 6 showed the resulting HRV signal that was obtained after removal, resampling and detrending of the outlier. Figure 7 showed the changes in the ECG signal throughout the Pan and Tompkins algorithm processes. It can be seen that the algorithm was able to detect the R-R intervals throughout the signal excerpt. This method was chosen due to the simplicity and efficacy of this algorithm in QRS detection among adult subjects with 99.3% accuracy rate [15]. The subsequent HRV signal produced (illustrated in Figure 6. The HRV signal obtained from pulse peak detected in SSF signal.  While evaluating the algorithm necessary for the HRV signal acquisition, it can be said that the pre-processing of the HRV signal recorded using the PPG system is simpler, as the signal contained only one type of wave (blood pulse) compared to the ECG signals usually containing a combination of three waves (P, QRS and T waves). Despite that, the HRV signal produced through both recordings do have relatively consistent magnitude.

HRV feature extraction
The analysis discussed in this section focuses mainly on the HRV features extracted using PPG method. Generally, the features selected have been associated with significant reactivity under stress conditions.

Time-domain features
The HRV signal obtained under resting and stress conditions were subsequently plotted in Figure 9 which also showed the HRV obtained with time excerpts of 10 min duration. In addition, different lengths of HRV excerpts carry different  weightage of information on the HRV of the sample. Longer HRV excerpts allow better visualization of fluctuations in the HRV measurements in both conditions. However, it is difficult to distinguish the difference of HRV changes between resting and stress testing through visual inspection only.

Frequency-domain features
The PSD can be classified into three components which are VLF band between 0.0033 and 0.04 Hz, LF band between 0.04 and 0.15 Hz and HF band between 0.15 and 0.4 Hz [18].
Based on the findings in Figure 10, the LF components increases during stress testing while HF components relatively decreases.

Nonlinear time-frequency features
For the plotted Figure 11, it was observed that more complex changes experienced during stress testing in 10 min. TFD plot was able to provide supplementary visualization of more complex changes within the HRV features during stress phase. Next, the changes within VLF and LF frequency bands were also more noticeable in TFD analysis. Figure 10. Samples of PSD generated from PPG-derived HRV for 10 min from same sample between resting and stress condition. Figure 11. Samples of TFD generated from PPG-derived HRV for 10 min from same sample between resting and stress condition.

Multiscale HRV comparison and correlation analysis
Based on this finding, it can be seen that most of the HRV features extracted using the PPG device produced similar measurements as the ECG, especially for the TA and FA features. However, for more sophisticated measurements, such as nonlinear TF characteristics, the correlation between the two techniques was less important, particularly for smaller HRV characteristics. This could be due to the fact that PPG waveform mainly reflects the central artery properties which means factors such as artery stiffness may attenuate the signal and resulted in differences of NN intervals obtained between different individuals [19]. The PPG signals are also influenced by other parasympathetic activity such as temperature variations HR-mean of heart rate; SDNN-standard deviation of NN intervals; RMSSD-root mean square of the successive differences; SDANN-standard deviation of average NN intervals; NN50-NN intervals differing by more than 50 ms; pNN50-percentage of NN50 count; HTI-HRV triangular index; VLF-very low frequency; LF-low frequency; HFhigh frequency; TP-total power; Lfnu-low frequency normalized unit; Hfnu-high frequency normalized unit; ShEn LF-Shannon entropy measurements; and ReEn-Renyi entropy measurements. *Correlation is significant at the 0.01 level (2-tailed). Table 2.
Correlation between multi-length HRV features with standard of 10 min.
[20] and could significantly changes due to factors such as body age, vascular age, physical status, sleeping hours, physical activities [21]. Correlation analysis was performed to assess the interdependence between PPG-derived HRV and ECG-derived HRV as shown in Table 2.
In general, HRV features resulted less correlated in resting than during stress conditions. This is most likely due to the fact that HRV showed a more depressed dynamic during stress phase. Other than that, HRV features such as HR, NN50, TP, VLF, LF, HF, Lfnu, Hfnu, LF/HF, and Renyi entropy (LF, HF and Total(O)) has also showed significant correlation between the values measured for HRV excerpts collected using PPG and ECG. This prove that PPG is able to produce HRV signal with equivalent significant to HRV signal produced by ECG during stress testing [8,22]. Besides, it can be deduced that HR, RMSSD, LF/HF, Lfnu and Hfnu features showed consistent characteristics as valid surrogate of the standard HRV which means regardless of length of HRV signal (between 1 and 10 min), these features would produce values that high correlate to value produced with standard HRV excerpt.
This study intends to investigate if there is different length of HRV excerpts provide valid measurement of HRV indices with comparison to standard 5-min excerpt for detection of mental stress. Although many studies have shown that HRV analyzes provide a reliable quantification technique for mental stress, it is hard to compare the precision of each method as their experimental design (i.e., duration of HRV characteristics) differs. Although it was claimed that the excerpt of 5-min HRV is the gold standard [18], the growing demand for wearable devices to instantly evaluate mental stress has increased interest in HRV computing characteristics shorter than the 5-min HRV standard [2]. In order to investigate the utility of various length of HRV excerpts in quantifying HRV features, 22 features were extracted at each time interval. The agreement between features at each time interval was compared with standard 5-min excerpt under both resting and stress phases. Overall, TA features (except HTI) conform significantly across all excerpts in correlation to standard excerpt while FA features (i.e., VLF, LF, HF, and TP) showed significant correlation across excerpts longer than 3 min while LFnu, HFnu and LF/HF showed consistent high correlation for all excerpts. As for timefrequency analysis, Shannon entropy measurements showed significant correlation for signal excerpts longer than 4 min while for Renyi entropy, only HF and Total(O) measurements showed significant correlation throughout all time excerpts.
Despite that, the limitation of these analyses is that correlation coefficient is blind to the possibility of bias caused by the difference in the mean or standard deviation between two measurements [23].

Conclusion
In comparison to conventional ECG, a correlation assessment between HRV characteristics obtained by PPG was also performed to observe any variation between the extracted measurements and analyze whether the PPG system is sufficiently robust to obtain HRV characteristics according to clinical standards. For this research, an ultra-short and short-term HRV feature was presumed to be a valid surrogate of the equivalent standard HRV if the feature sustained at a high correlation (i.e., rho > 0.6 and prho < 0.05) with the equivalent 5-min standard feature over all time scales and produced consistent trend and significant difference (pvalue < 0.05) during the rest and stress phase. Therefore, it can be deduced that HR, RMSSD, LF/HF, LFnu and HFnu features showed consistent characteristics as valid surrogate of the standard HRV which means regardless of length of HRV signal (between 1 and 10 min), these features would produce values that high correlate to value produced with standard HRV excerpt. In the future, methods such as machine learning may be applied to test the accuracy between the use different PPG specifications such as measurement site, probe contact force and LED wavelengths which affect the reliability of its recordings or between different experimental protocol such as type of stressor and subject conditions.