International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 2 – March 2015 Simulation of Wearable ECG Monitoring Device using MATLAB and J2ME Wireless Toolkit Madhur Gabhane#1, Zahir Aalam*2 #, * Department of Information Technology, Thakur College of Engineering and Technology, University of Mumbai, India Abstract— Owing to an increase in the rate of cardiovascular diseases, it is of utmost importance to provide appropriate healthcare services to the masses in the form of wearable devices that are wireless and work in a ubiquitous environment. The simulation of one such wearable device is shown in this paper. The device continuously monitors, ECG and if there is any change in the ECG, sends MMS of the changed ECG to patient’s mobile phone, which is interfaced to the hardware device via a Bluetooth interface; and in turn, the patient’s mobile phone will send that ECG image to a mobile phone at the hospital. The purpose of this paper is to show simulation of this device using MATLAB and Java 2 Micro Edition (J2ME) Wireless Toolkit (WTK). Keywords— Wearable Devices, Simulation, Mobile Phone, MATLAB, J2ME WTK, ECG. I. INTRODUCTION Electrocardiogram (ECG) is a noninvasive tool widely used for many years to perform basic cardiac monitoring in a clinical set-up [1]. With advances in technology, the ECG recording equipment are available in a smaller form factor. Due to this improvement it is now practically possible to develop wearable ECG (W-ECG) equipment for cardiac monitoring in ambulatory conditions. This project uses the patient’s ECG under normal conditions for initial setup, stores this as a reference against which comparisons are made with the real time ECG signals of the patient in a non-clinical setup and finally, if any abnormality is found; this ECG plot is stored digitally in the W-ECG equipment and is sent via wireless transmission to the hospital. With advancements in technology, it is now possible to create wearable devices for Healthcare and diagnostics purposes [2]. Technology can be introduced in the form of wireless sensors to form a wireless communication network that would widely help patients and healthcare professionals by communicating data in a faster way thereby providing mobility to the patient. One such device is an ECG (Electrocardiogram) monitoring device [3]. The device measures changes in the ECG of the patient, calculates the change in the ECG parameters and change if any, notifies the wireless mobile devices. The purpose of this paper is to show simulation of this device, after which it would be rather easy to construct the device for practical uses. ISSN: 2231-5381 II. ARCHITECTURE A. Description The Block diagram shown in Figure 1 is the overall outline of the system proposed. The system that is proposed consists of three major modules, the hardware, the patient’s mobile phone and mobile phone at the hospital’s end. The corresponding modules of the actual system and its simulating environment are: B. Working The Hardware continuously keeps on monitoring the ECG and compares it with existing ECG plots and if the ECG parameters are not in the range of the specified ECG plots, the hardware sends MMS of the ECG to the mobile phone of the patient; and finally this mobile phone will send that MMS image of the ECG to the mobile phone at the hospital. The paper shows working of this system in the form of simulation using MATLAB and J2ME WTK. TABLE I SYSTEM MODULE AND ITS’S CORRESPONDING SIMULATION Module of the System Proposed Simulation Environment of that Module in the System Hardware MATLAB Mobile Phone of Patient J2ME WTK Emulator 1 Mobile Phone at Hospital J2ME WTK Emulator 2 III. SOFTWARES USED FOR SIMULATION A. MATLAB MATLAB [2013b] – a fourth generation programming language is used for simulating the hardware, creating and manipulating the ECG signal; comparing ECG signal with threshold ECG plots. B. Java 2 Micro Edition Wireless Toolkit (J2ME WTK) J2ME WTK– version 2.5.2 is used for simulating the mobile phones. http://www.ijettjournal.org Page 72 International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 2 – March 2015 Fig. 1 Block Diagram of System Proposed C. Simulation Approach The generation of ECG waveform is done using MATLAB. The MATLAB code continuously displays the current ECG plot of the patient. This plot can be modified using the Graphical User Interfaces (GUI) interface provided. The creation of GUI”s has been done using GUIDE (Graphical User Interface Development Environment), the MATLAB graphical user interface development environment [4]. Various options have been provided to manipulate the ECG signal. These options control the variable values for ECG parameters, viz. amplitude of P-wave, length of PR segment, distortion of QRS – complex, etc. If these options are used, the necessary variables associated with them are changed. This causes the ECG plot to refresh under the current conditions. Thus, after a certain threshold value of parameters is breached, a Portable Network Group (PNG) image file is generated. This file is accessed by J2ME program code for sending MMS from one emulator to other [5]. IV. RESULTS Figure 2 shows the generation of ECG signals by the MATLAB, as it appears on the GUIDE. ISSN: 2231-5381 Fig. 2 ECG signal under monitoring The GUI interface provided for manipulating the ECG signal is as shown in Figure 3; this figure illustrates the various buttons that can be used to simulate any required changes in the ECG parameters. Fundamentally, only four parameters are present. These have been chosen on the basis of some identified illnesses [6]. The P-wave in the ECG can help determine Atrial Premature Beat (APB). This can be made out due to its shapeless appearance or even due changes in amplitude. The PR segment precedes the QRS complex, however, if it is prolonged over 0.2 seconds, the first degree atrioventricular block can be diagnosed. The QRS complex helps determine myocardial infarction (heart attack). The Q and S parameters in the ECG vary, causing the QRS complex to be distorted. Thus we can make out that a myocardial infraction has occurred [7]. http://www.ijettjournal.org Page 73 International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 2 – March 2015 Fig. 3 GUI Interface in MATLAB with Buttons for change in ECG Parameters Fig. 5 GUI Interface in MATLAB with change in PR-segment duration Figure 4 shows Emulator 1 sending emulator (resembling the patient’s mobile device) and Emulator 2 receiving emulator (resembling the mobile device at hospital). Figure 5 shows the MATLAB interface with a slight change in the duration of PR-segment Fig 4 J2ME WTK Emulators for sending and receiving ECG images ISSN: 2231-5381 Similar changes can be observed for parameters- P-wave and QRS complex. After each change in a parameter, the respective callback function in MATLAB has been programmed to check the variation level. If this goes beyond a safe threshold, an image file is generated in the resource folder of the J2ME application for sending it as a Multimedia Message. This image file is of the PNG format and is only 2KB in size. This file is accessed by the J2ME program code for MMS. In J2ME, this file acts as the resource for sending a Multimedia Message. This sending of Multimedia Message has been facilitated by means of the SUN JAVA Wireless Toolkit 2.5.2. The Wireless Toolkit provides development environment for J2ME applications and also serves as a testing tool by means of emulating the mobile screen. Essentially two files are created in the text editor, which are saved in the Java format. The MIDlet file - MMSMIDlet uses a non-blocking, event-driven notification mechanism to receive messages. It opens a server mode connection that can receive incoming messages. However this server mode connection can also be used to send messages. The class file MMSSender is used by the MMSMIDlet file to send multipart messages. Since this file contains a connection created in the client mode, it can only send messages. Both these files act as source codes for the mobile device application, and when the application is run on WTK simulator, these codes enable the sending and reception of image. http://www.ijettjournal.org Page 74 International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 2 – March 2015 Fig. 6 Receiving Emulator showing change in PR-segment duration Fig. 7 Receiving Emulator showing an increase in the P-wave amplitude After a change in the values of the PR-segment duration and P-wave amplitude, modified ECG images are received on the emulators of J2ME WTK, figure 6 and figure 7, respectively. ISSN: 2231-5381 http://www.ijettjournal.org Page 75 International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 2 – March 2015 V. CONCLUSION Advances in the field of Information and Communication Technology has made it possible for the construction of small sized wearable devices which are able to work in a wireless environment, on their own, without the involvement of the patient. The simulation results obtained were carried out to show the working of the proposed system and thus it is now practically possible to implement such a system for uses in real time environments. The implementation of the system proposed is simple and feasible, and can serve a host of patients suffering from heart related diseases. REFERENCES [1] [2] [3] [4] [5] [6] [7] Subhasis Chaudhuri, Tanmay D. Pawar and Siddhartha Duttagupta, “Review of ECG Analysis,” in Ambulation analysis in Wearable ECG, Springer, 2009, pp. 15-21. Borromeo S, Rodriguez-Sanchez C, Machado F, Hernandez-Tamames JA and de la Prieta R, “A Reconfigurable, Wearable, Wireless ECG System,” presented at IEEE Int. Conf. EMBS, Lyon, France, 23rd-26th Aug. 2007. Madhur Gabahne and Zahir Aalam, “Design and Modeling of wearable ECG (Electrocardiogram) monitoring device for Heart Patients,” unpublished. Brian R. Hunt, Ronald L. Lipsman and Jonathan Rosenberg, A guide to MATLAB: for beginners and experienced user, 2nd ed. Cambridge University Press, 2006. James Keogh, J2ME: The Complete Reference, Berkeley, California, McGraw-Hill/Osborne, 2003. Dr. Aswini Kumar (2014, Nov. 14), ECG in 100 steps [Online]. Available: http://www.lifehugger.com/doc/120/ecg-100-steps P. E. Trahanias. “An Approach to QRS Complex Detection using Mathematical Morphology,” IEEE Trans. on Biomed. Eng., vol. 40, no. 2, pp. 201-205, Feb. 1993. Fig. 8 Receiving Emulator showing a negative P-wave and a distorted QRS complex ISSN: 2231-5381 http://www.ijettjournal.org Page 76