Heart Attack Notification and Monitoring System Using Internet of Things

People are frequently shocked when someone passes away suddenly without any prior symptoms. One of the contributing factors is a heart attack. This condition might occur anywhere and at any time. A sudden heart attack can be highly perilous for a person who is alone, without family members or friends because the family cannot be informed of the victim's condition or their location. Therefore, it is vital to raise awareness of heart attacks. With the support of the Internet of Things, this study aims to develop a wearable device that people may use to monitor their heart health and connect with hospitals to get alerts in case of a heart attack. This system also provides family members with access to a web-based patient monitoring tool. The heart beat is considered as the parameter in developing this system. There are three types of evaluation which are conducted in this study, namely: 1) Sub-system evaluation; 2) Black-box testing; and 3) Integrating system testing. The three evaluation results show that all assembled hardware components are work properly and the system effectively satisfies the objectives of monitoring, buzzer activation, hospital and patient family notification, and so forth, with 1.96% average sensor error, which is still considerably acceptable.


Introduction
The sudden death of someone who had no medical history frequently shocks people. A heart attack may have been a contributing factor in this untimely demise [1]. A heart attack is a life-threatening heart condition that happens quickly due to a lack of oxygen-rich blood flow to the heart muscle, depriving the heart of the oxygen it requires [2]. In that circumstance, the heart's ability to pump blood throughout the body may be compromised. Moreover, many people today have unhealthy lifestyles, such as insufficient sleep, smoking, consuming unhealthy food, drinking excessive amounts of sugary drinks or meals, seldom or never exercising, etc. Heart attacks are one ailment that may result from this lifestyle [3].
A heart attack is a potentially fatal condition that might endanger the patient's life [4]. This disease can occur at any time and in any location. In fact, many patients delay obtaining medical care and thereby miss out on the benefits of current treatment advancements [5]. A sudden heart attack can be extremely dangerous for a person who is alone and without friends or family, as the family will be unaware of the condition and position of the patient. Therefore, societal vigilance against a heart attack is essential.
Numerous studies related to heart attacks have been carried out, and several innovations regarding cardiac disease also have been invented, to predict and reduce the occurrence of a heart attack. An Internet of Thingsbased temperature and heartbeat monitoring system is conducted by Kumar et al. in [6]. Using a heart rate sensor, a temperature sensor, and an 8051 microprocessor, this system aims to detect the earliest symptom of an irregular heartbeat. Through Bluetooth and Wi-Fi, the detected and processed data are transmitted to the mobile application. Another IoTbased heart attack detection system is also developed by Vaishnave et.al in [7] which also uses temperature and heartbeat as the parameters. The data gathered by the pulse sensor and temperature sensor are displayed in the LCD and are broadcasted to the Thingspeak IoT application to be shown as graphs. In addition to these two characteristics, research conducted by Banerjee et al on an IoT heartbeat monitoring system considered human breathing as a third parameter [8]. If the system detects an abnormal heart condition based on those parameters, the user is advised to take self-mitigate action. An android-based application proposed by Lukman et al. in [9] aims to monitor the condition of heart disease patients, enabling the patient's location to be transmitted when an unusual heart condition is detected. This work utilizes the heartbeat, body temperature, and breath as its parameters. However, the data collected by this system may not be in real-time. In the paper [10], Wang et al. created a wearable device based on the Internet of Things (IoT) with the intention of monitoring the heartbeat of athletes while they are engaging in physical activity. The device is capable of transmitting the ECG sensor data to the physician treating the athlete. Another advanced feature developed by Chowdhury in [11] is a wearable heart attack prevention gadget. The technology employs an AFE sensor to detect the heartbeat and a GPS module to track the patient's location in the event of an accident.
The studies performed in [6] - [11] are indeed able to measure a certain set of defined parameters of the heart attack condition. Some of them are also adopting the IoT technology for real-time monitoring, the buzzer, GPS module to send the location of the patient for early treatment, and even as a device that can be worn. Despite the capability of the system in [6] - [11] to perform real-time monitoring, none of them are integrated into the hospital for early and fast treatment. Thus, this work aims to develop an IoT-based wearable device that can be worn by users for monitoring their heart condition, as well as integrated into the hospital for emergency notification. Additionally, this system allows access for the family of the patient to also monitor the condition through the web application.

Research Methods
Three processes-hardware design, software design, and assessment process-were used to generate this work. The heart attack notification and monitoring system prototype as a whole combines both designs. Additionally, the system is evaluated to see if it achieves the objective. The following subsections elaborate on each of these processes in depth. Figure 1 illustrated the conceptual block diagram designed in this work. It can be seen in the Figure that there is one sensor utilized in this system which is the AD8232 ECG sensor since it utilizes low power and is capable of reducing the noise [12]. This sensor is used to read the heartbeat of the patient and serves as the early heart detection metric. Real-time sensed data are then transmitted to the microcontroller ESP32 to be processed. There is also an alarm button that is used by the patient for the buzzer when a heart attack occurs, and it is processed by the microcontroller. The microcontroller ESP32 is connected to a Wi-Fi module, allowing the user to send and monitor real-time data via web application.

Hardware Design
The schematic design is illustrated in Figure 2. The microprocessor ESP32 is connected to the other major components, including the AD8232 ECG sensor, buzzer, and push button. It also employs the 10K ohm resistor to restrict the electric current flow of the hardware.

System Flowchart
The system flowchart of complete systems is depicted in Figure 2. The system begins with a Wi-Fi connection with the AD8232 ECG sensor to detect the heartbeat of the patient. Subsequently, the heartbeat data are processed in the microcontroller ESP32 to be checked whether it is a normal or abnormal heartbeat. Based on [13], the normal heartbeat of an adult (woman or man) is in the range of 60 to 100 beats per minute (BPM). If the detected heartbeat value is out of the defined range, meaning that is below 60 or above 100, then the system will activate the buzzer for the user.
According to [14], [15], chest soreness was described as an essential symptom of a heart attack. Thus, the chest pain felt by the patient is considered in this experiment.
The user needs to check if they are experiencing chest pain. If so, the patient needs to push the notify button.

Evaluation Methodology
In order to evaluate this system, three tasks must be completed: the sub-system evaluation, black box testing, and the total system evaluation.
The sub-system evaluation is intended to assess the accuracy of the AD8232 ECG sensor. To evaluate the sensor, five heartbeat reading experiments are carried out. During this test, the measurement of the heartbeat is also evaluated using a Pulse Oximeter. Both results are compared and assessed by calculating the error value using formula 1.
The second evaluation is the blackbox testing. The purpose of blackbox testing is to evaluate the functionality of the system without viewing the structure of the code. The test is done by running the system within some cases. The cases that are taken into account are: a) Clicking register menu b) Clicking register button c) Clicking log in menu d) Clicking log in button e) Saving the measurement history f) Viewing the measurement history g) Activate buzzer h) Sending the location.
The final evaluation is the integrating system testing that aims to simulate and to ensure that the assembled components are run accordingly to the design. The simulation is performed five times to determine whether the buzzer is activated when the heartbeat is outside the defined range, whether the notification system sends a message to the family and hospital when the patient presses the notification button, and whether the data displayed on the web application is accurate.

Results and Discussions
The results that will be discussed in this section will be divided into two parts, namely the prototype of the system, and the evaluation results. Both of this parts are explained in detail in the sub-sections below.

Prototype of the System
The physical design of the system is depicted in Figure  4. All the components, such as microcontroller ESP32, AD3282 sensor, and a button are assembled and accommodated in a casing with the size 12.5cm x 8.5cm x 5cm. However, the electrodes that is connected to the sensor is placed outside the casing. This casing later will be attached to the trouser of the patient, as in Figure 5 (left). Each electrode of the AD8332 sensor can be pinned to the patient's shirt. In Figure 5 (right) it can be seen that the red electrode as the negative pole is stuck on the right chest of the patient, the yellow electrode as the positive pole is on the left chest of the patient, and the green one as the ground is on the stomach. The web application of the system is shown in Figures  6-9. To access the web application the user needs to register to the app by providing the device ID of the patient, the role (either as as the family, patient, or hospital), the name, the email address, the name of a family member who will serve as the contact person, and the password as in Figure 6. Figure 7 shows the login page that appears each time the user accesses the app. The main page of the application shows the realtime monitoring heartbeat data as illustrated in Figure  8. When the notify button is pushed by the user, the notification is sent to the contact person as well as the hospital, and it shows the exact location of the patient as in Figure 9.  After integrating the assembled hardware and the software, the system is evaluated to check if the system meets the goals. The evaluation is carried out in five different heart rate values. The buzzer is triggered to be activated based on the heart rate value read by the sensor. On the first and second tests, the sensed heart rate is considered normal since it is in the range of 60-100 BPM, then there is no buzzer activated by the system. When the heart beat exceeds 100 BPM as in the third and fourth tests, the buzzer is automatically activated. This indicates that the user has the choice to hit the notification button to notify the family and hospital. In both cases, the button is pressed to determine whether the notice was issued successfully. The findings demonstrate that the system satisfactorily According to these five tests, the objectives of integrated system evaluation have been attained. When the heartbeat falls outside of the specified range, the buzzer is activated. When the patient touches the notification button, the notification system relays a message to both the family and the hospital. Moreover, the data presented on the web application is accurate.