You are on page 1of 22

IOT Based Patient Monitoring System

Submitted in partial fulfillment of the requirements for the degree of

Bachelor of Technology

In

Electronics and Communication Engineering

By

18BEC0440 Manisha Kumari


18BEC0464 Yash Srivastava
18BEC0469 Adarsh Kumar
18BEC2006 Aaradhya

1
DECLARATION

This is to declare that this report has been written by us as part of our coursework. No part of the report is
plagiarized from other sources. All information included from other sources have been duly
acknowledged. We aver that if any part of the report is found plagiarized, we shall take full responsibility
for it.

18BEC0440 Manisha Kumari


18BEC0464 Yash Srivastava
18BEC0469 Adarsh Kumar
18BEC2006 Aaradhya

Place: Vellore Institute of Technology, Vellore

Date: 17 May 2020

2
ACKNOWLEDGMENT

We would like to express our special thanks to our IoT Domain Analyst Professor Dr. Pradheep T who
gave us this opportunity to work on this project and expand our knowledge in the field of IoT as well as
for guiding us on the same.

We are also sincerely grateful to the Vellore Institute of Technology, Vellore for giving us the occasion to
learn in depth the concepts of IoT to enhance our fundamentals and grow interest in the area.

A special mention to our friends and families who helped and encouraged us throughout the journey
despite the distance barrier and communication discomfort to ideate and move ahead with the project
within the time frame.

3
TABLE OF CONTENTS

TITLE PAGE NO.

Declaration 2
Acknowledgement 3

Table of Contents

1. Introduction_________________________________________ 5
2. Abstract _________________________________________ 6
3. Literature Survey_____________________________________7
4. Technical Specification ________________________________ 9
5. Working 10
6. Results & Conclusions 20
7. Limitations 21
8. Future Work 21
9. References 22

4
INTRODUCTION

Health monitoring is the major problem in today’s world. Due to lack of proper health monitoring,
patients suffer from serious health issues. There are lots of IoT devices nowadays to monitor the health of
patients over the internet. Health experts are also taking advantage of these smart devices to keep an eye
on their patients. With tons of new healthcare technology start-ups, IoT is rapidly revolutionizing the
healthcare industry.

IoT based health monitoring system is used where the patient and heath expert(s) are at different
locations. For example, a patient can stay at home and continue his/her routine life and a doctor can
monitor a patient's health. Based on the received data the heath expert can prescribe a best treatment or
take an immediate action in case of an emergency.

IoT based patient health monitoring system is a generic term given to any medical equipment that has
internet capability and can measure one or more health data of a patient who is connected to the device
such as heartbeat, body temperature, blood pressure, ECG, steps etc. The equipment can record, transmit
and alert if there is any abrupt change in the patient’s health.

5
ABSTRACT

In our Patient health monitoring system , we’re going to monitor patient’s health in an automated way.
1) The device will firstly monitor the body health parameters like glucose, temperature, pulse etc.
using different sensor’s.
2) Then the data collected will be sent to cloud (Thingspeak) using ESP 8266 WiFi module. The
Thingspeak IOT platform will store all the parameter data values.
3) These body parameter values will be converted into a data set which we can use in a training
algorithm.
4) Using this data set we can train it using ML on Jupyter Notebook, predicting the diseases of the
patient. (for example whether he/she has diabetes or not).

6
LITERATURE SURVEY

We have taken inferences from some of the research papers.


● Predictive Analytics: A Review of Trends and Techniques: Vaibhav Kumar, M.L. Garg

Journal: International Journal of Computer Applications 2018

Predictive analytics is a term mainly used in statistical and analytics techniques. This term is drawn
from statistics, machine learning, database techniques and optimization techniques.It brings together
the information technology, business modeling process, and management to make a prediction about
the future.

Predictive analytics involves several steps through which a data analyst can predict the future based
on the current and historical data:

Research related to cardiorespiratory fitness often uses regression analysis in order to predict
cardiorespiratory status or future outcomes. Reading these studies can be tedious and difficult unless the
reader has a thorough understanding of the processes used in the analysis.

The machine learning models have a very good track record of being used as predictive models.
Based on the input parameters, the output or future of any value can be predicted.

7
In our project we’re going to use predictive analysis. This paper opens a scope of development of new
models for the task of predictive analytics. There is also an opportunity to add additional features to
the existing models to improve their performance in the task.

● Internet of things (IoT) based health monitoring system and challenges

In this paper, we’ve found the importance and fruitful benefits of implementation of IoT in remote health
monitoring systems. The compact sensors with IoT will make a huge impact on every patient’s life, that
even though they are away from home and physician, this helps them to reduce the fear of danger.

This is a RPM based IOT system.

In our project we’ve taken help from this paper in order to understand the process of collecting data from
sensors and then storing in the cloud and then converting it into a dataset . Thereby using it to predict
diseases and analysis.

8
TECHNICAL SPECIFICATION

Our project includes software components. We have worked on three software platforms to achieve our
results:

1) Tinkercad:
It is a free, online 3D modeling program that runs in a web browser, known for its simplicity and
ease of use. Tinkercad circuits allow anyone to virtually create and program Arduino projects
without the need for physical hardware.

Tinkercad is used in our system for circuit construction and simulation. Components that are used
to make the circuits are as follows:

I. Bread Board:
It is a construction base for prototyping of electronics which is used for designing and
testing circuits. Since the components are not soldered we can change the circuit design at
any point.

II. Male-Female Wires:


These are the types of jumper wires, which are used to interconnect the components of
the breadboard internally.

III. LM35 Temperature Sensor:


It is an analog linear temperature sensor whose output is proportional to the temperature
(in ℃). The operating temperature range is from -55℃ to 150℃. The output voltage
varies by 10mVin response to every ℃ rise or fall in temperature. It can be operated from
a 5V as well as 3.3V supply and the standby current is less than 60µA.

IV. Arduino UNO:


The Arduino Uno is an open-source microcontroller board based on the Microchip
ATmega328P microcontroller.

V. LCD:
LCD (Liquid Crystal Display) screen is an electronic display module and finds a wide
range of applications. A 16x2 LCD display is a very basic module and is very commonly
used in various devices and circuits.

VI. ESP8266 WiFi Module:


ESP8266 is used as a WiFi module, but it is actually a microcontroller. This
microcontroller has the ability to perform WiFi related activities hence it is widely used
as a WiFi module. It is used by considering AT commands.

9
2) Thingspeak:
ThingSpeak is an IoT analytics platform service that allows you to aggregate, visualize, and
analyze live data streams in the cloud. You can send data to ThingSpeak from your devices, create
instant visualization of live data, and send alerts.

In our project, Thingspeak is used as our IoT platform to store patient’s health parameter values.
It is the platform that stores the values on the cloud.

3) Jupyter Notebook:
The Jupyter Notebook is an open source web application that you can use to create and share
documents that contain live code, equations, and visualizations. Jupyter Notebook is used to do
predictive analysis of the obtained data set.

WORKING

All the hardware connections are made on the Tinkercad and it is implemented with the help of the
sensors and modules available on our software platform.

Temperature sensor is used that takes up the reading and displays on the LCD connected in the circuit.
The entire process runs on the code given as:

Code for Tinkercad simulation:

#include <LiquidCrystal.h>

#include <SoftwareSerial.h>

//const int TMP36 = A0;

const int LedRed = 12;

const int LedGreen = 11;

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

String ssid = "Simulator Wifi"; // SSID to connect to

String password = ""; // Our virtual wifi has no password

String host = "api.thingspeak.com"; // Open Weather Map API

const int httpPort = 80;

10
String uri = "/update?api_key=N048PD4L1J3R79WQ&field1=";

int setupESP8266(void) {

// Start our ESP8266 Serial Communication

Serial.begin(115200); // Serial connection over USB to computer

Serial.println("AT"); // Serial connection on Tx / Rx port to ESP8266

delay(10); // Wait a little for the ESP to respond

if (!Serial.find("OK")) return 1;

// Connect to 123D Circuits Simulator Wifi

Serial.println("AT+CWJAP=\"" + ssid + "\",\"" + password + "\"");

delay(10); // Wait a little for the ESP to respond

if (!Serial.find("OK")) return 2;

// Open TCP connection to the host:

Serial.println("AT+CIPSTART=\"TCP\",\"" + host + "\"," + httpPort);

delay(50); // Wait a little for the ESP to respond

if (!Serial.find("OK")) return 3;

return 0;

void anydata(void) {

float Temperature = (analogRead(A0)*500.0)/1024.0;

int temp = map(Temperature,9,174,0,100);

// Construct our HTTP call

String httpPacket = "GET " + uri + String(temp) + " HTTP/1.1\r\nHost: " + host + "\r\n\r\n";

int length = httpPacket.length();

// Send our message length

11
Serial.print("AT+CIPSEND=");

Serial.println(length);

delay(10); // Wait a little for the ESP to respond if (!Serial.find(">")) return -1;

// Send our http request

Serial.print(httpPacket);

delay(10); // Wait a little for the ESP to respond

if (!Serial.find("SEND OK\r\n")) return;

void setup() {

Serial.begin(115200);

lcd.begin(16, 2);

lcd.print("IoT Project");

lcd.setCursor(0,1);

lcd.print("Temp Level");

pinMode(LedRed, OUTPUT);

pinMode(LedGreen, OUTPUT);

delay(1000);

lcd.clear();

lcd.print("Temp= ");

setupESP8266();

void loop() {

float value1=analogRead(A0);

12
float Temperature1 = (value1*500.0)/1024.0;

int temp1 = map(Temperature 1,9,174,0,100);

lcd.setCursor(6,0);

lcd.print((float)temp1);

lcd.setCursor(6,0);

if(temp1 < 90){

digitalWrite(LedRed,HIGH);

digitalWrite(LedGreen,LOW);

}else{

digitalWrite(LedRed,LOW);

digitalWrite(LedGreen,HIGH);

anydata();

delay(1000);

Through this code temperature is read and displayed on LCD.

Fig: It shows circuit on Tinkercad

13
Fig: Temperature sensor reads the temperature and is displayed on LCD

The ESP 8266 WiFi module used in the circuit is used to transmit the data to the cloud (Thingspeak) that
also helps us to keep track and monitor the health of our user. It collects the data, analyses it and acts on it
by triggering a reaction using internet, channels and web pages.

It will be used to monitor a patient's temperature and various attributes like number of pregnancies,
glucose, blood pressure, skin thickness, insulin, BMI, Diabetes Pedigree Function, Age to know whether a
person has diabetes or not.

The data collected by the sensors is stored in the ThingSpeak channel and the output is displayed on the
ThingSpeak platform.
ThingSpeak account is set up and a Write API Key is generated.

14
Fig: channel ‘iot_patient_monitoring’ and a field called ‘temperature’

Fig: Output showing temperature ThingSpeak

Here, we have created the channel ‘iot_patient_monitoring’ and a field called ‘temperature’ is as shown
above.

Then, using the dataset stored on the cloud, we have done the training using predictive analytics.

15
Predictive analytics encompasses a variety of statistical techniques from data mining, predictive
modelling, and machine learning, that analyze current and historical facts to make predictions about
future or otherwise unknown events.
Various business, predictive models exploit patterns found in historical and transactional data to identify
risks and opportunities. Models capture relationships among many factors to allow assessment of risk or
potential associated with a particular set of conditions, guiding decision making for candidate
transactions.

Our model uses Linear Regression techniques. Regression analysis is a form of predictive modelling
techniques that investigates the relationship between a dependent and independent variable.A supervised
algorithm that learns from a set of training samples.

Linear Regression is used as:


• Each training sample has one or more input values and a single output value.
• The algorithm learns the line, plane or hyper-plane that best fits the training
samples.
• Uses the learned line, plane or hyper-plane to predict the output value for any input sample.

To get the output, every attribute is defined for whose value is taken from the ThingSpeak platform.
In the code below, a threshold value is given of 0.50. If the Diabetes Pedigree Function exceeds 0.50, the
patient has diabetes otherwise not.

Fig: The following dataset of 768 patients used for the project

Code for training:

16
import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

from sklearn import linear_model

df=pd.read_csv("diabetes.csv")

df

print(df.isnull().sum())

#linear y=mx+b Outcome=m*Insulin +b

plt.scatter(df.Insulin,df.Outcome,color='red',marker='*')

#linear regression training

reg_analysis = linear_model.LinearRegression()

reg_analysis.fit(df[['Insulin']],df.Outcome)

reg_analysis.predict([[300]])

#multiple Outcome=m1*Pregnancies +m2*Glucose +m3*BloodPressure +m4*SkinThickness +m*Insulin


+m5*BMI +m6*DiabetesPedigreeFunction +m7*Age +b

reg_analysis1 = linear_model.LinearRegression()

reg_analysis1.fit(df[['Pregnancies','Glucose','BloodPressure','SkinThickness','Insulin','BMI','DiabetesPedi
greeFunction','Age']],df.Outcome)

reg_analysis1.predict([[6,148,72,35,0,33.6,0.627,50]]) #1

reg_analysis1.predict([[1,85,66,29,0,26.6,0.351,31]]) #0

reg_analysis1.predict([[10,101,76,48,180,32.9,0.171,63]]) #0

17
reg_analysis1.predict([[1,93,70,31,0,30.4,0.315,23]]) #0

reg_analysis1.predict([[1,126,60,0,0,30.1,0.349,47]]) #1

reg_analysis1.predict([[8,183,64,0,0,23.3,0.672,32]]) #1

reg_analysis1.predict([[0,137,40,35,168,43.1,2.288,33]]) #1

reg_analysis1.predict([[5,121,72,23,112,26.2,0.245,30]]) #0

18
19
Fig: Output of training using linear regression

The above code and the training helps us to know whether the patient has diabetes or not. ‘1’ denotes that
the patient suffers from diabetes. And ‘0’ denotes that the patient does not suffer from diabetes. It also
helps us to know the number of people suffering from diabetes in a given data set.

RESULTS & CONCLUSIONS

We trained through 769 datasets defining various parameters to understand if the person suffers from
diabetes or not. Our project was also available to simulate Tinkercad, store our data on cloud and then do
its predictive analytics.

Through our dataset we have observed that 268 people suffered from diabetes.

Diabetes is a disease that many people suffer from, if not treated properly it dramatically increases the
risk of various cardiovascular problems, including coronary artery disease with chest pain (angina),
heart attack, stroke and narrowing of arteries (atherosclerosis). If you have diabetes, you're more likely to
have heart disease or stroke.

20
Therefore, with the advancements in machine learning and IoT, our healthcare system can be a backbone
of our country and easing out the job for medical staff.

LIMITATIONS

Our project faces with two limitations as identified by us are as follows:

● We faced an issue to include various sensors in the Tinkercad, therefore, limiting our project only
to the temperature sensor.
● We could not get a proper dataset, our dataset could only predict if a person has diabetes or not
and the number of people suffering from diabetes. A proper dataset could also give us an idea of
the number of patients suffering from Type I Diabetes and Type II Diabetes.

FUTURE WORK

Our project can be used in future to predict and do training for various other diseases. But as now we have
trained on diabetes dataset. Our project can be used in the current situation of COVID-19. Various
attention is given to treat covid-19 patients, but post covid-19 treatment is not efficient and often ignored.

Various reports have claimed certain deaths post covid-19 due to ‘Mucormycosis’ or ‘Black Fungus’. The
various predisposing factors of mucormycosis are uncontrolled diabetes (particularly in patients having
ketoacidosis), malignancies such as lymphomas and leukemias, renal failure. A proper dataset of
ketoacidosis- Diabetic ketoacidosis is a serious complication of diabetes that occurs when your body
produces high levels of blood acids called ketones. The condition develops when your body can't produce
enough insulin.

Therefore, our further dataset with proper specifications of ketoacidosis level can help the health
authorities to know if the patient has severe diabetes or not, if the patient will be vulnerable to COVID-19
and if the patient will develop post-covid symptoms. This data will enable the health authorities to pay
attention to those patients with proper facilities and treatment.

21
REFERENCES

● https://www.researchgate.net/publication/324526847_Internet_of_things_IoT_based_healt
h_monitoring_system_and_challenges

● https://www.sciencedirect.com/science/article/pii/S1877050918310202

● https://link.springer.com/article/10.1007/s11894-018-0611-3

● https://www.researchgate.net/publication/334123674_Secure_Health_Monitoring_of_Soldie
rs_with_Tracking_System_using_IoT_A_Survey
● https://ijesc.org/upload/7e87698a2fca5013081f14d6a8bd6f02.Health%20Monitoring%20an
d%20Tracking%20System%20for%20Soldiers%20using%20Live%20track%20Applicatio
n%20(1).pdf

22

You might also like