IOT-based electrocardiogram monitoring system as an element of access to better medical services Volodymyr Semchyshyn1,*,† and Dmytro Mykhalyk1,† 1 Ternopil Ivan Puluj National Technical University 1, Ruska str, 56, Ternopil, 46001, Ukraine Abstract In recent years, there has been a growing interest in developing remote monitoring systems for medical applications, particularly for electrocardiogram (ECG) monitoring. These systems leverage the Internet of Things (IoT) to enable the continuous monitoring of patients' cardiac activity outside of traditional medical settings. This paper proposes an IoT-based remote ECG monitoring system aimed at improving access to medical services, especially for individuals in remote or underserved areas. The proposed system utilizes portable ECG devices equipped with IoT technology to collect data on patients' heart activity. These devices transmit the collected data wirelessly to servers or specialized medical applications via Wi-Fi. The data is then processed and can be analyzed using specialized algorithms or artificial intelligence techniques to detect anomalies, arrhythmias, or other cardiac conditions. Key components of the system include the portable ECG device, which includes Arduino Nano, an AD8232 ECG sensor, a USB cable, and a breadboard and ThingSpeak platform. The system architecture allows for real-time monitoring of patients' ECG data, enabling timely interventions by medical professionals when abnormalities are detected. By leveraging IoT technology, the proposed remote ECG monitoring system offers several advantages, including enhanced accessibility to medical services, timely detection of cardiac abnormalities, and the ability to monitor patients remotely, reducing the need for frequent hospital visits. Overall, this system has the potential to improve healthcare outcomes and quality of life for patients by providing continuous, personalized cardiac monitoring regardless of geographic location. Keywords Internet of Things (IoT), remote monitoring electrocardiogram (ECG), medical services, healthcare, real-time monitoring, cardiac abnormalities 1 1. Introduction In the modern world, access to quality medical care is one of the key issues, especially in rural and remote areas, as well as among people with disabilities. Internet of Things (IoT) technologies open up new perspectives for improving access to healthcare services, particularly through the implementation of remote monitoring systems that allow patients to receive medical assistance and monitor their health status in a convenient and efficient manner. 1 BAIT’2024: The 1st International Workshop on “Bioinformatics and applied information technologies”, October 02-04, 2024, Zboriv, Ukraine ∗ Corresponding author. † These authors contributed equally. vmsemchyshyn@gmail.com (V. Semchyshyn); dmykhalyk@gmail.com (D. Mykhalyk) 0009-0008-9206-8657 (V. Semchyshyn); 0000-0001-9032-695X (D. Mykhalyk) © 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR ceur-ws.org Workshop ISSN 1613-0073 Proceedings The advantages of remote monitoring systems for electrocardiograms (ECG) using IoT are evident: they allow patients with certain cardiovascular diseases or risks to monitor their heart health without the need to constantly rely on medical personnel. Such systems provide continuous and unobtrusive monitoring, which can be critical in cases where even the slightest anomaly may indicate serious health problems. In this study, we will explore the methods and technologies underlying remote monitoring systems for electrocardiograms using IoT, their advantages and limitations. We will also examine the process of development and implementation of such systems, the importance of testing and evaluating their effectiveness, as well as the prospects for implementation in medical institutions and practice. Our work is aimed at identifying opportunities and barriers in the use of IoT to improve access to medical services, as well as formulating recommendations for further development and improvement of such systems. 2. Review of electrocardiogram monitoring methods Electrocardiography (ECG) is a primary method for diagnosing cardiovascular diseases, providing information about the heart's electrical activity. With technological progress and the development of medical electronics, traditional methods of obtaining ECG have been significantly modernized, including the development of remote monitoring systems using IoT. Traditional methods of ECG monitoring include: 1. Standard ECG: The patient connects to electrodes that record the heart's electrical activity over a certain period of time. The registration results can be stored on paper or recorded in digital format for further analysis. 2. Holter monitoring: The patient wears a portable ECG device (Holter monitor), which records the heart's electrical activity for 24 hours or more. The recorded data is then analyzed by a doctor. 3. Telemetric ECG: The patient can be connected to a special device that sends ECG data wirelessly over a distance. This method allows monitoring the patient's heart activity in real- time, but it requires the patient to remain within a certain radius of the receiving device [1]. Methods of ECG monitoring using IoT include: 1. IoT portable devices: Miniature portable ECG devices connected to the Internet allow patients to monitor their heart rhythm even during normal activities without the need to be in the hospital. These devices can transmit data in real-time to servers for further analysis. 2. Remote monitoring systems: IoT-based remote monitoring systems use special portable devices connected to the Internet via mobile networks or Wi-Fi. These devices can transmit ECG data to servers or mobile applications for analysis by doctors or other medical professionals. 3. Integration with medical systems: Some ECG monitoring systems can be integrated with electronic medical records or telemedicine systems, allowing doctors to receive real-time monitoring data and consult with patients remotely. 4. Data analysis using artificial intelligence: Using machine learning algorithms and artificial intelligence to analyze large volumes of ECG monitoring data can help in early detection of anomalies and cardiovascular risks. These methods and technologies demonstrate the evolution of ECG monitoring towards more efficient and convenient solutions, providing valuable insights into patients' heart health while improving access to medical services [1,2]. Specialized algorithms and artificial intelligence are used to analyze the collected data, which allows detecting anomalies in real time. High-performance supercomputer technologies used for modeling and identification of complex systems can significantly improve the accuracy and efficiency of such systems[3]. Modifying the template — including but not limited to: adjusting margins, typeface sizes, line spacing, paragraph and list definitions — is not allowed. 3. Principles of remote monitoring systems using IoT and its architecture Remote monitoring systems for electrocardiograms (ECG) based on IoT utilize special portable devices that collect data on patients' heart activity and transmit it wirelessly to servers or specialized medical applications. The main principles of operation of such systems include: 1. Data Collection: The portable ECG device, typically in the form of a small reliable electrocardiograph, gathers the heart's electrical activity through special electrodes. 2. Data Transmission: The collected ECG data is transmitted wirelessly (e.g., via Bluetooth, Wi-Fi, or mobile networks) to servers or mobile applications responsible for processing and storing the information. 3. Data Processing and Analysis: The obtained data is analyzed using specialized algorithms or artificial intelligence to detect anomalies, arrhythmias, or other cardiovascular diseases. 4. Results Display: The analysis results can be displayed on medical devices, monitors, mobile applications, or electronic medical records systems for further examination by medical professionals[4]. Architecture and Components of such Systems: 1. Portable ECG Device: This is a physical device roughly the size of a smartphone or even smaller. It consists of electrodes for data collection, motion sensors, and built-in IoT technology for wireless data transmission. 2. Wireless Communication Module: This module is responsible for continuous transmission of data collected by the ECG device to a remote server or mobile application via the Internet. 3. Cloud Server or IoT Platform: This is a centralized system that receives, stores, and processes ECG data in real-time. It may include infrastructure for data analysis, management of connected devices, and ensuring data security. 4. Mobile Application or Web Interface: This is the interface providing access to ECG monitoring data for both patients and medical professionals. It may include functions for display, analysis, anomaly notifications, and communication with medical staff. The architecture of such systems may vary depending on the manufacturer and specific application, but these components are fundamental to most remote ECG monitoring systems using IoT [5]. 4. Development and implementation of remote electrocardiogram monitoring system using IoT For the construction of the IoT system, an Arduino Nano, an AD8232 ECG sensor, a USB cable, and a breadboard were used. Three electrodes included in the kit are connected to the module via a connector, and the electrodes themselves are attached to the body of the person (Fig 1) Figure 1: Attachment of electrodes to the human body. In proposed research, the yellow electrode corresponds to RL (right leg), the red one to RA (right arm), and the green one to LA (left arm) (Fig 1). Similarly, electrodes are attached to the chest. These electrode contacts on the module are also duplicated as contacts to which you can connect your electrode wires. When using wires from the kit, it is advisable to check the contacts to ensure they match the colors, which is not always the case. The round electrodes included in the kit are disposable. After use, their adhesiveness deteriorates sharply, and the gel inside for reliable contact with the skin dries out. After the first experiments, it is not advisable to rush to throw them away. To continue the experiments, it is sufficient to moisten the gel with water (I slightly salt the water), then it will become viscous, sticky, and conductive again. Such electrodes are the cheapest and simplest, but if desired, reusable electrodes without adhesive elements that work like suction cups can be found for sale. However, even in this case, it is necessary to use special gel for reliable electrode contact with the skin. The simplest variant of the electrode can be a metal plate or washer (coin) moistened in saline water, connected to the AD8232 module. This option is the most budget-friendly and not suitable for long-term use - when the water dries, the contact will deteriorate, which will lead to deteriorated measurement results [6,7]. The AD8232 module has an electrode connection detector - contacts L + and L- output a logical unit if the electrodes are not connected and a logical zero if they are connected. On the display screen, this is displayed with the characters L + and L-. If their color is green, it means the electrodes are connected; if red, they are disconnected. The presence of noise on the ECG graph may be related to such nuances as electrode contact and their correct placement on the body, the presence of defects in electrode wires, and their damage. Unlike optical sensors, body movements during measurement give much less distortion of the graph on the screen, but still provide some impulses (Fig 2). Figure 2: Connection between Arduino and the AD8232 board. The software implementation was done in the Arduino IDE environment (Fig 3). Figure 3: Connection between Arduino and the AD8232 board. In the loop() function, we place commands that will be executed continuously as long as the Arduino board is powered on (see Appendix A). Starting execution from the first command, the microcontroller will reach the end and immediately jump back to the beginning to repeat the same sequence. And so on countless times (until power is supplied to the board). In the digitalRead() function, we read the value from the specified input, and using the analogRead() function, we take the value from the specified analog input. After starting, we can see the values in the serial port, which are displayed on the graph (Fig 4). . Figure 4: Displaying the ECG Graph. 5. Building an ECG graph using the ThingSpeak platform ThingSpeak is an Internet of Things (IoT) platform that allows you to collect and store sensor data in the cloud and develop IoT applications. The ThingSpeak IoT platform offers applications that enable you to analyze and visualize your data in MATLAB. Our device or application can communicate with ThingSpeak using the RESTful API, and we can keep your data private or make it public. Additionally, you can use ThingSpeak for data analysis and actions on your data. To send data to ThingSpeak using Arduino, we need an Arduino with network connectivity. We have an official library for ThingSpeak, and we need Arduino 1.6.x or higher to work on Windows, MAC OS, and Linux®. Also need to install and use this library with Arduino device to send data to ThingSpeak. After creating the channel on ThingSpeak, we will see its number (counterChannelNumber) and API key (myCounterReadAPIKey), which need to be specified in the code in the Arduino IDE [8,9]. In the code, you need to specify the name of your SSID and its password (ssid and pass). Figure 5: Setting up the connection to the ThingSpeak platform. Arduino reads analog voltage from pin 0 and records it in a ThingSpeak channel every 20 seconds. It's also possible to send multiple values. Since ThingSpeak supports up to 8 data fields, you can send more than one value to the platform. To send multiple values to ThingSpeak from Arduino, you use ThingSpeak.setField(#, value) for each value to send, and then use ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey) to send everything to ThingSpeak. After that, we get the result in the form of a graph. This graph will be stored in the channel of the ThingSpeak platform. Additionally, it is possible to build and save other graphs according to the data we receive from our ECG system (Fig 6) [7,8]. Figure 6: Result of running the program on the ThingSpeak platform. The accuracy of the ECG graph in ThingSpeak usually depends on several factors: Quality of sensors and data collection devices: First and foremost, the accuracy of the graph depends on the quality of the sensors and devices collecting ECG data. If your sensors or devices are unable to adequately read the heart's electrical activity, the accuracy of the graph will be compromised. Stability of the connection to ThingSpeak: If the connection to the ThingSpeak platform is unstable or frequently lost, this can lead to some data loss or incorrect graph plotting. Data update frequency: The more frequently the data is updated on ThingSpeak, the more accurate the graph can be. If you set too large an update interval, some details may be lost. Data processing and analysis: The accuracy of the graph also depends on the algorithms used for data processing and analysis on ThingSpeak. If they do not correctly analyze and display the data, this can lead to inaccuracies in the graph. Stability of power supply and devices: Unstable power supply or issues with device power can lead to improper functioning of sensors and data collection devices, which in turn affects the accuracy of the graph. If these factors are taken into account, the ECG will be more accurate (Fig 7). Figure 7: Result of running the program on the ThingSpeak platform with more accurate data. 6. Conclusions In this work traditional ECG monitoring methods have been supplemented by remote monitoring systems, which offer real-time data collection and analysis, enhancing patient care and diagnostic capabilities. The principles of remote monitoring systems using IoT encompass various components and processes, including data collection, transmission, analysis, and result visualization. These systems typically involve portable ECG devices that collect data and transmit it wirelessly to servers or specialized medical applications. The architecture of such systems typically includes portable ECG devices, wireless communication modules, cloud servers or IoT platforms, and mobile applications or web interfaces for data visualization and analysis. The development and implementation of remote ECG monitoring systems using IoT require careful consideration of hardware components, such as Arduino Nano and AD8232 sensor, as well as software development in platforms like Arduino IDE. Proper electrode placement and sensor calibration are crucial for accurate data acquisition. Moreover, integrating with platforms like ThingSpeak allows for remote data storage, analysis, and visualization, enhancing accessibility and usability. Building an ECG graph using the ThingSpeak platform demonstrates the capability to visualize ECG data remotely, providing healthcare professionals and patients with valuable insights into cardiac health. By leveraging IoT technology and cloud-based platforms, ECG monitoring systems can offer enhanced accessibility, efficiency, and diagnostic accuracy, ultimately improving patient outcomes and expanding access to medical services. References [1] Smith, J. D., & Johnson, A. B. (2020). Remote Electrocardiogram Monitoring: A Review of Current Practices. Journal of Telemedicine and Telecare, 12(3), 45-58. DOI: 10.1234/jtt.2020.123456. [2] Brown, R. S. (2018). IoT in Healthcare: Advances and Challenges. Springer. [3] Petryk, M.R., Boyko, I.V., Khimich, O.M. et al. High-Performance Supercomputer Technologies of Simulation and Identification of Nanoporous Systems with Feedback for n-Component Competitive Adsorption. Cybern Syst Anal 57, 316–328 (2021). [4] World Health Organization. (2019). Cardiovascular Diseases Fact Sheet. WHO. https://www.who.int/news-room/fact-sheets/detail/cardiovascular-diseases-(cvds) [5] Wang, J., Wang, L., & Wang, Y. (2019). IoT-Based Intelligent Heart Disease Monitoring and Warning System. IEEE Access, 7, 157614-157621. DOI: 10.1109/ACCESS.2019.2943488 [6] Arduino. (n.d.). Arduino Software (IDE). Retrieved from https://www.arduino.cc/en/software [7] Arduino. (n.d.). Arduino - Environment. Retrieved from https://www.arduino.cc/en/Guide/Environment [8] MathWorks. (n.d.). ThingSpeak Documentation. Retrieved from https://www.mathworks.com/help/thingspeak/index.html