An IoT Assisted Real-Time High CMRR Wireless Ambulatory ECG Monitoring System with Arrhythmia Detection

: The absence of cardiovascular disease (CVD) diagnostic and management solutions cause significant morbidity among populations in rural areas and the coronavirus disease of 2019 (COVID-19) emergency. To tackle this problem, in this paper, the development of an Internet of things (IoT) assisted ambulatory electrocardiogram (ECG) monitoring system is presented. The system’s wearable single-channel data acquisition device supports 25 h of continuous operation. A right leg drive (RLD) circuit supported analog frontend (AFE) with a high common mode rejection ratio (CMRR) of 121 dB and a digitally implemented notch ﬁlter is used to suppress power-line frequency interference. The wearable device continuously sends the collected ECG data via Bluetooth to the user’s smartphone. An application on the user’s smartphone renders real-time ECG trace and heart rate and detects abnormal heart rhythms. This data are then shared in real-time with the user’s doctor via a real-time cloud database. An application on the doctor’s smartphone allows real-time visualization of this data and detection of arrhythmias. Simulations and experimental results demonstrate that reliable ECG signals can be captured with low latency and the heart rate computation is comparable to a commercial application. Low cost, scalability, low latency, real-time ECG monitoring, and improved performance of the system make the system highly suitable for the real-time remote identiﬁcation and management of CVDs in users of rural areas and in the COVID-19 pandemic.


Introduction
According to the World Health Organization (WHO), cardiovascular diseases (CVDs) are the number one cause of deaths globally [1]. In addition, CVD related mortalities are expected to stagger to 23.3 million by 2030 [2]. Individuals in rural communities often experience limited access to healthcare services and have high rates of obesity, CVD, and stroke [3]. The biggest barriers to accessing cardiovascular care for rural populations include poor or non-existing transportation, cardiology workforce, and cardiology services.
Internet of things (IoT) based health monitoring is a key telehealth strategy that has received increasing attention in recent years as a technological way to confront poor health outcomes and bolster access to clinical services in rural communities. The IoT strategy has been successfully implemented in many countries for remote diagnosis and evaluation of patients and addresses the geographical maldistribution of cardiologists. In addition, more recently, the corona virus disease of 2019 (COVID-19) pandemic emergency has enforced traditional in-person visits to the IoT based health monitoring systems to overcome the difficulties and deliver care. Many health monitoring systems using mobile devices have been used for electrocardiogram (ECG) monitoring, diabetes control, dermatosis care,

1.
A right leg drive (RLD) circuit based analog frontend (AFE) with a high CMRR of 121 dB and a digitally implemented notch filter to suppress the power-line frequency noise-for improved diagnostic performance.

2.
A programmable embedded system-on-chip (PSoC) for conditioning of ECG signals (with integrated digital filtering)-for power optimization of the hardware part, portability, and further noise and interference suppression in the data acquisition device.

3.
Heart rate calculations in the user's smartphone (rather than in the wearable ECG device)-for power saving in the wearable device.

4.
A smartphone-based application for display of real-time ECG trace and heart rate, and detection of abnormal heart rhythms-for monitoring by the user.

5.
A smartphone-based application with real-time ECG trace visualization, heart rate detection, and arrhythmia detection capability-for monitoring, assessment, and diagnosis by the user's doctor. Figure 1 shows the architecture of the proposed system. The system consists of multiple patients with a chest belt-based or wearable strap-based data acquisition and wireless transmission unit (DATU) and three electrodes attached to it. The DATU transmits (via the Bluetooth transmission link) the collected ECG data in real-time to the user's smartphone. A backend Android mobile application on the user's smartphone displays real-time received ECG trace and computed heart rate, and relays registered user's information along with the ECG data to a cloud for data storage and sharing. Efficient real-time data sharing of the ECG data is achieved using the Google Firebase cloud database. Multiple doctors are also shown in Figure 1 to access patient data simultaneously from the Cloud. Data is synchronized in real-time to a connected doctor's smartphone. The Android application at the doctor's smartphone selects the registered user of interest and receives real-time instances of updated ECG data and heart rate from the Firebase cloud. The doctor's application helps to identify types of arrhythmias and displays this information along with the real-time ECG trace and heart rate.

System
Design and Implementation 2.2.1. DATU Figure 2 shows the detailed DATU block diagram, consisting of four major sub-blocks: sensing unit (SU), AFE, PSoC 5LP [19], Bluetooth module, and a power management circcuit. The DATU is also supported by a rechargeable battery. The design and implementation of these sub-blocks is described next.

Sensing Unit
The sensing unit comprises of three silver-silver chloride (Ag-AgCl) electrodes. The electrodes are attached to the patient's body to effectively detect the electrical depolarization of the heart and convey to the AFE via ECG cables. In Figure 2, sensing unit electrodes are shown to focus on the Lead I measurement, which is the electrical potential formed between the left arm (LA) and right arm (RA) with reference to a right leg (RL) reference lead. The skin-electrode interface is normally modeled as a parallel RC combination of a 47 nF capacitor and a 52 kΩ resistor, with a DC source generator modeling as the offset potential. The DC offset potential is due to the half-cell potential caused by different energies of electrode, electrolyte, and skin [20]. The electrical model of the body impedance model is included in the AFE design schematic of Figure 3.

AFE
The AFE circuitry consisting of an instrumentation amplifier (INA), an RLD circuit, and a low pass (LP) filter is shown in Figure 3. The ECG signal is generally superimposed by a large common mode voltage. The source of common mode voltage is generally 50 Hz or 60 Hz line frequency noise. Other sources that generate noise are muscle contractions, respiration, electromagnetic interference, and electromagnetic emissions from electronic components [21]. INA128PA [22] is chosen as the INA to reduce the common mode noise. The INA128PA was selected due to its low current and voltage noise, and CMRR of 93 dB. The INA128PA operates on ∓3.3 V to take advantage of the large input voltage range. The gain for INA128PA is set to 54 times by setting the external gain resistor R G to 470 Ω.
The RLD circuit is used to invert and amplify the average common mode signal back into the patient's right leg, canceling the line frequency noise and thus improving the CMRR. Two TLC2262 op-amps [23] operating at ∓3.3 V are used in the RLD circuit. The TLC2262 is selected due to its low current and voltage noise, and high CMRR of 95 dB. The first op-amp (U1) is used as a unity gain amplifier, whereas the second op-amp (U5) is used in an inverting LP filter with a cutoff of 50 Hz to reduce instability. The RLD gain is calculated using the formula: In addition, a current limiting resistor R 7 of 500 kΩ is used to reduce the maximum possible drive current being sent back to the body. Furthermore, a simple, single-pole LP antialiasing RC filter with a 3 dB cut-off at 200 Hz is added at the INA output to band limit the ECG signal. For the cut-off frequency of 200 Hz, the defined values of R and C were calculated as 8.2 kΩ and 0.1 µF, respectively.
To eliminate the noise in the ECG signal due to unstable DC electrode offset, a DC blocking capacitor was added to filter/AFE output. In Figure 3, the AFE also shows a 100 kΩ resistor and its routing for PSoC 5LP P2_6 and P2_7 terminals to support variable full-scale input range and level shifting. An offset of 2.5 V was applied to the signal at pin P2_6 for level shifting. This signal was then sent via an op-amp (in the PSOC 5LP block) that conditions the signal to better levels for the ADC range.
Key technical parameters of the AFE sub-blocks are summarized in Table 1. The digital section of the DATU unit includes a PSoC 5 architecture based PSoC 5LP unit and a Bluetooth low energy (BLE) module [24]. The circuit connection of PSoC 5LP module is shown in Figure 4a. The PSoC 5LP component is used for ADC and digital filtering, whereas wireless transmission of ECG data are carried out through the BLE interface. The AFE outputs are directly connected to the built in 12-bit Sigma/Delta ADC (Del Sig ADC or simply ADC) of PSoC 5LP. ECG signals entering the ADC block have a cut-off 200 Hz, thus according to the Nyquist criterion, the sampling rate should be at least 400 Hz. The antialiasing filter is not ideal, so it is possible to have high frequency components getting into the ECG signal. To ease the filter requirements and prevent aliasing due to high frequency components beyond the cut-off frequency, the ECG signal was oversampled at 4 K samples per second (sps). In addition, ADC was configured in differential mode with a range of ±2.048 V. To reduce the DATU complexity and hardware cost associated with analog filtering, real-time ECG signal filtering was carried out through PSoC 5LP digital filtering block (DFB). To remove the baseline wander [25], in the first DFB stage, a second order biquad high pass (HP) Chebyshev filter with cutoff frequency of 0.5 Hz was employed. Next, to remove any residual power-line frequency interference, a two stage (i.e., DFB Stages 2 and 3) second order biquad band stop Chebyshev filter was implemented to give a notch of bandwidth 10 Hz at 50 Hz. A normal heart operation is included in the frequency range of 0.5-150 Hz. It is therefore in the DFB Stage 4; a finite impulse response (FIR) LP Blackman filter was used to give a sharp drop off after the 150 Hz cut-off. The biquad filters were designed by using bilinear transformation using MATLAB, and associated filter coefficients were then inserted manually in PSoC Creator [26]. To simplify the filter design, the Stage 4 filter was configured using drop-down menus in PSoC Creator to specify filter parameters.
The PSOC 5LP top design schematic is shown in Figure 5. The ADC component measures the differential voltage between P2_7 and V ref pins. P2_7 is connected to the ADC's positive input. With V dda = 5V on the CY8CKIT-050 PSoC ® 5LP Development Kit [27], V ref is configured to generate a constant voltage of 2.5 V on the ADC's negative input. The op-amp is simply configured in the buffer mode so that its output voltage is equal to V dda /2 = 2.5V. The op-amp provides a DC bias of 2.5 V for the maximum input swing. The DMA is configured to transfer the ADC output to the DFB Channel A input, on each rising edge of the ADC end of conversion (EOC) signal.
The DFB Channel A contains the composite filter (constituting a combination of abovedescribed HP, Notch, and LP filters). The composite filter processes this sample and sets off the interrupt when the processing is complete. The data are used by a light emitting diode (LED) to blink when an interrupt is detected. The data are then transferred to the universal asynchronous receiver-transmitter (UART) for serial transmission. The UART receiver pin (Rx) is connected to the transmitter pin (Tx) of the HM-10 BLE module and the UART Tx pin is connected to the HM-10 Rx pin. The filtered data are then sent to the HM-10 Rx pin for transfer to the user's smartphone. When the phone sends a message to the DATU via HM-10, it triggers a UART interrupt called 'rxisr'. This interrupt is used to stop (start) the ADC conversion and filtering when a stop (start) command is received.
Key technical parameters of the PSoC 5LP sub-block are summarized in Table 2.  BLE, also known as Bluetooth Smart or Bluetooth 4.0, is a mainstream technology with a growing adoption for wearable ECG devices. BLE devices can reliably transmit data up to 30 m or more under the line-of-sight, but the typical operating range is 5 to 10 m, with a speed of 10 Kb/s [24]. The DATU module (the peripheral device) utilizes a popular inexpensive Bluetooth 4 HM-10 module [28,29] which operates in the 2.4 GHz industrial, scientific, and medical (ISM) band with a transmit power of +6 dBm and a receiver sensitivity of −23 dBm. HM-10 directly connects to the PSoC 5LP using a serial UART connection (as shown in Figure 4b) and uses Bluetooth wireless to connect with other devices (such as the user's smartphone). The data are framed in the form of packets and transmitted wirelessly to the smartphone with one second interval [30]. The module is powered using the 3.3 V from the power circuit and draws about 10 mA when active and connected to a smartphone. A custom service in HM-10 is used to act as a read/write function for the UART connection. The Generic Attribute Profile (GATT) Service UUID (0000FFE0-0000-1000-8000-00805F9B34FB) is used to enable bidirectional communication between the HM-10 module and any central device connected to it and characteristic UUID (0000FFE1-0000-1000-8000-00805F9B34FB) is used to allow 20 bytes of unformatted data during data transfer.
Key technical parameters of the Bluetooth sub-block are summarized in Table 3.

Power Management
The total current consumption of DATU is 38.6 mA and our requirement was to power up the DATU for 24 h of continuous operation. The minimum battery capacity requirement was thus 926.4 mAh. It is, therefore, a 3.7 V, 1000 mAh rechargeable Lithium-ion battery was selected to power the DATU unit for around 25 h.
A power management circuit (shown in Figure 6) was designed to provide a stable working voltage and current to the DATU. The circuit provides PSoC 5LP a stable voltage of 5 V and the AFE with ±3.3 V. A S7V8F5 [31] regulator is used to generate +5 V from the battery output voltage, a S7V8F3 [32] regulator is then used to generate 3.3 V from the 5 V input voltage, and a separate MAX1044 [33] voltage inverter to used further invert 3.3 V input to −3.3 V output. The voltage provided by a lithium-Ion battery ranges from 4.2 V when fully charged to 3 V when discharged. A micro-USB battery charger is used to charge the battery with an output current of 500 mA at 3.7 V. Key technical parameters of the power management sub-block are summarized in Table 4.  [34] was used to develop the Android mobile applications used in this project. The applications were run on a Samsung Galaxy S7 Edge smartphone with Android version 8.0. The patient's end Android mobile application (named Health ECG Patient App) with a simple user interface (UI) was developed to connect the DATU and user's smartphone via a BLE connection, computation of the heart rate, and sending this data with the user's name to the Firebase cloud. Additional features such as plotting of ECG trace, display of calculated heart rate, and issuance of ECG warning were also added to the application. Figure 7 shows the flowchart of the Health ECG Patient App. At first, the patient is required to enter his/her name to register. As the Enter button is pressed, the text entered is saved as a tag name for the Firebase cloud database [35]. The user then chooses the duration of the test. The chosen duration is then saved. The user is then provided with Bluetooth control buttons. When the Scan control button is pressed, the smartphone scans the available Bluetooth devices in the vicinity and displays the devices list. When the user presses the Stop Scan button, the device halts scanning and allows the user to select the device of choice for Bluetooth connectivity. After the selection has been made and the Connect control button is pressed, the phone connects to the selected device. Pressing the Disconnect control button disconnects the smartphone from the device. When the smartphone is connected to the DATU, the ECG data are transferred to the application, the incoming data are saved, and the ECG trace is plotted. The incoming data are set as a y-coordinate and the x-coordinate is incremented by one to be ready for the next sample. The coordinates are used to plot the EG trace on the canvas. It was decided to utilize the peak detection of R wave based on a set threshold value for the automated determination of the heart rate. The applied threshold value depends on the incoming ECG signal R peak amplitude. The threshold value is set in such a manner that only R peaks having an amplitude greater than the set threshold value are detected and other peaks smaller than the set threshold are ignored. The threshold value was set to 60% of the maximum signal amplitude (easily observed from the incoming data on the user's smartphone). If the R peak is not detected, then the threshold needs adjustment to a lower threshold value. The threshold value used in this study is not to be considered a suggestion and should be set by the user till the heart rate is detected.
Accordingly, when the incoming data values are greater than the set threshold value, the exact time of the event is logged. Next, incoming data are monitored for a value greater than the threshold value. The exact time of this event is logged again and the interval period (in milliseconds) between the two events/beat-to-beat (RR BB ) is calculated. The RR interval time series comprising of N = 10 successive beat intervals are then collected. The mean RR interval (RR MEAN ) and the mean heart rate (HR MEAN or simply HR) are then calculated as: The result of the calculated result goes through an if statement to check if it is lesser than 60 beats per minute (bpm) or greater than 100 bpm, which are the limits for a realistic human heart rate. If the heart rate is not within the normal limits, then a warning 'heart rate is not normal' is displayed. The heart rate data are then formatted and sent with the ECG data to the Cloud under the patient's name tag.

Google Firebase
The Firebase real-time database [35] service uses WebSocket communication protocol compared to a traditional HTTP communication protocol. This allows much faster communication between the server and client, with reduced latency. In addition, the database can sustain up to 20,000 simultaneous connections which are roughly a monthly user base of 10 million. Moreover, it can handle 100,000 responses in a second with a transfer speed of 10 MB/s [36]. We thus chose Firebase's real-time database due to its high scalability and fast response time/reduced latency.
A Firebase Spark plan was registered, allowing storage of data of up to 10 GB per month for free. Figure 8 shows the Firebase data tree stored as JSON objects. The database is named 'ecgcloud-mk1' and contains an application bucket named 'ecg1'. Inside the application bucket is the data sorted by the name tag. Joe is the name of User 1 stored under the first tag and Mary the name of User 2 under the second tag. The user's data are formatted under each tag using the JSON format.

The Android Application at Doctor's End
A second Android application at the doctor's end (named Health ECG Doctor App) was developed. The application connects the doctor's smartphone with the Firebase database to read the selected user's real-time ECG and heart rate data. As in the case of the Health ECG Patient App, the ECG data are visualized through a real-time trace and the heart rate is shown. Visual inspection of the real-time ECG trace allows the doctor to diagnose the patient depending on the shape and characteristic of the ECG signal. Figure 9 shows the flowchart of the Health ECG Doctor App. The user interface and functions are loaded up at the application launch. As soon as the doctor presses the Find button, the get tag list function is called to pull the available tags in the Firebase cloud database as a list of registered users' names. When the doctor selects the user, the user's name is saved. This data change is detected in the corresponding tag and the relevant data is pulled. The formatted data from the Health ECG Patient app is decoded to get back the heart rate and ECG data. The ECG trace and heart rate are then updated in real-time. Automated detection and classification of arrhythmias can play a crucial role in the reliable and accurate diagnosis of CVDs in remote ECG monitoring applications. Lower than normal heart rates are usually an indication of a condition known as bradycardia, while higher than normal heart rates (over 100 bpm) are known as tachycardia [37]. The Doctor's Android Application was designed to detect bradycardia and tachycardia in the patient's ECG signal. If the heart rate is greater than 100 bpm, a warning message 'tachycardia is detected' is displayed. If the heart rate is lesser than 60 bpm, a warning message 'bradycardia is detected' is displayed. If none of the conditions are met, the message 'no abnormalities detected' is displayed.

Hardware Implementation
For the DATU prototype implementation, the debugger was snapped away from the CY8CKIT−059 PSoC 5LP prototyping kit [38] to reduce the footprint size. The prototype DATU was then soldered onto a Veroboard. This Veroboard was supported by screws and hooked onto a second Veroboard to provide a sturdy base. The battery was also tucked in between the two Veroboards to prevent puncture and damage. Figure 10a shows the prototype DATU top and side views. In addition, Figure 10b shows a visual depiction of the DATU printed circuit board (PCB) and final package. The DATU unit can be easily plugged in or out of the chest strap for charging and is estimated to cost around $55.

AFE Analogue Filtering
The simulated frequency response of the AFE LP filter is shown in Figure 11. The −3 dB cut-off frequency of the LP filter can be seen at around 200 Hz, in addition, it is shown that the filter offers −14.53 dB of attenuation at 1 KHz. Figure 11. AFE LP filter frequency response. Figure 12 shows the circuit diagram for this simulation. A common-mode noise of 2 V at 50 Hz was added to the circuit via the v cm source. In addition, transient ECG signals [39] were added to the right arm and left arm as signal inputs. In Figure 13, clean ECG signals that were sent to the inputs are named as Left Arm and Right Arm. v cm , INAout and LPFout represent the noise source, INA128 output, and output of the LP filter, respectively. Observing the INAout and LPFout, the circuit can suppress 50 Hz noise completely. In addition, the LPF is not seen to affect the ECG signal. We, thus, conclude that the designed AFE can effectively remove the common mode noise in the ECG signal without affecting its shape and bandwidth.

AFE CMRR vs. Frequency
For this simulation, we used the circuit in Figure 12. In this case, CMRR was measured by connecting a 1V pp , 50 Hz common mode input signal with the differential inputs shorted together. The AFE (without RLD circuit) CMRR plot in Figure 14a shows a CMRR of 85.61 dB at 50 Hz. In contrast, the AFE (with RLD circuit) CMRR plot in Figure 14b shows an increased in CMRR to 121 dB at 50 Hz.   Figure 15a shows the magnitude response of the PSoC implemented Stage 1 biquad HP Chebyshev filter. The drop-off prior to the cut-off of 0.5 Hz can also be seen. In addition, Figure 15b shows the magnitude response of the PSoC implemented composite filter. The two-stage notch filter offers mostly flat response in the passband and a deep notch of around 102 dB can be seen at 50 Hz. This signifies that the 50 Hz component of the signal created by the parasitic effect of the mains supply gets eliminated. This reduction has no side effects. As can be seen in Figure 15b, after the notch at 50 Hz the gain can return to its passband value before decreasing again so parts of useful information contained in the signal are preserved. In addition, notice that the stage 4 FIR LP filter (with Blackman windowing) provides a good balance of flat-response at low frequencies and sharp drop off after the cutoff of 150 Hz.

AFE and PSoC Test Results
Initial experimental testing was performed in the laboratory with SKX-2000C ECG simulator [40]. The ECG simulator was set up to produce Lead II ECG signals with different heart rate settings between 60-100 bpm for sinus rhythm. We underscore that in this study, Lead II measurement is the electrical potential formed between the left lower chest (LL) and RA with reference to the RL lead. LA signal was thus replaced with LL signal. The device was able to pick up all relevant ECG features (i.e., the P wave, T wave, Q wave, R wave, and S wave) and no 50 Hz noise was present in the ECG signals. Further, PSoC outputs were downloaded, and the intervals of these waves (i.e., RR interval, PR interval, QT interval, and QRS interval) measured in MATLAB were within the associated ranges of a normal ECG wave.
Separate AFE ECG signal tests were performed with the three electrodes connected in Lead I configuration on a 25-year-old individual and the output was passed through the AFE circuit board. Figure 16a shows the captured ECG signal. The QRS complex of the ECG can be seen clearly. The deflections of the Q and S waves can also be seen. The observed peak-to-peak voltage of the measured ECG signal is 34.4 mV. Furthermore, spectra analysis of the ECG signal in Figure 16b shows spectrum magnitude of −65.4 dB at 50 Hz. Figure 17a shows the test setup used to compare the AFE and PSoC filtering outputs. The setup comprised of the AFE circuit board and passing its output through the CY8CKIT-050 PSoC 5LP Development Kit for digital filtering. After setting up the PSoC filter block, we added another DMA block (with the same settings as the first DMA block) to the schematic, and VDAC (or voltage digital-to-analog converter) was added as the last hardware block. The AFE and VDAC outputs were connected to the Oscilloscope CH1 and CH2 inputs, respectively.  The PSoC filtered and AFE outputs are shown in Figure 17b as upper and lower traces, respectively. The PSoC filtered output appears significantly cleaner and the 50 Hz noise present in the AFE signal is highly reduced. As a result of PSoC filtering, the P wave (that is hidden underneath the noise in the AFE trace) is visible.
The peak-to-peak amplitude of the PSoC filtered signal is 28.8 mV. This reduction in amplitude is due to filter effects. A gain of 20 is introduced at the DAC output to see the noise more clearly. The FFT of the AFE signal output in Figure 17c shows that the spectrum amplitude of −65.7 dB at 50 Hz. In contrast, the FFT of the PSoC output in Figure 17d shows an amplitude of −74.9 dB at the 50 Hz noise. The results thus show that the 50 Hz noise is well attenuated by the PSoC to produce a clean ECG signal.

Android Applications Test Results
Using the Lead 1 configuration setup, ECG measurements were taken through the DATU prototype. Figure 18a shows the user interface prior to connection with any Bluetooth device. The user's name is entered as a tag name in the database. Choices for the duration of the ECG test and list of discovered Bluetooth devices can also be seen. The duration of 5 h for analysis and selection of HMSoft (HM-10 Module device name) is made. Figure 18b shows the application after connecting to the HM-10. 'HR Thr' of 134 is added as the threshold limit to compute the heart rate. The added threshold is also shown next to the label 'HR Thr'. The calculated heart rate is shown under the label 'Heart Rate' as 112 bpm, ECG real-time data sample amplitude is shown under the label 'Data Incoming' and the remaining time for data transmission is also displayed under 'HR Thr' input window. Analysis of resulting real-time ECG trace clearly shows P, Q, R, S and T waves of the ECG signal.  Figure 18c shows the ECG Health Doctor App interface. The doctor presses the Find button to reveal the list of patients in the Firebase database. After the patient is selected, the incoming heart rate and associated ECG data are read from the database and displayed on the doctor's smartphone (please see Figure 18d). As can be seen, the doctor's application shows a very clear and stable ECG trace. In addition, the Tachycardia warning is shown as the heart rate is above 100 bpm.
We validated our smartphone application heart rates against a dedicated photoplethysmography (PPG) sensor in the Samsung Galaxy S7 edge smartphone. For this test, ECG sample and heart rate data were transmitted to the Firebase cloud database and updated in real-time for the patient name 'Ricky'. The ECG Health patient app in Figure 19a is seen to show a heart rate of 96 bpm for the user Ricky. In contrast, the Samsung Health app in Figure 19b can be seen to show a heart rate of 100 bpm. To get a better assessment of HR results, ten measurements were performed on the 25-year-old individual. The measurements were taken after lying down for 2 min. The average heart rate found through the Samsung application and the ECG Health patient app was 98 bpm and 96 bpm, respectively. This suggested that our HR application has comparable accuracy with a commercial heart rate application.
Furthermore, a 10-s segment window of the ECG signal was captured from the prototype for 15 individuals. A threshold for QRS detection (60% of the ECG amplitude) was applied to this segment. To assess the QRS detection algorithm, two performance parameters were used: sensitivity, Se, and positive predictability, +P [41]. The sensitivity was 100% for all the recordings, and the lowest positive predictability obtained was 99.5%. The lack of false negatives confirms the quality of the QRS detection algorithm. To minimize motion artifact during ECG data collection the subjects were in sitting down condition. In addition, during ECG testing on normal humans, the signal remained mostly stable while the subjects were standing or walking, and relevant ECG features were clearly visible. The device thus can be worn during daily routine activities carried out at low intensity levels. To access the system latency, both the patient and doctor's applications were run minimized on the same smartphone. This is shown in Figure 19c with the ECG Health Patient App running at the bottom and ECG Health Doctor App running at the top using the Android multi-window function. Both the applications display the same heart rate and ECG traces. The warning flag returns to 'no complications detected' as the heart rate is not above 100 bpm or below 60 bpm to trigger the warning. As can be seen, the ECG trace on the doctor's application is around one beat off as compared to the ECG trace on the patient's application. Specifically, the proposed system offers an average latency of 0.75 s. This difference is well within the acceptable range for an effective response from a doctor. The proposed system thus shares real-time data with low latency.

Comparison with RLD Circuit Based Wireless ECG Monitoring Systems
In two electrodes wireless wearable ECG devices (such as [12,18,[42][43][44]), often the bandwidth is restricted in the range 0.05-40 Hz, to achieve a low sampling rate and avoid the line frequency interference signal. Due to the absence of a line frequency signal, the RLD circuit is also omitted. These systems save significant battery power due to the omission of the RLD circuit and use low sampling rates. However, due to limited bandwidth, these devices are primarily aimed at personal well-being and fitness applications rather than being suitable for real-time remote monitoring and diagnosis. In contrast, our proposed ECG module spans a bandwidth of 0.5-150 Hz and uses a third electrode with an RLD circuit to suppress the interference signal and to further improve the CMRR. Accordingly, a comparison of our proposed system with RLD based wearable single channel wireless ECG monitoring systems [45][46][47][48] is given in Table 5. We exclude the system in [45] from our discussion, as the system relies on SMS technology for sharing heart rate and abnormal conditions of the user with the health care provider, and no real time data are shared with the doctor/health care provider. The American Heart Association (AHA) recommends a minimum bandwidth of 125 Hz for adults and a minimum bandwidth of 150 Hz for children of 12 to 16 years age group [49]. The bandwidth of the ANT wireless technology-based ECG system in [47] is restricted in the range of 0.5-85 Hz. In addition, the ANT wireless technology-based ECG systems [46] and [47] transmit data to a local computer for processing and storage. We thus also exclude systems [46] and [47] from this discussion. The system in [48] and our proposed system fulfill AHA bandwidth requirements. Further, both the systems share real-time ECG data continuously with a remote doctor. A fair comparison is thus carried out between the system in [48] and our proposed system.
The proposed DATU and the ECG sensing module in [48], use gold standard disposable Ag-AgCl electrodes to minimize motion artifacts and achieve good quality measurements. In addition, in the proposed system, DATU is attached directly to the chest strap to reduce the length of electrode cables and thus minimize the motion artifact.
The interpretation of ECG signals depends on the precision and quality of ECG signals. As compared to the ECG module of [48], the proposed DATU relies on a high sampling rate to ease restrictions on the anti-aliasing filter and prevent aliasing due to high frequency components beyond the cut-off frequency of the filter. Further, in contrast to the lowresolution 8-bit ADC used in [48], our proposed DATU supports 12-bit ADC to achieve high precision ECG measurements.
To obtain a clear and noiseless ECG signal, it is necessary to use three filters: an HP filter to eliminate DC voltage from electrodes and visualization baseline wander, a stopband filter to eliminate line frequency noise, and an LP filter to eliminate the high frequency noise. In contrast to the fixed function microcontroller used in the sensing module of [48], the proposed DATU module relies on a PSoC 5LP microcontroller with a higher number of programmable blocks to implement these filters. This approach reduces the number of external components needed in the AFE stage. The size and cost of the system are thus significantly reduced. In addition, the reconfigurability feature of the PSoC 5LP microcontroller allows the designers to obtain different filter configurations, with different cutoff frequencies, as per their own requirements. Moreover, the PSoC 5LP Delta Sigma ADC is also highly flexible. It offers a maximum resolution of 20-bits at a sampling rate of 187 sps and a maximum sampling rate of 384 Ksps at 8-bits resolution. This feature allows the designers to obtain different resolutions with the desired sampling rates (depending on the operational modes).
According to the recommendations of the Association of the Advancement of Medical Instrumentation (AAMI), CMRR is required to be higher than 90 dB. Further, according to Article 51.5.3 of the European-Spanish Legislation UNE-EN 60601-2-47, the minimum CMRR must be 60 dB. Our DATU sensing module fulfills both requirements. In contrast, the sensing module of [48] does not list its AFE CMRR.
The proposed system is based on smart technologies such as smartphones, cloud technology, and applications to share real-time data with the user's doctor. After the real-time ECG data are obtained through the wearable DATU and smartphone, cloud hosted Firebase real-time database is used to provide an effective and efficient way to store and share real-time data for a doctor's analysis. The Firebase real-time database is highly scalable and allows much faster communication between the server and client, with reduced latency. This means that many users can be connected to the Cloud and many doctors can access the patient data simultaneously from the Cloud, without any problems. In addition, security and data validation can be implemented through security rules. Moreover, with the help of the cloud services (such as computing, data analytics, and machine earning), computationally intensive denoising and atrial fibrillation (AF) detection filtering techniques, data analysis, and disease warning can be carried out at the Cloud-end to ease the burden on smartphones.
The system in [48] relies on a home PC for visualization of real-time Lead-I ECG trace. The home PC also acts as a web server for sharing real time ECG data with the patient's doctor(s). Though multiple doctors can access user's real-time ECG tracing, the home server is restricted to a single user. Further, the system in [48] does not support heart rate calculation and arrhythmia classification. Moreover, the system in [48] consumes 1817 mAh energy in 24 h and is estimated to cost around $70-80. In contrast, the DATU consumes 926 mAh energy in 24 h, and the proposed system is estimated to cost about $45. Due to the above advantages, the proposed system is a low-cost, scalable, high speed, and high-resolution ECG monitoring system.

Comparison with Commercial Real-Time ECG Monitoring Systems
A comparison of the proposed system with commercial cloud-based real-time continuous ECG monitoring systems iHealth Rhythm [50][51][52] and QardioCore [18] is given in Table 6.
The iHeart Rhythm prototype was revealed in 2015. The Company (iHealth Labs) claimed that it is a flat recorder that clips onto a consumable patch allowing individuals to monitor 72 h of continuous ECG recording using the internal memory of the device. The device allows continuous ECG data sharing via smartphone and cloud technologies with the user's doctor. While iHealth Rhythm and its associated features appear much promising, the device is not yet commercially available in the market and no further information including its AFE parameters, battery life, and the cost is available. We thus only compare our proposed system with the QardioCore device. In both the systems, a single lead ECG data are transmitted via BLE for (i) real time viewing on the user's smartphone and (ii) real-time sharing of data with the user's doctor via cloud technology. While our proposed system detects one type of arrhythmia (i.e., Bradycardia or Tachycardia), no arrhythmia detection feature is available with QardioCore. QardioCore (our proposed system) is only compatible with Apple products (Android smartphones). QardioCore relies on a high resolution 16-bit ADC (as compared to the 12-bit resolution ADC in our system), its AFE CMRR information is not available. More importantly, QardioCore fails to fulfill the AHA minimum bandwidth requirements of ECG signals for adults and children in the age group 12-16 years. It is not US Food and Drug Administration (USFDA) approved and is not available for sale in the US. In contrast, our proposed system fulfills AHA minimum bandwidth requirements. In addition, as compared to the QardioCore (priced at $449) our system is estimated to cost around $45. The proposed system is thus not only suitable for the acquisition of medical grade ECG signals but is highly cost effective and affordable for use in remote rural communities.

Limitations
Our system has the following limitations.

1.
Like most of the wearable smartphone-based ECG systems, the proposed system allows recording of a single lead ECG signal which limits detection of arrhythmias.
For detection of ischemia or other cardiac diseases, more leads are required. Though the proposed system does not allow simultaneous recording of multiple leads, serial recording of multiple leads by the proposed system is feasible. The device thus has the potential to play an important role in the detection of arrhythmias, allowing early screening of cardiac disorders. Due to the complexity of this process, relevant screening and diagnostic studies of the proposed device will be carried out in future studies.

2.
The DATU power consumption is high, and it supports only 25 h of operation before the next recharge. Continuous mode of operation, high sampling rate, and 12-bit ADC are responsible for the high-power consumption. PSoC 5LP consumes most of the power in active power mode and around 2 µA in deep sleep mode. It is, thus, if the DATU is run in the sleep wake-up mode then the device can be run for much longer periods of time before the next recharge. The duration and frequency of data recording depends on the doctor's advice. It thus will necessitate the inclusion of a control feature in the doctor's application to set the ECG test duration and frequency.
In addition, significant power can be saved if the device is run at a low sampling rate and/or a reduced resolution ADC is used at the cost of sacrificing performance. Furthermore, the authors recommend using the Cypress Semiconductor CYBLE-416045-02 Ultra Low Power BLE Module [53]. The recommended BLE module offers a transmit power of +4 dBm against +6 dBm transmit power used in the HM-10 module.

3.
The rural residents are less likely to own a smartphone as compared to the urban or suburban residents. However, the use of smartphones in rural areas is on the rise recently due to their affordability. For example, a recent budget iVOOMi Android smartphone is priced at $55 [54]. The current cost can still present a problem for rural residents from low-income countries. Therefore, Government efforts are needed to provide subsidies on the purchase of smartphones and offer low-cost data plans to rural communities to support digitalization and use of telehealth technologies.

Improvements and Future Work
Over 100 bpm is generally defined as a fast heart for adults. However, the setting of this threshold depends on the user's age and overall health. Further, for athletes and people that exercise on regular basis, a heart rate of under 60 bpm is normal and even healthy. These thresholds should be set by a doctor after accessing each user's health conditions. Accordingly, the user's smartphone application will be revised to allow the user to enter his/her health conditions and age for the doctor's review and the necessary setting of these thresholds through the Doctor's Health App.
The warning message about tachycardia or bradycardia gets displayed on the doctor's application only when the doctor's application is launched. For a prompt intervention, it could be useful to send an alert to the doctor, regardless of the application launch. In addition, in the proposed system ECG features are inspected visually in short segments. In the case of longer-range ECG signals, beat-by-beat inspection of ECG signals is a challenging task. To facilitate the compact display of short-and long-range ECG signals and a beat-by-beat examination of ECG features, sliders and markers are to be added to the existing display of the Doctor's Health App. Both these features will be included in our future refined version of the Doctor's Health App.
The device was not calibrated and tested on real patients. The proposed system was designed as a proof of concept. Due to this, our focus in this work was mainly on the design and preliminary testing. Further studies are required to evaluate the calibrated system's detection accuracy and feasibility in patients with arrhythmias and heart disorders. This work will be presented in our future research work/studies.
Further future suggested improvements of the proposed system include: • Detection of detailed cardiac abnormalities in the home environment (for patients of different age groups) and the heart rate variability. • Development of a three-lead wearable patch-type ECG device. • Detection of motion artifacts through adaptive filtering methods and removal through denoising methods. • Use of machine learning to identify CVDs. • Development of a full-scale database for long-term healthcare applications. • Development and use of dry electrodes to reduce patient discomfort.

Conclusions
A single-channel IoT based real-time wearable ambulatory ECG monitoring system is proposed. The system consists of a wearable device with three ECG leads. The collected data by the wearable device are streamed via BLE technology to a user's smartphone. An accompanying Android application on the user's smartphone then renders the user's ECG data as a single lead trace and heart rate including a warning for abnormal heart rate rhythms. The same information is shared with the user's doctor via a real-time cloud database and a dedicated Android application on a doctor's smartphone. The doctor's smartphone also displays the selected user's live ECG trace and heart rate and classifies heart rate into types of arrhythmias (bradycardia or tachycardia).
The system's AFE employs an RLD circuit to achieve a high CMRR of up to 121 dB to suppress 50 Hz power line frequency interference. A further digitally implemented notch filter completely eliminates the 50 Hz power-line interference. The use of a PSoC microcontroller in the proposed wearable device allows increasing flexibility through scalable options as well allows reduced size and cost of the wearable device. The system is highly scalable as multiple users can send the data to the Cloud and multiple doctors can access the patient data simultaneously. Further, the system supports 25 h of continuous monitoring without constraining users' locations.
Experimental results suggest that the device is highly capable of producing clean ECG signals with relevant features and complete elimination of 50 Hz noise. The device demonstrated high sensitivity and lack of false negatives which confirmed the quality of the built in QRS detection algorithm. It was also shown that the device's reliability detects cardiac abnormalities and has comparable accuracy to a commercial heart rate application. It was evident from experimental results that the system offers fast response/low latency.
Android smartphones have a consistent lead in the market share versus Apple due to their affordability and reliability. It thus makes the proposed system an attractive low-cost, highly scalable, low latency, and high-performance real-time ECG monitoring system for prevention, early diagnosis, and effective treatment of CVDs for users in rural communities and in the COVID-19 pandemic scenario. Data Availability Statement: New data generated is shared through this article. All other sources of data are cited throughout the paper.