Energy Efﬁcient Framework for a AIoT Cardiac Arrhythmia Detection System Wearable during Sport

: The growing market of wearables is expanding into different areas of application such as devices designed to improve and monitor sport activities. This in turn is pushing research on low-cost, very low-power wearable systems with increased analysis capabilities. This paper proposes integrated energy-aware techniques and a convolutional neural network (CNN) for a cardiac arrhythmia detection system that can be worn during sport training sessions. The dynamic power management strategy (DPMS) is programmed into an ultra-low-power microcontroller, and in combination with a photovoltaic (PV) energy harvesting (EH) circuit, achieves a battery-life extension towards a self-powered operation. The CNN-based analysis ﬁlters, scales the image, and using a bicubic technique, interpolates the measurements to subsequently classify the electrocardiogram (ECG) signal into normal and abnormal patterns. Experimental results show that the EH-DPMS achieves an extension in the battery charge for a total of 14.34% more energy available, which represents 12 consecutive workouts of 45 min without the need to manually recharge it. Furthermore, an arrhythmia detection precision of 98.6% is achieved among the experimental sessions using 55,222 images for training the system with the MIT-BIH, QT, and long-term ST databases, and 1320 implemented on a wearable system. Therefore, the proposed wearable system can be used to monitor an athlete’s condition, reducing the risk of abnormal heart conditions during sports activities.


Introduction
Recent years have shown an increased demand of smart monitoring systems using wearable devices.Among many applications, there is a special interest in developing wearable health devices (WHDs) tailored for sports activities [1,2].These WHDs can help in observing, classifying, and improving an athlete's performance [3], or they can be used to monitor their body response in real time during intense training [4][5][6][7][8][9].The latter is particularly important to avoid possible injuries or sudden death due to abnormal cardiac activity.Therefore, the analysis of electrical abnormalities in the heart during training sessions is of broad general interest [10].As electrocardiogram (ECG) signals can be used to distinguish between normal and pathological heart activity, then the influence of type and length of exercise in athletes can be assessed with the classification of ECG signals during training sessions [4,11].In this regard, Artificial Intelligence (AI) has created new opportunities to automate and expedite the solution of complex problems in medical practice that in the past, depended heavily in human expertise.For example, pattern recognition with deep neural networks can be used to help interpret images from medical scans, X-rays, tissue samples, among others, improving diagnosis accuracy and reducing the possibility of human error [12][13][14][15].Neural networks can also be used to interpret different vital bio signals.Different studies to classify ECG signals have already been proposed, using optimum-path forest (OPF) [16], Hidden Markov models (HMM) [17], independent component analysis (ICA) [18], cluster analysis (CA) [19], probabilistic neural networks (PNN) [20], recurrent neural networks (RNN) [21] and support vector machines (SVM) [22].However, none of these works develop an Internet of Things (IoT) wearable solution leveraging such AI methods.The artificial intelligence-of-things (AIoT) combines AI with IoT technology.AIoT uses the existing IoT standards with a wearable embedded system to support intelligent data exchange between devices [23,24].
In recent years, diverse IoT wearable systems for ECG signal acquisition and analysis were proposed [25][26][27][28][29][30].Their integration usually contains a low-power microcontroller (MCU), sensors, and smartphone interfaces with low-energy wireless data communication to store data in real time and exchange information with other devices.However, energyaware techniques for a battery extension operation are not always incorporated, and the use of machine learning on sports wearable devices has not been fully explored [31].The complexity lies in the amount of data required in artificial intelligence algorithms and the low-power processing for wearable electronic systems.Therefore, the challenge remains in developing energy-saving techniques for an autonomous, smart detection of underlying cardiac pathologies that may lead to increased risk in the athlete.Such a system must consist of wearable devices with the potential to perform AI pattern recognition.These features would allow the real-time monitoring of ECG signals while exercising for long periods, and detecting the pathological physiology of heart activity.
In this work, an energy-efficient framework adapted to a wearable artificial intelligenceof-things (AIoT) embedded system for arrhythmia detection during training sessions is proposed.The integration of an EH circuit with a Dynamic Power Management Strategy (DPMS) for a battery extension operation is developed.The DPMS is programmed into an ultra-low-power microcontroller unit adjusting the ECG signal sampling and transmission to the corresponding intensity training period, therefore reducing the energy consumption of the system.A Convolutional Neural Networks (CNN) is proposed to analyze ECG signals of different heart rates and automatically detect arrhythmias in real time with high accuracy.Moreover, a visual interface is implemented in a mobile device to analyze the signals and generate a list with the sequence of arrhythmias in real time.This interface enables clinicians to identify during training sessions which part of the ECG signal is significantly associated with a cardiac event.Figure 1 illustrates the conceptualization of the proposed self-powered and wearable AIoT cardiac arrhythmia detection system.Experimental results show that the EH-DPMS achieves an extension in the battery charge for a total of 14.34% more energy.Moreover, the CNN-based arrhythmia detection algorithm achieves a precision of 98.6% using 55,222 ECG samples for training the system from different databases, such as MIT-BIH, ECG-ID, Long Term ST, QT, among others, and 1320 ECG samples were acquired and used to validate the system.
The rest of this paper is organized as follows.The design of the wearable ECG prototype and the dynamic power management strategy are presented in Section 2. The AIoT architecture based on CNN is described in Section 3, and the database and experimental results with test-case scenarios for high-performance athletes are assessed in Section 4. Finally, discussion and conclusion are drawn in Sections 5 and 6, respectively.

Wearable ECG Design and Dynamic Power Management Strategy
In this section, the dynamic power management strategy and the design of an ultralow-power wearable electrocardiogram monitoring prototype are described.

Ultra-Low-Power Wearable ECG Design
The wearable system is composed of four sections: the energy harvester circuit, analog front-end, digital control unit, and wireless communication module.

Energy Harvester Circuit
The design of this module is focused on providing the system with enough energy for a training session of 45 min.For this purpose, the BQ25570 EH integrated circuit is selected.This is a power management device with maximum power point tracking (MPPT) capability that enables it to extract energy from low-voltage, inexpensive, small-size sources, with a typical current consumption lower than 500 nA.The BQ25570 contains a highly efficient boost charger that can charge a 2600 mAh Li-Ion battery and integrates a nanopower buck converter to regulate the supply voltage of the digital control unit.A 6 V, 1 W, monocrystalline PV panel is selected, which has been characterized with an open-circuit voltage of 5.89 V and a short circuit current of 180 mA.Furthermore, its voltage (current) at the maximum power point (MPP) is 5.1 V (157.38 mA) at standard irradiance conditions (∼1000 W/m 2 ).The ultra-low-power EH module has been designed to deliver a regulated voltage of V CC = 3.3 V to all the other system's modules.

Front-End Design
The wearable ECG device is based on the AD8232 integrated circuit (IC) to condition cardiac signals for heart rate monitoring [32].This circuit has a low-power consumption of 170 µA (typical) and contains an instrumentation amplifier that amplifies the cardiac signals.The common-mode rejection ratio is up to 80 dB (DC to 60 Hz).The AD8232 IC also contains a 2-pole adjustable high-pass filter and a 3-pole adjustable low-pass filter with adjustable gain.A right leg drive (RLD) amplifier is used to invert the common-mode signal at the inputs of the instrumentation amplifier.When the right leg drive output current is injected into the user, it counteracts common-mode voltage variations, thus improving the common-mode rejection.The AD8232 operates from a single supply of 2.0 V to 3.5 V and a reference buffer is created with a virtual ground between the supply voltage and the system ground.

Digital Control Unit
The nRF52840 is an ultra-low-power microcontroller (MCU) device incorporated as a controller unit for this self-powered and wearable ECG system with the following characteristics: 32-bit ARM Cortex-M4F at 64 MHz supporting a supply voltage range from 1.7 V to 5.5 V and up to 256 KB of non-volatile random access memory (RAM).The MCU also contains a +96 dBm Sensitivity for Bluetooth Low Energy (BLE), ARM CryptoCell CC310 cryptographic security module, and a high-speed SPI interface at 32 MHz.

BLE Wireless Communication Module
Bluetooth is a full wireless protocol that allows devices to communicate over radio waves.Other radio frequency (RF) technologies for low-power, short-range wireless communications are ANT, Zigbee, RF4CE, Nike + , and Wi-Fi, among others.Although these technologies are also designed for low-power, short-range, and modest data transfer, they have different range, throughput, robustness, and coexistence capabilities [33].In this study, Bluetooth-5 (BLE-5) is selected.BLE-5 is the low energy version built-in in the small package Nordic nRF52820 MCU.This circuit represents a good fit for the design of a wearable ECG device.nRF52820 supports all Bluetooth 5.2 features in addition to the Direction Finding, high-throughput 2 Mbps, and long-range features.This chip has an extended temperature range of −40 to 105 °C, 1.7-5.5 V supply voltage range, and a system current consumption of 0.6 µA in sleep mode and 4.8 mA TX at 0 dBm.

Wearable Prototype
Wearable operation for AIoT cardiac arrhythmia detection is achieved with the integration of the ultra-low-power EH circuit, analog ECG front-end, MCU digital control, and the wireless BLE device on the athlete.Figure 2 shows the prototype design concept.Two sections are identified, i.e., the power management module adapted on the arm, and the wireless digital controller located on a PCB on the athlete's chest.The photovoltaic cell and the EH circuit are embedded in an arm cloth support, which is made of an elastic band and velcro.The wireless controller is fixed to the chest by the elastic band, in which three metallic electrodes are directly in contact with the athlete's pectoral muscles.The system is implemented using 3-D printing, which allows low-cost custom prototyping.The material used is thermoplastic polyurethane (TPU) and the structural design of the system integrates the wireless control unit, a battery, and analog front-end.

Dynamic Power Management Strategy
The DPMS is programmed into the nRF52840 MCU.The strategy follows a sequence of states which manages the MCU low-power modes, i.e., an IDLE mode with 0.7 µA current consumption, a Sleep mode of up to 0.5 µA current consumption, and 1.5 µA for an active mode.These power modes are necessary for extending the battery energy; especially, for IoT applications based on EH techniques, where the energy source, i.e., solar PV, is power limited.In this study, the PMS is proposed according to the athlete's training session towards a self-power operation and wearable functionality.The DPMS is based on the three-intensity-zone model [34] of the athlete training session as illustrated in Figure 3.Following the athlete's training model, the microcontroller employs two different sampling rates.In the first and last 19 and 5 min, 1 sample/min is configured by the system because it is less probable that a cardiac abnormality would occur.In the next 21 min, the rate increases to 2 sample/min in which the elite athlete performs the high-intensity interval training with short periods of recoveries.Each sample of 1000 measurements is stored, processed, and transmitted in a single package after 10 s. Figure 4

Processing done
Variable Time (DPMS)

AIoT Cardiac Arrhythmia Detection
A convolutional neural network (CNN) is a Deep Learning (DL) model used for realtime classification and prediction of non-stationary physiological ECG signals.Among a variety of optimal methods, CNN is considered a more suitable technique for ECG classification purposes [35,36].The proposed CNN architecture for the arrhythmia detection system is illustrated in Figure 5.

ECG Dataset
ECG signals are acquired for processing by the wearable prototype.For the learning process, normal and abnormal ECG databases were used from MIT-BIH arrhythmia, ECG-ID, MIT-BIH supraventricular arrhythmias, MIT-BIH atrial fibrillation, QT, and long-term ST.The complete database is composed of 55,222 images, half of them, i.e., 27,611 ECGs' images, are used as normal, and the other half as abnormal or arrhythmia.These images were used to learn the wearable system with 10 epochs of convergence, and 1320 ECG samples were acquired during sport training and used for validation.The classification results are 0/1 sequences, where each element represents a positive or negative result of the cardiac arrhythmia detection.

CNN Architecture
A CNN architecture for intelligent cardiac arrhythmia detection is proposed following Figures 5 and 6.Each incoming image is pre-processed due to heart rate variations, i.e., denoising, filtering, image scaled, and bicubic interpolation without deforming patterns, and subsequently classifies it.A predictor made of a sequence of four 2D-convolutional (Conv2D) and MaxPooling layers is employed.The inputs are images processed by filters in each stage.The MaxPooling layers, inserted between the successive convolutional layers, progressively reduce the spatial size using the max operation.After that, a flatten and two dense layers are computed sequentially.In this study, the convolutional layers transform the original image, layer by layer, from the input image values to the final classification, i.e., arrhythmia or normal.Table 1 shows the pseudocode for the Tensor Flow Lite implementation.From the analysis, one can see that the first two Conv2D layers use 3 × 3 kernel sizes of 64 filters.In the third and final Conv2D layers, the number of filters is reduced to 32 and 16, respectively.Array (1, 1) Type = float32

Intelligent IoT Cardiac System
An Android application system was developed for training configuration, online data visualization, and analysis in the Web and mobile devices.The software interface is implemented using Google's UI toolkit, Flutter, and Amazon Web Service (AWS) for database storage and analysis.Likewise, to comply with intelligent processing, data are processed and classified with TensorFlow Lite API and generates the intelligent ECG classification and cardiac arrhythmia detection.The upper part of the user's interface application displays the raw data from the ECG signal and the bottom shows the results for the arrhythmia CNN classification as illustrated in Figure 7.A list of incidences was generated with the time and training section of each abnormal arrhythmia signal.Data are managed from the cloud platform employing the MySQL Lite tool for Flutter.

Experimental Results
The results of the proposed cardiac detection prototype are reported in this section.The dynamic power management strategy and the ECG performance prediction during sport training sessions were evaluated, i.e., in the athlete's environment.A group of seven athletes of the Universidad Autónoma de Yucatán volunteered to participate and gave a signed informed consent before the involvement in this study.All selected athletes had been in a high-performance program for at least one year.

Experiment Setup
The training session follows the three intensity zone model [34] of Figure 3 with periods of a low, medium, and high-intensity work.The prototype continuously monitors the ECG signals during running, sprint, or jumping exercises.Addressing the DPMS in the training session, two different sleep periods of 15 and 45 s are employed in combination with the ECG data acquisition, storing, and processing for 5 s, which means data rates of 1 and 2 ECG samples per min, respectively.

Power Consumption and Battery Extension Analysis
Power consumption is evaluated at the circuit level.N TS = 66 samples, 1000 measurements each, are implemented during the 45 min training.Two different sample periods were used, in a high-intensity section of 21 min with N HS = 42 samples, and in a lowintensity during the first and last 19 and 5 min, with N LS = 24.BLE advertising interval increase to optimize the current consumption by incorporating empty packets to keep the connection alive.The transmit power was also adjusted to 0 dBm, which is enough to cover the 10 to 15 m range along the training, and also, to maintain the power consumption.The prototype's current consumption (mA) analysis is the following: where I ECG = 1.5 µA is the MCU average current consumption in active mode with the analog font-end at each data acquisition period T ECG of 4.7 s, I BLE requires an average of 0.357 mA to send data packets in T BLE = 10 s, I STO = 1.53 µA is the current to data store in T STO = 0.1 s, I PRO = 1.5 µA is the current to process the data in T PRO = 0.2 s, and I S = 0.5 µA is the average current consumption of the MCU in sleep mode for the sleep periods of T S1 = 45 s and T S2 = 15 s.Considering a session discharge of Q = 237.5 mA for 45 min training (or Q = 316.7 mAh), and a 3.7 V battery with a nominal capacity of 2600 mAh and 90% DC-DC converter efficiency, the battery duration can be estimated (without energy harvesting) for approximately 7.3885 h, or 9.8513 training sessions.The selected mono-crystalline PV module of dimension 113 × 89 × 5 mm for the intelligent ECG device produces 157.34 mAh at a typical STC (i.e., 1000 W/m 2 and a cell temperature of 25 °C).Regarding a capture efficiency of 35% for a wearable operation of the solar PV module [37,38], the harvester system provides ≈55.1 mAh, which means a battery life extension for 1.7 more training sessions without the need for manually recharging or replacing the battery.

CNN Performance Evaluation
Remark that the proposed CNN architecture used 55,222 images for training, and 1320 images were acquired during the 20 sport trainings and used for validation.Figure 8 illustrates the evaluation results of all processing stages of the CNN architecture for the intelligent cardiac classification.Each CNN architecture output layer is displayed when processing an image for the normal or arrhythmia category.It shows the changes as they are processed on each layer until a numerical value is obtained, which is represented in the figure with white if the value is close to one, or black if it is close to zero.The classification performance during the athlete's training are presented in Table 3. Considering the ECG samples of each athlete, the arrhythmia accuracy detection and the intensity training section have been calculated following [39].
From the analysis of Table 3, one can deduce a 42.85% of athletes with normal ECG's signals, 28.57% with one arrhythmia, and 28.58% with two non-consecutive arrhythmias.In this study, we confirm that only non-consecutive arrhythmias were detected with the supervision of a cardiac specialist.Please note that our proposed software application generates an incident list of the detected arrhythmia, highlighting time, the training section, and the complete ECG record of each athlete on the Cloud.The ECG database information on the cloud is available as supplementary material of this work in [40].

Accuracy
Training Section

Discussion
In this work, energy harvesting and a dynamic power management strategy are adapted to extend the battery life of an AIoT-based wearable, automated cardiac arrhythmia detection system.Table 4 compares this work with recent similar systems.In [30,41], wearable systems for ECG signal monitoring are developed, but no algorithm for diagnosis is proposed.Other works [26,27,29,42] develop algorithms for heart rate detection only.In contrast, our system analyzes ECG signals and detects real-time arrhythmias with high precision using ultra-low-power devices.Experimental results demonstrate a battery charge that lasts for approximately 12 consecutive workouts of 45 min, without the need to manually recharge or replace it, meaning an attractive feature that other studies in [26,38,39] have not incorporated.A physiological adaptation of athletes to exercises was also shown in training tests showing non-continuous abnormal ECG signals.This study could also serve to determine the physiological adaptation to the training, improving the performance of athletes.Another possible application is the prediction of cardiac pathologies in athletes, decreasing the risk of sudden death.Further studies could also be directed to a reliability analysis of the system performance considering the fatigue life of the system components.

Figure 1 .
Figure 1.Conceptual idea of the self-powered and wearable AIoT cardiac arrhythmia detection system.
shows the MCU states of the DPMS methodology for energy improvement.The figure shows the current consumption on each state of the model taken from datasheets.The model starts in the Idle stage, then MCU is activated to acquire the ECG measurements.The acquired data are stored and processed, passing through the Idle state; after that, data are transmitted and the MCU reaches the sleep stage.It is worth mentioning that the proposed DPMS can be configured for different sport training scenarios.

Figure 5 .
Figure 5. Intelligent cardiac arrhythmia detection system based on CNN.

Figure 6 .
Figure 6.Processing chain methodology for cardiac arrhythmia detection.

Figure 7 .
Figure 7. Experimental results with ECG AIoT Application for cardiac arrhythmia detection.
TS (I ECG T ECG + I PRO T PRO + I STO T STO + ... I BLE T BLE ) + N LS (I S T S1 ) + N HS (I S T S2 )

Figure 8 .
Figure 8. Experimental performance of the proposed CNN model for a normal and abnormal testcases.

a
Years refers to the number of years in a high-performance training program.

Table 1 .
Pseudocode of the CNN implementation using TensorFlow Lite.

Table 2
also shows the output result at each epoch iteration, achieving a maximum of 98.6% during validation.

Table 2 .
CNN precision evaluation results at each epoch.