Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

Human health care system

Chapter 1: Introduction

Chapter 2: Methodologies

Chapter 3: Controller and sensor Sub Chapter Integration

Chapter 4: Software description

Chapter 5: Hardware and Software integration

Chapter 6: Result

Chapter 7: Conclusion

Chapter 8: Reference

ABSTRACT

Nowadays Health-care Environment has developed science and knowledge based on


Wireless-Sensing node Technology oriented. Patients are facing a problematic situation of
unforeseen demise due to the specific reason of heart problems and attack which is because of
nonexistence of good medical maintenance to patients at the needed time. This is for
specially monitoring the old age patients and informing doctors and loved ones. So we are
proposing a innovative project to dodge such sudden death rates by using Patient Health
Monitoring that uses sensor technology and uses internet to communicate to the loved ones in
case of problems. This system uses Temperature and heartbeat sensor for tracking patients
health. Both the sensors are connected to the controller. To track the patient health
microcontroller is in turn interfaced and wi-fi connection to send the data to the
web-server(wireless sensing node). In case of any abrupt changes in patient heart-rate or body
temperature alert is sent about the patient using IoT. This system also shows patients
temperature and heartbeat tracked live data with timestamps over the Internetwork. Thus
Patient health monitoring system based on IoT uses internet to effectively monitor patient
health and helps the user monitoring their loved ones from work and saves lives.
Chapter 1: Introduction

The objective of this project is to detect and send the data to serial monitor and also in
the same network. Which mean the data which are read at the device will show on serial
monitor to the patient. The consideration of patient absence of observation, any monitoring
person or nurse can see remotely on her system the values of the patient health detected
values on particular ip address. This can be achieved when the patient and monitoring person
in the same network connection.

In low and middle-income countries, there is increasingly growing number of people with
chronic diseases due to different risk factors such as dietary habits, physical inactivity, and
alcohol consumption among others. According to the World Health Organization report, 4.9
million people die from lung cancer from the consumption of snuff, overweight 2.6 million,
4.4 million for elevated cholesterol and 7.1 million for high blood pressure [1]. Chronic
diseases are highly variable in their symptoms as well as their evolution and treatment. Some
if not monitored and treated early, they can end the patient's life.
For many years the standard way of measuring glucose levels, blood pressure levels and
heartbeat was with traditional exams in a specialized health centres. Due to the technological
advances in today, there is great variety running sensor reading vital signs such as blood
pressure cuff, glucometer, heart rate monitor, including electrocardiograms [2], which allow
patients to take their vital signs daily. The readings which are taken daily are sent to doctors
and they will recommend the medicine and workout routines that allow them to improve the
quality of life and overcome such diseases.
The internet of things applied to the care and monitoring of patients is increasingly
common in the health sector, seeking to improve the quality of life of people. The Internet of
things is defined as the integration of all devices that connect to the network, which can be
managed from the web and in turn provide information in real time, to allow interaction with
people they use it [3]. On the other hand, the Internet of things can be seen from three
paradigms[4], which are Internet-oriented middleware, things sensors oriented and
knowledge-oriented semantics.
The arduino is a programmable device that can sense and interact with its environment. It
is great open source microcontroller platform that allows electronic enthusiasts to build
quickly, easily and with low cost small automation and monitoring projects. The combination
of IoT with arduino is the new way of introducing Internet of Things in Health care
Monitoring system of patients [5]. Arduino Uno board collects data from the sensors and
transfer wirelessly to IoT website.

Chapter 2: Methodologies

The development of this project system is divided into two parts. One is the hardware: a
bracelet monitoring device for health detection (hereinafter referred to as “model”) and the
other is the software: the user operating interface on the monitoring computer (hereinafter
referred to as “user interface software”). Our blood leakage detector is designed for the
purpose of easy operation, small size, light weight, low amount of blood for detection, high
sensitivity, low cost and long battery life. The sensing element on the detector is a photo
interrupter and with an absorbent material used for adsorbing the leaking blood. The working
principle is to place an absorbent material at the sensing region. When the coloured liquid
(red ink representing actual blood) drops at the edge of absorbent material, the absorbent
material adsorbs the red ink due to the capillarity action.
Our proposed system user’s sensors that allow to detect heart rate of a person using heartbeat
sensing even if the person is at home. The sensor is then interfaced to a microcontroller that
allows checking heart rate readings and transmitting them over internet. The user may set the
high as well as low levels of heart beat limit. After setting these limits, the system starts
monitoring and as soon as patient heart beat goes above a certain limit, the system sends an
alert to the controller which then transmits this over the internet and alerts the doctors as well
as concerned users. Also, the system alerts for lower heartbeats. Whenever the user logs on
for monitoring, the system also displays the live heart rate of the patient. Thus, concerned
ones may monitor heart rate as well get an alert of heart attack to the patient immediately
from anywhere and the person can be saved on time.

It is common for people to monitor their blood pressure at home. They may need to do this to
manage or treat a certain condition. If you do this, you should keep a record, or log, of the
measurements. The record shows your doctor how your blood pressure changes throughout
the day. If you take medicines to control your blood pressure, it will help document if they
are working. Measuring your blood pressure at home is a good way to take part in managing
your health.

2.1 ​Block diagram

The above figure shows the proposed system .The health monitoring sensors are used to
collect health related data i.e. for data acquisition. Communication can be done by controller
for sending data on internet wirelessly. Data processing has been done at server. All data
collected and aggregated at server point. To get health related information in understandable
format it can be shown on web page i.e. data management.
The results collected from sensor are analyzed i.e. if abnormal behavior has been detected
, then emergency plan activated to inform the Doctor about patient’s health .So it reduces
critical conditions in Hospital.
Chapter 3: ​Controller and Sensor

Below is the list of controllers


a) Arduino Nano
b) ESP-01

Below is the list of sensor


a) BP kit (Doctors prescribed)
b) Heart beat or Pulse sensor
c) Temperature sensor (Proto module LM35)

Other components:
a) Junction wires (M to M, M to F, F to F)
b) Resistor
c) 10k Trim pot
d) LED for pulse detection
e) Cable A to B

Components Used:

Arduino Nano:
Arduino Nano is a function module which is very small but has a lot of advantages. The
shape is very small so it is suitable to make a project that looks small. Arduino Nano is very
special because of this support with breadboards. we can plug Arduino and other electronic
components in one breadboard. In the Arduino Nano 2.x version, still used avr ATmega168
microcontroller while the Arduino Nano 3.x version already used avr ATmega328
microcontroller.

Arduino Nano has features and functions similar to Arduino Duemilanove. But Arduino Nano
in different packaging. Arduino Nano does not have a DC jack so that its power supplied
through mini-B USB port or directly connect to the VCC pin and GND. Arduino Nano can be
supplied with a voltage of 6-20V power source via USB mini-B port. Or you can provide a
voltage of 5V on pin 30 (this voltage will not be adjusted by the regulator, so make sure you
provide 5V voltage)
Arduino Nano Specifications:

Microcontroller Atmel ATmega168 or ATmega328


Operating Voltage (logic
5V
level)
Input Voltage
7-12 V
(recommended)
Input Voltage (limits) 6-20 V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 8
DC Current per I/O Pin 40 mA
16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used
Flash Memory
by bootloader
SRAM 1 KB (ATmega168) or 2 KB (ATmega328)
EEPROM 512 bytes (ATmega168) or 1 KB (ATmega328)
Clock Speed 16 MHz
Dimensions 0.73″ x 1.70″
Length 45 mm
Width 18 mm
Weight 5g

In some cases, Arduino Nano has features that are more complete than Arduino Uno.
Arduino Nano has 8 channel ADC (Analog to Digital Converter) while the Arduino Uno only
has 6 channels. Through the RX and TX pins you can communicate serially with other
devices.
According datasheet ATmega328 AVR microcontroller, Arduino Nano has 2 pin interrupts,
namely int0 and int1.

Overall, Arduino Nano has 30 pins. The 8 pin of them (19-26 pin) are Analog pins (ADC).
While the other 14 pins are Digital pins.
Ardino nano datasheet

Arduino Nano pin configuration

ESP 01

The ESP-01 is one of the smallest units available. Compared to other ESP units it is powered
directly and thus need to be fed with 3.3V and not 5V. Two general GPIOs are available and
if you need more you can use the two serial ports (1,3 / RX, TX).
In order to get the unit in flash mode the GPIO-0 needs to be LOW and the CH-EN need to
be set to high. The CH-EN can be connected to the VDD, in the pictures a jumper is soldered
between these but you could ​use a resistor to make sure that no over current hurt the
unit​. Start flashing and do a reset once in order to get the show going.
Units with a mem chip labelled ​PUYA need to be flashed with the special built PUYA bin
files. This is needed because the PUYA chip needs to be dealt with in another way than
normal mem chips.
Features
● Processor: L106 32-bit RISC microprocessor core based on the Ten silica Xtensa
Diamond Standard 106Micro running at 80 MHz

● Memory:

o 32 KiB instruction RAM

o 32 KiB instruction cache RAM

o 80 KiB user-data RAM

o 16 KiB ETS system-data RAM

● External QSPI flash: up to 16 MiB is supported (512 KiB to 4 MiB typically


included)

● IEEE 802.11 b/g/n Wi-Fi

o Integrated TR switch, balun, LNA, power amplifier and matching network

o WEP or WPA/WPA2 authentication, or open networks

● 16 GPIO pins

● SPI

● I²C (software implementation)

● I²S interfaces with DMA (sharing pins with GPIO)

● UART on dedicated pins, plus a transmit-only UART can be enabled on GPIO2

● 10-bit ADC (successive approximation ADC)

Pinout of ESP-01

The pinout is as follows for the common ESP-01 module:

1. VCC, Voltage (+3.3 V; can handle up to 3.6 V)


2. GND, Ground (0 V)
3. RX, Receive data bit X
4. TX, Transmit data bit X
5. CH_PD, Chip power-down
6. RST, Reset
7. GPIO 0, General-purpose input/output No. 0
8. GPIO 2, General-purpose input/output No. 2

Ai-Thinker modules

Ai-Thinker ESP8266 modules (ESP-12F, black colour) soldered to breakout boards (white
colour)
This is the first series of modules made with the ESP8266 by the third-party manufacturer
Ai-Thinker and remains the most widely available. They are collectively referred to as
"ESP-xx modules". To form a workable development system they require additional
components, especially a serial TTL-to-USB adapter (sometimes called a USB-to-UART
bridge) and an external 3.3 volt power supply. Novice ESP8266 developers are encouraged to
consider larger ESP8266 Wi-Fi development boards like the NodeMCU which includes the
USB-to-UART bridge and a Micro-USB connector coupled with a 3.3 volt power regulator
already built into the board. When project development is complete, those components are
not needed and these cheaper ESP-xx modules are a lower power, smaller footprint option for
production runs.

Pulse sensor:
The Pulse Sensor is a plug-and-play heart-rate sensor for Arduino. It can be used by students,
artists, athletes, makers, and game & mobile developers who want to easily incorporate live
heart-rate data into their projects. Essence it is an integrated optical amplifying circuit and
noise eliminating circuit sensor. Clip the Pulse Sensor to your earlobe or fingertip and plug it
into your Arduino, you can ready to read heart rate. Also, it have an Arduino demo code that
make it easy to use.

Features

● Working voltage: 5V
● Working current: 4mA

Pulse Sensor Schematic

BP kit:
BP TEST KIT
Blood Pressure Monitoring with Analog Data
What Is Blood Pressure? - Sphygmomanometer

Blood pressure is the force of blood against the walls of arteries. Blood pressure is
recorded as two numbers—the systolic pressure (as the heart beats) over the diastolic
pressure (as the heart relaxes between beats). The measurement is written one above or
before the other, with the systolic number on top and the diastolic number on the bottom.
For example, a blood pressure measurement of 120/80 mmHg (millimeters of mercury) is
expressed verbally as "120 over 80."

How it Works

In this System we are not using Full Sphygmomanometer, Half part only, Remaining
Electronics parts Which creates analog O/p As per Increasing the AIR.

Chapter 3: ​Controller and sensor Sub Chapter Integration


The software development for this project is developed using Arduino ide, Where we have
developed a software using C++ language. The supporting libraries are listed below
a) Software Serial Library
b) #include "TimerOne.h"
c) ESP-01 AT commands
d) Main Arduino program
a) Software Serial Library

The library declaration can be done as like below


#include <SoftwareSerial.h>

The Arduino hardware has built-in support for serial communication on pins 0 and 1 (which
also goes to the computer via the USB connection). The native serial support happens via a
piece of hardware (built into the chip) called a UART. This hardware allows the Atmega chip
to receive serial communication even while working on other tasks, as long as there room in
the 64 byte serial buffer.

The SoftwareSerial library has been developed to allow serial communication on other digital
pins of the Arduino, using software to replicate the functionality (hence the name
"SoftwareSerial"). It is possible to have multiple software serial ports with speeds up to
115200 bps. A parameter enables inverted signaling for devices which require that protocol.

Limitations

The library has the following known limitations:

● If using multiple software serial ports, only one can receive data at a time.
● Not all pins on the Mega and Mega 2560 support change interrupts, so only the
following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63),
A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
● Not all pins on the Leonardo and Micro support change interrupts, so only the following
can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
● On Arduino or Genuino 101 the current maximum RX speed is 57600bps
● On Arduino or Genuino 101 RX doesn't work on Pin 13

b) TimerOne library

TimerOne & TimerThree Libraries

TimerOne and TimerThree let you use the built-in 16 bit timers.

Hardware Requirements
These libraries use Timer1 and Timer3.
Each timer controls PWM pins. While uses these libraries, analogWrite() to those pins will
not work normally, but you can use the library pwm() function.

TimerOne TimerThree
Board
PWM Pins PWM Pins
Teensy 3.6 3, 4 29, 30
Teensy 3.5 3, 4 29, 30
Teensy 3.2 & 3.1 3, 4 25, 32
Teensy 3.0 3, 4
Teensy 2.0 4, 14, 15 9
Teensy++ 2.0 25, 26, 27 14, 15, 16
Arduino Uno 9, 10
Arduino Leonardo 9, 10, 11 5
Arduino Mega 11, 12, 13 2, 3, 5
Wiring-S 4, 5
Sanguino 12, 13

Basic Usage
The timer is configured to repetitively measure a period of time, in microseconds. At the end
of each period, an interrupt function can be run. The PWM pins can also be configured to
switch during a portion of the period.
If using TimerThree, replace "Timer1" with "Timer3".

Configuration
Timer1.initialize(microseconds);
Begin using the timer. This function must be called first. "microseconds" is the period of time
the timer takes.
Timer1.setPeriod(microseconds);
Set a new period after the library is already initialized.

Run Control
Timer1.start();
Start the timer, beginning a new period.
Timer1.stop();
Stop the timer.
Timer1.restart();
Restart the timer, from the beginning of a new period.
Timer1.resume();
Resume running a stopped timer. A new period is not begun.

PWM Signal Output


Timer1.pwm (pin, duty);
Configure one of the timer's PWM pins. "duty" is from 0 to 1023, where 0 makes the pin
always LOW and 1023 makes the pin always HIGH.
Timer1.setPwmDuty(pin, duty);
Set a new PWM, without reconfiguring the pin. This is slightly faster than pwm(), but pwm()
must be used at least once to configure the pin.
Timer1.disable Pwm(pin);
Stop using PWM on a pin. The pin reverts to being controlled by digitalWrite().

Interrupt Function
Timer1.attachInterrupt(function);
Run a function each time the timer period finishes. The function is run as an interrupt, so
special care is needed to share any variables between the interrupt function and your main
program.
Timer1.detachInterrupt();
Disable the interrupt, so the function no longer runs.

Example Program
#include <TimerOne.h>

// This example uses the timer interrupt to blink an LED


// and also demonstrates how to share a variable between
// the interrupt and the main program.

const int led = LED_BUILTIN; // the pin with a LED

void ​setup​(void)
{
pinMode(led, OUTPUT);
Timer1.initialize(150000);
Timer1.attachInterrupt(blinkLED); // blinkLED to run every 0.15 seconds
​Serial​.begin(9600);
}

// The interrupt will blink the LED, and keep


// track of how many times it has blinked.
int ledState = LOW;
volatile unsigned long blinkCount = 0; // use volatile for shared variables

void blinkLED(void)
{
if (ledState == LOW) {
ledState = HIGH;
blinkCount = blinkCount + 1; // increase when LED turns on
} else {
ledState = LOW;
}
digitalWrite(led, ledState);
}

// The main program will print the blink count


// to the Arduino Serial Monitor
void ​loop​(void)
{
unsigned long blinkCopy; // holds a copy of the blinkCount

// to read a variable which the interrupt code writes, we


// must temporarily disable interrupts, to be sure it will
// not change while we are reading. To minimize the time
// with interrupts off, just quickly make a copy, and then
// use the copy while allowing the interrupt to keep working.
noInterrupts();
blinkCopy = blinkCount;
interrupts();

​Serial​.print("blinkCount = ");
​Serial​.println(blinkCopy);
delay(100);
}

Interrupt Context Issues

Special design is necessary to share data between interrupt code and the rest of your program.
Variables usually need to be "volatile" types. Volatile tells the compiler to avoid
optimizations that assume variable can not spontaneously change. Because your function may
change variables while your program is using them, the compiler needs this hint. But volatile
alone is often not enough.
When accessing shared variables, usually interrupts must be disabled. Even with volatile, if
the interrupt changes a multi-byte variable between a sequence of instructions, it can be read
incorrectly. If your data is multiple variables, such as an array and a count, usually interrupts
need to be disabled for the entire sequence of your code which accesses the data.

c) ESP-01 AT commands
ESP8266 WiFi Module offers complete networking solutions to our DIY 
(Do-it-yourself) and IoT (Internet of Things) projects. It provides WiFi 
connectivity to any microcontroller through its full TCP/IP Stack.
The ESP8266 WiFi module and the microcontroller can be interface through 
UART and with the help of a wide range of AT Commands, the Microcontroller 
can control the ESP Module.  

The AT Commands of the ESP8266 WiFi Module are responsible for controlling 
all the operations of the module like restart, connect to WiFi, change mode of 
operation and so forth. So, it is important to understand the ESP8266 AT 
Commands, at least a few important ones if not all. 

Types of ESP8266 AT Commands 

Before going into the details of the AT Command Set and how the AT Commands 
are divided, you need to understand about the different types AT Commands. 

Basically, the ESP8266 AT Commands can be classified into four types: 


● Test 

● Query 

● Set 

● Execute 

The following table gives you a clear idea about these different types of AT 
Commands. Here, I’ll use a sample command as “TEST” to demonstrate the 
differences. 

AT Command Format  Function  Command Type 

AT+TEST=?  Returns value range of parameters  Test 

AT+TEST?  Returns current value  Query 

AT+TEST=parameter1, 
Set configuration  Set 
parameter2, … 

AT+TEST  Executes an action  Execute 

Test Commands:​ The Test AT Commands of ESP8266 WiFi Module are used to get the
parameters of a command and their range.

Query Commands:​ The Query Commands returns the present value of the parameters of a
command.

Set Commands:​ The Set Commands are used set the values of the parameters in the
commands and also runs the commands.

Execute Commands:​ The Execute Commands will run the commands without parameters.

NOTE:​ Not all the ESP8266 AT Commands support all the four command types.
Now that we have seen the different types of ESP8266 AT Commands, let us proceed with
the actual AT Commands list.

ESP8266 AT Commands Set

The ESP8266 AT Commands Set is divided into three categories. They are:

● Basic AT Commands
● WiFi AT Commands
● TCP/IP AT Commands

There are a total of 88 AT Commands for ESP8266 WiFi Module. I will not talk about all the
88 AT Commands but just a few important ones.

If you want to know the details of all the ESP8266 AT Commands, then I suggest you to visit
the official documentation page provided by Espressif Systems (the manufacturer of
ESP8266EX SoC). You can view the official ESP8266 AT Commands Documentation
from ​here​.

Let us see about different ESP8266 AT Commands in each category along with their format
(syntax) and responses.

d) Main Arduino program


The below program used for our project for successful completion
#include <SoftwareSerial.h>
#include "TimerOne.h"
SoftwareSerial wifiSerial(10,11);
SoftwareSerial BPkit(2,3); // rx & tx

String AP = "Embiot_3G"; // CHANGE ME


String PASS = "EmbiotTech@io#"; // CHANGE ME

bool DEBUG = true; //show more logs


int responseTime = 10; //communication timeout
// Pulse of a person
int pulse = A0;
int th = A1;
volatile unsigned long Threshold =0;
int LED12 = 12;
int counter = 0;
int interruptPin = 2;
volatile unsigned long blinkCount = 0;
volatile unsigned long beep = 0;
int ledState = LOW;

// BP kit data

float PressureMin=-15;
float PressureMax=15;
float Vsupply=5;

int bppin=A2;
float volta=0;
int i;
float maxvolt=0;
float volt=0;
float pressure=0,MAP=0,maxv=0;

// Body Temperature
int body = A7;

void pulseroutine()
{
// Timer1.detachInterrupt(); // Stop the timer
if (ledState == LOW) {
blinkCount = blinkCount + 1; // increase when LED turns on
}
int Signal = analogRead(A0);
int Threshold = analogRead(A1);
int Threshold1 = map(Threshold, 0, 1024, 100,800);
beep = Signal+5;
if ( beep>Threshold){
ledState = HIGH;
}
else {
ledState = LOW;
}
digitalWrite(LED12, ledState);

}
void setup() {

pinMode(LED12, OUTPUT);
Timer1.initialize(1000);
Timer1.attachInterrupt(pulseroutine); // blinkLED to run every 0.15 seconds
Serial.begin(115200);
wifiSerial.begin(115200);

wifiSerial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

while (!wifiSerial) {
; // wait for serial port to connect. Needed for Leonardo only
}

sendToWifi("AT",5,"OK");
sendToWifi("AT+CWMODE=1",responseTime,DEBUG); // configure as access point
sendToWifi("AT+CIFSR",responseTime,DEBUG); // get ip address
sendToWifi("AT+CIPMUX=1",responseTime,DEBUG); // configure for multiple connections
sendToWifi("AT+CIPSERVER=1,80",responseTime,DEBUG); // turn on server on port 80
sendToWifi("AT+CWJAP=\""+ AP +"\",\""+ PASS +"\"",responseTime,DEBUG);
sendToWifi("AT+CIFSR\r\n",1000,DEBUG);
// sendData("AT+CIFSR\r\n",1000,DEBUG);

sendToUno("Wifi connection is running!",responseTime,DEBUG);

void loop() {
noInterrupts();
unsigned long beeping = beep;
unsigned long beet = blinkCount;
interrupts();

//Serial.println(beeping);

// Body Temperature of a person


const int temp = analogRead(body);
const int temperature = abs((5 * temp *100)/1024);
Serial.println("Temperature of body is");
Serial.println(temperature);

// BP kit data
digitalWrite(3,HIGH);
for(i=0;i<40;i++)
{
volta=BPkit.read();
volt=(volta*Vsupply)/(pow(2,10)-1);
maxv=max(abs(volt-2.5),maxvolt);
maxvolt=abs(maxv-2.5);
delay(50);

}
pressure=(((maxvolt)-0.1*Vsupply)/((0.8*Vsupply)/(PressureMax-PressureMin)))+PressureM
in;
MAP=-1*((14.7)-pressure*-1)*(51.7)-(3.16)/maxvolt;
digitalWrite(3,LOW);
Serial.print("MAP=");
Serial.println(MAP);
Serial.println(MAP*1.1);
//Serial.print(abs(MAP*1.1));
Serial.print("/");
Serial.print(abs(MAP*0.8));
Serial.println();

sendData("{\"temperature\":"+String(temperature)+",\"MAP\":"+String(MAP)+",\"BPM\":"+
String(beet)+"}");

void sendData(String str){


String len="";
len+=str.length();
sendToWifi("AT+CIPSEND=0,"+len,responseTime,DEBUG);
delay(100);
sendToWifi(str,responseTime,DEBUG);
delay(100);
sendToWifi("AT+CIPCLOSE=5",responseTime,DEBUG);
}

/*
* Name: find
* Description: Function used to match two string
* Params:
* Returns: true if match else false
*/
boolean find(String string, String value){
return string.indexOf(value)>=0;
}
/*
* Name: readSerialMessage
* Description: Function used to read data from Arduino Serial.
* Params:
* Returns: The response from the Arduino (if there is a reponse)
*/
String readSerialMessage(){
char value[100];
int index_count =0;
while(Serial.available()>0){
value[index_count]=Serial.read();
index_count++;
value[index_count] = '\0'; // Null terminate the string
}
String str(value);
str.trim();
return str;
}

/*
* Name: readWifiSerialMessage
* Description: Function used to read data from ESP8266 Serial.
* Params:
* Returns: The response from the esp8266 (if there is a reponse)
*/
String readWifiSerialMessage(){
char value[100];
int index_count =0;
while(wifiSerial.available()>0){
value[index_count]=wifiSerial.read();
index_count++;
value[index_count] = '\0'; // Null terminate the string
}
String str(value);
str.trim();
return str;
}

/*
* Name: sendToWifi
* Description: Function used to send data to ESP8266.
* Params: command - the data/command to send; timeout - the time to wait for a response;
debug - print to Serial window?(true = yes, false = no)
* Returns: The response from the esp8266 (if there is a reponse)
*/
String sendToWifi(String command, const int timeout, boolean debug){
String response = "";
wifiSerial.println(command); // send the read character to the esp8266
long int time = millis();
while( (time+timeout) > millis())
{
while(wifiSerial.available())
{
// The esp has data so display its output to the serial window
char c = wifiSerial.read(); // read the next character.
response+=c;
}
}
if(debug)
{
Serial.println(response);
}
return response;
}

/*
* Name: sendToUno
* Description: Function used to send data to Arduino.
* Params: command - the data/command to send; timeout - the time to wait for a response;
debug - print to Serial window?(true = yes, false = no)
* Returns: The response from the esp8266 (if there is a response)
*/
String sendToUno(String command, const int timeout, boolean debug){
String response = "";
Serial.println(command); // send the read character to the esp8266
long int time = millis();
while( (time+timeout) > millis())
{
while(Serial.available())
{
// The esp has data so display its output to the serial window
char c = Serial.read(); // read the next character.
response+=c;
}
}
if(debug)
{
Serial.println(response);
}
return response;
}
Chapter 4​: Software description

Arduino programs are written in the Arduino Integrated Development Environment (IDE).
Arduino IDE is a special software running on your system that allows you to write sketches
(synonym for program in Arduino language) for different Arduino boards. The Arduino
programming language is based on a very simple hardware programming language called
processing, which is similar to the C language. After the sketch is written in the Arduino IDE,
it should be uploaded on the Arduino board for execution.

The first step in programming the Arduino board is downloading and installing the Arduino
IDE. The open source Arduino IDE runs on Windows, Mac OS X, and Linux. Download the
Arduino software (depending on your OS) from the official website and follow the
instructions to install.

The structure of Arduino program is pretty simple. Arduino programs have a minimum of 2 
blocks, 

Preparation & Execution 

Each block has a set of statements enclosed in curly braces: 

void setup( ) 

statements-1; 

statement-n; 

void loop ( ) 

statement-1; 


statement-n; 

Here, setup ( ) is the preparation block and loop ( ) is an execution block. 

The setup function is the first to execute when the program is executed, and this function is 
called only once. The setup function is used to initialize the pin modes and start serial 
communication. This function has to be included even if there are no statements to execute. 

void setup ( ) 

pinMode (pin-number, OUTPUT); // set the ‘pin-number’ as output 

pinMode (pin-number, INPUT); // set the ‘pin-number’ as output 

After the setup ( ) function is executed, the execution block runs next. The execution block 
hosts statements like reading inputs, triggering outputs, checking conditions etc.. 

In the above example loop ( ) function is a part of execution block. As the name suggests, the 
loop( ) function executes the set of statements (enclosed in curly braces) repeatedly. 

Void loop ( ) 

digitalWrite (pin-number,HIGH); // turns ON the component connected to ‘pin-number’ 

delay (1000); // wait for 1 sec 

digitalWrite (pin-number, LOW); // turns OFF the component connected to ‘pin-number’ 

delay (1000); //wait for 1 sec 


Chapter5: ​Hardware Integration

Chapter6: ​Conclusion

This research led to the development of a system which measured heartbeat and temperature
of a patient and sent it to a remote end by the use of a Arduino and Atmega328
microcontroller at a reasonable cost with great effect. It utilized remote patient monitoring
system technology which enabled the monitoring of patients outside of clinical settings
and leads to increasing access to health care as well as decreasing the health care delivery
costs. Nowadays, most of the systems work in offline mode. The research utilized two
sensors for measuring heartbeat and temperature of a body. These sensors are controlled by
the Atmega328 Microcontroller. For measurement of heartbeat, we used fingertip to measure
it accurately. The device uses the optical technology to detect the flow of blood through the
finger. The heart beat monitor in our research counts the heart beat rate in beats per
minute(bpm) for specific interval and transfers the calculated rate via Wi-Fi module and
sends it to a remote end where it displays the observed data in the website of local server. The
signal is then amplified and filtered and fed to the microcontroller input. The microcontroller
processes the input and calculates heart beat rate in beats per minute. Thus, calculated heart
beat rate is displayed in the website of local server. The data is also displayed on the screen
of a mobile device or PC by using Wi-Fi module. LM35 is used as a temperature sensor in
this project which measures the temperature of the body and the measured data is fed to the
transmitter module. Wireless system is used to transmit the measured data to a remote
location. The transmitter transmits the calculated beat rate and is received in another terminal
called receiver module. Inconvenience of using wire is avoided in this research. Finally, the
data are displayed in the mobile screen or PC at the receiving end where the specialist or
physician can analyse the data and will be able to provide aid. The developed system is
reliable, economical and user friendly.
Chapter7: ​Future Work

The current version of the system can post three parameters (Heartbeat, Temperature, Blood
pressure) on to the web. But still there is room for improvements. Few other parameters like
glucose levels, BMI (Body Mass Index), waist circumference etc., can also be measured.
Then the complete health status of patient will be recorded and readily available on the web.
Such that it will be much easier to the doctor to monitor the progress of patients' health now
and then to advise them about their health. The system can be extended by adding more
features like linking the ambulance services, leading doctors list and their specialties,
hospitals and their special facilities etc., Doctors can create awareness about diseases and
their symptoms through the mobile application. From the evaluation and the result obtained
from analysis the system is better for patients and the doctor to improve their patients'
medical evaluation.

Chapter8: ​REFERENCES

[1]OMS,Overview–Preventing chronic diseases: a vital


investment,http://www.who.int/chp/chronic_disease_report/part1/en/, visited, April 2017.

[2]Swan, M. Sensor mania! The internet of things, wearable computing, objective metrics,
and the quantified self 2.0. Journal of Sensor and Actuator Networks,1(3), 217-253, 2012.

[3] Gómez, J., Huete, J. F., Hoyos, O., Perez, L., & Grigori, D. Interaction System based on
Internet of Things as Support for Education. Procedia Computer Science, 21, 132-139, 2013.

[4] Atzori, L., Iera, A., & Morabito, G. The internet of things: A survey.Computer networks,
54(15), 2787-2805, 2010

[5]Charalampos Doukas, “Building Internet of things with arduino”, Apr 02 2012. Available
online: http://www.buildinginternetofthings.com/wp-content/uploads/INTRODUCTION.pdf,
visited April 2017.

[6]Purnima, Puneet singh, “Zigbee and GSM based Patient Health Monitoring System”, IEEE
International Conference on Electronics and Communication System, September 2014.
[7]MatinaKiourexidou, Konstantinos Natsis, Panagiotis Bamidis, Nikos Antonopoulos,
Efthymia Papathanasiou, Markos Sgantzos, Andreas Veglis “Augmented Reality for the
Study of Human Heart Anatomy” International Journal of Electronics Communication and
Computer Engineering 2016.

[8]Sankar Kumar S, Gayathri N , Nivedhitha D , Priyanka A S “A Cost effective Arduino


Module for Bedridden patients Respiratory Monitor and Control”International Journal of
advanced research trends in engineering and technology (IJARTET) VOL. II, SPECIAL
ISSUE XXI, MARCH 2016.

[9]Bhagya Lakshmi, M1 Hariharan ,R2 Udaya Sri, C3 Nandhini Devi, P4 Sowmiya“Heart


Beat Detector using Infrared Pulse Sensor” IJSRD - International Journal for Scientific
Research & Development| Vol. 3, Issue 09, 2015.

[10]Ch.Sandeep Kumar Subudhi,’Intelligent Wireless Patient Monitoring and Tracking


System (Using Sensor Network and Wireless Communication)”,2014.

[11]Souvik Das “The Development of a Microcontroller Based Low Cost Heart Rate
Counter for Health Care Systems” International Journal of Engineering Trends and
Technology- Volume 4 Issue 2- 2013.

[12]American Heart Association, overview High Blood Pressure,


http://www.heart.org/HEARTORG/Conditions/HighBloodPressure/KnowYourNumbers/Und
erstanding-Blood-Pressure-Readings_UCM_301764_Article.jsp#.WQA2Omxf3IU,visited,
April 2017.

[13]Franca Delmastro, “Pervasive communications in healthcare”, Computer


Communications Vol.35, pp.1284– 1295, 2012.

[14]S. Mada and S. Sandhyarani, “An Adaptive Embedded System for helping Patients”,
International Journal of Computer Trends and Technology, vol. 2,
(2011)

You might also like