Real-Time System for Monitoring and Analyzing Electrocardiogram on Cell Phone O. Muñoz-Ramos, O. Starostenko, V. Alarcon-Aquino, C. Cruz-Perez Research Center CENTIA, Department of Computing, Electronics and Mechatronics, University de las Américas-Puebla, Cholula, 72820, Mexico e-mails: {orlando.munozrs, oleg.starostenko, vicente.alarcon,claudia.cruzpz}@udlap.mx Abstract- A novel framework on cell phone for recollecting, processing and interpretation of patient's electrocardiograms ECG as part of development of health care and assisted living environments is presented in this paper. The proposed architecture and algorithm provide continuous detection of the QRS complex during real time ECG monitoring and interaction between doctor and patient expanding coverage of medical services. The developed procedure for heart activity monitoring uses a set of filters for image noise reduction and computes ECG signal gradient for identification of the components with the greatest slope. To highlight the steepest parts of ECG, the absolute value of gradient is averaged over a moving window of 80 milliseconds considered as the minimum duration of QRS complex. In the decision phase, a peak detector is applied. The height of detected peaks is compared to the threshold determined as the signal-to-noise ratio for final definition of heart rate. The designed prototype has been tested using standard MIT-BIH Arrhythmia Database and evaluated confirming that system has good compromise between high transmission and processing speed and satisfactory accuracy, which does not fall below the precision of commercial equipment for heart monitoring. Index Terms—Mobile health monitoring, ECG signal processing, QRS complex recognition, mobile databases and interfaces.
I.
INTRODUCTION
In recent years the computing power of mobile phones and their capabilities have increased considerably with the addition of new processors, video cameras, sensors and actuators. Development of operating systems, such as Apple iOS, Google Android, Windows Phone 7 from Microsoft and RIM BlackBerry make cell phones today capable to perform complex tasks previously restricted to these devices.
The heart disease control on mobile devices is very important area because they have high incidence among the population. There are many commercial systems used to support health care and assisted living environments. As usually, personal mobile health monitoring systems support the rehabilitation process of patients after heart surgery or recovering from a heart attack [1], [2], recollecting patient's electrocardiograms ECG, heart rate and oxygen level in the blood [3], remote control of cardio implants [4], tracking of patients by GPS in case of emergency [5], expanding coverage of medical services to rural communities [6], real time interaction and communication between doctors and patient [7], and others used for diagnosis assistance [8], [9], [10]. The widely used algorithms for analysis of heart activity are based on interpretation of ECG, detection of the QRS complex, heart rate as well as other vital signs [7], [8], [10]. The wellknown approaches include neural networks, genetic algorithms, wavelet transforms, heuristic methods, etc. [11], [12]. However, the complexity of these approaches and large number of floating point operations during ECG analysis make little feasible the utilization of cell phones. Therefore, instead of mentioned data processing approaches the simplified algorithms are suggested to apply. They use filters, analyze amplitude and slope of ECG signal, operate with thresholds and gradient to detect the QRS complex in systems with limited resources, such as a cell phone [13]. For example, the most used approaches for detection of the QRS complex in real time are the Pan-Tompkins and Hamilton algorithms based on signal filtering and computing derivatives [14], [15]. Table 1 resumes some high performance systems for heart activity monitoring.
T ABLE 1 M OBILE HEALTHCARE SYSTEMS AND THEIR C HARACTERISTICS System, device Personal Health Monitoring [1], [2] Wireless Children Monitoring [3] AliveECG [8] H’andy Sana 210 [9] Mobile Heart Monitoring [10] Mobile Biotelemetry System [7] HeartToGo [6] Mobile Personal ECG Monitoring System [5]
Data acquisition ECG via Bluetooth ECG via Wireless ECG via Wireless ECG, Embedded ECG via Bluetooth ECG via Bluetooth ECG via Bluetooth temperature, ECG, blood pressure via Bluetooth
Output parameters heart rate, arrhythmia detection heart rate, arrhythmia detection heart rate heart rate, blood pressure, glucose heart rate heart rate, arrhythmia detection heart rate, arrhythmia detection
Used Algorithms Hamilton Hamilton variable sampling retransmission to server retransmission to server 100-1000 samples ps Pan Tompkins, 300 sps
Platform Windows Mobile Windows Mobile iOS, Android Android Windows Mobile Windows Mobile
ECG samples
retransmission to server
-
The paper has the following structure. In the second section, the proposed architecture and algorithm are described. The section III presents the designed framework for heart
monitoring and its implementation. In the section IV the evaluation of system is discussed. Finally, the contributions of the paper are presented in conclusions.
II.
THE PROPOSED ARCHITECTURE AND ALGORITHMS
After analysis of well-known systems it was detected that the key parameters of heart monitoring are the sampling frequency and number of ECG leads sent to cell phone. Some systems report sampling frequency between 100-1000 samples per second (sps) as recommended value [6], [7] considering that high sampling frequency provides better signal quality but increments data quantity reducing battery life of cell phone due to continuous work of processor. A.
Generalized architecture of heart monitoring on mobile device The health-monitoring system on mobile devices may be introduced by three-level architecture containing physical layer of data acquisition, mobile device-server communication layer and application layer for data processing shown in Fig. 1. The input data acquired by sensors represent patient’s vital and physiological signs, for example, ECG, heart rate, blood pressure, temperature, volume of oxygen in the blood, etc. A mobile device operates as communication node for connected sensors, preprocessing recollected data before transmission them to remote monitoring or emergency centers. The preprocessing is used for data sampling, A-D conversion, compression, storage, and visualization on mobile device. Additionally, a mobile device receives and visualizes notifications, alerts and recommendation as result of applying different healthcare services. The proposed system for ECG monitoring is presented in Fig. 2. It has been designed with some modifications: all operation, such as for ECG reception, processing and visualization are implemented on cell phone,
which does not delegate any data processing task to server. It is possible if a cell phone has enough processing power and sufficient amount of memory. The interaction of cell phone with a server is provided for emergency messages or alerts including situations when a doctor requests data form mobile device of monitored patient. The Bluetooth Connector establishes communication with the ECG acquisition device, handles address acquisition and user preferences for transmission by that device. The Connection Handler is responsible for receiving data sent by ECG acquisition device preparing them for analysis, storage and monitoring changes in the state of connection and generation of notifications or alerts for user. The ECG Signal Analysis module implements the proposed algorithm to detect QRS complex and patient's heart rate.
Fig. 1. Block diagram of the system for heart monitoring on mobile device.
Fig. 2. Architecture of system for ECG acquisition and preprocessing on mobile device
The obtained results are processed by module of Notification and Alarm, which generates and distributes the corresponding messages about events that may occur in analyzed ECG, or because of changes in connection status, for example, loss of connection, interruption, changes in heart rate, etc. Data Storage and Retrieval module is responsible for persistent and secure storage of ECG data and ensures their availability for heart monitoring applications. The control of system is provided according to preferences defined by User Settings Manager (record, store and share information, such as
user identification, duration of analysis session, definition of a default acquisition device, etc). B.
The proposed algorithm for detection of QRS complex The proposed algorithm for ECG analysis is based on detection of QRS complex, which is the most notable representation of the cardiac cycle. The QRS detection algorithm has been implemented using as base the PanTompkins QRS detector improved by Hamilton [14], [15].
Data flow chart of the algorithm and results of applying filters to ECG signal are shown in Fig. 3 and 4 respectively.
window of 80 milliseconds considered as the minimum duration of the QRS complex. In the decision phase, a peak detector is applied. The height of detected peaks is compared to the threshold determined as the S/N signal-to-noise ratio. If the height of peak is higher than threshold, it is considered as a signal peak, otherwise it is interpreted as a noise peak. Finally, the detected signal peaks corresponding to QRS complex are selected and used for computing heart frequency. The advantage of this algorithm is its adaptability to any heart rate. In addition, the implementation of filters is provided by simple and fast shift operations with integer numbers that permits to obtain satisfactory results on cell phone with limited speed, memory resources, and computing power. III. DESIGNED FRAMEWORK FOR HEART MONITORING
Fig. 3. QRS Complex Detector: flow chart of the proposed algorithm
In order to evaluate the performance and efficiency of the proposed architecture and algorithm the framework for ECG analysis on cell phone has been designed. It consists of ECG acquisition module, heart activity monitoring module, and ECG storage and management module shown in Fig. 5. Electrocardiograms used by this framework are obtained from MIT-BIH Arrhythmia Database available in [16]. This database contains 48 records of 30 minutes two-channel ECGs with expert annotations indicating occurrence of the QRS complex. ECG acquisition module via BluetoothConnector supports communication between ECG tool and phone by RFCOMM protocol, which allows emulating a serial port on both devices to send the connection request and desired recording time of ECG. Before ECG acquiring the ConnectionHandler defines signal characteristics, such as sample rate, calibration value produced by ADC corresponding to 0 volts (ADC zero), and gain factor of ADC (ADC gain). During data recovery, ECG samples are converted to corresponding values in millivolts (mV) according to eq. 1 used then for correct ECG displaying. mV
Fig. 4. Application of filters in QRS Complex Detector
On the preprocessing stage, the ECG signal passes through a series of filters: Low pass filter is used for reduction of signal noise. The high pass filter and first derivative are applied for detection of signal gradient and identification of the components with the greatest slope. To highlight the steepest parts, the absolute value of gradient is averaged over a moving
sample value ADC zero ADC gain
(1)
MonitoringService supports ECG data acquisition, processing and analysis, management of database, user interaction interface and system testing. Additionally, it delegates responsibilities to associated classes and defines a set of methods to describe the changes in state of connection (on hold, online, offline, etc.) and state of heart activity. The BackupWorker receives data from Buffer and feeds DatabaseManager. QRSDetector determines the time of event occurrence and updates the value of heart rate using time interval between the last two QRS complexes. BoudedBuffer supports a graphical interface that allows users to control the system, select data acquisition device, define user preferences, start or stop transmission, display the ECG, and others. The prototype of system for heart activity monitoring has been implemented on Linux operating system, particularly, on the Ubuntu version 10.10 for 64-bit processors, using Eclipse development environment 3.6 and Toolkit WFDB library functions [16]. Cell phone is Samsung Galaxy S, IG9000 with ARM Cortex A8 processor at 1 GHz, with 515 MB RAM, 5 GB of internal memory and Bluetooth radio.
Fig. 5. Class diagram of the framework for heart activity monitoring.
One of the most important requirements of heart monitoring system is its ability to store, management, and retrieval of ECG records over long periods. The storage capacity for ECG signals is limited by used sampling frequency. On cell phone SQLite database manager has been used, which supports various operating systems for mobile devices like Symbian, iOS, BlackBerry, Android. The stored ECG records include parameters of data acquisition device (frequency, adc_zero, adc_gai, sample_number and sample_value), identification
number, date of created record (record_id and created_at) and time of occurrence of QRS complex (beat_time). As result, system with SQLite database provides simple and fast management of ECG data on cell phone. Designed interface provides Menu of Options that allows user to define an ECG acquisition device, analyze a list of records stored in database, specify desired transmission time and visualize real-time ECG. Some examples of applications for continuous heart monitoring are shown in Fig. 6.
a)
c)
b)
d)
Fig. 6. a) principal menu of options; b) selection of ECG acquisition device; c) user preferences interface d) main GUI for continuous monitoring
IV. EXPERIMENTS AND DISCUSSION To determine the feasibility of the prototype and evaluate performance of the proposed algorithm some tests have been done. They include analysis of battery behavior during continuous heart monitoring, required time for transmission of
ECG and precision of heart rate interpretation by the algorithm. The power consumption defines the time of ECG recording without recharging the battery. With the battery of Samsung Galaxy S IG9000 cell phone with 100% of capacity (1500 mAh) the operational time was 6 hours, 14 minutes for sequential transmission of 12 complete (30 minutes each) and
one partial records supporting monitoring until the battery is completely discharged. For example, even though the battery is low, system processes the input signals and detects emergency events when the value of heart rate is less than 60 (bradycardia) or greater than 100 (tachycardia) beats per minute. Cell phone generates audible alarm, which is maintained until the frequency heart returns to normal range of 60-100 beats per minute. Some examples of these notifications and are depicted in Fig. 7 a) and b). In Fig. 7 b) the system detects and notifies occurrence of rapid heartbeats while the interface still presents the previous heartbeat. For performance evaluation of our prototype with respect to ECG transmission, processing and storage time, the 30-minute ECG records have been transmitted from MIT-BIH Normal Sinus Rhythm Database and MIT-BIH Arrhythmia Database
using different sampling frequency of 128, 200 and 360 sps. For registration of record transmission and processing-storage time, the prototype uses two timers shown in principal interface. The first big size timer measures the time of ECG transmission to phone, while the second small size timer measures the time from start of transmission until the ECG is stored in the database. The results of this test are illustrated in Fig. 7 c) and d). In the cases of 128 and 200 sps, the transmission time approaches the duration of 30-minute ECG, such as 31:42 and 32:32 (in Fig. 7c) minutes respectively. However, in the case of 360 sps, the transmission time is increased almost in 50% (59:48 min in Fig 7d). The values of small size timer in all three cases were similar to the transmission time indicating that the time of data processing and storage takes less than one second.
a)
c)
b)
d)
Fig. 7. Alarm notifications a) bradycardia and b) tachycardia. Transmission and storage time measurements in tests with c) 200 sps and d) 360 sps
In Fig. 7 d) the heart rate value (71 bpm) obtained with 360 sps is different comparing with the values obtained in the other cases (83 bps for 200 sps). It means that the computed result with 360 sps is more accurate due to higher quality of received signal. It is because the heart rate precision depends on the sampling frequency. After statistical analysis of multiple tests with different records and sampling frequencies the relative error ( ) of computing the heart rate obtained according following equation ( % )
N max/ min N real N real
100%
(2)
lies in the range of 10% for 128 samples per seconds, 8% for 200 sps and 4% for 360 sps. | | is the absolute error of real value of heart rate measurement with respect to maximum or minimum measured values . However, because of significant increment (almost twice) of transmission time for high sampling rate, it is not recommended to use sampling with more than 200 sps despite
using high technology phone like Samsung Galaxy S IG9000. The increment of transmission time for 128 and 200 sps does not exceed 5% and 8% respectively. This is a good compromise between high speed and satisfactory accuracy, which does not fall below the precision of commercial equipments for heart monitoring. Visualization of ECG in real time is a very useful feature of the proposed framework for heart monitoring. However, some concurrent operations, such as ECG acquisition by cell phone, ECG retrieval from database and plot of ECG on display have a significant impact on system performance. For example, in Fig. 8 the ECG plot of 4:11 minutes is shown even though cell phone has completed 5:14 minutes of data reception and storage in database. Additionally, the computed heart rate is more precise after 5:14 minutes (73 bps in Fig. 8 b) than after 4:11 minutes presented in plot (71 bps in Fig. 8 a). Evaluating low cell phone performance during graphical visualization of ECG plot, the heart rate relative error does not exceed 3% in the case of ECG received signal encoded by 200 sps.
This problem may be solved by using mobile phone with high speed and sufficient processing power as well as by
extension of bandwidth of data communication channel with ECG transmission tool.
a)
b) Fig.8. a) ECG plot during real time monitoring and b) corresponding heart monitor.
V.
CONCLUSION
The proposed architecture, which provides continuous data transmission and processing on mobile device with limited computing resources, may be considered as the conceptual contributions of this paper. This approach has sufficient merit to be used as a reference in development of applications, such as personal health monitoring system, mobile learning assistant, remote detection and control, etc. Additionally, the proposed and implemented algorithm for ECG signal receiving, processing, storage and visualization provides successful monitoring of heart activity. The relative error of computing the heart rate is less than 10% in the worst case when sampling frequency of ECG signal is 128 sps, and it is less than 4% for 360 sps. In terms of practical contributions, the proposed architecture integrates various emerging technologies, which with minimum computational resources has operational performance enough to be used as heart monitoring system on cell phone with the ability to process and visualize in real time ECG signals, detect and manage situations of risk and provide the interaction between doctor and patient. It is important to note that the prototype does not exclude diagnosis by a doctor. Our intention is to propose applications that serve as the approach towards development of more complex health assistance systems expanding coverage of medical services.
REFERENCES [1]
[2]
[3] [4] [5]
[6]
[7]
[8] [9] [10]
[11]
[12] [13]
[14]
ACKNOWLEDGMENT [15]
This research is sponsored by Mexican National Council of Science and Technology, CONACyT, Projects: #154438, and #156228.
[16]
V. Gay. A Mobile Rehabilitation Application for the Remote Monitoring of Cardiac Patients after a Heart Attack or Coronary Bypass Surgery. in Proc. Int. Conf. on Pervsive Technologies, Greece, 2009, pp. 235–238. P. Leijdekkers. A Self-Test to Detect a Heart Attack Using a Mobile Phone and Wearable Sensors. in Int.Symposium on Computer-Based Medical Systems (CBMS), Finland, 2008, pp. 93-98. E. Kyriacou, System for Monitoring of Children with Arrhythmias. in Int. Conf. on Pervasive Technologies Greece, 2009, p. 668. Biotronik. BIOTRONIK - excellence for life. December 2010, available at http://www.biotronik.com/es/lam/2246 N. Belgacem, S. Boumerdassi. Mobile Personal Electrocardiogram Monitoring System with Patient Location. in ACM Int. Workshop on Medical-Grade Wireless Networks, Louisiana, 2009, pp. 69-72. S. Kulkarni. Smartphone Driven Healthcare System for Rural Communities in Developing Countries. in Int. Workshop on Systems and Networking Support for Health Care Envir., Colorado, 2008, pp. 1-3. CardioNet. Mobile Cardiac Outpatient Telemetry (MCOT) – Cardiac Telemetry CardioNet Event Monitors. December, 2010, available at http://www.cardionet.com/ AliveCor. AliveCor - mHealth for iHumans. January 2011, available at http://alivecor.com/ H'andy Sana. The Doctor in the Pocket. December 2010, available at http://handysana.com/ IMEC. Monitoring your health with your mobile phone. October 2010, available at http://www2.imec.be/be_en/press/imecnews/wirelesshealthnecklaceinterface.html V. Alarcon-Aquino, O. Starostenko. Detection of Microcalcifications in Digital Mammograms Using the Dual-tree Complex Wavelet Transform, J. of Engineering Intelligent Systems, 2009, Vol. 17, # 1, pp. 49–63. R. Gonzalez, R. Woods, Digital Image Processing, Prentice Hall, 2007 O. Starostenko, V. Alarcon-Aquino. Computational approaches to support image-based language learning within mobile environments, J. of Mobile Learning and Organisation, 2010, Vol.4, #2, pp.150-171. J. Pan, W. J. Tompkins. A Real-Time QRS Detection Algorithm, in IEEE Trans. Biomed. Eng., 1985, pp. 230-236. P. Hamilton. Open Source ECG Analysis, in J. Computers in Cardiology, 2002, pp. 101-104. A. L. Goldberger et al., PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals. Circulation, vol. 101, no. 23 June 2000, pp. e215-e220, available at http://www.physionet.org/physiobank/