An Adaptive Heart Rate Monitoring Algorithm for Wearable Healthcare Devices

: This paper focuses on developing an adaptive heart rate monitoring algorithm for wrist-based rehabilitation systems. Due to the characteristics of the wrist, the heartbeat measurements are unstable. To improve the preprocessing efﬁciency and perform measurement calibration, a novel joint algorithm incorporating automatic multiscale-based peak detection and fuzzy logic control (AMPD-Fuzzy) is proposed. The monitoring approach consists of two phases: (1) Preprocessing and (2) Detection and Calibration. Phase 1 explores the parameter settings, threshold, and decision rules. Phase 2 applies fuzzy logic control and the Laplacian model to provide signal reshaping. Experimental results show that the proposed algorithm can effectively achieve heart rate monitoring for wearable healthcare devices.


Introduction
The use of photoplethysmography (PPG)-based systems is widespread in clinical applications of heart rate (HR) tracking. In comparison to the various types of PPGbased HR monitoring devices, the wristband-type PPG is considered the most popular and preferred device [1]. The reason for its popularity is partly due to its remarkable properties such as being inexpensive, highly portable, and very convenient to wear by its users. Esfahani [2] presented that for the placement of an inertial measurement unit (IMU), the wrist is one of the most frequently selected locations, with 55.6 percent preference. Accordingly, the features of wristband-type placement may be utilized to design more convenient and comfortable healthcare systems. Following this concept, we developed a pulmonary rehabilitation (PR) system, evolving from a biosensor module-based approach (Figure 1 (left)) [3] to an arm bag-based way (Figure 1 (right)) [4] to a wrist-based wearable system (Figure 1 (bottom)). Note that PR is widely regarded as an effective therapy [5,6] for patients with pulmonary disease, considering the overload principle (e.g., the training intensity) and safety concerns (e.g., heart rate). Since the heart rate measurement is critical in the PR operation, this work focuses on the HR monitoring. Figure 2a-c show the finger and wrist PPG signals. Observe that the wrist measurements are unstable. Even with a heartbeat bracelet on the market [7], Figure 2d shows the fluctuation of PPG signals on the dynamic wrist. This is because the measurement accuracy is subject to noise introduced by the variation of skin contact on the patient, device  [3]; an arm bagbased system (top right) [4]; the proposed wrist-based wearable system; the prototype (bottom left); and the system size (bottom right). Heart rate tracking from a wrist-type PPG signal during physical activities is a challenge. The commonly used motion artifact rejection methods are incapable of achieving satisfactory tracking performance. To solve the above problem, several algorithms have  [3]; an arm bag-based system (top right) [4]; the proposed wrist-based wearable system; the prototype (bottom left); and the system size (bottom right).
Electronics 2021, 10, x FOR PEER REVIEW 2 of 28 movement, or environmental conditions [8]. Therefore, this work aims to develop an HR tracking mechanism for healthcare applications with wrist-based wearable devices. Figure 1. Pulmonary rehabilitation: a biosensor module-based system (top left) [3]; an arm bagbased system (top right) [4]; the proposed wrist-based wearable system; the prototype (bottom left); and the system size (bottom right). Heart rate tracking from a wrist-type PPG signal during physical activities is a challenge. The commonly used motion artifact rejection methods are incapable of achieving satisfactory tracking performance. To solve the above problem, several algorithms have Heart rate tracking from a wrist-type PPG signal during physical activities is a challenge. The commonly used motion artifact rejection methods are incapable of achieving satisfactory tracking performance. To solve the above problem, several algorithms have been developed to refine the heart rate estimates, such as adaptive filtering [9], wavelet-based denoising [10], independent component analysis [11], empirical mode decomposition [12], time frequency analysis, and signal decomposition [13]. However, their performances are highly dependent on heuristic thresholds or parameters tuned for specific scenarios, which makes them impractical in natural environments where a user performs a wide range of physical activities in daily life [14].
In consideration of tackling the above challenge, the major contributions and features of this work are as follows: (1) the proposition of a novel HR monitoring algorithm, integrating the properties of automatic multiscale-based peak detection (AMPD) [15] and fuzzy logic control (AMPD-Fuzzy); (2) the development of parameter settings, thresholds, and decision rules to improve the preprocessing efficiency; (3) the construction of a fuzzy logic control to determine the value of an adaptive parameter for adjusting the signal index range of overlap and calibration; (4) the use of the Laplacian model to perform periodic offset calibration and remove noise interference. The performance comparison of the existing and proposed systems is detailed in Section 2.4.
The rest of the paper is organized as follows. Section 2 reviews the literature and background information. In Section 3, we describe the proposed AMPD-Fuzzy algorithm. Section 4 evaluates the system performance. Section 5 concludes this study and describes future work.

Background and Related Work
This section introduces background information and related work, including the wristband-type PPG-based devices, the sources of measurement inaccuracy, the learning models, and the time-frequency analysis.

Wristband-Type PPG-Based Devices
Although the wristband-type PPG is considered the most popular and preferred device, these devices have their own limitations [16] related to signal quality. Lee [17] presented a wristwatch PPG probe positioned on the ulnar and radial arteries around the patient's wrist instead of the blood capillaries, which is the common measurement site. The proposed device improved sensitivity and accuracy of the PPG signal by using an array of sensors, IR-LEDs, and photo transistors. Thomas [18] proposed a method to mitigate the effects of motion artifacts on the quality of the PPG signal with an inertial sensor along with green LEDs.

Sources of Inaccuracy-Motion Artifacts
Due to the high probability of the proximity of HR and motion artifact spectral peaks and spectral peak randomness, the removal of motion artifacts is an important preprocessing step in classical signal processing to calculate the HR from PPG. In [19], HR calculations were divided into four phases, including pre-filtering, motion artifact removal, peak detection, and peak tracking. Zong [20] addressed the HR tracking problem in two distinct stages: pre-filtering and peak tracking. The pre-filtering stage focused on noise and movement artifact removal. The peak tracking stage contained the peak detection and tracking operations. Sources of inaccuracy in wearable optical heart rate sensors were further investigated in [21,22].

Learning Models
Very recently, several deep-learning-based approaches have been proposed to estimate the HR from contaminated PPG signals, such as CorNET [23] and Deep PPG [24], which were trained for each different individual and rely on the HR derived from electrocardiography (ECG) signals as the labels. Chang [14] proposed DeepHeart, an approach for HR estimation from contaminated PPG signals using deep-learning-based denoising and spectrum analysis, which generated clean PPG signals from ECG signals based on a training data set. DeepHeart applied deep convolutional neural networks ensemble for denoising the PPG signals. To obtain the labels of the contaminated PPG signals, a method to generate clean PPG signals from ECG signals was designed. With the contaminated PPG signals and their labels, denoising convolutional neural networks were trained for denoising. As a result, most of the motion artifacts were removed from the contaminated PPG signals. Then, a spectrum-analysis-based HR calibration algorithm was applied to the processed PPG signals.

Time-Frequency Analysis
Cicone [25] argued that despite the popularity of the noninvasive, economic, comfortable, and easy-to-install PPG, it was still lacking a mathematically rigorous and stable algorithm which can simultaneously extract information from a single-channel PPG signal. Two nonlinear time-frequency analysis techniques, the de-shape short time Fourier transform and the synchrosqueezing transform, were applied to extract the instantaneous physiological information from the PPG signal in a reliable way. Masinelli [26] proposed a spectral peak recovery algorithm for the pulsewave reconstruction of PPG signals, exploiting the local semiperiodicity of the pulsewave signal, together with the information about the cardiac rhythm provided by an available simultaneous ECG.
In the frequency domain, Temko [27] used Wiener filtering to filter the motion artifacts noise of the three-axis acceleration in motion, refined the estimated heart rate data through a phase vocoder, used linear regression for instance calibration, and finally performed the post-processing through a Viterbi decoder. Yang [28] applied an adaptive spectrum noise cancellation algorithm to estimate the heart rate data. However, the complicated operations made the algorithm not suitable for wearable systems. In the time domain, the AMPD-BL algorithm in [29], jointly integrating the AMPD [15] and Bayesian learning (BL) approaches, was used to estimate the heart rate data.
Considering the capabilities of the wearable device, this work adopts the AMPDbased scheme for heart rate monitoring. For the purpose of performance comparison, the AMPD-BL algorithm is used to explore the feasibility of the proposed AMPD-Fuzzy algorithm. To provide background on peak detection, the following subsection explores the characteristics of heartbeat signals and briefly describe the AMPD algorithm, considering the Laplacian distribution and the Bayesian learning scheme. Table 1 depicts the performance comparison of existing and proposed systems, considering features and limitations of time-frequency analysis. Most of the existing methods applied pre/post-processing techniques to remove noise interference to recover the signal peak, which may lead to limitations and challenges ranging from device architecture, time consumption, and computational operations to data acquisition methods. In contrast, the proposed AMPD-Fuzzy is able to perform noise filtering, adaptive parameter setting, and real-time heart rate monitoring, which achieves heart rate monitoring for wearable healthcare devices with a low intensity activity.

Background-AMPD Schemes
This section introduces the background information, including on the AMPD and Bayesian learning (BL) approaches.

Features Limitations
Masinelli [26] • spectral peak recovery • using multimodal sensors Temko [27] • using pre/post-processing to predict heart rhythms • noise reduction The standard unit for calculating heart rate is beats per minute (BPM). With the duration of 60 s, one alternative for calculating the BPM is to divide 60 by the timestamp difference of two adjacent detected peaks, Peak Interval , as described in Equation (1). Thus, we reshape the problem to finding the timestamps of the detected peaks of the heartbeat signal as follows: Note that the sampling period of the PPG signal is set to be 0.1 s. Similar to the operations of the AMPD algorithm, a window size (e.g., 15 samples) is used for the control of data blocks, considering the minimum detectable heart rate value 40 BPM. Accordingly, Equation (2) describes the relationship between the window size and the heart rate BPM, which yields: where P TD is the sample index difference of two adjacent detected peaks.

AMPD Algorithm
This subsection briefly introduces the AMPD algorithm, which aims to detect the peak positions in a heartbeat signal. Denote myHeartX i = {X 1 , X 2 , X 3 , . . . , X N } as a vector to record periodic or quasi-periodic peaks in a sampled signal, and let the moving window length w k w k = 2k| k=1,2, ..., L be a tunable parameter to calculate the local maxima scalogram, where L = [N/2] − 1 and [z] is the ceiling function that rounds up z to an integer.

Laplacian Distribution
Since a heartbeat is a periodic continuous-time signal, Quer [30] proved that the Laplacian model could be used to analyze the heart rate data for predicting the next peak of

Laplacian Distribution
Since a heartbeat is a periodic continuous-time signal, Quer [30] proved that the Laplacian model could be used to analyze the heart rate data for predicting the next peak of the signal. Denote t m as the mth instant of time corresponding to a heartbeat. The process Y is defined by the timestamp difference of two adjacent detected peaks, which is calculated as: Moreover, define process d as the timestamp difference between consecutive peak intervals, which is: Ismail [19] showed that the Laplacian model exhibited the best fit for analyzing the d process. Based on the analytical results, the probability density function P (i) 2 is given by the following: where D i = Y i − Y last , Y i represents the difference between sample i and the last detected peak, Y last represents the last recorded timestamp difference of two adjacent detected peaks from the last window cycle, µ is defined as the median, and the parameter b is: where N d is the number of records of the process d. Note that in the PPG signal, we can reasonably let µ be zero. Since a heartbeat is periodic, this leads to a smaller value of b and a larger value of P 2 . Figure 4 (right) shows the Laplacian probability of the PPG signal, as depicted in Figure 5. Observe that in Figure 4 (right), since a peak is detected in sample i = 4, the P 2 value turns to zero in sample i = 5. The calculation process is detailed in Section 3.
Electronics 2021, 10, x FOR PEER REVIEW 7 of 28 the signal. Denote as the mth instant of time corresponding to a heartbeat. The process is defined by the timestamp difference of two adjacent detected peaks, which is calculated as: Moreover, define process d as the timestamp difference between consecutive peak intervals, which is: Ismail [19] showed that the Laplacian model exhibited the best fit for analyzing the d process. Based on the analytical results, the probability density function ( ) is given by the following: where D = − , represents the difference between sample i and the last detected peak, represents the last recorded timestamp difference of two adjacent detected peaks from the last window cycle, μ is defined as the median, and the parameter b is: where is the number of records of the process d. Note that in the PPG signal, we can reasonably let be zero. Since a heartbeat is periodic, this leads to a smaller value of b and a larger value of . Figure 4 (right) shows the Laplacian probability of the PPG signal, as depicted in Figure 5. Observe that in Figure 4 (right), since a peak is detected in sample i = 4, the value turns to zero in sample i = 5. The calculation process is detailed in Section 3.

AMPD-BL Algorithm
With probabilities ( ) and ( ) , a probability value adjustment may be applied by a Bayesian learning approach, integrating the AMPD and Laplacian algorithms, to refine the possibility of sample point i for being a local peak. Assume that the probability of having a peak at sample i is ( ) , which can be initially calculated using Equation (9). Since the adjusted probability ( ) is related to the output of the AMPD (i.e., ( ) = 1 or 0) and the probability density function ( ) , the adjusted probability can be written as:

AMPD-BL Algorithm
With probabilities P (i) 1 and P (i) 2 , a probability value adjustment may be applied by a Bayesian learning approach, integrating the AMPD and Laplacian algorithms, to refine the possibility of sample point i for being a local peak. Assume that the probability of having a peak at sample i is P (i) 2 , which can be initially calculated using Equation (9). Since the adjusted probability P adjust(i) is related to the output of the AMPD (i.e., AMPD output(i) = 1 or 0) and the probability density function P (i) 2 , the adjusted probability can be written as: Alqaraawi [29] addressed that the Beta function can be used to model P P that initially considers the probability computed in Equation (8) as the expected value for this distribution, which is given by: is a normalized constant to ensure that the total probability integrates to 1. α and β are hyper-parameters that control the shape of the distribution. Assume that (α + β) is a constant, and set the expectation value to be E P P 2 . Therefore, to obtain the desired parameters α and β for sample i, we have P P As shown in Figure 6, a small value of P  Based on the threshold setting and the output of AMPD, P 1 can be further set to 1 and 0 (i.e., if P (i) 1 is greater than the threshold, change it to 1; otherwise, change it to 0), which implies that the output of the AMPD can be considered as a Bernoulli experiment. Therefore, P AMPD output(i) P (i) 2 is given by: Substituting Equations (11) and (12) into Equation (10) yields: In Equation (13), as AMPD's output equals to n = 1, let α = α + 1 and β = β, having the Beta distribution close to the negatively skewed probability distribution (i.e., sample i is close to the next expected peak). On the other hand, when AMPD's output equals to n = 0, let α = α and β = β + 1, having the Beta distribution close to the positively skewed probability distribution (i.e., sample i is close to the last detected peak). Accordingly, we integrate the adjusted probability P adjust(i) from the threshold to 1 to obtain the probability of the peak P (i) 3 , which is: Note that the threshold is based on the AMPD output. Based on the above analysis, the peak position is determined by the index with the maximum value of the product of 3 for all samples within the index range of a window, which is given by: (15) Figure 7 shows the block diagram of the AMPD-BL. Readers may refer [29] for details.
Electronics 2021, 10, x FOR PEER REVIEW 9 of 28   Figure 8a shows the heart rate measurements by using a static fingertip. Observe that the thin skin on the fingers, which causes less interference, leads to good detection performance with the AMPD-BL approach. However, when measuring the PPG signal on the dynamic or static wrist (the symbol "b" in Figure 7), Figure 8b,c show the performance degradation due to the much larger effect of interference in wrist PPG measurement. As shown in Figure 8d, the peak values are calibrated to better positions with the AMPD-BL (the symbol "c" in Figure 7), but a part of the peak values are missing or calibrated to the wrong positions. To resolve the above problem, this work aims to develop a novel joint algorithm, incorporating the concepts of automatic multiscale-based peak detection and fuzzy logic control, for adjusting the signal index range of overlap and performing offset calibration.  Figure 8a shows the heart rate measurements by using a static fingertip. Observe that the thin skin on the fingers, which causes less interference, leads to good detection performance with the AMPD-BL approach. However, when measuring the PPG signal on the dynamic or static wrist (the symbol "b" in Figure 7), Figure 8b,c show the performance degradation due to the much larger effect of interference in wrist PPG measurement. As shown in Figure 8d, the peak values are calibrated to better positions with the AMPD-BL the symbol "c" in Figure 7, but a part of the peak values are missing or calibrated to the wrong positions. To resolve the above problem, this work aims to develop a novel joint algorithm, incorporating the concepts of automatic multiscale-based peak detection and fuzzy logic control, for adjusting the signal index range of overlap and performing offset calibration. Electronics 2021, 10, x FOR PEER REVIEW 10 of 28

The Adaptive Heart Rate Detection System
This section describes the proposed AMPD-Fuzzy algorithm, incorporating the AMPD algorithm with fuzzy logic control. Due to the measurement interference of the wrist PPG signal (e.g., movement or swinging of the hand), a data processing operation is implemented. Moreover, since the heartbeat is a continuous instant signal, considerably reducing the calculations is essential for balancing the overall system computing time. The following subsections describe the design principles of the proposed AMPD-Fuzzy algorithm, including a window protocol, data processing, the fuzzy control mechanism, and the signal calibration. Figure 9 shows the block diagram of the proposed AMPD-Fuzzy algorithm.

Design of A Sliding Window Protocol
Based on the AMPD, the design of a sliding window protocol and the method of data overlap are developed. In the proposed scheme, the parameter L for sample comparison in Section 2.2 is set to 1, which means that sample only compares the previous and the next samples. Referring to the description of the AMPD in Section 2, if the sample is greater than the previous and the next samples, then the sample is compared with the entire myHeart vector such that the probability of for being a local maximum can be calculated (Equations (16) and (17)). In contrast, in order to reduce the data processing time, the probability of for being a local maximum is calculated only when the sample is larger than the previous and the next samples. Equations (16) and (17) are calculated as follows:

The Adaptive Heart Rate Detection System
This section describes the proposed AMPD-Fuzzy algorithm, incorporating the AMPD algorithm with fuzzy logic control. Due to the measurement interference of the wrist PPG signal (e.g., movement or swinging of the hand), a data processing operation is implemented. Moreover, since the heartbeat is a continuous instant signal, considerably reducing the calculations is essential for balancing the overall system computing time.
The following subsections describe the design principles of the proposed AMPD-Fuzzy algorithm, including a window protocol, data processing, the fuzzy control mechanism, and the signal calibration. Figure 9 shows the block diagram of the proposed AMPD-Fuzzy algorithm.

The Adaptive Heart Rate Detection System
This section describes the proposed AMPD-Fuzzy algorithm, incorporating the AMPD algorithm with fuzzy logic control. Due to the measurement interference of the wrist PPG signal (e.g., movement or swinging of the hand), a data processing operation is implemented. Moreover, since the heartbeat is a continuous instant signal, considerably reducing the calculations is essential for balancing the overall system computing time. The following subsections describe the design principles of the proposed AMPD-Fuzzy algorithm, including a window protocol, data processing, the fuzzy control mechanism, and the signal calibration. Figure 9 shows the block diagram of the proposed AMPD-Fuzzy algorithm.

Design of A Sliding Window Protocol
Based on the AMPD, the design of a sliding window protocol and the method of data overlap are developed. In the proposed scheme, the parameter L for sample comparison in Section 2.2 is set to 1, which means that sample only compares the previous and the next samples. Referring to the description of the AMPD in Section 2, if the sample is greater than the previous and the next samples, then the sample is compared with the entire myHeart vector such that the probability of for being a local maximum can be calculated (Equations (16) and (17)). In contrast, in order to reduce the data processing time, the probability of for being a local maximum is calculated only when the sample is larger than the previous and the next samples. Equations (16) and (17) are calculated as follows:

Design of a Sliding Window Protocol
Based on the AMPD, the design of a sliding window protocol and the method of data overlap are developed. In the proposed scheme, the parameter L for sample comparison in Section 2.2 is set to 1, which means that sample X i only compares the previous and the next samples. Referring to the description of the AMPD in Section 2, if the sample X i is greater than the previous and the next samples, then the sample X i is compared with the entire myHeartX i vector such that the probability of X i for being a local maximum can be calculated (Equations (16) and (17)). In contrast, in order to reduce the data processing time, the probability of X i for being a local maximum is calculated only when the sample X i is larger than the previous and the next samples. Equations (16) and (17) are calculated as follows: where Window_length = HR_data + HR_fuzzy. Figure 10 shows that a window (previous HR_Fuzzy = 6, HR_Fuzzy = 8) consists of two parts: (1) the range of sample indices for HR_Data, including the range of sample indices determined by the previous HR_Fuzzy parameter, and the range of sample indices for heart rate samples, which is equal to a fixed size (e.g., 15 heart rate samples, ranging from X 25 to X 39 in Figure 10) and (2) the range of sample indices for latest heart rate samples (i.e., the updated HR_Fuzzy value). Accordingly, the window length is equal to the sum of the range of sample indices of HR_Data and the value of the HR_Fuzzy parameter, which makes the window length adaptive. Given the heart rate samples within a window, if sample X i is larger than the previous and the next samples, the heart rate samples (i.e., the heart rate samples within the sliding window) are applied to generate a signal vector for calculating P (i)

.
Electronics 2021, 10, x FOR PEER REVIEW 12 of 28 where Window_length = HR_data + HR_fuzzy. Figure 10 shows that a window (previous HR_Fuzzy = 6, HR_Fuzzy = 8) consists of two parts: (1) the range of sample indices for HR_Data, including the range of sample indices determined by the previous HR_Fuzzy parameter, and the range of sample indices for heart rate samples, which is equal to a fixed size (e.g., 15 heart rate samples, ranging from to in Figure 10) and (2) the range of sample indices for latest heart rate samples (i.e., the updated HR_Fuzzy value). Accordingly, the window length is equal to the sum of the range of sample indices of HR_Data and the value of the HR_Fuzzy parameter, which makes the window length adaptive. Given the heart rate samples within a window, if sample is larger than the previous and the next samples, the heart rate samples (i.e., the heart rate samples within the sliding window) are applied to generate a signal vector for calculating ( ) . Because of the characteristics of the sensor, the baseline level of a PPG signal is varied. Based on the above window structure, the value can be calculated for determining a peak position. The procedures of data processing and the selection of the HR_Fuzzy parameter are detailed in Section 4.2.

Principle of Signal Overlapping and Data Processing
Under normal circumstances, a peak rarely appears within the next few samples after detecting a peak. Hence, based on the sampling rate and the BPM, denote the parameter HR_Fuzzy as the range of sample indices that no peaks are detected. For example, if a patient's current average heart rate is 60 bpm, it is rare for his/her average heart rate to jump to 100 bpm suddenly. Note that the peak interval of 60 bpm is 10 samples, and the peak interval of 100 bpm is 6 samples, which means that, as a peak is detected, a signal peak may not occur in the next 6 samples. Because of that, the sampled signals are overlapped and cascaded in the heart rate vector.
According to the above principle, Figure 11 shows a sequence diagram of signal overlapping and data processing with a heart rate vector. Observe that the samples in the output sub-window are applied for the calculation process (detailed in Section 3.4) and the samples in the input sub-window are used to determine the HR_Fuzzy data for the next window cycle. Because of the characteristics of the sensor, the baseline level of a PPG signal is varied. Based on the above window structure, the P 1 value can be calculated for determining a peak position. The procedures of data processing and the selection of the HR_Fuzzy parameter are detailed in Section 4.2.

Principle of Signal Overlapping and Data Processing
Under normal circumstances, a peak rarely appears within the next few samples after detecting a peak. Hence, based on the sampling rate and the BPM, denote the parameter HR_Fuzzy as the range of sample indices that no peaks are detected. For example, if a patient's current average heart rate is 60 bpm, it is rare for his/her average heart rate to jump to 100 bpm suddenly. Note that the peak interval of 60 bpm is 10 samples, and the peak interval of 100 bpm is 6 samples, which means that, as a peak is detected, a signal peak may not occur in the next 6 samples. Because of that, the sampled signals are overlapped and cascaded in the heart rate vector.
According to the above principle, Figure 11 shows a sequence diagram of signal overlapping and data processing with a heart rate vector. Observe that the samples in the output sub-window are applied for the calculation process (detailed in Section 3.4) and the samples in the input sub-window are used to determine the HR_Fuzzy data for the next window cycle. Electronics 2021, 10, x FOR PEER REVIEW 13 of 28 Figure 11. A sequence diagram of the heart rate vector.
Considering the HR_Fuzzy = 6, Figure 12 (left) shows the signal vector with the initial setting of the previous HR_Fuzzy samples zero. Similarly, Figure 12 (right) shows the second window with HR_Fuzzy = 6, where the first 6 samples of the heart rate vector are set to be the last 6 samples of the previous window cycle. After briefly describing the principle of signal overlapping, the fuzzy control mechanism for determining the value of the HR_Fuzzy parameter is presented in Section 3.3.

Fuzzy Control Mechanism
This section describes the fuzzy control logic for adaptively determining the value of the HR_Fuzzy parameter with two fuzzy inputs, the current heart rate and the trend of the heart rate.

Fuzzy Inputs
Fuzzy input 1 is based on the current heart rate, where the membership functions of different heart rate ranges are shown in Table 2. The classification criterion is based on the heart rate value calculated by the peak interval. Compared with a high heart rate (say, 120~140 bpm), a change of the peak interval causes an obvious change of the heartbeat with a low heart rate (say, 60~80 bpm), as shown in Figure 13 (left). Therefore, with a lower heart rate, the corresponding triangular membership function is narrower.  Considering the HR_Fuzzy = 6, Figure 12 (left) shows the signal vector with the initial setting of the previous HR_Fuzzy samples zero. Similarly, Figure 12 (right) shows the second window with HR_Fuzzy = 6, where the first 6 samples of the heart rate vector are set to be the last 6 samples of the previous window cycle. After briefly describing the principle of signal overlapping, the fuzzy control mechanism for determining the value of the HR_Fuzzy parameter is presented in Section 3.3.
Electronics 2021, 10, x FOR PEER REVIEW 13 of 28 Figure 11. A sequence diagram of the heart rate vector.
Considering the HR_Fuzzy = 6, Figure 12 (left) shows the signal vector with the initial setting of the previous HR_Fuzzy samples zero. Similarly, Figure 12 (right) shows the second window with HR_Fuzzy = 6, where the first 6 samples of the heart rate vector are set to be the last 6 samples of the previous window cycle. After briefly describing the principle of signal overlapping, the fuzzy control mechanism for determining the value of the HR_Fuzzy parameter is presented in Section 3.3.

Fuzzy Control Mechanism
This section describes the fuzzy control logic for adaptively determining the value of the HR_Fuzzy parameter with two fuzzy inputs, the current heart rate and the trend of the heart rate.

Fuzzy Inputs
Fuzzy input 1 is based on the current heart rate, where the membership functions of different heart rate ranges are shown in Table 2. The classification criterion is based on the heart rate value calculated by the peak interval. Compared with a high heart rate (say, 120~140 bpm), a change of the peak interval causes an obvious change of the heartbeat with a low heart rate (say, 60~80 bpm), as shown in Figure 13 (left). Therefore, with a lower heart rate, the corresponding triangular membership function is narrower.

Fuzzy Control Mechanism
This section describes the fuzzy control logic for adaptively determining the value of the HR_Fuzzy parameter with two fuzzy inputs, the current heart rate and the trend of the heart rate.

Fuzzy Inputs
Fuzzy input 1 is based on the current heart rate, where the membership functions of different heart rate ranges are shown in Table 2. The classification criterion is based on the heart rate value calculated by the peak interval. Compared with a high heart rate (say, 120~140 bpm), a change of the peak interval causes an obvious change of the heartbeat with a low heart rate (say, 60~80 bpm), as shown in Figure 13 (left). Therefore, with a lower heart rate, the corresponding triangular membership function is narrower.  Fuzzy input 2 considers the heart rate tendency through the change of latest heart rates and the maximum difference of the previous k heart rates. Table 3 describes the relationship between heart rate and peak interval. Denote the Difference Ratio (DR) as the ratio of the change of latest heart rates, − −1 , to the maximum difference of the previous k heart rates, , which yields: The membership function of the DR is depicted in Figure 13 (right).

Fuzzy Output
A fuzzy rule-based model is defined with fuzzy conditional statements. Table 4 summarizes the proposed fuzzy rule-based system to determine the value of the HR_Fuzzy, which is associated with 18 rules, considering heart rate and difference ratios (DR). Note that since the heart rate rarely jumps or drops 2 or more intervals in 1.5 s, a single-interval adjustment is performed for setting the value of the HR_Fuzzy. Figure 14 shows the output of the center of area (COA) defuzzification method.  Fuzzy input 2 considers the heart rate tendency through the change of latest heart rates and the maximum difference of the previous k heart rates. Table 3 describes the relationship between heart rate and peak interval. Denote the Difference Ratio (DR) as the ratio of the change of latest heart rates, HR t i − HR t i−1 , to the maximum difference of the previous k heart rates, τ t i , which yields: The membership function of the DR is depicted in Figure 13 (right).

Fuzzy Output
A fuzzy rule-based model is defined with fuzzy conditional statements. Table 4 summarizes the proposed fuzzy rule-based system to determine the value of the HR_Fuzzy, which is associated with 18 rules, considering heart rate and difference ratios (DR). Note that since the heart rate rarely jumps or drops 2 or more intervals in 1.5 s, a single-interval adjustment is performed for setting the value of the HR_Fuzzy. Figure 14 shows the output of the center of area (COA) defuzzification method.  Figure 14. Output of the HR_Fuzzy parameter with heart rate and difference ratio.

Detection Threshold
Under the above circumstance, the threshold of is dynamically adjusted according to the current heartbeat value. Observe that although the baseline is varied, the peak value is set to be the local maximum sample of the heartbeat signal and the sample index difference from two adjacent peaks is at least the value of HR_Fuzzy. That is, the adjacent peaks are at least the value of HR_Fuzzy away in the sample index. Thus, the threshold is given by: Window_length (20) That is:

> HR_fuzzy
Through the characteristics of the peak, the peak value is larger than the previous and the next samples. Moreover, because the heartbeat value is examined in units of windows, it may make the first and last data incomparable. To solve this problem, we apply the parameter HR_Fuzzy to include part of the data in the previous window and process the HR_Data to increase the detection accuracy.
Accordingly, Equation (22) shows a new generated vector AMPD_Out, which completes the preprocessing procedure after sample comparison. As shown in Figure 15a, the desired heartbeat output vector is formed for detection. Figure 14. Output of the HR_Fuzzy parameter with heart rate and difference ratio.

Detection Threshold
Under the above circumstance, the threshold of P 1 is dynamically adjusted according to the current heartbeat value. Observe that although the baseline is varied, the peak value is set to be the local maximum sample of the heartbeat signal and the sample index difference from two adjacent peaks is at least the value of HR_Fuzzy. That is, the adjacent peaks are at least the value of HR_Fuzzy away in the sample index. Thus, the threshold is given by: (20) That is: Through the characteristics of the peak, the peak value is larger than the previous and the next samples. Moreover, because the heartbeat value is examined in units of windows, it may make the first and last data incomparable. To solve this problem, we apply the parameter HR_Fuzzy to include part of the data in the previous window and process the HR_Data to increase the detection accuracy.
Accordingly, Equation (22) shows a new generated vector AMPD_Out, which completes the preprocessing procedure after sample comparison. As shown in Figure 15a, the desired heartbeat output vector is formed for detection. Similar to the sliding window protocol in Section 3.1, the AMPD_Out vector consists of two parts: AMPD_Out[HR_Data] and AMPD_Out [HR_Fuzzy]. Note that the AMPD_Out[HR_Fuzzy] obtained in the first window cycle is applied to construct the AMPD_Out vector of the second window cycle. Figure 15b shows the AMPD_Out vector of the second window cycle with HR_Fuzzy = 8. The preprocessing and threshold determination procedures of the AMPD-Fuzzy are depicted in Algorithm 1. Similar to the sliding window protocol in Section 3.1, the AMPD_Out vector consists of two parts: AMPD_Out[HR_Data] and AMPD_Out [HR_Fuzzy]. Note that the AMPD_Out[HR_Fuzzy] obtained in the first window cycle is applied to construct the AMPD_Out vector of the second window cycle. Figure 15b shows the AMPD_Out vector of the second window cycle with HR_Fuzzy = 8. The preprocessing and threshold determination procedures of the AMPD-Fuzzy are depicted in Algorithm 1.

Algorithm 1.
Comparison procedures of the AMPD-Fuzzy.

4.
Determine whether the sample i is larger than the previous and the next samples. for (n = HR_Fuzzy; n ≤ N; n + +) if ((X n > X n−1 ) & (X n > X n+1 )) Compare the value of each sample, and calculate P 1

Calibration and Detection
Referring to the description of Y and d processes in Section 2, the Laplacian analysis is summarized in Algorithm 2. Note that Laplacian distribution's parameter b and the HR_Fuzzy parameter play key roles for describing the measurement characteristics and detection mechanism. Through these two parameters, the preprocessed vector AMPD_Out can be applied for further calibration. Note that the output vector in the current window cycle consists of two sub-vectors, the AMPD_Out[HR_Data] and the AMPD_Out[HR_Fuzzy], for the next processing window.
During the operation procedure, when AMPD_Out[i] = 1, the index of the sample i will be multiplied by the weight, P  (23)). Since the calibration is a window-based operation, the peak position of the heartbeat may run into the index range of the sub-vector AMPD_Out [HR_Fuzzy], which carries this peak information to the next window cycle as the part of data overlap: and [ ] is a floor function. Figure 16a shows P (i) 2 of each sample point. With a new peak in i = 6, observe that when i = 7, the P (i) 2 reduces to 0. Figure 16b shows a typical example AMPD_Out with HR_Fuzzy = 6. As shown in Figure 16c, since the noise has been filtered, samples i = 1, 2 are removed and sample i = 15 is carried over into the AMPD[HR_Fuzzy] vector. Therefore, this peak will be considered and calibrated in the next cycle heart rate calculation with next HR_Fuzzy samples. Figure 16d shows that based on the next cycle of AMPD_Out, the previous calibrated AMPD_Out[HR_Fuzzy] will be used in the next cycle.

Calibration and Detection
Referring to the description of Y and d processes in Section 2, the Laplacian analysis is summarized in Algorithm 2. Note that Laplacian distribution's parameter b and the HR_Fuzzy parameter play key roles for describing the measurement characteristics and detection mechanism. Through these two parameters, the preprocessed vector AMPD_Out can be applied for further calibration. Note that the output vector in the current window cycle consists of two sub-vectors, the AMPD_Out[HR_Data] and the AMPD_Out[HR_Fuzzy], for the next processing window.
During the operation procedure, when AMPD_Out[i] = 1, the index of the sample i will be multiplied by the weight, ( ) , which can be derived by the Laplacian analysis in Algorithm 2. Similarly, weight the sampled signals with AMPD_Out = 1 and add them up. Then, divide this summed value by the sum of ( ) and use the round function to obtain a new index (Equation (23)). Since the calibration is a window-based operation, the peak position of the heartbeat may run into the index range of the sub-vector AMPD_Out [HR_Fuzzy], which carries this peak information to the next window cycle as the part of data overlap: where A = ∑ ( ) , B = ∑ ( ) , and ⌊ ⌋ is a floor function. Figure 16a shows ( ) of each sample point. With a new peak in = 6, observe that when = 7, the ( ) reduces to 0. Figure 16b shows a typical example AMPD_Out with HR_Fuzzy = 6. As shown in Figure 16c, since the noise has been filtered, samples = 1, 2 are removed and sample = 15 is carried over into the AMPD[HR_Fuzzy] vector. Therefore, this peak will be considered and calibrated in the next cycle heart rate calculation with next HR_Fuzzy samples. Figure 16d shows that based on the next cycle of AMPD_Out, the previous calibrated AMPD_Out[HR_Fuzzy] will be used in the next cycle.

1.
Record the last j heart rate peak interval

2.
Use (2.10) to calculate Laplacian's parameter b for (n = 1; n ≤ j − 1; n + +) The parameter b will be used in the next subsection to calculate P Figure 17 shows the flow chart of calibration, calibrating the AMPD_Out data within the range of HR_Data and then generating the heart rate of this cycle.  Figure 17 shows the flow chart of calibration, calibrating the AMPD_Out data within the range of HR_Data and then generating the heart rate of this cycle.

System Implementation
As shown in Figure 18, GY-521 (InvenSense Inc., San Jose, CA, USA) [32] is used for measuring human walking speed and Max30105 (SparkFun Electronics, Niwot, CL, USA) detects SpO2 and heart rate through red, green, and IR LED [33,34]. These sensors and components are integrated with a small device strapped to the patient's wrist. Arduino delivers the processed date to a smartphone using Bluetooth (Figure 19a,b). The smartphone saves the data to SQLite and then uploads the rehabilitation information to a database through the Internet (Figure 19c). On the patient side, their rehabilitation history can be displayed on their smartphone. On the hospital side, patient's rehabilitation procedures can be illustrated on the website.

System Implementation
As shown in Figure 18, GY-521 (InvenSense Inc., San Jose, CA, USA) [32] is used for measuring human walking speed and Max30105 (SparkFun Electronics, Niwot, CL, USA) detects SpO2 and heart rate through red, green, and IR LED [33,34]. These sensors and components are integrated with a small device strapped to the patient's wrist. Arduino delivers the processed date to a smartphone using Bluetooth (Figure 19a,b). The smartphone saves the data to SQLite and then uploads the rehabilitation information to a database through the Internet (Figure 19c). On the patient side, their rehabilitation history can be displayed on their smartphone. On the hospital side, patient's rehabilitation procedures can be illustrated on the website.

Performance Evaluation
This section presents the system performance with the hardware and prototype described in Section 3.6. Three experiments are conducted to assess the system feasibility. Experiment 1 explores the preprocessing performance. Experiment 2 explores the performance of AMPD-BL tracking. Experiment 3 quantitatively analyzes the AMPD-BL, the AMPD-Fuzzy, and a referenced system [7]. As depicted in Section 2.2, for the AMPD-BL algorithm [20], the symbol "a" represents the preprocessing output, the symbol "b" represents the estimation output with Laplacian distribution, and the symbol "c" represents the final estimation output. For the AMPD-Fuzzy algorithm, the symbol "d" represents the preprocessing output, and the symbol "e" represents the final estimation output.

Performance Evaluation
This section presents the system performance with the hardware and prototype described in Section 3.6. Three experiments are conducted to assess the system feasibility. Experiment 1 explores the preprocessing performance. Experiment 2 explores the performance of AMPD-BL tracking. Experiment 3 quantitatively analyzes the AMPD-BL, the AMPD-Fuzzy, and a referenced system [7]. As depicted in Section 2.2, for the AMPD-BL algorithm [20], the symbol "a" represents the preprocessing output, the symbol "b" represents the estimation output with Laplacian distribution, and the symbol "c" represents the final estimation output. For the AMPD-Fuzzy algorithm, the symbol "d" represents the preprocessing output, and the symbol "e" represents the final estimation output.

Performance Evaluation
This section presents the system performance with the hardware and prototype described in Section 3.6. Three experiments are conducted to assess the system feasibility. Experiment 1 explores the preprocessing performance. Experiment 2 explores the performance of AMPD-BL tracking. Experiment 3 quantitatively analyzes the AMPD-BL, the AMPD-Fuzzy, and a referenced system [7]. As depicted in Section 2.2, for the AMPD-BL algorithm [20], the symbol "a" represents the preprocessing output, the symbol "b" represents the estimation output with Laplacian distribution, and the symbol "c" represents the final estimation output. For the AMPD-Fuzzy algorithm, the symbol "d" represents the preprocessing output, and the symbol "e" represents the final estimation output.

Experiment 1: Preprocessing
As shown in Figure 20a, it is the heartbeat signal detected on the wrist. In Figure 20b, red samples are the local maxima through AMPD-BL algorithm by threshold = 6/L with L = 7. As depicted in Figure 20c, when the threshold value decreases, the region of local maxima will increase. As shown in Figure 20d, red samples are the local maxima through the AMPD-Fuzzy algorithm with L = 1. Comparing Figure 20c,d, we can see that in the preprocessing phase, the difference between the results of these two algorithms is not obvious.
Electronics 2021, 10, x FOR PEER REVIEW 20 of 28 As shown in Figure 20a, it is the heartbeat signal detected on the wrist. In Figure 20b, red samples are the local maxima through AMPD-BL algorithm by threshold = 6/L with L = 7. As depicted in Figure 20c, when the threshold value decreases, the region of local maxima will increase. As shown in Figure 20d, red samples are the local maxima through the AMPD-Fuzzy algorithm with L = 1. Comparing Figure 20c,d, we can see that in the preprocessing phase, the difference between the results of these two algorithms is not obvious.

Experiment 2: AMPD-BL Tracking
This section describes the estimation performance of the AMPD-BL, which predicts the heartrate in three ways: Method 1 (Based on , use to adjust ), Method 2 (Based on , determine whether the ( ) value is greater than the threshold), and Method 3 (Based on , apply Bayesian learning to derive ).

Method 1
After the preprocessing phase, the value of is used to mark the peak value of the local maximum, referring to the symbol "b" in Figure 7. As shown in Equation (24), we adjust according to the value of , and set a threshold to decide whether the local maximum sample is a peak value. Figure 21a shows the estimated peak values through this decision, where the peak positions seem to be periodic, but not at the peak positions of the PPG signal. As shown in Figure 21b, the heart rate value is about 75 bpm. This is because the previous few heart rates are 75 bpm, and the value for the next heart rate

Experiment 2: AMPD-BL Tracking
This section describes the estimation performance of the AMPD-BL, which predicts the heartrate in three ways: Method 1 (Based on P 2 , use P 1 to adjust P 2 ), Method 2 (Based on P 1 , determine whether the P (i) 2 value is greater than the threshold), and Method 3 (Based on P 2 , apply Bayesian learning to derive P 3 ).

Method 1
After the preprocessing phase, the value of P 2 is used to mark the peak value of the local maximum, referring to the symbol "b" in Figure 7. As shown in Equation (24), we adjust P 2 according to the value of P 1 , and set a threshold to decide whether the local maximum sample is a peak value. Figure 21a shows the estimated peak values through this decision, where the peak positions seem to be periodic, but not at the peak positions of the PPG signal. As shown in Figure 21b, the heart rate value is about 75 bpm. This is because the previous few heart rates are 75 bpm, and the P 2 value for the next heart rate may be too high to be adjusted through P 1 . For the heart rate value about 83 bpm, Figure 22a,b show similar conditions, not at the peak positions of the PPG signal.

Method 2
The second method is based on AMPD, performed with = 1. First, set the threshold of . If the value of is greater than 's threshold, define this sample as a peak value. As shown in Figure 23a, in the entire PPG signal, only a peak value is detected, due to the measurement interference of the wrist PPG signal (e.g., movement or swinging of the hand). Consequently, if the threshold of is too high, most samples will be = 0, which means there are fewer samples that can be calculated. In Figure 23b, set threshold to 2/L such that the number of the samples that greater than threshold increases. However, the irregular signal, appeared in the major parts of the PPG signal, will be ignored because the value of is too small.

Method 2
The second method is based on AMPD, performed with P 1 = 1. First, set the threshold of P 2 . If the value of P 2 is greater than P 2 's threshold, define this sample as a peak value. As shown in Figure 23a, in the entire PPG signal, only a peak value is detected, due to the measurement interference of the wrist PPG signal (e.g., movement or swinging of the hand). Consequently, if the threshold of P 1 is too high, most samples will be P 1 = 0, which means there are fewer samples that can be calculated. In Figure 23b, set P 1 threshold to 2/L such that the number of the samples that greater than threshold increases. However, the irregular signal, appeared in the major parts of the PPG signal, will be ignored because the value of P 2 is too small.

Method 3
AMPD-BL calibrates the peak position with Bayesian learning approach. Since the probability values are multiplied with indices, they are more sensitive to the unstable heart rate. Figure 24a shows that in the sample 42, because of the change of the heart rate value, the peak value is changed as well. In addition, due to baseline changes, the subsequent peaks are lost. Figure 24b shows the peak sample through our AMPD-Fuzzy algorithm, in which it can be seen that the irregular signal appearing in the major parts of the PPG signal can also be applied to detects peaks and was calibrated to the estimation by using the previous heart rate signal.

Method 3
AMPD-BL calibrates the peak position with Bayesian learning approach. Since the probability values are multiplied with indices, they are more sensitive to the unstable heart rate. Figure 24a shows that in the sample 42, because of the change of the heart rate value, the peak value is changed as well. In addition, due to baseline changes, the subsequent peaks are lost. Figure 24b shows the peak sample through our AMPD-Fuzzy algorithm, in which it can be seen that the irregular signal appearing in the major parts of the PPG signal can also be applied to detects peaks and was calibrated to the estimation by P 2 using the previous heart rate signal.

Experiment 3: AMPD-Fuzzy Tracking
This subsection presents a performance comparison of the three tracking methods (i.e., AMPD-BL, AMPD-Fuzzy, and a referenced system) with respect to the placement of wearable sensors and the tracking errors. Two tests are conducted to assess the system feasibility and provide statistical analyses of the results. Test 1 compares the tracking performance of AMPD-BL and AMPD-Fuzzy on the static wrist. Test 2 explores the tracking error of AMPD-Fuzzy with respect to the referenced system. Note that the referenced heart rate is obtained by the heartbeat bracelet on the market [7] with the right wrist in the static manner. The left wrist is used to assess the tracking performance of AMPD-BL and AMPD-Fuzzy. The number of repetitions of Tests 1 and 2 for each method is 50. The tests are conducted by a man aged 24 years, of an average height, and a healthy weight.
For Test 1, Figure 25a,b show the AMPD-BL and AMPD-Fuzzy estimated heart rate data, respectively, on the static wrist. In these typical runs, the average heart rates of AMPD-BL, AMPD-Fuzzy, and the referenced system are 66.86 (bpm), 66.14 (bpm), and 65.86 (bpm), respectively. To further examine the monitoring behavior, Table 5 depicts the tracking errors in terms of the mean absolute error (MAE) and the root mean squared error (RMSE). The experimental result and the quantitative analysis imply that the estimation performance of AMPD-Fuzzy is superior to that of AMPD-BL.

Experiment 3: AMPD-Fuzzy Tracking
This subsection presents a performance comparison of the three tracking methods (i.e., AMPD-BL, AMPD-Fuzzy, and a referenced system) with respect to the placement of wearable sensors and the tracking errors. Two tests are conducted to assess the system feasibility and provide statistical analyses of the results. Test 1 compares the tracking performance of AMPD-BL and AMPD-Fuzzy on the static wrist. Test 2 explores the tracking error of AMPD-Fuzzy with respect to the referenced system. Note that the referenced heart rate is obtained by the heartbeat bracelet on the market [7] with the right wrist in the static manner. The left wrist is used to assess the tracking performance of AMPD-BL and AMPD-Fuzzy. The number of repetitions of Tests 1 and 2 for each method is 50. The tests are conducted by a man aged 24 years, of an average height, and a healthy weight.
For Test 1, Figure 25a,b show the AMPD-BL and AMPD-Fuzzy estimated heart rate data, respectively, on the static wrist. In these typical runs, the average heart rates of AMPD-BL, AMPD-Fuzzy, and the referenced system are 66.86 (bpm), 66.14 (bpm), and 65.86 (bpm), respectively. To further examine the monitoring behavior, Table 5 depicts the tracking errors in terms of the mean absolute error (MAE) and the root mean squared error (RMSE). The experimental result and the quantitative analysis imply that the estimation performance of AMPD-Fuzzy is superior to that of AMPD-BL.   Figure 26 shows the typical runs of AMPD-Fuzzy on the finger and AMPD-Fuzzy on the dynamic wrist. The round-trip time of a swing with wrist movement is about one second. For the finger placement (Figure 26a), the average heart rates of AMPD-Fuzzy (Finger) and the referenced system are 75.63 (bpm) and 74.82 (bpm), respectively. For the wrist placement (Figure 26b), the average heart rates of AMPD-Fuzzy (Dynamic Wrist) and the referenced system are 78.25 (bpm) and 79.25 (bpm), respectively. To characterize the performance, Table 6 depicts the deviations in terms of the mean absolute error (MAE) and the root mean squared error (RMSE). Figure 26a shows that AMPD-Fuzzy has a good tracking capability for estimating the heart rate on the finger. Moreover, even for estimating the heart rate on the dynamic wrist, Figure 26b shows that AMPD-Fuzzy still provides acceptable heart rate accuracy (< 10%) [35].  For Test 2, Figure 26 shows the typical runs of AMPD-Fuzzy on the finger and AMPD-Fuzzy on the dynamic wrist. The round-trip time of a swing with wrist movement is about one second. For the finger placement (Figure 26a), the average heart rates of AMPD-Fuzzy (Finger) and the referenced system are 75.63 (bpm) and 74.82 (bpm), respectively. For the wrist placement (Figure 26b), the average heart rates of AMPD-Fuzzy (Dynamic Wrist) and the referenced system are 78.25 (bpm) and 79.25 (bpm), respectively. To characterize the performance, Table 6 depicts the deviations in terms of the mean absolute error (MAE) and the root mean squared error (RMSE). Figure 26a shows that AMPD-Fuzzy has a good tracking capability for estimating the heart rate on the finger. Moreover, even for estimating the heart rate on the dynamic wrist, Figure 26b shows that AMPD-Fuzzy still provides acceptable heart rate accuracy (<±10%) [35].   Figure 26 shows the typical runs of AMPD-Fuzzy on the finger and AMPD-Fuzzy on the dynamic wrist. The round-trip time of a swing with wrist movement is about one second. For the finger placement (Figure 26a), the average heart rates of AMPD-Fuzzy (Finger) and the referenced system are 75.63 (bpm) and 74.82 (bpm), respectively. For the wrist placement (Figure 26b), the average heart rates of AMPD-Fuzzy (Dynamic Wrist) and the referenced system are 78.25 (bpm) and 79.25 (bpm), respectively. To characterize the performance, Table 6 depicts the deviations in terms of the mean absolute error (MAE) and the root mean squared error (RMSE). Figure 26a shows that AMPD-Fuzzy has a good tracking capability for estimating the heart rate on the finger. Moreover, even for estimating the heart rate on the dynamic wrist, Figure 26b shows that AMPD-Fuzzy still provides acceptable heart rate accuracy (< 10%) [35].

Conclusions
This paper proposes a new algorithm, the AMPD-Fuzzy algorithm, to monitor heart rate for wearable healthcare devices. To reshape the signal and specify the range of calibration, an adaptive fuzzy logic control mechanism is designed to determine the value of the HR_Fuzzy parameter for signal processing in the next window. With the proposed sliding window approach and the signal overlap processing principle, Experiment 2 shows that the noise interference and unstable heart rate measurements can be effectively preprocessed and calibrated on the static wrist. Compared to the tracking performance of a wearable monitor on the market, Experiment 3 illustrates that the proposed system is able to provide an acceptable error rate on the dynamic wrist, which may be used in research and clinical applications. Future issues will further explore preprocessing techniques, heart rate tracking schemes, and the design of system prototypes to improve the PPG signal quality and increase the accuracy of heart rate tracking.