You are on page 1of 83

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/348479227

IoT Smart ambulance system with patient health monitoring

Book · January 2021

CITATIONS READS

0 6,793

2 authors, including:

Mahmoud Yasser
Modern Technology and Information University
23 PUBLICATIONS 0 CITATIONS

SEE PROFILE

All content following this page was uploaded by Mahmoud Yasser on 14 January 2021.

The user has requested enhancement of the downloaded file.


Modern University For technology &
Information Faculty of Engineering
Communication Engineering Department

IoT Smart ambulance system with patient health


monitoring

The Project is elaborated by


1 Mahmoud Yasser Elsayed Abdelghany - 17746
-
2 Mostafa Maher Mostafa Ibrahim - 15093
-
3 Abdullah Mohamed Abdullah Saleh - 14989
-
4 Mario Mamdouh Malak Megaly - 15050
-
5 Mohamed Elsayed Labib Mohamed - 87925
-

Under Supervision of

Dr. Mohamed Sharaf Dr. Ramy Agieb

Cairo – 2020
Abstract

With an improvement in technology and miniaturization of sensors, there have


been attempts to utilize the new technology in various areas to improve the
quality of human life. One main area of research that has seen an adoption of the
technology is the healthcare sector. The people in need of healthcare services
find it very expensive this is particularly true in developing countries.

As a result, this project is an attempt to solve a healthcare problem currently


society is facing. The main objective of the project was to design a remote
healthcare system. It’s comprised of three main parts. The first part being,
detection of patient’s vitals using sensors, second for sending data to cloud
storage and the last part was providing the detected data for remote viewing.
Remote viewing of the data enables a doctor or guardian to monitor a patient’s
health progress away from hospital premises.

The Internet of Things (IoT) concepts have been widely used to interconnect the
available medical resources and offer smart, reliable, and effective healthcare
service to the patients. Health monitoring for active and assisted living is one of
the paradigms that can use the IoT advantages to improve the patient’s lifestyle.
In this project, I have presented an IoT architecture customized for healthcare
applications. The aim of the project was to come up with a Remote Health
Monitoring System that can be made with locally available sensors with a view
to making it affordable if it were to be mass produced.

Hence the proposed architecture collects the sensor data through


microcontroller and relay it to the cloud where it is processed and analyzed for
remote viewing.

i
Acknowledgments

First and foremost, we thank ALLAH, with whom truly all things are possible.
This project is definitely proof of that!

There are a number of people we want to acknowledge and thank for all of their
help along the way. We would like to express our deepest gratitude to all of our
professors who taught us and specially project supervisor Dr. Mohamed Sharaf
for his expertise, encouragement, support and further guidance along five years
of engineering study. We would like to express our deepest gratitude to our
project supervisor Dr. Ramy Agieb for his guidance & constant supervision as
well as for providing necessary information regarding the project & also for his
support in completing the project.

We would like to express our gratitude towards our parents & members of
Modern University for Technology & Information (MTI) for their kind
cooperation & encouragement which helps us in completion of this project.

ii
Table of content

Abstract.......................................................................................................... i
Acknowledgements ...................................................................................... ii
Table of content........................................................................................... iii
List of tables .................................................................................................. v
List of figures................................................................................................ vi

1 Chapter 1 : Introduction .............................................................................. 2


1.1 General ........................................................................................................................ 2
1.2 Motivation ................................................................................................................... 3
1.3 Overview ..................................................................................................................... 4
1.4 Objective ..................................................................................................................... 5
2 Chapter 2 : Background study and literature review ............................... 8
2.1 Introduction ................................................................................................................. 8
2.2 Intelligent wireless mobile patient monitoring system ............................................. 10
2.3 Scope and Contents ................................................................................................... 11
2.3.1 ECG (Electrocardiograph) ............................................................................................ 11
2.3.2 ECG sensor generated within the body ......................................................................... 13
2.3.3 Heart Beat ..................................................................................................................... 14
2.3.4 ATmega128A ................................................................................................................ 15
2.3.5 Communication between Hardware and Software ........................................................ 16
3 Chapter 3 : A proposed model................................................................... 18
3.1 Working methodology............................................................................................... 18
3.2 Workflow Electrical Components Control Unit........................................................ 20
3.3 System Model............................................................................................................ 21
4 Chapter 4: Implementation ....................................................................... 24
4.1 Hardware Implementation ......................................................................................... 24
4.2 Components............................................................................................................... 26
4.2.1 Atmega128 .................................................................................................................... 26
4.2.2 SIM 900 GSM Module ................................................................................................. 28
4.2.3 ECG Sensor ................................................................................................................... 29
4.2.4 Power Adapter............................................................................................................... 30
4.2.5 LCD Display ................................................................................................................. 31
4.2.6 Jumper Wire .................................................................................................................. 32

iii
4.2.7 Laptop ........................................................................................................................... 32
4.2.8 LED ............................................................................................................................... 33
4.2.9 Push Button ................................................................................................................... 33
4.2.10 GPS Module .................................................................................................................. 34
4.2.11 Body Temperature Sensor ............................................................................................. 35
4.2.12 Keypad .......................................................................................................................... 36
4.2.13 Heart beat sensor ........................................................................................................... 37
4.3 Software implementation & Hardware connection ................................................... 38
4.3.1 GPS ............................................................................................................................... 38
4.3.2 GSM .............................................................................................................................. 40
4.3.3 Heart beat ...................................................................................................................... 42
4.3.4 Keypad .......................................................................................................................... 44
4.3.5 LCD............................................................................................................................... 46
4.3.6 Body Temperature sensor ............................................................................................. 48
4.3.7 ECG............................................................................................................................... 50
4.3.8 All system connection ................................................................................................... 53
5 Chapter 5 : Web server .............................................................................. 56
5.1 Introduction ............................................................................................................... 56
5.2 What is Django? ........................................................................................................ 56
5.3 Why do you need a framework? ............................................................................... 57
5.4 framework ................................................................................................................. 57
5.5 MVC .......................................................................................................................... 58
5.5.1 Model ............................................................................................................................ 59
5.5.2 View .............................................................................................................................. 59
5.5.3 Controller ...................................................................................................................... 59
5.6 Web Server implementation ...................................................................................... 60
5.7 Files of the application .............................................................................................. 61
5.8 Server rendering ........................................................................................................ 62
6 Real time implementation with Results .................................................... 67
6.1 Performance & Evaluation ........................................................................................ 70
6.1.1 Performance Testing Challenges in IoT ........................................................................ 70
7 Chapter 7 : Conclusion............................................................................... 73
7.1 Future Plan ................................................................................................................ 73
References .......................................................................................................... 74

iv
List of tables

Table 2.3.3: Rate of heartbeat per minute …………………………………………………..15

Table 5.7 : Pieces of APP. …………...……………………………………………………...61

Table 6.1.1: Performance test on IoT framework…………………………………………...71

v
List of figures

Figure 2.3.1 Normal sinus rhythm ECG ……………………………………...…...……….12

Figure 2.3.2 Heart Diagram …………………………………………...…………………...13

Figure 3.1 Working Flow Diagram ………………..……………………………….……………19

Figure 3.3(a) System model for Temperature & Heart Beat sensor ……………..….……..21

Figure 3.3(b) System model for ECG sensor ……………………………………………...22

Figure 4.1 Block diagram of Hardware Implementation …………………………………...25

Figure 4.2.2 SIM 900 GSM Modules………………………………………………………..28

Figure 4.2.3 ECG sensor …………………………………………………………………....29

Figure 4.2.4 Power Adapter ……………………………………………………………...…30

Figure 4.2.5 LCD Display 20*4…………………………………………….…………...31

Figure 4.2.6 Jumper Wire……………………………………………………….……..........32

Figure 4.2.7 Laptop ………………………………………………………………….……...32

Figure 4.2.8 LED Lights ..………………………………………….……………….……….33

Figure 4.2.9 Push Button.….……………………………………….…………….…………33

Figure 4.2.10 GPS module ………………………………………………….………………34

Figure 4.2.11 Body Temperature Sensor ……………………………………………………35

Figure 4.2.12 Keypad …………………………………………………………………….…36

Figure 4.2.13 Heart beat sensor …………………………………………………………..…37

Figure 4.3.1 GPS Connection with microcontroller ……………………………………….38

Figure 4.3.2 GSM Connection with microcontroller ……………………………………....40

Figure 4.3.3 Heart Beat Connection with microcontroller ………………………………..42

Figure 4.3.4 Keypad Connection with microcontroller ……………………………………44

vi
Figure 4.3.5 LCD Connection with microcontroller ………………………………………46

Figure 4.3.6 Body Temperature sensor Connection with microcontroller ………………...48

Figure 4.3.7 ECG Connection with microcontroller ……………………………………….50

Figure 4.3.8 System connection with all parts ……………………………………………..53

Figure 5.5 MVC Model …………………………………………………………………….58

Figure 5.6 Server Framework……….………………………………………………………60

Figure 5.8(a) Home page …………………………………………………………………..62

Figure 5.8(b) Login page …………………………………………………………………..62

Figure 5.8(c) Patient information ………………………………………………………….63

Figure 5.8(d) Car or Device location ………………………………………………………63

Figure 5.8(e) Heart beat graph ..……………………………………………………………64

Figure 5.8(f) Entire details for patient ……………………………………………………...65

Figure 6(a) Hardware setup ……………………………………………...…………………67

Figure 6(b) GPS Testing ………………………………………...…………………………67

Figure 6(c) Keypad test ………………………………………………..…………….…….68


.
Figure 6(d) Sending data process ……………………………………..………….………..68

Figure 6(e) Receiving data at serial monitor …………………………...………….……….69

Figure 6(f) Sending Done …………………………………………………………………..69

Figure 6(g) Receiving data at backend server …………………………..…………………70

vii
‫‪Chapter 1 : Introduction‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Chapter 1‬‬

‫‪Introduction‬‬

‫‪1‬‬
Chapter 1 : Introduction
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

1 Chapter 1 : Introduction
1.1 General

Because of expanding work cost, medical institutions would constrain to


decrease nursing staff for patients. Our project aims to develop new innovations
for the use of basic nursing care. In this report, we introduce a secure (IoT)
based healthcare monitoring system. This system will be included in the
ambulance and other places so we will talk in general about the system itself .

To achieve system efficiency simultaneously and robustness of transmission


within public (IoT) based communication networks, we will utilize robust
crypto-primitives to construct two communication mechanisms for ensuring
transmission confidentiality.

By implementing nursing system will get a new dimension and every patient
can be monitored remotely. By this on the basis of derived data if a patient is in
critical situation, an immediate instruction can be given to the one who is in
charge. It may play a vital role to reduce labor cost, rather will be easy to assess
from anywhere anytime and will be helpful to take immediate decision. Thus,
nursing system will be digitalized. In day to day life, people are affected by
various serious and complex diseases which are highly sensitive .

So, people are continuously anxious about their health condition. They need to
consult with doctors, according with reports and checkup all of that. Internet of
Things (IoT) is a growing present concept which has an effect of many aspect of
human life. Various processes of different concepts including data acquisition,
data transmission and data analytics enables (IoT) based system to support
smart solutions especially for health care [1].

In (IoT) based system, the work progress depends on 3 systems which are
sensor work, transmission and cloud. Firstly, talk about sensor network which is
the first step for monitoring patients as well as data collection. Secondly, the
gateway system which is a continuous connection networks between sensors
and cloud system. The death rate of 55.3 million people dying each year or
1,51,600 people dying each day or 6316 people dying each hour is a big issue
for all over the world [2].

2
Chapter 1 : Introduction
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

So, we are proposing a model where patient can measure heart beat rate and
ECG by himself or herself and that report immediately sent to the cloud. Later
that, those reports will used to consult with doctors within very short time. It is
also reduced valuable time for both patients and doctors. They don’t need to
wait for the reports because sensors are giving real time data. The model is very
effective for rural areas people.

IoT serves through GSM/3G/4G technologies data or patient report is sending to


the doctors with time and date. This proposed model can use any type of
persons like he or she affected with a disease or not. So, they can check it in
regular basis because people pay more attention towards prevention and early
recognition of disease [3]. Here, all reports also live video recording will be
recorded with real time. IoT devices produce large amount of data and
information [3]. These health care services are getting better and less costly by
recoding and collecting patients monitoring.

1.2 Motivation

The progression of the advance technology has constantly intrigued us.


Moreover, we additionally found that there are not critical examines on
computerization technology for hospital IoT based Patient Monitoring System.

Patient monitoring system is much accessible, painless and smooth for the
patient. Recently grew innovative devices executed in patient's body to
reestablish ordinary activities. Sometimes it is quite difficult to know about
health condition of patient for doctor and nurse. For this, they cannot give the
proper treatment and instant result to the patient. Now it is very important to
build up a system which can help doctor and nurse to maintain patient
monitoring remotely

3
Chapter 1 : Introduction
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

1.3 Overview

Our system will be beneficial to all age of people especially for the old aged or
ICU patient. It will measure the Heartbeat and ECG of the patient and upload
the result in web server. Therefore, we have developed website in which doctors
can get access and see the output by searching date and time. Moreover, in case
of emergency, nurse or patient’s relative check out patient’s condition by using
live monitor option.

The sensors detect the conditions of the patient and the data is collected and
transferred using a microcontroller. Doctors and nurses need to visit the patient
frequently to examine his/her current condition. In addition to this, use of
multiple microcontrollers based intelligent system provides high-level
applicability in hospitals where many patients must be frequently monitored.
For this, here we use the idea of network technology with wireless applicability,
providing each patient a unique ID by which the doctor can easily identify the
patient and his/her status of health parameters. Using the proposed system, data
can be sent wirelessly to the cloud, allowing continuous monitoring of the
patient. Contributing accuracy in measurements and providing security in
proper alert mechanism give this system a higher level of customer satisfaction
and low-cost implementation . Thus, the patient can engage in his daily
activities in a comfortable atmosphere where distractions of hardwired sensors
are not present.

Physiological monitoring hardware can be easily implemented using simple


interfaces of the sensors with a microcontroller and can effectively be used for
healthcare monitoring. This will allow development of such low-cost devices
based on natural human-computer interfaces. The system we proposed here is
efficient in monitoring the different physical parameters of many number
bedridden patients and then in alerting the concerned medical authorities if
these parameters bounce above its predefined critical values. Thus, remote
monitoring and control refer to a field of industrial automation that is entering a
new era with the development of wireless sensing devices.

Mainly, our goal was to build up a system with high accuracy with minimum
cost so that anyone can use and afford this.

4
Chapter 1 : Introduction
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

1.4 Objective

Easy to use
It will be a very handy tool as it shows all the data collection and information by
using just only the internet. So, it reduces the workloads and stress of the
relatives of the patient who work outsides.

Better patient experience


For being connected to the health care system through IoT, doctors can improve
the diagnosis accuracy as they are getting all the necessary patient data at hand.
In a word, we can say that it allows monitoring patient continuously and
remotely.

Provide an accurate detection


By using this system, we can get approximate result based on patient health.
Moreover, it will be less error, collect data in less time and more accuracy than
any human performances.

Reduce costs
When a patient gets health service at home on a real time basis, there is no need
for unnecessary doctor or nursing visit. In particular, this project helps to cut
down cost for hospital stays.

Giving a quality life for old aged people:


Most of the people at their old age, like to stay at home with their dear ones
rather than visiting or passing time in hospitals. But hue to hectic lifestyle
people are suffering from many diseases at their early age and the older people
become very weak. Additionally, this project will be beneficial to ICU patient.

5
Chapter 1 : Introduction
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

Shows the outcome of the treatment:


By accessing patient’s health data in real time information helps to make
decision for the doctor on how the treatment is going on and what should do
next. Over all, this project will enable the physicians to utilize the results from
data collection and analyze that data in real time.

Non expensive:
This project total cost will be less expensive than any other machines which are
used in the hospitals. Moreover, it is compact, lightweight and easy to use.

Communication between doctor and patient:


Health care is all about the patient so the need of the patient always comes first
but it is a matter of fact that most of the patient feel uncomfortable to go to
hospital or visit doctor’s chamber. In this way, this system creates a
communication between patient and doctor by providing the data.

6
‫‪Chapter 1 : Introduction‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Chapter 2‬‬

‫‪Background study and literature review‬‬

‫‪7‬‬
Chapter 2 : Background study and literature review
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

2 Chapter 2 : Background study and literature review

2.1 Introduction

Now-a-days increasing of technologies health experts is taking the great


advantage of these electronic gadgets [4]. IoT (Internet of things) devices are
highly used in medical sector. In this paper, the project is about health
monitoring system. Especially, 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 needed, this hardware device will immediately send the report to
the doctors or intern doctors. Doctors will do their rest of works by their reports.

But in present time, no remote analysis systems for patients available to help the
doctors to track down the progression of the patient's condition or critical events
in rural area [5]. IoT is nothing but an advanced concept of ICT (Information
Communication Technology). [2] Raspberry pi component is more costly than
AVR component device. Technologies are broadly expanded in web based or on
line system [6]. Now- a - days collecting real time is vital. When the critical
condition, patients are discharging from the hospital, he or she needs to check
up in regular basis. That is why IoT based heath monitoring system is best
option for rural area.

The complexity of IoT combined with the high expectations created by the
Internet, Mobile, and 24/7 IT environments has made the need for new analytics
approaches and technologies more urgent. Achieving desired business
objectives requires the ability to act in real-time to take advantage of
opportunities and address problems quickly.

8
Chapter 2 : Background study and literature review
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

In the pre-IoT era, an issue in a typical supply chain scenario could be


addressed in 2-3 days cycles for satisfactory results. But in IoT, time to action is
in minutes, seconds, or microseconds – 30 minutes to provision electric service,
30 seconds to act on information from devices, 5 milliseconds to address a
security breach. This explosion of data and the high expectations in the IoT
environment means the value of data will slip away quickly.

The importance of time-to-action for IoT applications can be seen in a wide


array of applications and use cases. Broadly speaking, these applications can be
grouped into three categories:

1) Operations and fulfillment are a convenient place to prove out efficiency


gains.

2) Customer-focused sales and marketing applications have the potential to


increase customer satisfaction and long-term growth.

3) Innovation in new products and services can drive new revenue and business
value.

There are also specific use cases within these applications:


• Predictive Maintenance • Demand/Supply Optimization
• Predictive 1 to 1 Marketing • Outage Management Addressing the critical
time-to-action requirement for these use cases and applications in IoT demands
an advanced analytics solution that

1) Unifies historical, real-time streaming, predictive, and prescriptive analytics.


2) And provides faster analytics and smarter actions.

9
Chapter 2 : Background study and literature review
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

2.2 Intelligent wireless mobile patient monitoring system

Nowadays, Heart-related diseases are on the rise. Cardiac arrest is quoted as the
major contributor to the sudden and unexpected death rate in the modern stress
filled lifestyle around the globe. A system that warns the person about the onset
of the disease earlier automatically will be a boon to the society. This is
achievable by deploying advances in wireless technology to the existing patient
monitoring system.

This paper proposes the development of a module that provides mobility to the
doctor and the patient, by adopting a simple and popular technique, detecting
the abnormalities in the bio signal of the patient in advance and sending an alert
to the doctor through Global System for Mobile(GSM) thereby taking suitable
precautionary measures thus reducing the critical level of the patient.
Worldwide surveys conducted by World Health Organization (WHO) have
confirmed that the heart-related diseases are on the rise.

Many of the cardiac-related problems are attributed to the modern lifestyles,


food habits, obesity, smoking, tobacco chewing and lack of physical exercises
etc. The post-operative patients can develop complications once they are
discharged from the hospital. In some patients, the cardiac problems may
reoccur, when they start doing their routine work. Hence the ECG of such
patients needs to be monitored for some time after their treatment.

This helps in diagnosing the improper functioning of the heart and take
precautions. Some of these lives can often be saved if acute care and cardiac
surgery is provided within the so-called golden hour. So, the need for advice on
first-hand medical attention and promotion of good health by patient monitoring
and follow-up becomes inevitable. Hence, patients who are at risk require that
their cardiac health to be monitored frequently whether they are indoors or
outdoors so that emergency treatment is possible. Telemedicine is widely
considered to be part of the inevitable future of the modern practice of
medicine.

10
Chapter 2 : Background study and literature review
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

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 a 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. IoT the term was first mentioned by
Kevin Ashtor in 1998. IoT can be divided in three sections.

1. Internet – Oriented Middle ware.


2. Things Sensors Oriented.
3. Knowledge Oriented Semantics.

First as hardware layer which allow the interconnection by using sensors and
technologies. Sensors are used to measure Heart Beat, ECG, and Temperature
etc. The main purpose of this IoT is to improve a solution based on ontology
with ability to monitor the health status. [4]

2.3 Scope and Contents

2.3.1 ECG (Electrocardiograph)

ECG or Electrocardiography is a system which can record and measure the


electrical activity of the heart over a period of time using electrodes on the skin.
Bio monitoring electrodes have passed through a great evolution and progress
from 19th century. In 1883, Carlo Matteucci who was a professor of physics at
the University of Pisa, first time showed and proposed sensors that watch and
monitor the electricity in human body periodically. In 1887, Augustus D.Waller
was presented and published the first human electrocardiogram. He was British
physiologist. In 1901, Willem Einthoven made re infrastructure of Waller’s
technology. Here, he used fine quartz coated with silver in a device which is
called the string galvanometer. Einthoven won noble prize for formulate and
create the electrocardiograph. In present time, bio monitoring electrodes use in
ECG which is made of a plastic substrate covered with a silver chloride ionic
compound.

11
Chapter 2 : Background study and literature review
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

The Ag/Acl electrode is mostly used for all the application in bio medical
electrode system. These electrodes create an electrical potential and ionic
activity in living cells. After connecting the human body, these potentials are
demonstrated on the body surface. [7]

The heart starts activation at sino-atrical node which is build and produces heart
frequency about 70 cycles per minute. This activation generated to the right and
left muscle tissues. There is delay which use to allow the ventricles to fill with
blood from atrial contraction in the ventricular node.
These activities help to pump blood to the aorta and to the rest of the body. At
last, the re polarization happen and the cycle is repeated time after time. When
the cycle take place, the trans membrane potential which measure the voltage
difference between the internal and external spaces of the cell membrane create
a change at each stage. Voltages differences are measured by using the surface
electrodes. These different peaks P, Q, R, S, T and U are detected in these
stages. [8] in figure 1 it’s shown.

Figure 2.3.1 Normal sinus rhythm ECG

12
Chapter 2 : Background study and literature review
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

2.3.2 ECG sensor generated within the body

The heart has four chambers. The upper two chambers (left/right atria) are
section focuses into the heart, while the lower two chambers (left/right
ventricles) are shrinkage chambers sending blood through the course. The
dissemination is splitted into a "circle" through the lungs (aspiratory) and
another "circle" through the body (foundational).

The cardiovascular cycle alludes to an entire pulse from its age to the start of
the following beat, containing a few phases of filling and purging of the
chambers. The frequency of the cardiac cycle is reflected as heart rate (beats per
minute, bpm).

The heart works naturally – it is self-energizing (different muscles in the body


require anxious jolts for excitation). The rhythm of compressions of the heart
happen unexpectedly, yet are touchy to apprehensive or hormonal impacts,
especially to thoughtful (stimulating) and parasympathetic (decelerating) air
conditioning activity.

Figure 2.3.2: Heart Diagram

13
Chapter 2 : Background study and literature review
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

2.3.3 Heart Beat

Heart rate known as pulse rate is the number of times a person’s beat per
minute. Normal heart rate varies from person to person but a normal range for
adults is 60 to 100 beats per minute. Also, normal heart rate depends on the
individual age, body size, heart condition also, the person is sitting or moving,
medication use and even air temperature.

vary heart rate for example getting excited, scared can increase the heart rate.
According to American Herat Association (AHA) well trained athlete may have
a normal heart rate of 40 to 60 beats per minute.

There are 4 steps to measure heart rate:

1) Writs
2) Inside of an elbow
3) Side of the neck
4) Top of the foot

How to measure accurate heart rate: Put two fingers over one of these areas and
count the number of beats in60 seconds. Also measure 20 seconds and multiply
by three which is easier than first step.
Resting heart rate: When a person is in resting mode, it is the best time to
measure heartbeat. According (AHA) for adults and older normal heart rate is
between 60 and 100 beats per minute (bpm). But below 60 (bpm) doesn’t mean
the person has health issue problem. Active people have lower heart rates
because their muscles don’t need to work as hard to maintain a steady beat.

14
Chapter 2 : Background study and literature review
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

Maximum and target heart rate: A person’s target heart rate zone is between 50
percent and 85 percent of his or her maximum heart rate. According to (AHA)
30-year-old person would be between 50 and 85 percent of his or her max heart
rate. [9]

Table 2.3.3: Rate of heartbeat per minute

2.3.4 ATmega128A

ATmega128A is a low-power CMOS 8-bit microcontroller based


on the AVR® enhanced RISC architecture. By executing powerful instructions
in a single clock cycle, the ATmega128A achieves throughputs close to
1MIPS per MHz This empowers system designer to optimize the device for
power consumption versus processing speed.

15
Chapter 2 : Background study and literature review
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

2.3.5 Communication between Hardware and Software

In this project, communication between hardware and software in serial data


communication is used. Serial data communication uses two methods.

1) Synchronous
2) Asynchronous

In where, synchronous method transfers a block of data at a time. Asynchronous


method transfers a single byte at a time. It is possible to write software to use
either of the methods. The program can be tedious and long that’s why special
IC chips is made by many manufactures for serial data communication. These
chips are commonly referred to as Universal Asynchronous Transmitter /
Receiver (UART).

16
‫‪Chapter 2 : Background study and literature review‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Chapter 3‬‬

‫‪A proposed model‬‬

‫‪17‬‬
Chapter 3 : A proposed model
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

3 Chapter 3 : A proposed model

3.1 Working methodology

The system consists of six major embedded electronics.

1. ECG Sensor
2. Heart Beat Sensor
3. Temperature sensor
4. GPS module
5. GSM Module
6. Atmega128A
7. LCD Display
8. Keypad

For power on, 12-volt adapter is using with microcontroller and 5-volt adapter
attached with GSM module externally. Patient will touch the heart beat sensor,
and then the IR sensor’s ray will count the beat from blood flow. After counting
beat from blood flow, we will push the button H-Beat and wait for 20 seconds.
The result will upload and the heart beat value will show in LCD display. For
implement the function of ECG sensor, the sensor will be attached with
patient’s chest and push the button ‘ECG’. In the meanwhile, it will generate the
ECG curve. After that, the curve will upload web page. Similarly, GPS module
and Temperature sensor will make measurements and display it to LCD then
GSM module will send all data to web server .

18
‫‪Chapter 3 : A proposed model‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Figure 3.1 Working Flow Diagram‬‬

‫‪19‬‬
Chapter 3 : A proposed model
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

3.2 Workflow Electrical Components Control Unit

The Atmel AVR core combines a rich instruction set with 32 general purpose
working registers. All the 32 registers are directly connected to the Arithmetic
Logic Unit (ALU), allowing two independent registers to be accessed in one
single instruction executed in one clock cycle. The resulting architecture is more
code efficient while achieving throughputs up to ten times faster than
conventional CISC microcontrollers.

The Power-down mode saves the register contents but freezes the Oscillator,
disabling all other chip functions until the next interrupt or Hardware Reset. In
Power-save mode, the asynchronous timer continues to run, allowing the user to
maintain a timer base while the rest of the device is sleeping. The ADC Noise
Reduction mode stops the CPU and all I/O modules except Asynchronous
Timer and ADC, to minimize switching noise during ADC conversions. In
Standby mode, the Crystal/Resonator Oscillator is running while the rest of the
device is sleeping. This allows very fast start-up combined with low power
consumption. In Extended Standby mode, both the main Oscillator and the
Asynchronous Timer continue to run.

It can be connected to a computer with a USB cable or power it with an AC to


DC adapter or battery to get started. It features the Atmega 8 U2 programmed as
a USB to serial converter. MCU board can be powered via the USB connection
or with an external power supply. The power source is selected automatically.

In this project power adapter is 5v 2amp. From those power sources heart beat
sensor is getting 5 v. 3.3 v power is driven in ECG sensor if more power is
driven in the ECG sensor it will get damage. The GSM module is driven by 5v.

20
Chapter 3 : A proposed model
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

3.3 System Model

Our project is comprised of both hardware and software. In hardware part,


heartbeat, ECG and Body temperature sensors are used. Therefore,
microcontroller integrates with the GSM Module. When the sensors measures
are done, GSM module helps to upload it in Web server. Moreover, LCD
displays the results too.

Figure 3.3(a): System model for Temperature & Heart Beat sensor

21
‫‪Chapter 3 : A proposed model‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Figure 3.3(b): System model for ECG sensor‬‬

‫‪22‬‬
‫‪Chapter 3 : A proposed model‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Chapter 4‬‬

‫‪Implementation‬‬

‫‪23‬‬
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4 Chapter 4 : Implementation

4.1 Hardware Implementation

To run the system first we need to connect components with the power supply
as atmega is the main control unit. In input side, we have heartbeat sensor,
Temperature sensor, ECG sensor and some manual buttons. On the other hand,
output is shown in the LCD display. Moreover, GSM Module helps to send data
in 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, a finger is placed in the heartbeat sensor and another one for body
temperature and push button is also pressed so that the system can read data.
After that, it shows result in the LCD display. Also, by pressing the push button,
it can upload the output in webpage through GSM module. Similar process is
done with the ECG sensor but instead of placing a finger, 3 electro pads are
placed in the body and the data reading is taken but LCD display is unable to
show the ECG result in its display as the characters are too long. For this case,
by pressing push button, data is sent through GSM module and shows the ECG
curve in the Web page.

GPS module providing location with longitude ana latitude either in LCD and
web server too .Keypad is used to enter SSN or patient ID .This is all about the
block diagram which shows the entire process of hardware in figure below .

24
‫‪Chapter 4 : Implementation‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Heart beat‬‬
‫‪Finger‬‬ ‫‪LCD display‬‬
‫‪sensor‬‬

‫‪TEMP.‬‬
‫‪sensor‬‬ ‫‪GSM module‬‬

‫‪Atmega128‬‬

‫‪Body‬‬ ‫‪ECG‬‬
‫‪sensor‬‬

‫‪laptop‬‬

‫‪Keypad‬‬

‫‪GPS‬‬

‫‪Power‬‬
‫‪adapter‬‬

‫‪Figure 4.1 Block diagram of Hardware Implementation‬‬

‫‪25‬‬
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.2 Components

To begin with the project, it is very important to know all the information about
both hardware specifications. The components we are using are as follows:

1) Atmega128 microcontroller
2) SIM 900 GSM MODULE
3) GPS MODULE
4) ECG sensor
5) Heartbeat sensor
6) Body Temperature sensor
7) PCB board
8) Power adapter
9) LCD (20*4)
10) Keypad (4*4)
11) Jumper wires
12) Laptop/ computer
13) LED
14) Button

4.2.1 Atmega128

ATmega128A is a low-power CMOS 8-bit microcontroller based


on the AVR® enhanced RISC architecture. By executing powerful instructions
in a single clock cycle, the ATmega128A achieves throughputs close to
1MIPS per MHz This empowers system designer to optimize the device for
power consumption versus processing speed.

26
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

Features

• High-performance, Low-power Atmel AVR 8-bit Microcontroller

• Advanced RISC Architecture


– 133 Powerful Instructions - Most Single-clock Cycle Execution
– 32 × 8 General Purpose Working Registers + Peripheral Control Registers
– Fully Static Operation
– Up to 16MIPS Throughput at 16MHz
– On-chip 2-cycle Multiplier

• High Endurance Non-volatile Memory segments


– 128Kbytes of In-System Self-programmable Flash program memory
– 4Kbytes EEPROM
– 4Kbytes Internal SRAM

• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
– Two Expanded 16-bit Timer/Counters with Separate Prescaler, Compare

• Mode and Capture Mode


– Real Time Counter with Separate Oscillator
– Two 8-bit PWM Channels
– 6 PWM Channels with Programmable Resolution from 2 to 16 Bits
– Output Compare Modulator
– 8-channel, 10-bit ADC

• I/O and Packages


– 53 Programmable I/O Lines
– 64-lead TQFP and 64-pad QFN/MLF

• Operating Voltages
– 2.7 - 5.5V

• Speed Grades
– 0 - 16MHz

27
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.2.2 SIM 900 GSM Module

The GPRS Shield provides a way to use the GSM cell phone network to receive
data from a remote location. The shield allows achieving this via any of the
three methods which are: short Message Service, audio and GPRS Service. The
GPRS Shield is compatible with all boards which have the same form factor
(and pin out) as a standard Arduino Board. The GPRS Shield can be configured
and controlled through UART by simple AT commands. Based on the SIM900
module from SIMCOM, the GPRS Shield is like a cell phone. Besides the
communications features, the GPRS Shield has 12 General purpose input output
pins, 2 PWMs and an ADC (Analog to digital Converter).

Figure 4.2.2 SIM 900 GSM Modules

28
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.2.3 ECG Sensor

An ECG Sensor with disposal electrodes attaches directly to the chest to detect
every heartbeat. The electrodes of ECG sensor will convert heart beat to electric
signal. ECG sensor is very light weight, slim and accurately to measures
continuous heart beat and shows data rate of heart beat. The AD8232 is a little
chip used to measure the electrical activity of the heart. The electrical activity
can be charted as an ECG or Electrocardiogram. Electrocardiography is used to
help diagnose various heart conditions.

Features
The AD8232 heart monitor has 9 connection pins in the IC. They are Ground
(GD), 3.3 V power supply, output signal, leads of detect (LO -), leads of detect
(LO+), shutdown (SDN), Ra (input 1), LA (input 2), RL (input 3). This kit has
also 3 cables.

Figure 4.2.3 ECG sensor

29
‫‪Chapter 4 : Implementation‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪4.2.4 Power Adapter‬‬

‫‪In order to run our project, we need a power adapter which are: 5V 2A power‬‬
‫‪adapter. To connect with microcontroller and to connect with GSM module we‬‬
‫‪are using 5V 2A power adapter.‬‬

‫‪Figure 4.2.4 Power Adapter‬‬

‫‪30‬‬
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.2.5 LCD Display

In 20*4 LCD is named because it has 20 columns and 4 rows. It is a very


important device in embedded system and used to display information required.
It is a character display. Moreover, it has 16 pins including supply power +5V
and optional supply power +3V.

Features

▪ High contrast STN 20x4 character LCD


▪ White text on blue background
▪ Single +5.0V supply operation
▪ LED backlight
▪ 5x8 dot characters
▪ HD44780 equivalent controller

Figure 4.2.5 LCD Display 20*4

31
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.2.6 Jumper Wire

Jumper wires are used for making connections between items on the PCB and
microcontroller’s header pins. It is required to use them to wire up all the
circuits.

Figure 4.2.6 Jumper Wire

4.2.7 Laptop

In order to do coding, monitor data and develop web server we need a laptop.

Figure 4.2.7 Laptop

32
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.2.8 LED

Light emitting diode is a two-lead semiconductor light source. It is a P-N


junction diode that emits light when activated. When a suitable current is
applied to the leads, electrons are able to recombine with electron holes within
the device, releasing energy in the form of photons. The benefits of LED’s are
low power requirement, high efficiency and long life.

Figure 4.2.8: LED Lights

4.2.9 Push Button

Push button is a kind of switch which is used for controlling a process. Buttons
are usually made of plastic or metal. It can connect two points in a circuit when
someone presses it. When button is not pressed it is open because there is no
connection between the two legs of the push button and reading will be high.
When the button is pressed, it is closed and reading will be low because it
makes a connection between two legs and connect pin to ground. One point is
connected with 12v and another point of the resistor is connecting 10kΩ resistor
with the ground.

Figure 4.2.9: Push Button

33
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.2.10 GPS Module

GPS receiver module gives output in standard (National Marine Electronics


Association) NMEA string format. It provides output serially on Tx pin with
default 9600 Baud rate.
This NMEA string output from GPS receiver contains different parameters
separated by commas like longitude, latitude, altitude, time etc. Each string
starts with ‘$’ and ends with carriage return/line feed sequence.

E.g.

$GPGGA,184237.000,1829.9639,N,07347.6174,E,1,05,2.1,607.1,M,-64.7,M,,0000*7D

VCC: Power Supply 3.3 – 6 V

GND: Ground

TX: Transmit data serially which gives information about location, time etc.

RX: Receive Data serially. It is required when we want to configure GPS module.

Figure 4.2.10 GPS module

34
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.2.11 Body Temperature Sensor

This is human body temperature sensor. It can be applied to skin surface and
indicate the body temperature after reaching steady state. The sensor is accurate
and stable and comply with medical certification. It can be used in many
applications such as child incubators, patient monitoring and medical research
labs.

Specifications
▪ Accuracy: +/- 0.4%
▪ Resistance: 2.25 Kohm at 25 C
▪ Cable Length: 3 meters
▪ Time constant: 7 second (sensor require about 5 time constant for
stability to read 99%)
▪ Temperature range: -40 to 100 C
▪ Certification: CE,ISO13485

Figure 4.2.11 Body Temperature Sensor

35
‫‪Chapter 4 : Implementation‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪4.2.12 Keypad‬‬

‫‪The 4*4 matrix keypad usually is used as input in a project. It has 16 keys in‬‬
‫‪total, which means the same input values. Keypad in this project used to enter‬‬
‫‪SSD or ID for patient .‬‬

‫‪Figure 4.2.12 Keypad‬‬

‫‪36‬‬
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.2.13 Heart beat sensor

Heart beat sensor is designed to give digital output of heat beat when a finger is
placed on it. When the heart beat detector is working, the beat LED flashes in
unison with each heartbeat. This digital output can be connected to
microcontroller directly to measure the Beats Per Minute (BPM) rate. It works
on the principle of light modulation by blood flow through finger at each pulse.

FEATURES

▪ Heart beat indication by LED


▪ Instant output digital signal for directly connecting to microcontroller
▪ Compact Size
▪ Working Voltage +5V DC

Figure 4.2.13 Heart beat sensor

37
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.3 Software implementation & Hardware connection

4.3.1 GPS

Figure 4.3.1 GPS Connection with microcontroller

………………….
…………………..
……………………..
/* convert raw latitude/longitude into degree format */
decimal_value = (value/100);
degrees = (int)(decimal_value);
temp = (decimal_value - (int)decimal_value)/0.6;
position = (float)degrees + temp;

38
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

dtostrf(position, 6, 4, degrees_buffer); /* convert float value


into string */
}

void gbs_main() {
GGA_Index=0;
memset(GGA_Buffer, 0, Buffer_Size);
memset(degrees_buffer,0,degrees_buffer_size);

LCD_Init(); /* initialize LCD16x2 */


_delay_ms(3000); /* wait for GPS receiver to initialize */
USART_Init(9600); /* initialize USART with 9600 baud rate */
sei();
LCD_Clear();
while (1)
{
_delay_ms(1000);
LCD_String_xy(1,0,"UTC Time: ");
get_gpstime(); /* Extract Time in UTC */
LCD_String(Time_Buffer);
LCD_String(" ");

LCD_String_xy(2,0,"Lat: ");
get_latitude(GGA_Pointers[0]); /* Extract Latitude */
LCD_String(degrees_buffer) /* display latitude in degree */
memset(degrees_buffer,0,degrees_buffer_size);

LCD_String_xy(3,0,"Long: ");
get_longitude(GGA_Pointers[2]); /* Extract Longitude */
LCD_String(degrees_buffer) /* display longitude in
degree */
memset(degrees_buffer,0,degrees_buffer_size);

LCD_String_xy(4,0,"Alt: ");
get_altitude(GGA_Pointers[7]); /* Extract Altitude in
meters*/
LCD_String(Altitude_Buffer);
}
}

39
‫‪Chapter 4 : Implementation‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪4.3.2 GSM‬‬

‫‪Figure 4.3.2 GSM Connection with microcontroller‬‬

‫‪………….‬‬
‫‪………….‬‬
‫‪………..‬‬

‫)(‪void gsm_main‬‬
‫{‬
‫;]‪char _buffer[100‬‬

‫‪#ifdef POST_DEMO‬‬
‫;‪uint8_t Sample = 0‬‬
‫‪#endif‬‬

‫‪40‬‬
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

USART_Init(9600); /* Initiate USART with 9600 baud rate */


sei(); /* Enable global interrupt */
while(!SIM900HTTP_Start());
while(!(SIM900HTTP_Connect(APN, USERNAME, PASSWORD)));
SIM900HTTP_Init();

while(1)
{
if (!HTTP_Connected()) /* Check whether gsm connected */
{
SIM900HTTP_Connect(APN, USERNAME, PASSWORD);
SIM900HTTP_Init();
}

/* Take local buffer to copy response from server */


uint16_t responseLength = 100;

#ifdef POST_DEMO /* POST Sample data on server */


memset(_buffer, 0, 100);
HTTP_SetURL(URL); HTTP_Save();
sprintf(_buffer, "api_key=%s&field1=%d", API_WRITE_KEY,
Sample++);
HTTP_Post(_buffer, responseLength);
_delay_ms(15000); /* server delay */
#endif

#ifdef GET_DEMO /* GET last sample data from server */


memset(_buffer, 0, 100);
sprintf(_buffer, "api.thingspeak.com/channels/%s/feeds/last.
txt", CHANNEL_ID);
HTTP_get(_buffer, responseLength);
#endif
}
}

………
………
………

41
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.3.3 Heart beat

Figure 4.3.3 Heart Beat Connection with microcontroller

……….
………..
…………

void PulseSensor::begin(int pPin)


{
pinMode(pulsePin, INPUT);
pulsePin = pPin;

// Initializes Timer1 to throw an interrupt every 2ms.


TCCR1A = 0x00;
TCCR1B = 0x0C; // CTC (Compare match mode) and ClockIO/256
OCR1A = 0x7C; // 2 ms
TIMSK1 = 0x02;

42
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

sei(); // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED


}

// THIS IS THE TIMER 1 INTERRUPT SERVICE ROUTINE.


// Timer 1 makes sure that we take a reading every 2 milliseconds
ISR(TIMER1_COMPA_vect)
{ // triggered when Timer1 counts to 124
cli(); // disable interrupts while we
do this
PulseSensor::Signal = analogRead(pulsePin); // read
the Pulse Sensor
sampleCounter += 2; // keep track of the
time in ms with this variable
int N = sampleCounter -
lastBeatTime; // monitor the time since the last beat to avoid
noise

// find the peak and trough of the pulse wave


if(PulseSensor::Signal < thresh && N > (PulseSensor::IBI/5)*3){
// avoid dichrotic noise by waiting 3/5 of last IBI
if (PulseSensor::Signal < T){ // T is the
trough
T = PulseSensor::Signal; // keep track
of lowest point in pulse wave
}

if(PulseSensor::Signal > thresh && PulseSensor::Signal > P){


// thresh condition helps avoid noise

P = PulseSensor::Signal; // P is the
peak
} // keep track of highest point in
pulse wave

…………….
…………….
…………….

43
‫‪Chapter 4 : Implementation‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪4.3.4 Keypad‬‬

‫‪Figure 4.3.4 Keypad Connection with microcontroller‬‬

‫‪…….‬‬
‫‪…….‬‬
‫‪……..‬‬
‫‪#define KEY_PRT‬‬ ‫‪PORTD‬‬
‫‪#define KEY_DDR‬‬ ‫‪DDRD‬‬
‫‪#define KEY_PIN‬‬ ‫‪PIND‬‬

‫‪unsigned char keypad[4][4] = { {'7','8','9','/'},‬‬


‫‪{'4','5','6','*'},‬‬
‫‪{'1','2','3','-'},‬‬
‫;}}'‪{' ','0','=','+‬‬

‫;‪unsigned char colloc, rowloc‬‬

‫‪44‬‬
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

char keyfind()
{
while(1)
{
KEY_DDR = 0xF0; /* set port direction as
input-output */
KEY_PRT = 0xFF;

do
{

KEY_PRT &= 0x0F; /* mask PORT for column read


only */
asm("NOP");
colloc = (KEY_PIN & 0x0F); /* read status of column */
}while(colloc != 0x0F);

do
{
do
{
_delay_ms(20); /* 20ms key
debounce time */
colloc = (KEY_PIN & 0x0F); /* read status of
column */
}while(colloc == 0x0F); /* check for any key
press */

_delay_ms (40); /* 20 ms key debounce time


*/
colloc = (KEY_PIN & 0x0F);
}while(colloc == 0x0F);

/* now check for rows */


KEY_PRT = 0xEF; /* check for pressed key in
1st row */
asm("NOP");
colloc = (KEY_PIN & 0x0F);
if(colloc != 0x0F)
{
rowloc = 0;
break;
}
……………
……………
……………

45
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

4.3.5 LCD

Figure 4.3.5 LCD Connection with microcontroller

……..
……..
……..

void LCD_Init (void) /* LCD Initialize function */


{
LCD_Command_Dir = 0xFF; /* Make LCD command port direction
as o/p */
LCD_Data_Dir = 0xFF; /* Make LCD data port direction as
o/p */
_delay_ms(20); /* LCD Power ON delay always >15ms */

LCD_Command (0x38); /* Initialization of 16X2 LCD in 8bit


mode */
LCD_Command (0x0C); /* Display ON Cursor OFF */
LCD_Command (0x06); /* Auto Increment cursor */
LCD_Command (0x01); /* Clear display */

46
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

LCD_Command (0x80); /* Cursor at home position */


}

void LCD_String (char *str) /* Send string to LCD function */


{
int i;
for(i=0;str[i]!=0;i++) /* Send each char of string till the
NULL */
{
LCD_Char (str[i]);
}
}

void LCD_String_xy (char row, char pos, char *str)/* Send string to
LCD with xy position */
{
if (row == 0 && pos<16)
LCD_Command((pos & 0x0F)|0x80); /* Command of first row and
required position<16 */
else if (row == 1 && pos<16)
LCD_Command((pos & 0x0F)|0xC0); /* Command of first row and
required position<16 */
LCD_String(str); /* Call LCD string function */
}

void LCD_Clear()
{
LCD_Command (0x01); /* clear display */
LCD_Command (0x80); /* cursor at home position */
}

………………
………………
………………

47
‫‪Chapter 4 : Implementation‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪4.3.6 Body Temperature sensor‬‬

‫‪Figure 4.3.6 Body Temperature sensor Connection with microcontroller‬‬

‫‪48‬‬
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

………
………
………

void ADC_main()
{
char Temp[10];
float celsius,eeg_rate;

//LCD_Init(); /* initialize 16x2 LCD*/


//ADC_Init(); /* initialize ADC*/

//LCD_String_xy(1,0,"Temp");
celsius = (ADC_Read(0)*4.88);
celsius = (celsius/10.00);

//sprintf(Temperature,"%d%cC", (int)celsius, degree_sysmbol);


/* convert integer value to ASCII string */
//LCD_String_xy(2,0,Temp); /* send string data for printing */

//_delay_ms(1000);
//memset(Temperature,0,10);
eeg_rate = (ADC_Read(0)*4.88);
DATA_FRAME[4]=celsius;
DATA_FRAME[5]=eeg_rate;
}

……..
……..
……..

49
‫‪Chapter 4 : Implementation‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪4.3.7 ECG‬‬

‫‪Figure 4.3.7 ECG Connection with microcontroller‬‬

‫‪50‬‬
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

………………….
…………………..
………………….

PulseSensor::Signal = analogRead(pulsePin); // read


the Pulse Sensor
sampleCounter += 2; // keep track of the
time in ms with this variable
int N = sampleCounter -
lastBeatTime; // monitor the time since the last beat to
avoid noise

// find the peak and trough of the pulse wave


if(PulseSensor::Signal < thresh && N > (PulseSensor::IBI/5)*3){
// avoid dichrotic noise by waiting 3/5 of last IBI
if (PulseSensor::Signal < T){ // T is the
trough
T = PulseSensor::Signal; // keep track
of lowest point in pulse wave
}
}

if(PulseSensor::Signal > thresh && PulseSensor::Signal > P){


// thresh condition helps avoid noise
P = PulseSensor::Signal; // P is the
peak
} // keep track of highest point in
pulse wave

// NOW IT'S TIME TO LOOK FOR THE HEART BEAT


// signal surges up in value every time there is a pulse
if (N > 250){ // avoid high
frequency noise
if ( (PulseSensor::Signal > thresh) && (Pulse == false) && (N >
(PulseSensor::IBI/5)*3) )
{
Pulse = true; // set the Pulse flag
when we think there is a pulse
PulseSensor::IBI = sampleCounter -
lastBeatTime; // measure time between beats in mS
lastBeatTime = sampleCounter; // keep track of time for
next pulse

if(secondBeat){ // if this is the

51
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

second beat, if secondBeat == TRUE


secondBeat = false; // clear secondBeat flag
for(int i=0; i<=9; i++){ // seed the running total
to get a realisitic BPM at startup
rate[i] = PulseSensor::IBI;
}
}

if(firstBeat){ // if it's the first time


we found a beat, if firstBeat == TRUE
firstBeat = false; // clear firstBeat flag
secondBeat = true; // set the second beat
flag
sei(); // enable interrupts
again
return; // IBI value is unreliable so
discard it
}

// keep a running total of the last 10 IBI values


word runningTotal = 0; // clear the runningTotal
variable

52
‫‪Chapter 4 : Implementation‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪4.3.8 All system connection‬‬

‫‪Figure 4.3.8 System connection with all parts‬‬

‫‪53‬‬
Chapter 4 : Implementation
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

#define F_CPU 16000000UL /* Define CPU clock */


#include <avr/io.h> /* Include AVR std. library file */
#include <string.h> /* Include string library */
#include <stdio.h> /* Include standard IO library */
#include <stdlib.h> /* Include standard library */
#include <stdbool.h> /* Include standard boolean library */
#include <util/delay.h> /* Include delay header file */
#include <avr/interrupt.h> /* Include avr interrupt header file */
#include "USART_RS232_H_file.h" /* Include USART header file */
#include "LCD16x2_4bit.h" /* Include LCD.4bit header file */
#include "LCD_4BIT.c" /* Include KEYPAD NID SOURCE */
#include "HTTP_GSM.c" /* Include GSM MODULE SOURCE */
#include "GPS_SERIAL.c" /* Include GPS MODULE SOURCE */
#include "ADC_SEN.c" /* Include ADC SENSORS SOURCE */
#include "KPAD.c" /* Include KEYPAD NID SOURCE */

unsigned int CAR_ID=693;


extern char DATA_FRAME_1[20],DATA_FRAME_2[20];
extern int SP_ID=0,flag=0,T_HR=00,T_MIN=00;

int main(){
SP_ID++;
interruptsInit();
USART1Init();
SIM900HTTP_Start();
SIM900HTTP_Connect();
_delay_ms(3000); /* wait for GSM to CONNECT HTTP */
LCD_Init ();
LCD_String ("System Starting...");
_delay_ms(3000); /* wait for system to be stable */
LCD_CLEAR();
LCD_String ("Enter Petient ID:");
_delay_ms(1500);
kpad_main(); /* getting NATIONAL ID */
gsm_post(DATA_FRAME_2)
while(flag==0);

while(1){
flag=0;
SP_ID++;
gbs_main(); /* getting location */
ADC_main(); /* getting Senseors values */
_delay_ms(1500);
gsm_post(DATA_FRAME_1);
while(flag==0);
}
}

54
‫‪Chapter 4 : Implementation‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Chapter 5‬‬

‫‪Web server‬‬

‫‪55‬‬
Chapter 5 : Web server
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

5 Chapter 5 : Web server

5.1 Introduction

The whole web Server system the we are making is using the Python
Programing language which make it easy in terms of programming and
deployment

By using Python’s Web Framework, we can Structure , Build , Deploy and


maintain the web server for our project , one of these frameworks is called
Django we can easily start building the framework which mostly built by
Django already , Django is a high-level Python Web framework that encourages
rapid development and clean, pragmatic design. Built by experienced
developers, it takes care of much of the hassle of Web development, so you can
focus on writing your app without needing to reinvent the wheel. It's free and
open source.

5.2 What is Django?

Django is a free and open source web application framework, written in Python.
A web framework is a set of components that helps you to develop websites
faster and easier.
When you're building a website, you always need a similar set of components: a
way to handle user authentication (signing up, signing in, signing out), a
management panel for your website, forms, a way to upload files, etc.

Luckily for you, other people long ago noticed that web developers face similar
problems when building a new site, so they teamed up and created frameworks
(Django being one of them) that give you ready-made components to use.
Frameworks exist to save you from having to reinvent the wheel and to help
alleviate some of the overhead when you’re building a new site.

56
Chapter 5 : Web server
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

5.3 Why do you need a framework?

To understand what Django is actually for, we need to take a closer look at the
servers. The first thing is that the server needs to know that you want it to serve
you a web page.

Imagine a mailbox (port) which is monitored for incoming letters (requests).


This is done by a web server. The web server reads the letter and then sends a
response with a webpage. But when you want to send something, you need to
have some content. And Django is something that helps you create the content.

5.4 framework

Any website framework is consisted of two parts :

• The Front-End ; The front end of a website is the part that users interact
with. Everything that you see when you’re navigating around the Internet,
from fonts and colors to dropdown menus and sliders, is a combo of
HTML, CSS, and JavaScript being controlled by your computer’s
browser.

• The Back-End ; The back end of a website consists of a server, an


application, and a database. A back-end developer builds and maintains
the technology that powers those components which, together, enable the
user-facing side of the website to even exist in the first place.

To make the process of structuring the Web Server , we are going to use
a paradigm (Application Design Model) called Model-View-Controller or
MVC for short

57
Chapter 5 : Web server
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

5.5 MVC

Model–view–controller (usually known as MVC) is a software design pattern


commonly used for developing user interfaces that divides the related program
logic into three interconnected elements. This is done to separate internal
representations of information from the way’s information is presented to and
accepted from the user. This kind of pattern is used for designing the layout of
the page.

Traditionally used for desktop graphical user interfaces (GUIs), this pattern has
become popular for designing web applications. Popular programming
languages like JavaScript, Python, Ruby, PHP, Java, C#, and Swift have MVC
frameworks that are used for web or mobile application development straight
out of the box.

Figure 5.5 MVC Model

58
Chapter 5 : Web server
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

5.5.1 Model

The central component of the pattern. It is the application's dynamic data


structure, independent of the user interface.[5] It directly manages the data,
logic and rules of the application.

5.5.2 View

Any representation of information such as a chart, diagram or table. Multiple


views of the same information are possible, such as a bar chart for management
and a tabular view for accountants.

5.5.3 Controller

Accepts input and converts it to commands for the model or view.


In addition to dividing the application into these components, the model–view–
controller design defines the interactions between them.

• The model is responsible for managing the data of the application. It


receives user input from the controller.

• The view means presentation of the model in a particular format.

• The controller responds to the user input and performs interactions on the
data model objects. The controller receives the input, optionally validates
it and then passes the input to the model.

As with other software patterns, MVC expresses the "core of the solution" to a
problem while allowing it to be adapted for each system. Particular MVC
designs can vary significantly from the traditional description here.

59
Chapter 5 : Web server
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

5.6 Web Server implementation

Figure 5.5 Server Framework

1. The doctor accesses the web server as a client requests the patient’s
telemetry on the database .

2. The web server directs the request the in a public manner to Rails
framework which contain the routing and MVC Application Design

3. The controller receives the request and process the request as a (get) then
send it to the model to handle the rest

4. When the Model receive the get request goes to the database which is
automatically built by Django and fetch the desired information and
forward it back to the model

5. Then the model sends the information to the controller which will process
and handle the information .

6. The view receives the info from the controller as (POST) to make it into a
presentable form that the use (doctor ) may understand which usually in
HTML and CSS language combined (web page ).

7. Lastly the controller sends the webpage to the browser where the client
(doctor ) can read .

60
Chapter 5 : Web server
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

5.7 Files of the application

➢ Models.py contains of the Models used to control the designated Data


individually
(put, post, get, delete )

➢ admin.py file is used to display your models in Django admin panel also
you can customize your admin panel using admin.py file

➢ Views.py contains definitions for the templates and how to control them

➢ Test.py used to make tests, the default behavior of the test utility is to
find all the test cases

➢ Migrations are Django’s way of propagating changes you make to your


models (adding a field, deleting a model, etc.) into your database
schema.

Table 5.7 Pieces of APP.

61
‫‪Chapter 5 : Web server‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪5.8 Server rendering‬‬

‫‪Figure 5.8(a) Home page‬‬

‫‪Figure 5.8(b) Login page‬‬

‫‪62‬‬
‫‪Chapter 5 : Web server‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Figure 5.8(c) Patient information‬‬

‫‪Figure 5.8(d) Car or Device location‬‬

‫‪63‬‬
‫‪Chapter 5 : Web server‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Figure 5.8(e) Heart beat graph‬‬

‫‪64‬‬
‫‪Chapter 5 : Web server‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Figure 5.8(f) Entire details for patient‬‬

‫‪65‬‬
‫‪Chapter 5 : Web server‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Chapter 6‬‬

‫‪Real time implementation with Results‬‬

‫‪66‬‬
‫‪Chapter 6 : Real time implementation with Results‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪6 Chapter 6 : Real time implementation with Results‬‬

‫‪Figure 6(a) Hardware setup‬‬

‫‪Figure 6(b) GPS Testing‬‬

‫‪67‬‬
‫‪Chapter 6 : Real time implementation with Results‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Figure 6(c) Keypad test‬‬

‫‪Figure 6(d) Sending data process‬‬

‫‪68‬‬
‫‪Chapter 6 : Real time implementation with Results‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Figure 6(e) Receiving data at serial monitor‬‬

‫‪Figure 6(f) Sending Done‬‬

‫‪69‬‬
Chapter 6 : Real time implementation with Results
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

Figure 6(g) Receiving data at backend server

6.1 Performance & Evaluation

Performance of the system can be determined based on the system


responsiveness under all kinds of load. Performance testing in IoT framework is
little different than traditional performance testing. IoT devices generates a lot
of data which is saved in server and analyzed for immediate decisions. Hence
IoT system must be built for high performance and scalability. And to measure
these two key attributes, it is important to understand the business value for
which it is build i.e. in our case patient health data. Hence it is necessary to
simulate real world models, network conditions etc.

6.1.1 Performance Testing Challenges in IoT

1) IoT does not have a standard protocol set to establish a connection


between IoT application and devices. IoT protocols used range from
HTTP, MQTT, AMQP and more. These protocols are still in early phases
of development and different IoT vendors come up specific protocol
standards. Since these are new protocols, current performance testing
tools may or may not support them.

70
Chapter 6 : Real time implementation with Results
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

2) IoT devices or sensors spread across different places and use different
network to connect to servers to send and receive data. we can simulate
devices from different locations using different networks such as 2G, 3G,
4G, Bluetooth, WIFI etc.

3) Sometimes IoT implementations require the data from device that needs
to be processed at runtime and based on data received, corresponding
decision to be made. These decisions are generally notifications or alerts,
these notifications are to be monitored i.e. time taken to generate the
notification.

Performance testing approach on IoT


Framework
Section IoT PT

Simulation On devices or sensors

Scale Few devices to thousands of devices

Protocols IoT uses non-standard and new protocols to


communicate
Requests/Response IoT devices create the requests and receive
response as well as request and provide response

Amount of data Sends and receives minimal data per request but
data is shared continuously with time interval

Table 6.1.1: Performance test on IoT framework

71
‫‪Chapter 6 : Real time implementation with Results‬‬
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

‫‪Chapter 7‬‬

‫‪Conclusion‬‬

‫‪72‬‬
Chapter 7 : Conclusion
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

7 Chapter 7 : Conclusion

In general, IoT based health care platform which connects with smart sensors
attach with human body for health monitoring for daily checkup. In this report
we discussed about IoT based patient monitoring system. The system
technologies being used by smart phones or gadgets in present time where we
also mentioned about advantages, challenges and opportunities. Due to the
importance of observing medical patient, continuous remote monitoring is
necessary. Our project work is giving the opportunity to monitor patient
continuously by using the web service . This report also compared the early
aged medical system between present time health monitoring. The present time
represents the time reducing, reduce health care cost especially for rural area
people.

7.1 Future Plan

In our proposed system we monitor the patient condition especially elder


patients but, in the future, we will upgrade both hardware and software part. In
hardware part, we will measure blood pressure of the patient so for this we will
need the sensor. Also, person fall detection feature will be added which would
be beneficial to older people Moreover video live monitoring will be added
In software segment we will upgrade the Website and develop the Apps. We
will build a user-friendly feature in the website which will show the patient
name, date and time description in the ECG segment automatically.

Similarly, Apps will be built and uploaded in the store. Therefore, people will
get the opportunity to download the Apps from Google Play Store and install it
in their Mobile phone. And starting to send SMS alert to patient relatives with
location by receiving SMS or notification alert doctors and relatives can take
necessary action. it saves lives in case of emergency.
Due to the importance of observing medical state of patients who are suffering
from acute diseases , a continuous remote patient monitoring is essential.
Internet of Things is able to provide tools to build comprehensive services.

73
References
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬

References

[1] Iman Azimi, Arman Anzanpour, Amir M. Rahmani, Pasi Liljeberg, Tapio Salakoski,
“Medical Warning System Based on Internet of Things Using Fog Computing”.

[2] Vivek Pardeshi, Saurabh Sagar, Swapnil Murmurwar, Pankaj Hage, “Health
Monitoring Systems using IoT and Raspberry Pi – A Review”.

[3] S.Lavanya, G.Lavanya, J.Divyabharathi, “REMOTE PRESCRIPTION AND I-


HOME HEALTHCARE BASED ON IoT”.

[4] https://ac.els-cdn.com/S18770506301260/1-s2.0-S1877050916301260-
main.pdf?_tid=dcbc873b-3c7a-4fea-8d41-
f4c25d549727&acdnat=1521015990_964ce32f5ddee49a5b9eb8f73c99179f

[5] R.N. Kirtana, Y.V. Lokeswari, “An IoT Based Remote HRV Monitoring System For
Hypertensive Patients”.

[6] Ruhani Ab. Rahman, Nur Shima Abdul Aziz, Murizah Kassim, Mat Ikram Yusof,
“IoT- based Personal Health Care Monitoring Device for Diabetic Patients”.

[7] https://www.eeworldonline.com/a-brief-look-at-ecg-sensor-technology/

[8] Dhvani Parekh, “Designing Heart Rate, Blood Pressure and Body Temperature
Sensors for Mobile On-Call System”.

[9] https://www.livescience.com/42081-normal-heart-rate.html

[10] P. Sundaram, Patient Monitoring System Using Android Technology, International Journal
of Computer Science and Mobile Computing, Vol. 2, Issue 5, pp.191-201, May, 2013.

[11] Parekh, D. (2010). Designing heart rate, blood pressure and body temperature sensors for the
mobile on-call system. Bachelor Degree Thesis. McMaster University.

[12] S. F. Babiker, L. E. Abdel-Khair, S. M. Elbasheer: “Microcontroller Based Heart Rate


Monitor using Fingertip Sensors”, UofKEJ, Vol.1, Issue 2, pp. 47-51 (October 2011).

[13] Y. S. Satyanarayan, Y. R. Satyanarayan, D. H. Desai: “Intelligent Wireless Emergency Alert


System for Patient Monitoring using AT89S52 Microcontroller”, IJAREEIE, Vol. 2, Issue 4,
April 2013.

74
View publication stats

You might also like