Abstract

This paper describes the design and implementation of an in-body electromagnetic sensor for patients with implanted pacemakers. The sensor can either be mounted on myocardial tissue and monitor the electrocardiography (ECG) with contact electrodes or implanted under the skin and monitor the ECG with coaxial leads. A 16-bit high-resolution analog front-end (AFE) and an energy-efficient 32-bit CPU are used for instantaneous ECG recording. Wireless data transmission between the sensor and clinician’s computer is achieved by an embedded low-power Bluetooth transmitter. In order to automatically recognize the working status of the pacemaker and alarm the episodes of arrhythmias caused by pacemaker malfunctions, pacing mode classification and fault diagnosis on the recorded ECG were achieved based on an AI algorithm, i.e., a resource allocation network (RAN). A prototype of the sensor was implemented on a human torso, and the in vitro test results prove that the sensor can work properly for the 1-4-meter transmission range.

1. Introduction

According to the WHO’s 2019 Global Health Estimates [1], cardiovascular diseases (CVD) have become one of the main sources of human death in the last 20 years, accounting for 16 percent of total death cases. Accurate and advanced screening of heart failure signs is an effective method in reducing the mortality of patients caused by heart failures. Among all the cardiac monitoring technologies, electrocardiography (ECG) signals are most commonly used to assess the state of the heart and indicate irregular heartbeats, due to its high resolution and strong anti-interference abilities.

For continuous heart monitoring, pacing of the heart is generally monitored by a mobile ECG monitoring device, i.e., Holter [2, 3]. However, there are some disadvantages of the Holter. Firstly, it is bulky and inconvenient to carry, which leads to the need for a specific environment for operation. Secondly, patients with CVD need to paste the electrodes on their skin which may lead to allergy. Thirdly, the Holter is not allowed to operate at frequencies above 1 kHz [4], which makes it difficult to detect abnormal cardiac events in extreme conditions. For example, when a patient with implanted pacemaker is exposed to a transient electromagnetic field, the electromagnetic interference (EMI) with frequency of ~kHz to ~MHz could be created in the pacing loop formed by the leads and the pulse generator. These EMI signals are difficult to detect by a regular Holter, but they need to be properly monitored since these signals could be misunderstood as the normal pacing pulses by the pacemaker and potentially cause pacemaker malfunctions. A sensor which can monitor the normal ECG and the high frequency EMI signals simultaneously is necessary for heart failure protection.

At present, various wearable and implantable sensors have been developed for monitoring heart activity based on surface ECG, but most of them can only detect ECG without classifying the pacing mode [3, 5, 6]. As a result, abnormal ECG signals, such as arrhythmias, can only be recognized by manual visual examination of the ECG by physicians. However, some abnormal signals lack specificity, and the differences between them and normal signals are inconspicuous. Misunderstandings and omissions of important information in ECG diagnosis are inevitable. Therefore, an intelligent diagnostic method is necessary to improve the accuracy of ECG diagnosis. Recent research has shown that deep machine learning can establish the mapping relationship of nonlinear functions in ECG and fully explore the information that is difficult to identify manually [6, 7]. For this reason, the introduction of machine learning to assist the identification and diagnosis of ECG signals detected by an implantable sensor can greatly improve the efficiency of diagnosis, reduce the rate of misdiagnosis, and save medical costs [68].

In this paper, the design and evaluation of an implantable electromagnetic sensor are introduced, which can monitor and classify ECG with ultralow power consumption, high signal resolution, and automatic pacing mode recognition. This paper is organized as follows: firstly, we describe the architecture and key parameters of the joint ECG telemonitoring system, followed by the embedded forms in various clinical conditions and main circuit blocks of the sensor. Next, a deep learning network based on the RAN model is introduced for automatic fault diagnosis of the measured ECG signal. Eventually, the feasibility of the in-body sensor is tested by in vitro tests, where it is indicated that the sensor can work properly for the 1-4-meter transmission range, and two types of the abnormal pacing mode, i.e., pulmonary hypertension (PH) and respiratory sinus arrhythmia (RSA), are successfully validated through the AI-enhanced ECG signals.

2. Design of the Implantable Electromagnetic Sensing System

2.1. System Architecture

As shown in Figure 1, the implantable electromagnetic sensing system consists of two parts, i.e., the in-body electromagnetic sensor and the AI diagnostic system. For the in-body sensor, the heart rhythms on the surface of the myocardium are detected by the contact electrodes and amplified by a highly sensitive and low-noise operational amplifier (TLV 9152) integrated with a resistance network and high-pass filter. A time-multiplexed 16-bit SAR ADC digitizes the output signals. The output of the ADC is then sent to the central processing unit (CPU MSP432P4011RGCR), which packs the ADC output data with the proposed frame structure. The recorded data is stored in a 1 GB SPI Flash memory and transmitted wirelessly by an energy-efficient Bluetooth transmitter to the PC. A 3.7 V lithium battery is chosen as the power supply to support up to 1 MHz sampling rate for the 1-4-meter transmission range. The transmitted heart rhythms are in the form of ECG and examined by the AI diagnostic system on the PC. The AI diagnostic system is achieved by offline network training and online pattern recognition. In the offline training section, typical ECG in normal, pulmonary P wave, and arrhythmia cases monitored by Holter were packed into the ECG database. Wavelet packet decomposition (WPD) and principal component analysis (PCA) are used to extract the features of the above three types of ECG. Then, the training was carried out in the model based on the RAN algorithm. For the online model evaluation, the ECG monitored in real time by the in-body sensor are scanned online through WPD and the feature extraction is achieved online by PCA. By using the pretrained weights of the network, the pacing mode can be correctly recognized.

2.2. Sensor Geometry

As shown in Figure 2, the implantable electromagnetic sensor mainly consists of a titanium alloy shell and a built-in sampling chip. The titanium alloy shell can be described as a cylindrical shielded container with proper seal cover, which ensures good electromagnetic shielding with frequency up to GHz and is waterproof. It is noted that the contact electrodes for heart rhythm measurement are different for in vivo and in vitro conditions. For the in vitro test, the sensor can stay close to the torso, so that the contact electrodes are designed as a pair of probe needles. For the in vivo test, the sensor can only stay in the subcutaneous pocket, so that the contact electrodes are designed as coaxial lead electrodes which can pass through the veins. The built-in sampling chip consists of four parts, i.e., a signal modulation board, a master control board, a wireless communication, and a data storing board. The detailed implementations of each part are described in the following sections.

2.3. Circuit Implementation
2.3.1. Signal Modulation Board

As shown in Figure 3, the signal modulation board is completely achieved by the implementation of an analog circuit. Its main function is to filter clutter and amplify the heart rhythm signal. The analog circuit is composed of the input circuit, the secondary amplifier circuit, and the trailing circuit. The input circuit is made by two resistances with values of 800 kΩ and 200 kΩ in series, which can realize the function of reducing the input signal by 4/5 through resistor voltage division. The secondary amplifier is a coamplifier with model TLV9152. The role of the secondary amplifier circuit is to make the signal to the setting threshold value, and ensure that the polarity of the signal can be recorded. The trailing circuit is a resistance network composed of an eight-choice analog switch with model SN74CBTLV3251, which can amplify the signal by 128 times. The trailing circuit can remove clutter which is below the setting threshold. Further, by setting the parameters of the filter, the device can measure signals with frequencies up to 1 MHz.

2.3.2. Master Control Board

As shown in Figure 4, the function of the master control system is to transform the amplified and noiseless electrical signals into digital signals. A time-multiplexed 16-bit SAR ADC digitizes the output signals. The output of the ADC is then sent to the central processing unit (CPU MSP432P4011RGCR), which packs the ADC output data with the proposed frame structure. Further, the reference voltage chip (REF4132) provides voltage with the amplitude of 2.5 V to ensure high accuracy and high stability of ADC. This section guarantees that the device has a sampling rate of up to 1 Mbps.

2.3.3. Wireless Communication and Data Storing Board

As shown in Figure 5, digital signals are stored in a 1 GB flash memory (TC58CVG1S3HRAIJ), which is controlled through the serial interface (SPI) of the CPU. The device can connect to the PC to transmit data through wireless Bluetooth (CC2650). Then, the types of CVD can be recognized through the AI diagnostic system on the PC.

2.4. AI Diagnostic System

The offline network training process provides the pretrained weights of pacing modes for the online classification of the AI diagnostic system. Offline training uses the open data of ECG signals from the PhysioNet database [9]. A typical ECG signal from PhysioNet is shown in Figure 6. Three types of ECG signals are selected as the training target, i.e., normal, pulmonary hypertension (PH), and respiratory sinus arrhythmia (RSA), and the sample size for each pacing mode is defined as 500. For the precision of AI algorithm validation, ECG cases with PH and RAS are selected from people with different degrees of disease. The testing targets for online classification are the ECG signals obtained by the electromagnetic sensor. The detailed evaluations of the AI technology are described in the following sections.

2.4.1. Data Processing

ECG signals processing includes noise elimination, baseline drift, and data enhancement [10, 11]. The empirical decomposition algorithm (EDM) is used to decompose the ECG signal into 10 intrinsic mode functions (IMF) [12]. The wavelet transform algorithm is used to denoise IMF1 and IMF2 with high frequency. IMF9 and IMF10 with low frequency can eliminate baseline drift according to the median filtering algorithm. Then, the processed IMF mode and the remaining unprocessed IMF mode are reconstructed to obtain a smooth and noiseless ECG signal. Finally, data enhancement is performed to prevent the neural network from overfitting and to improve the unbalanced frequency of the ECG [13]. The ECG after data processing is shown in Figure 7.

After the ECG is enhanced by data processing, the pan-Tompkins QRS feature detection algorithm is applied to the processed ECG to locate QRS peak points. According to the position of QRS, the heartbeat signals are cut apart into singles [14]. After the position of QRS is determined, the position of the P wave which is about 200 ms away from QRS can also be located. The peak of the P wave can be obtained in the range of 150 ms-200 ms ahead of the appearance of the peak of QRS [15]. In the process of heartbeat segmentation, 99 sample points were intercepted forward and 100 sample points were intercepted backward at the QRS peak points which had been located. Each sample can contain a P wave, QRS wave, T wave, and other information of a heartbeat cycle. The positioned P wave is shown in Figure 8.

2.4.2. Feature Extraction

In this paper, wavelet packet decomposition (WPD) and principal component analysis (PCA) are used to extract ECG features. After three-layer wavelet packet decomposition of ECG, 8 wavelet packet coefficients of the subfrequency band can be obtained, which help to analyze signals with different frequency bands [16]. The time frequency of ECG cases with normal, PH, and RAS is totally different, so the energy of each ECG is different in various frequency bands. As a result, the energy of each frequency band is calculated as the feature vector to diagnose the ECG type [17]. After the decomposition of the signal wavelet packet, the energy in each subfrequency band is calculated as follows: where is the number of wavelet packet decomposition layers, is the number of coefficients in , and is the coefficient obtained from the decomposition of the -layer wavelet packet.

The energy in each subfrequency band obtained after -layer wavelet packet decomposition of the signal is calculated as where the signal is decomposed by a 3-layer wavelet packet to get 8 frequency bands, and then, the energy in each subfrequency band is calculated and normalized to get the feature vector of each ECG.

In order to simplify the calculation process, principal component analysis is used, which can be utilized to remove the redundant feature components and extract the main part. is the corresponding characteristic unit vector, . is the characteristic root. The relationship between the principal component (), the eigenvector matrix , and the contribution factors of the first principal components can be expressed as

2.4.3. Classification Tools

The resource allocation network (RAN) is a single hidden layer forward network, which can create a compact network, and has the characteristics of high learning speed [18]. Because of its structure and efficient performance, the RAN network can be used to classify ECG data after feature extraction. The Gaussian activation function is used for each hidden node of the hidden layer in RAN, and the following local mapping is implemented: is the data center of the hidden node of RAN. is the width of the hidden node. is the output of the hidden node. is the connection weight between the hidden node and the output node. In order to accelerate the learning speed of the algorithm, the following equation is usually adopted to replace equation (6). where is an empirical value of 2.67.

In the offline training process, the ECG cases with normal, PH, and RAS from the PhysioNet database were tagged as the dataset for ECG classification. Then, the ECG features were extracted by WPD and optimized by PCA. Finally, 80% of the ECG data was fed to the RAN network for training, and the remaining 20% of the ECG data was used to test the RAN classifier and establish the ECG diagnostic model. In the online classification process, the ECG data on the myocardium is collected by the in-body electromagnetic sensor. The features are obtained and selected, and then, the preferred abnormal features are sent to the RAN classifier for online diagnosis. Finally, the ECG type corresponding to the real ECG cases is indicted. The working flowchart of the AI diagnostic system is shown in Figure 9.

3. In Vitro Experimental Verifications

To further validate our design, an in vitro experiment using the prototype sensor is performed, as shown in Figure 10. A human torso phantom with an EMI source is introduced. The human torso phantom is made by a pacemaker connected to a pork heart immersed in saline solution. The EMI source uses the air gap as the on/off switch to charge/discharge a series of capacitors to generate an impulse current with duration in microseconds and amplitude of kiloampere, which can create a radiated electromagnetic field in milliteslas surrounding the torso.

During the test, the swine heart is continually excited by pacing pulses at 60 ppm emitted from the pacemaker, with the amplitude of the normal ECG of approximately 0.6-0.8 mV. The implantable electromagnetic sensor was used to monitor ECG signals on the myocardium continually.

The typical ECG signals measured by the in-body sensor are shown in Figure 11. Figure 11(a) shows the normal ECG measured by the sensor. The single ECG cycle is about 800 ms and its amplitude is 0.6 mV, which is the same as the ECG detected by Holter. Moreover, the characteristics of the P wave and the QRS wave can be fully demonstrated by the normal ECG signals measured by the sensor. Figure 11(b) shows the ECG cases with PH measured by the sensor. The key characteristic of this kind of ECG is that the P wave is a peaked wave with an extremely high amplitude, which is about 5 times of the normal P wave. This feature is identical to the clinical ECG cases with PH. Figure 11(c) shows the ECG cases with RAS recorded by the sensor. The key characteristic of this kind of ECG is that the interval time of the single ECG signal is greater than 1000 ms, which can correspond to clinical ECG cases with RAS.

In order to fully reflect the applicability of the model, we selected three kinds of pacemakers as heartbeat pulse sources in the in vitro experiment. Taking 1 kA as the step length, the three pacemakers worked under 1-5 kA, and 5 experiments were conducted at each current level. The identification results are shown in Figure 12 and Table 1. It is shown that the system can automatically distinguish three types of ECG, with an overall classification precision of 83.2%.

4. Conclusion

This paper presents a novel sensor system for implantable, wireless communicated, and easy-to-use ECG data acquisition and pacing mode recognition. This system is based on a cooperative heart-computer-interface technology, i.e., an in-body electromagnetic sensor combined with AI-enhanced ECG. The in-body sensor is formed by a highly sensitive and low-noise analog signal measuring module, a time-multiplexed ADC and high-resolution CPU for data processing, and an energy-efficient Bluetooth transmitter for data transferring to PC. The highly integrated chip-on-chip packaging allows the contact electrode on the sensor in either probe or coaxial lead forms and monitoring normal ECG and EMI signals simultaneously. Further, the deep learning network based on the RAN algorithm is applied on the measured ECG signals from PC, which allows the precise feature extraction and pattern recognition of both normal and abnormal ECG. The sensor is tested in an in vitro experiment, and the results indicate that the system is able to synchronously measure and diagnose ECG signals from pacemakers. Two types of abnormal ECG, i.e., PH and RAS cases, as well as the normal ECG are successfully recognized by the AI diagnosis system with overall classification precision of 83.2%. Overall, the validated and verified design of in-body sensor and AI-enhanced ECG could potentially be used as human-like interpretation of the ECG but also as a powerful tool for long-term and emergency monitoring of cardiac health and diseases.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that there is no conflict of interest regarding the publication of this paper.

Acknowledgments

This work is supported by the National Nature Science Foundation of China (Nos. 82172068 and 51707113).