JCC  Vol.9 No.7 , July 2021
A Healthcare System for Internet of Things (IoT) Application: Machine Learning Based Approach
Abstract: Internet of things (IoT) has become an interesting topic in the field of technological research. It is basically interconnecting of devices with each other over the internet. Beside its general use in terms of autonomous cars and smart homes, but some of the best applications of IoT technology in fields of health care monitoring is worth mentioning. The main purpose of this research work is to provide comport services for patients. It can be used to promote basic nursing care by improving the quality of care and patient safety from patient home environment. Rural area of a country lacks behind the proper patient monitoring system. So, remote monitoring and prescribing by sharing medical information in an authenticated manner is very effective for betterment of medical facilities in rural area. We have proposed a healthcare system which can analyze ECG report using supervise machine learning techniques. Analyzing report can be stored in cloud platform which can be further used to prescribe by the experienced medical practitioner. For performance evaluation, ECG data is analyzed using six supervised machine learning algorithms. Data sets are divided into two groups: 75 percent data for training the model and rest 25 percent data for testing. To avoid any kind of anomalies or repetitions, cross validation and random train-test split was used to obtain the result as accurate as possible.

1. Introduction

Machine learning allows systems the ability to automatically learn and improve from experience without programming explicitly. This is an application of artificial intelligence. Machine learning methods are often classified as supervised learning, unsupervised learning, semi-supervised learning and reinforcement learning. Supervised learning algorithms figure out model relationships and dependencies between the target prediction output and the input features. So we can predict the output values for new data based on those relationships which it learned from the previous data sets. For unsupervised learning, the model is trained with unlabeled data. Semi-supervised learning uses both labeled and unlabeled data, so it falls between supervised and unsupervised learning. Machine learning algorithms—reinforcement learning, interact with their environment by producing actions and then discover errors or rewards.

Machines and software agents are allowed to automatically determine the ideal behavior within a specific context in order to maximize its performance. ECG provides us with series of sinus rhythms which defines the condition of heart. ECG is useful for detecting certain types of conditions and because of its low cost, it is the most common test for screening heart diseases. An ECG telemonitoring system supports patients from avoiding frequent visits to hospitals and allows monitoring ECG patients. ECG signals of patients can be useful to identify different types of heart problems.

Wireless health care services provide remote monitoring diagnoses to the patient every now and then. At the present time, these services evolved tremendously that it is not only restricted to give services for the cognitive and physical disabilities patients but also can also maintain high-quality services for newborn and young children. Furthermore, ECG pattern recognition is often useful as an early warning system for heart diseases. So, we plan about finding anomalies in Heart Rate of ECG reports and figure out which algorithm gives better and reliable results for some particular heart disease. Often the doctors and medical staffs face problems in interpreting an ECG report. Very little change in any section of the ECG graph can result in different kinds of diseases. During medical emergencies, like in ER or ICU, where time is of the essence, it would be more advantageous to find out what is ailing the patient for immediate treatment.

Moreover, it is very difficult for a doctor to read an ECG report with bare eyes. At times, there is a high chance to miss out any abnormality in the ECG report as the change in the ECG wave shape is hardly noticeable. With the recent development in Machine Learning field, the scope of performing in different sectors and concluding with better accuracy and optimized performance has increased. Medical science has also improved over time. Considering all these factors, we decided to do use Machine learning technique to distinguish between normal and abnormal heart rate by detecting some diseases that occur due to change in any section of the ECG graph. We are introducing a secure IoT-based healthcare monitoring system utilizing Machine learning prediction algorithms for predicting different heart diseases. We have trained our model by supervised machine learning.

This research is organized as follows: Section 2 introduces brief literature. Section 3 includes detailed research methodology. Section 4 presents state of art supervised machine learning algorithm. Section 5 describes performance evaluation and finally, Section 6 concludes with mentioning future work.

2. Literature Review

Nowadays the increasing of technologies health experts is taking great advantage of these electronic gadgets. IoT devices are highly used in medical sector. Especially, for Cardiac patients, high blood pressure patients, hypertension problems, diabetic patients, etc. in rural area because in rural area number of doctors is less than urban area. In rural area, medical equipment is not available except government hospital. So, the number of patients is higher, than government hospital. Also, the equipment is expired in many cases. So, if any emergency call is needed, this hardware device will immediately send the report to the doctors or intern doctors. Medical practitioner will do their rest of works by their checking the reports. Of many chronic illnesses, hypertension has become a common major disease that remains the route cause for cardiac/stroke mortality. But in present time, no remote Heart Rate Variability (HRV) analysis systems for hypertension patient available to help the doctors to track down the progression of the patient’s condition or critical events in rural area [1].

IoT is nothing but an advanced concept of Information Communication Technology (ICT). Technologies are broadly expanded in web based or on line system [2]. Now-a-days collecting information in real time is vital. When the critical condition, patients are discharging from the hospital, he or she needs to check up on regular basis. That is why IoT based heath monitoring system is the best option for rural area. We live in an era where computation is being moved from vast centralized servers to PCs and cloud. For a long time researchers have been working on identifying and predicting different diseases using machine learning. Exploration supervised learning, unsupervised learning and reinforcement learning, which is better for machine learning are analysed in [3] [4] [5]. There has been much work in the field of classification and most work has been based on neural networks, Markov chain models and Support Vector Machines (SVMs). In [6] a comparison between three different machine learning algorithms was discussed. It has been done by many to improve past algorithm or create a new one for machine learning.

In [7] a definite review of pre-processing strategies, ECG databases, highlight extraction methods, classifiers and execution measures are displayed. Machine learning in medical science is unmistakable research related to the osmosis of present-day innovations: programming, PC and data advancements [8]. There is even research on defining the ECG wave from other waves or mixed-signal. For example, Independent Component Analysis (ICA) is connected on the blended signs and the isolated signs are recreated utilizing wavelet remaking and correlating the results demonstrate that Lifting Wavelet Transformation and FASTICA algorithm creates the best SNR estimation of 11.39 for maternal and 10.10 for fatal Electro Cardio Gram signals [9]. ECG early warning system comes to light for meeting public health, medical informatics referring to health services and information delivered or enhanced through the internet and related technologies [10].

Ultimately, there is much research work involving machine learning and medical science, however, we choose to work with ECG or the functionality of the human heart. During the time most common defect in human body is primarily related to heart. We try to implement an IoT-based machine learning utilized ECG classification system which can be helpful both for rural healthcare.

3. Research Methodology

According to the WHO, 4.9 million people died from lungs cancer, over weight 2.6 million, 4.4 million for elevated cholesterol, 7.1 million for high blood pressure. Patients who need regular monitoring by doctors to discuss the state of health condition, IoT-based patient monitoring system is useful for them. The main concept of IoT is defined as the integration with electronic devices that connect with doctors or health monitoring persons. The proposed system consists of Raspberry-pi, ECG Simulator, NodeMCU. Also displays the extracted data or extracted parameters on the cloud through Raspberry-pi and WiFi access point for immediate access to the experts or doctors. First electrodes capture the QRS parameters and send to controller. The controller which used here is Raspberry-pi, that process ECG signal and sends to ThingSpeak. Raspberry-pi is used to send data to cloud (ThingSpeak) wirelessly, ThingSpeak cloud is the open Internet of Things (IoT) with MATLAB analytics used to visualize data to doctor or experts, then doctor or experts analyst make the decision. Moreover, in case of emergency, nurse or patient’s relative check out patient’s condition by using LIVE monitoring option and distinguished normal and abnormal ECG using different machine learning algorithms.

Afterwards, we did the research on predicting few diseases depending on the availability of the data for a particular disease. The model that we trained to predict the outcome for different diseases and classify between normal and abnormal ECG can also be used to predict outcome for other diseases that we did not work for. In addition, our target was to figure out which algorithm gives the best result in predicting the diseases we worked with. We analysed the results that we predicted by using our model and calculated the accuracy level of different algorithms. A typical ECG tracing of a cardiac cycle, consists of a P wave, QRS Complex, T wave, and a U wave which is normally visible in 50% to 75% of ECGs. The baseline of the ECG (flat segments) represents the portion of the tracing that follows the T wave or in some cases the U wave and precedes the next P wave. In a normal healthy heart, the baseline is almost equivalent to isoelectric.

The system consists of three major embedded electronics: Raspberry Pi 4 Model B, AD8232 ECG Sensor Module, NodeMCU. NodeMCU provides open source electronics proto typing platform based on flexible, easy to use hardware and software as shown in Figure 1. NodeMCU is an open source firmware for

Figure 1. Block hardware implementation.

which open source prototyping board designs are available. The development board equips the ESP-12E module containing ESP8266 chip having Tensilica Xtensa® 32-bit LX106 RISC microprocessor which operates at 80 to160 MHz adjustable clock frequency and supports RTOS. In this system, 9 volt battery is used. From power 3.3 v power is driven in ECG sensor and ESP8266 NodeMCU. The Bluetooth module is driven by 5v.

To run the system first we need to connect Raspberry Pi with the power supply as Raspberry Pi is the main control unit. In this system, input side has ECG sensor and some manual buttons. On the other hand, output is shown in the Arduino IDE serial plotter moreover ThingSpeak cloud platform. NodeMCU and Bluetooth Module help to send data in the Raspberry Pi and using WiFi Raspberry Pi send ECG analog data to the cloud and when the data gets uploaded, we can check the output by using Laptop or Computer by log in to the server. First of all 3 electro pads of ECG sensor are placed in the body data is send through NodeMCU, Bluetooth Module and WiFi technology built in Raspberry pi and shows the ECG curve in the Arduino IDE serial plotter moreover ThingSpeak cloud platform. The entire process of hardware is shown in the block diagram of Figure 2.

4. Proposed Security Model and Framework

We have implemented four algorithms (Decision Tree, Nearest Neighbor, Naive Bayes, Support Vector Machine (SVM)) separately to analyze ECG data [11] [12].

4.1. Decision Tree

It is a supervised learning method used to solve classification problems mostly. It works for both categorical and continuous input and output variables. The model learns simple decision rules inferred from its data features and then predicts the value of a target variable. In other words, the population or sample is divided into two or more homogeneous sets (or sub-populations) based on most significant differentiator in input variables.

Figure 2. Proposed system model.

4.2. Nearest Neighbor

It is a type of instance-based learning that simply stores instances of the training data. In short, it involves a training set of cases and the aim is to predict the label from these predefined numbers of training samples closest in distance to the new point.

4.3. Naive Bayes

It is a training and classification algorithm for data that is distributed according to multivariate Bernoulli distributions. It is suitable for linear classification. There may be multiple features but each one is assumed to be a binary-valued variable. Therefore, this class requires samples to be represented as binary-valued feature vectors and the decision rule for the algorithm is based on.

4.4. Support Vector Machine (SVM)

This is a set of supervised learning method that is used for classification, regression and outliers detection. The algorithm outputs an optimal hyper plane which categorizes new examples given labeled training data. It performs classification tasks by constructing hyper planes in a multidimensional space that separates cases of different class labels. A normal heart is beating in a regular sinus rhythm between 60 - 100 beats per minute (specially 82 bpm). A slight change in the PQRST section can lead to different kinds of heart disease.

5. Results and Discussion

The test bed implementation is shown in Figure 3. In addition, we have utilized the data set from UC Irvine Machine Learning Repository database to validate the performance of the different machine learning methods. Figure 4 shows the prediction results for different types of machine learning methods.

Therefore, by examining the results given in Table 1, we can see that for predicting CAD it is best to use Naive Bayes Classifier since it has the highest score of 94% accuracy among all the algorithms. For predicting Myocardial Infarction, Decision Tree Classifier worked the best. The score is 96%. For Sinus Tachycardia, the algorithm has a score of 95% except Nearest Neighbor. Decision Tree Classifier also worked well for Sinus Bradycardia with a score of 95%. And Lastly Support Vector Machine (SVM) scored the highest, 96%.

Figure 3. Test-bed scenario.

Figure 4. Prediction rate for different Machine learning method.

Table 1. Result analysis.

6. Conclusion

IoT-based healthcare platform which connects with smart sensors attached with the human body for health monitoring for a daily checkup is presented in this research. This research work is giving the opportunity to monitor patient continuously by using ThingSpeak open source cloud platform with remote monitor and mobile message service distinguish between normal and abnormal heartbeat by means of machine learning. In addition, we figured out which algorithm works best for predicting a particular disease. Although machine learning methods are effective to detect cardiac disease results show that SVM and Decision Tree outperform other methods.


This work has been supported by Ministry of Science and Technology, Bangladesh, Financial Year 2020-2021, Special Grants from Science and Technology Program, GO No. 39.00.0000., dated 8 Dec 2020.

Cite this paper: Mamun-Ibn-Abdullah, M. and Kabir, M. (2021) A Healthcare System for Internet of Things (IoT) Application: Machine Learning Based Approach. Journal of Computer and Communications, 9, 21-30. doi: 10.4236/jcc.2021.97003.

[1]   Kirtana, R.N. and Lokeswari, Y.V. (2017) An IoT Based Remote HRV Monitoring System for Hypertensive Patients. 2017 International Conference on Computer, Communication and Signal Processing (ICCCSP), Chennai, India, 10-11 January 2017, 1-6.

[2]   Rahman, R.A., Aziz, N.S.A., Kassim, M. and Yusof, M.I. (2017) IoT-Based Personal Health Care Monitoring Device for Diabetic Patients. 2017 IEEE Symposium on Computer Applications & Industrial Electronics (ISCAIE), Langkawi, Malaysia, 24-25 April 2017, 168-173.

[3]   Laine, T.H., Lee, C. and Suk, H. (2014) Mobile Gateway for Ubiquitous Healthcare System Using ZigBee and Bluetooth. 2014 Eighth International Conference on Innovative Mobile and Internet Services in Ubiquitous Computing, Birmingham, UK, 2-4 July 2014, 139-145.

[4]   Babiker, S.F., Abdel-Khair, L.E. and Elbasheer, S.M. (2011) Microcontroller Based Heart Rate Monitor using Fingertip Sensors. University of Khartoum Engineering. Journal (UofKEJ), 1, 47-51.

[5]   Salzberg, S.L. (1994) C4.5: Programs for machine learning by J. Ross Quinlan. Morgan Kaufmann Publishers, Inc., 1993. Machine Learning, 16, 235-240.

[6]   Parekh, D. (2010) Designing Heart Rate, Blood Pressure and Body Temperature Sensors for the Mobile On-call System. Bachelor Degree Thesis, McMaster University, Hamilton, Canada.

[7]   Asfaqul Islam, A. (2015) A Real-time ECG Warning System on Myocardial Infarction, Hyperkalemia and Atrioventricular Block. Kristianstad University, Kristianstad, Sweden.

[8]   Pardeshi, V., Sagar, S., Murmurwar, S. and Hage, P. (2017) Health Monitoring Systems Using IoT and Raspberry Pi-A Review. 2017 International Conference on Innovative Mechanisms for Industry Applications (ICIMIA), Bengaluru, India, 21-23 Febuary 2017, 134-137.

[9]   Satyanarayan, Y.S., Satyanarayan, Y.R. and Desai, D.H. (2013) Intelligent Wireless Emergency Alert System for Patient Monitoring Using AT89S52 Microcontroller. International Journal of Advanced Research in Electrical, Electronics and Instrumentation Engineering (IJAREEIE), 2, 1224-1230.

[10]   Hu, Y.H. (2015) Wirelessly Connected Sensor Acquisition System for Remote Nursing Applications. Kennesaw State University, Kennesaw, USA.

[11]   Moyer, V.A. (2012) Screening for Coronary Heart Disease with Electrocardiography: U.S. Preventive Services Task Force Recommendation Statement. Annals of Internal Medicine, 157, 512-518.

[12]   Logan, P. and Vaidyanathan, V. (2013) Wireless Electrocardiogram System with Telemedicine Application for In-Home Use. International Journal of Applied Science and Technology, 3.