QRS Detection on Heart Rate Variability Readings using Two Moving Average Methods

Heart Rate Variability or the average deviation between heartbeats in humans is influenced by the autonomic nervous system control of heart function. Monitoring HRV is necessary to diagnose the underlying pathophysiology of hypertension, optimize treatment modalities for hypertensive patients with signs of autonomic dysfunction, and predict cardiovascular events in the heart. This study focused on providing an overview of QRS complex detection for heart rate variability or HRV reading using the Two Moving Average method in detecting heart in humans. In addition, current research also determine QRS complex detection for heart rate variability reading by adding a window size feature, then create a QRS Complex detection tool for HRV reading using the Two Moving Average method by adding a window size feature. Furthermore, another aim of this study is to know the FFT signal results in order to see the frequency of each ECG signal generated by the patient. In this study, the use of the Two Moving Average method or moving average makes it easier to find the R peak-to-peak signal, so the heartbeats reading is easier as well. In this study, QRS complex signal detection was performed using lead II pickups using the Two Moving Average method, which was used as a filter or attenuator of unsought signals such as P and T signals in ECG signals. In this case, this method is recommended for detecting patients with high P and T signal values. This was achieved by evaluating and studying each change in window size, an algorithm that uses an equation with two different window widths to generate signal features and detection thresholds, allowing it to adapt to various changes in QRS and noise levels. In addition, changes in each Two Moving Average signal can be clearly seen at each window size value. In this study, window sizes of 5, 10, 15, and 20 were used for comparison of signal reading results, and the best window size for heart rate measurement was found to be 15. This study used an Arduino Nano system for data processing and Delphi for displaying processed data. This study examined signal acquisition and heart rate monitoring for 5 minutes. This method is a method with a good level of accuracy of 98% and can be displayed in real-time by displaying the RR Interval value, BPM from the Phantom Fluke for 10 minutes, and the HRV value obtained is close to 0, so it can be concluded that the tool and method in this study were proven to be safe and accurate and can be used to perform examinations on humans.


I. INTRODUCTION
Electrocardiogram is a process of reading heart signals.The ECG signal output shows the condition of heart function to diagnose abnormalities that occur in the heart [1].This process is beneficial for biomedical applications such as heart rate measurement, abnormal diagnosis, biometric identification, and motion recognition.The complete ECG cycle consists of a P wave, QRS complex, T wave, and U wave [2].The QRS complex is a combination of the three graphic deflections seen in cardiac signals.It is usually the middle and most visually obvious part of tracing [3].This corresponds to depolarization of the right and left ventricles of the heart and contraction of the muscles of the large ventricles [4].Heart rate can be measured from the R-peak signal in the order of time after the detection of QRS waves [5].In 2014, Luis A Nunes Amaral et al. conducted a research on Revisiting QRS Detection Methodologies for Portable, Wearable, Battery Operated, and Wireless ECG System [6].This research examined wireless ECG which had the potential to be used in the assessment of heart function that can be easily integrated into everyday life [7].It is hoped that the author of a portable diagnostic system can help reveal cardiovascular disease.Meanwhile, ECG analysis is the detection of prominent QRS complexes as well as other characteristics of the ECG signal [8].The author investigated the current QRS detection algorithm based on three criteria, including noise resistance, parameter choice, and numerical efficiency [9].Furthermore, in 2016, Jinkwon Kim et al conducted a Simple and Robust Realtime QRS Detection Algorithm Based on Spatiotemporal Characteristic of the QRS Complex [10].The aim of this research was to develop an intuitive real-time QRS detection based on the physiological characteristics of the electrocardiogram waveform [11].The proposed algorithm has the function of finding the QRS complex based on the required criteria of the amplitude and duration of the QRS complex [12].This algorithm consists of a finite impulse, filter, differentiation or thresholding complex such as wavelet transform [13].The performance of this method was evaluated using the MIT-BIH arrhythmia database and the AHA ECG database, obtaining sensitivity and positive predictive values of 99.85% and 99.86% [14].In addition, Ivaylo I Christof conducted a study in 2004 on Real time electrocardiogram QRS detection using a combined adaptive threshold.This research is about ventricular rate detection and QRS which is an ECG processing procedure [15].The method used by the author is realtime detection, based on a comparison between the ECG values distinguished from one of the many ECG leads and the threshold [16].In this case, threshold combines three parameters, namely the value of the rate of change of voltage, the second value is to increase when the noise frequency is high, and the third is to avoid the loss of heart rate amplitude [17].The two algorithms developed are the first algorithm used to detect heart rate, while the second algorithm is for additional RR interval analysis [18].In 2016, Shweta Jain et al conducted a study on QRS detection using adaptive filters: A comparative study in this paper conducted an improvement in QRS detection, based on the principle of adaptive filtering [19].In 2017, Tanushree Sharma conducted a research on A new method for QRS detection in ECG signals using QRS preserving filtering techniques.The author proposed the use of least squares optimization with a smoothing technique that suppresses the peak of ECG noise and maintains the QRS complex.The researcher also applied a new non-linear transformation technique which was applied after the smoothing operation which equalized the QRS amplitude without increasing the noise suppressed.After the pre-processing operation, the Rpeak can be detected with high accuracy [20].In 2016, Suparerk Janjarsjitt conducted a research project on a new QRS detection method.The main component of QRS detection is the application of two moving averages using a bandpass filter and feature enhancement based on energy ratio calculations.The idea of splitting the ECG signal is to align each cycle of the separated ECG signal through resampling and then apply Fourier transform to extract the required components [21].Justus Eilers et al in 2021 conducted a study on Choosing the Appropriate QRS detector.In this case, QRS detector was used for the most basic processing tool for ECG signals.In addition to analyzing the type of heart rate, this meal also tested the noise resistance of different combinations of noise.Each QRS detector tested showed significant differences depending on the type of heartbeat [22].
In 2007, S-W Chen conducted a study on a non-linear trimmed moving averaging based system with its application to real time QRS beat classification.In this paper, a real time WRS beat classification system based on nonlinear trimming of moving average filters is presented.This system aimed to identify any abnormal beats originating from the ventricles [23].In 2021, Lorenzo Bachi conducted a research project on QRS Detection Based on Medical Knowledge and cascades of moving average filters in this paper, the author presents a QRS detection algorithm based on moving average filter, which provides a simple but powerful signal processing technique.The decision logic takes into account the rhythmic and morphological features of the QRS complex.The improvement of QRS detection was done by moving average cascade which was selected from a collection of derived systems designed by the authors [24].
Mohamed Elgendi, 2013, conducted a study on Fast QRS Detection with an Optimized Knowledge-Based Method: Evaluation on 11 Standard ECG Databases where the method used showed high resilience and an almost negligible error rate.The method used achieved a very high detection rate.Researchers developed a numerically efficient algorithm to accommodate ECG devices using batteries and to analyze signals with long-term recordings with time efficiency methods.The QRS detection method used by the author was a two moving average.The proposed method can be easily implemented in digital filter design.The device made by the author performed different recordings with sampling rates between 128Hz -1KHz and interference.In this case, lead I was applied on every record without exception.The corresponding reference R markers were provided in the data set for reference [25].
Furthermore, John Malik, et al in 2020 conducted a study on an adaptive QRS detection algorithm for ultra-long-term ECG recording.In this case, the background of the research was the accurate detection of complex QRS during monitoring of cellular ECG tools, the authors were challenged by high heart rate, drastic changes and persistence of signal amplitude, and intermittent deformation in signal quality that occurs due to subject movement, noise, and misplacement of the ECG electrodes.The author's aim was to propose a QRS detection algorithm that overcomes the aforementioned challenges.The proposed method was based on two advanced modifications, where the first modification was to implement local signal amplitude estimation, while the second modification is the mechanism by which the algorithm becomes adaptive to changes in heart rate.The authors proposed a state-of-the-art algorithm using short-term ECG recordings from 11 annotated databases on the Physionet application, as well as visualized 14-day longterm ECG recordings.In the database algorithm proposed by the author, the sensitivity results are 99.90%, while the positive predictive value is 99.73%.Meanwhile, the latest QRS detection algorithm achieved a sensitivity of 99.30% and a positive predictive value of 99.68% in the same database.In this case, the samples were taken at 200Hz [26].
Szi Wen Chen, et al. in 2006 conducted a study on A Realtime QRS detection method based on moving averaging incorporating with wavelet denoising.In this study, the author proposed a simple moving average method for real time QRS detection.In addition, for signal processing, the authors incorporate a wavelet-based denoising procedure to effectively reduce noise levels for ECG data.The overall computational structure of the algorithm proposed by the authors allowed QRS detection to be carried out and implemented in real time with time efficiency.The algorithm's performance was evaluated against the MIT-BIH arrhythmia database.The results showed that the algorithm achieves approximately 99.5% detection rate for standard databases, and can also function reliably even under conditions of poor signal quality in the measured ECG data [27].
Sami Torbey, et al in 2012 conducted a study on Multi-lead QRS Detection Using Windows Pairs, where the authors designed a new approach for multi-lead QRS detection.The algorithm used an equation with two different window widths to generate signal features and detection thresholds.This made it possible to adapt to various changes in QRS and noise levels.The result further obtained an error detection rate of 0.29% in the MIT-BIH Arrhythmia database.This algorithm was also computationally efficient and was capable of resolving the differences in several leads [28].In the earlier study, QRS complex detection was performed using the Two Moving Average method on Lead I with data obtained from long-term recordings lasting 24 hours.The previous study also performed real-time QRS complex detection using a window.In this study, QRS complex detection was performed using the Two Moving Average method on Lead II with data obtained from short-term recordings lasting 5 minutes, thus saving time.In addition, this study also used window size and was performed in realtime, with the additional development of displaying HRV or Heart Rate Variability readings.
This study focused on providing an overview of QRS complex detection for reading heart rate variability (HRV) using the Two Moving Average method in detecting the human heart.In addition, it directed to determine the QRS complex detection for HRV reading by adding window size features of 5, 10, 15, and 20.Furthermore, it also directed to develop a QRS Complex detection device for HRV reading using the Two Moving Average method by adding window size devices of 5, 10, 15, and 20.Lastly, it aimed to investigate the FFT signal results to observe the frequency of each ECG signal produced by the patient.The benefit of this study is to assist the monitoring process of patients who experience disturbances and provide indications or warnings that the patient is experiencing a disturbance, so that immediate treatment or handling can be given.
Based on the identification of the problem above, the author conducted a research on QRS Detection on Heart Rate Variability readings (Two Moving Average method).This tool displays the heart signal display using Delphi and analyzes the window size.The method used was the Two Moving Average method for reading Heart Rate Variability.The contribution of this paper is as follows: a.The utilization of the Two Moving Average method is suitable for detecting Heart Rate Variability due to its stability compared to manual QRS complex detection methods.b.The Two Moving Average method can display the signals generated in real-time during the respondent's use of the used electrode.c.The Two Moving Average method makes it easier to detect R-R values as it dampens P and T signals for patients with high P and T signals.

II. MATERIALS AND METHOD
The study was conducted through an experimental research.
The authors proposed an QRS Kompleks Detection on Heart Rate Variability using Two Moving Average Methods to measure heart rate variability, RR Interval and Beat Per Minute in human (FIGURE 1).The materials and method are further explained in the following sections.The FIGURE 2 shows a block diagram of the module where the ECG signal was obtained from the electrode placements on the body using Lead II to produce the best ECG signal.In addition to direct body placement, the heart signal was also obtained from the Phantom Fluke with BPM 30, 60, 90, 120, and 180 and a sensitivity of 1 mm/s.The acquired signal was then strengthened using a basic instrument circuit, which was an amplifier circuit that acted as an amplifier.The signal was then filtered using a Low Pass Filter circuit, so that the signal that passed through was the signal below the cutoff frequency.Meanwhile, the signal above the cutoff frequency was suppressed.Then, the signal was filtered again using a High Pass Filter circuit, so that the signal that passed through is the signal above the cutoff frequency, while the signal below the cutoff frequency was suppressed.
After that, the signal passed through a Notch Filter circuit, which was a circuit that suppressed the PLN signal noise with a frequency of 50 Hz that can distort the signal shape.Then, the signal passed through a non-inverting circuit that acted as an amplifier, so that the filtered signal became clearer.Furthermore, the signal passed through an adder circuit that increased the reference voltage so that it can be read by the microcontroller, where the Arduino microcontroller can read the voltage between 0V -5V.After that, the signal entered a buffer circuit that acts as a support, where its basic principle is current amplification without voltage amplification.
After passing through the buffer circuit, the ECG signal, which is the PQRST signal, was formed.To view the generated signal, the ECG signal was then connected to the microcontroller that will read the analog signal and convert it into a digital signal or Analog to Digital Converter (ADC) and used as a system for data processing.In addition to using a microcontroller, data processing was also performed using the Two Moving Average method, where the signal was analyzed, making it easier to find the R peak to peak signal, making it easier to read.The signal then passed through Two Moving Average I, which resulted in the detection of the QRS signal and detection threshold.Then it was analyzed again using Two Moving Average II, which detected the heart rate or R-R Interval signal.Subsequently, the processed signal or data was displayed through the GUI using Delphi programming language.The data displayed were R-R Interval, Beat Per Minute (BPM), and Heart Rate Variability (HVR) data.In addition to reading the heart rate using the Two Moving Average method, the heart rate is also read using an ECG recorder as a comparison tool.The input signal used was the patient's body placement and the Phantom Fluke.

B. DATA ANALYSIS
Measurements of each parameter, including Heart Rate Variability, RR Interval and Beat Per Minute, all was repeated 3 times (FIGURE 3).The average value of the measurement was obtained by using the mean or average by applying Eq. ( 1):  FIGURE 4 shows the result of the ECG signal with a window size of 5.The data comparison was taken using the fluke phantom with a sensitivity of 1mm/s and a BPM setting of 30.The ECG signal recording was performed for 10 minutes.It was seen that the signal processed with two moving average was still in the same form as the original PQRST ECG signal.Additionally, the generated signal did not dampen the P and T signals to form the QRS complex.There was a difference in the amplitude generated from the two moving average signal processing, where the generated signal was smaller than the ECG signal.Thus, window size 5 was not efficient in detecting the QRS complex signal.Based on this, window size 5 was not recommended to be used a reference window size when collecting patient signal data.FIGURE 5  It can be seen that the signal processed using two moving averages experienced a slight change in shape from the original PQRST ECG signal.The generated signal was enough to dampen the P and T signals to form the QRS complex.However, the dampening of the P and T signals was not significant enough to from the QRS complex.There was a difference in amplitude generated signal is smaller than the original ECG signal.Based on this, window size 10 was not recommended to be used as a reference window size when collecting data from patients.FIGURE 7 represents the result of the ECG signal with a window size of 20.Three ECG recording results were recorded for 10 minutes.Comparison data was collected using a phantom fluke device.The fluke was set at BPM 90 with a sensitivity of 1mm/s.It can be seen that the signal processed by two moving average effectively suppresses the P and T signals.However, this dampening caused the entire signal to become very small, making RR interval detection unstable, leading to a very large heart rate variability.Therefore, window size 20 was not efficient in detecting the QRS complex signal.Based on this, window size 20 was not recommended as a reference window size when collecting patient signal data.The results of RR interval can be seen in TABLE 1.The data was collected using a phantom fluke to determine the best results of the window size to be used for HRV readings on the respondents.The data was collected for 10 minutes, 3 times for each window size.To obtain the error value, the result of the ECG paper and the average value of each window were subtracted.The ECG paper reading result for each window was 2. The average for window size 5 was 2,000 and the error generated was ±0.000.The average for window size 10 was 1,996 and the error generated was ±0.217.The average for window size 15 was 1,995 and the error generated was ±0.233.The average for window size 20 was 5,595 and the error generated was ±179.750.The smallest error was found in window size 5 at ±0.000, while the largest error was in window size 20 at ±179.750.TABLE 2 shows the result of Beat Per Minute (BPM) at 30 BPM.The data was collected using a phantom fluke to determine the best result from the window size to be used for HRV readings on the Respondent.The data was collected for 10 minutes, three times for each window size.To obtain the error value, the results of the ECG paper and the average value of each window were subtracted.The ECG paper reading result in each window was 30 BPM.For the window size of 5, an average of 29.997 was obtained and an error value of ±0.003 was generated.For the window size of 10, an average of 30.068 was obtained and an error value of ±0.068 was generated.For the window size of 15, an average of 29.996 was obtained and an error value of ±0.004 was generated.For the window size of 20, an average of 24.910 was obtained and an error value of ±5.090 was generated.The smallest error value was found in window size 5 with ±0.003 and the largest error value was found in window size 20 with ±5.090.TABLE 3 shows the result of 30 BPM Heart Rate Variability.Data was collected using a phantom fluke to determine the best result of the window size to be used for HRV readings on the respondent.The data was collected for 10 minutes, 3 times for each window size.To obtain the error value, the difference between the ECG paper result and the average of each window was calculated.The ECG paper reading in each window was 0. In window size 5, the average was 0,017 and the error generated was ±0,017.In window size 10, the average was 0,068 and the error generated was ±0,068.In window size 15, the average was 0,007 and the error generated was ±0,007.In window size 20, the average was 2,895 and the error generated was ±2,895.The smallest error value was in window size 15 with ±0,007 and the largest error was in window size 20 with ±2,895.TABLE 4 shows the result of RR interval.The data was collected using the phantom fluke to determine the best result of the window size that will be used for HRV reading in the Respondent.the data was collected for 10 minutes three times at each window is 1.At window size 5, the average was 1.000 nd the error generated was ±0.000.At window 10, the average was 0.999 and the error generated was ±0.001.At window size 15, the average was 1.188 and the error ±0,188.At window size 20, the average was 0.999 and the ±0.001.The smallest error value was found at window size 5, ±0.000 and the largest error was found at window size 15, ±0.188.TABLE 5 shows the result of 60 BPM Beat Per Minute.Data was collected using the phantom fluke to determine the best result of the window size that will be used for HRV readings on the Respondent.Data was collected for 10 minutes 3 times at each window size.To obtain the error value, the difference was calculated between the result of the ECG paper and the average value of each window.The ECG paper reading result in each window was 60 BPM.The average at window size 5 was 59.991 and the error produced was ±0.009.At window size 10, the average was 59.995 and the error produced was ±0.005.At window size 15, the average was 59.991 and the error produced was ±0.009.At window size 20, the average was 60.041 and the error produced was ±0.041.The smallest error value was at window size 10 with ±0.005 and the largest error was at window size 20 with ±0.041.The results of Heart Rate Variability at 60 BPM are presented in TABLE 6.Data was collected using a phantom fluke to determine the best result from the window size used for HRV reading in the respondent.The data was collected for 10 minutes, 3 times for each window size.To obtain the error value, the ECG paper result and the average value of each window were calculated.The ECG paper reading result for each window was 0. For the window size 5, the average was 0.004 with an error of ±0.004.For the window size 10, the average was 0.023 with an error of ±0.023.For the window size 15, the average was 0.006 with an error of ±0.006.For the window size 20, the average was 0.014 with an error of ±0.014.The smallest error value was obtained at window size 5 with ±0.004 and the largest error was obtained at window size 10 with ±0.023.8 shows the result of the Patients' Beat Per Minute.The table comparison was obtained from the ECG paper results and the average result of 3 data collection trials from each patient.The Heart Rate Variability of the patients compared to the ECG paper results showed the error value of patient 1 was ±3.661, patient 2 was ±7.415, patient 3 was ±5.258, patient 4 was ±13.518, patient 5 was ±4.308, patient 6 was ±10.728, patient 7 was ±7.669, patient 8 was ±3.957, patient 9 was ±18.886, and patient 10 was ±23.183.Thus, the result of the lowest error value for Beat Per Minute was ±3.661 for patient 1, and the highest error value was ±23.183 for patient 10.The result of the Heart Rate Variability error value for patients tends to be higher due to factors such as the instability of the R-R distance in humans, the length of data collection, and human error factors.In TABLE 9, the FFT signal was processed with a test of the ECG 10 participants using lead II in order to see the frequency domain and frequency range of each participant.It can be seen that the frequency domain of patient 1 is 4.58 Hz with a frequency range of 0-55 Hz, patient 2 is 3.98 Hz with a frequency range of 0-55 Hz, patient 3 is 7.48 Hz with a frequency range of 0-62 Hz, patient 4 is 4.28 Hz with a frequency range of 0-50 Hz, patient 5 is 2.46 Hz with a frequency range of 0-58 Hz, patient 6 is 7.97 Hz with a frequency range of 0-30 Hz, patient 7 is 4.73 Hz with a frequency range of 0-50 Hz, patient 8 is 3.85 Hz with a frequency range of 0-57 Hz, patient 9 is 2.46 Hz with a frequency range of 0-122 58, and patient 10 is 2.67 Hz with a frequency range of 0-50 Hz.Therefore, it can be concluded from the results that the frequency domain range of the 10 participants using lead II as a pick-up is from a frequency of 2.46 Hz to 7.97 Hz.The range filter used is 5-40 Hz, but in some participants, there is still a signal with a frequency of 50 Hz PLN, with the frequency range, the filter is still unable to suppress it maximally.

IV. DISCUSSION
In the earlier study, QRS complex detection was performed using the Two Moving Average method on Lead I with data obtained from long-term recordings lasting 24 hours.The previous study also performed real-time QRS complex detection using a window.In this study, QRS complex detection was performed using the Two Moving Average method on Lead II with data obtained from short-term recordings lasting 5 minutes, thus saving time.This study also used window size and was performed in real-time, with the additional development of displaying HRV or Heart Rate Variability readings.The Two Moving Average method was developed to detect heart rate variability in humans.In this research, the window sizes of 5, 10, 15, and 20 were used for comparison.The best window size was found to be 15.The results of FFT using data obtained from lead II showed the presence of 50Hz PLN frequency.Two Moving Average is a method that functions to dampen ECG signals, specifically P and T signals so that R-R intervals can be seen more clearly.Not all human ECG signals have clear and readable R-R Intervals, which can be influenced by higher P and T signals compared to R signals.Therefore, the use of Two Moving Average method can be used as a solution to make it easier to detect complex QRS signals.The signal or data obtained was continuously averaged during data collection, so the reading of the complex QRS signal will be clearer than without using the Two Moving Average method.
In this study, a comparison was made using a Phantom Fluke as the input signal source, which has the same R-R Interval values, so the HRV produced must be zero.Meanwhile, when using an input signal source from a human, which has different R-R Interval values, the HRV produced will also be different.The HRV produced was obtained from the deviation of the R-R Interval and BPM values, the larger the deviation, the larger the HRV value.The limitations of the QRS Complex Detection module in reading Heart Rate Variability (Two Moving Average method) are that this method still requires a threshold setting of the detected R signal.Then, when the window size is smaller, the displayed signal will be smaller, causing much data to be lost and affecting the detection of the R signal in the PQRST signal.Furthermore, the filter used was not that good, so in the FFT results, there is still a 50Hz PLN signal that passed.In addition, this method used a frequency of 5-40 Hz, so some new signals appear when the BPM setting is over 100 BPM.Due to various factors, the module created by the author still had limitations.Possible development suggestions included exploring other signal processing techniques besides Two Moving Averages for detecting Heart Rate Variability.Creating Two Moving Average software that uses an auto threshold so that setting is no longer needed when changing the window size.Adding a better 50Hz Filter to prevent the 50Hz frequency from passing.Trying to use different frequencies that are consistent with previous journals to get better results.

V. CONCLUSION
This study focuses on providing an overview of QRS complex detection for reading heart rate variability or HRV using the Two Moving Average method in detecting the human heart.In addition, to determine the QRS complex detection for reading heart rate variability by adding features of window sizes 5, 10, 15, and 20.Then, it also aims to create a QRS complex detection device for reading heart rate variability using the Two Moving Average method by adding window sizes of 5, 10, 15, and 20.Furthermore, the last aim is to determine the results of the FFT signal to see the frequency of each ECG signal generated by the patient.Based on the research conducted, it can be concluded that a Two Moving Average can be created to detect heart rate variability in humans.Then, the FFT results are used to transform signals that use the time domain into the frequency domain.Where FFT has a function to see a dominant frequency of a signal that needs to be analyzed, as well as to see the PLN frequency of 50 Hz.In this study, the best error value for RR Interval was found in patient 5, Heart Rate Variability in patient 1, and Beat Per Minute in patient 1.
This research was conducted because several previous studies did not explain the effect of push the P and T ECG signal, especially the use of Two Moving Average.For this reasons of this study is to analyze the exploration of the ECG Two Moving Average signal using Lead II with the BPM settings being studied are 30,60,90,120 and 180, with window size settings of 5,10,15 and 20.With satisfactory results, it is obtained that the best window size is at window size 15 with the smallest error value in the analysis of heart rate variability, RR Interval and Beat Per Minute.The advantage of this research is that value of HRV reading is very accurate, reducing filters to push P and T, the signal is also good, and you can show it in real time.The deficiency of this study is that the signal is not precise.For future development, it is recommended to create a software for Two Moving Average that uses auto threshold so that there is no need to set it when changing window size, to develop features for the GUI display using Python programming language.Additionally, it is suggested to use the Internet of Things (IoT) to facilitate data transfer and remote control to make it easier to analyze diagnosis results.

FIGURE 1 .
FIGURE 1.The Display of Two Moving Average Methods, RR Interval, Heart Rate Variability and Beat Per MinuteA.DATA COLLECTIONIn this study, the research compared the design (QRS Detection on Heart Rate Variability using Two Moving Average methods) and the standard phantom (Fluke MPS450) as a comparison device.This study used the AD620 as a instrumentation and another IC for the filter LPF and HPF, as well as Arduino Uno component as microcontroller.In the measurement stage, the ECG machine compared 4 window size to find the best window size.In this case, the window size we used are window size 5, 10, 15 and 20.After we got the best window size, the result showed that window size 15 was the best because window size 15 had the smallest error value since it was placed at the setting of 60 BPM.After we collected the best window size, it was used to detect the heart rate variability, RR Interval and Beat Per Minute to 10 responden for 10 minutes for 3 times.Furthermore, the measured parameter was displayed on the PC screen.Moreover, if the user would like to save the data, then the user should press the save button.

FIGURE 2 . 24 𝐴𝑣𝑒𝑟𝑎𝑔𝑒FIGURE 3 .
FIGURE 2. The proposed design QRS Detection on Heart Rate Variability using Two Moving Average methods to measurement the heart rate variability.

FIGURE 4 .FIGURE 5 .
FIGURE 4. Signal Two Moving Average Window Size 5 FIGURE 4  shows the result of the ECG signal with a window size of 5.The data comparison was taken using the fluke phantom with a sensitivity of 1mm/s and a BPM setting of 30.The ECG signal recording was performed for 10 minutes.It was seen that the signal processed with two moving average was still in the same form as the original PQRST ECG signal.Additionally, the generated signal did not dampen the P and T signals to form the QRS complex.There was a difference in the amplitude generated from the two moving average signal processing, where the generated signal was smaller than the ECG signal.Thus, window size 5 was not efficient in detecting the QRS complex signal.Based on this, window size 5 was not recommended to be used a reference window size when collecting patient signal data.FIGURE5represents the result of ECG signal with a window size of 10.The comparison data was taken using a fluke phantom at a BPM setting of 60 with a sensitivity of

FIGURE 6 . 15 FIGURE 6
FIGURE 6. Signal Two Moving Average Window Size 15 FIGURE 6 represents the result of ECG signals using window size 15.The comparison data was collected using a fluke phantom with a BPM setting of 60 and a sensitivity of 1mm/s.The ECG signals were recorded for 10 minutes.it can be seen that the signals processed with two moving averages had a slight difference in shape from the original PQRST ECG signals.The generated signals effectively dampened the P and T signals to form the QRS complex, which made it easier to detect RR intervals and Heart Rate Variability.There was no defference in amplitude produced from the two moving average signal processing.The generated signals were the same as the original ECG signals.Therefore, window size 15 was efficient in detecting QRS complex signals.Based on this, window size 15 was the best window size to be used as a reference when collecting patient signal data as it forms the ECG QRS complex.

TABLE 7
Thus, the result of Heart Rate Variability with the smallest error value was in patient 1, which was ±0.007, and the largest error value was in patient 8, which was ±0.227.The results of Heart Rate Variability error values in patients tend to be larger due to several factors, including the first, the unsteadiness of the R-R distance in humans, the length of data acquisition, and human error factors.TABLE