Vitals Monitor: Presented By: Mustafa Zia Haider Badr Abdul Latif Hisham 2Nd Stage (Evening Study) Dr. Omar Youssef

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

Vitals Monitor

PRESENTED BY:
Mustafa Zia
Haider Badr
Abdul Latif Hisham
2ND STAGE (EVENING STUDY)
DR. OMAR
16 YOUSSEF
TABLE OF CONTENTS:

INTRODUCTION…………………………………………….2-5

FEATURES……………………………………………………….6

SUPPLIES…………………………………………………....…….7

ASSEMBLE ……………….…………………………………....8-12

Schematic ……………………………………12

PROGRAMING …………………………………….……….13-14

CONCLUSION……………………………………………….14-15

CODE……………………………………………….…………16-18

1
VITALS MONITOR

INTRODUCTION:

Wearable health monitoring technologies, including

smartwatches and fitness trackers, have attracted considerable

consumer interest over the past few years. Not only has this

interest has been mainly encouraged by the rapid demand

growth in the wearable technology market for the ubiquitous,

continuous, and pervasive monitoring of vital signs, but it has

been leveraged by the state-of-the-art technological

developments in sensor technology and wireless

communications. The wearable technology market was valued

at over $13.2 billion by the end of 2016 and its value is forecast

to reach $34 billion by the end of 2020. There are many

sensors for measuring vitals of the human body which are

essential for a doctor or a medic to know the health problems.

We all know that doctor first checks Heart Rate to know Heart

Rate Variability (HRV) and body temperature. But the current

wearable bands and devices fail in the accuracy and

2
repeatability of the measured data. This mostly happens due to

miss alignment of fitness tracker and erroneous reading etc.

Most use the LED and Photodiode based Photo

Plethysmography (PPG) sensors for the heart rate

measurement. In today’s world, the maximum use of resource

is always complimented. So, the use of wireless technology is

enhanced to meet the need of remote control and monitoring.

Remote patient monitoring (RPM) is a technology that helps us

to monitor patient even when the patient is not in the clinic or

hospital. It may increase access to health services and facilities

while decreasing cost. Remote Patient Monitoring saves time of

both patient and doctor, hence increasing efficiency and

reliability of health services. Heartbeat and body temperature

are the major signs that are routinely measured by physicians

after the arrival of a patient. Heart rate refers to how many

times a heart contracts and relaxes in a unit of time (usually

per minute). Heart rate varies for different age groups. For a

human adult of age 18 or more years, a normal resting heart

3
rate is around 72 beats per minute (bpm). The functioning of

heart can be called as efficient if it is having lower heart rate

when the patient is at rest. Babies have a much higher rate than

adults around 120 bpm and older children have heart rate

around 90 bpm. If the heart rate is lower than the normal heart

rate, it is an indication of a condition known as bradycardia and

if the heart rate is higher than the normal heart rate, it is an

indication of a condition known as tachycardia. Like heart rate,

normal body temperature also varies from person to person

and changes throughout the day. The body temperature is

lowest in the early morning and highest in the early evening.

The normal body temperature is about 37° C or 98.6 ° F.

However, it can be as low as 36.1° C (97°F) in the early morning

and as high as 37.2° C (99° F) and still be considered normal.

Thus, the normal range for body temperature is 97 to 100

degrees Fahrenheit or 36.1 to 37.8 degrees Celsius.

Temperature can be measured by using different types of

sensors. These sensors come in different forms such as

4
thermocouples, thermistors, resistance temperature detectors

(RTD), and integrated circuit (IC) sensors. The temperature

sensor produces analog output voltage which is proportional

to the temperature. The temperature sensor requires analog to

digital (A/D) converter so that the analog output voltage can be

converted to digital form. The output of the temperature

sensor is connected to the Port A of AT MEGA328R-PU Arduino

Uno. The Arduino Uno processes this data and displays it in

LCD as well as sends it to the receiving end for displaying at

the remote place. This paper describes the design of a very

low-cost remote patient monitoring system which measures

heart rate and body temperature of a patient and sends the

data to a remote end where the data will be displayed and

physician or doctor will be able to examine him/her. This

device will be much needed during emergency period or for

saving time of both patient and doctor.

5
FEATURES:

• Battery-powered wearable

• Measures real-time heart rate and inter-beat Interval (IBI)

• Measures real-time body temperature

• Plots real-time graph on the display

• Sends data over Bluetooth to mobile phone

• Data can be recorded and sent to the doctor directly for

further analysis.

• Good battery management with included sleep.

• By sending the data to the cloud it creates a huge

database for researchers working on medical solutions to

COVID-19.

6
SUPPLIES:

Hardware Needed:

• SparkFun Arduino Pro Mini 328 - 5V/16MHz×1

• pulse sensor×1

• thermistor 10k×1

• Rechargeable Battery, 3.7 V×1

• HC-05 Bluetooth Module×1

Software apps and online services

• Arduino IDE

Hand tools and fabrication machines

• 3D Printer (generic)

• Soldering iron (generic)

7
ASSEMBLE:

Currently, modern wearable devices are no longer only focused

on simple fitness tracking measurements such as the number

of steps taken in a day, they also monitor important

physiological considerations, such as Heart Rate Variability

(HRV), glucose measures, blood pressure readings, and much

additional health-related information. Among the numerous

vital signs measured, the heart rate (HR) calculation has been

one of the most valuable parameters. For many years, file

Electrocardiogram (ECG) has been used as a dominant cardiac

monitoring technique to identify cardiovascular abnormalities

and to detect irregularities in heart rhythms. The ECG is a

recording of the electrical activity of the heart. It shows the

variations in the amplitude of the ECG signal versus time. This

recorded electrical activity originates from the depolarization

of the conductive pathway of the heart and the cardiac muscle

tissues during each cardiac cycle. Even though traditional

cardiac monitoring technologies using the ECG signals has

8
undergone continuous improvements for decades to address

the ever-changing requirements of their users, specifically in

terms of measurement accuracy. These techniques, up to now,

have not been enhanced to the point of offering the user

flexibility, portability, and convenience. For instance, for the

ECG to operate effectively, several bio-electrodes must be

placed at certain body locations; this procedure greatly limits

the moving flexibility and mobility of the users. In addition, PPG

has shown itself to be an alternative HR monitoring technique.

By using detailed signal analysis, the PPG signal offers excellent

potential to replace ECG recordings for the extraction of HRV

signals, especially in monitoring healthy individuals. Therefore,

to overcome the ECG limitations, an alternative solution based

on PPG technology can be used. By all these data we can

conclude that measuring the heart rate and body temperature

and analyzing them to know to check whether there is

abnormal body temperature raises and lower SpO2 oxygen

levels in hemoglobin will help in early detection of COVID-19.

9
Since this device is a wearable this can help front line workers

such as doctors, nurses, police officers and sanitation workers

who are doing day and night service to fight against COVID-

19.

Get the required parts we can change displays and sensor type

based on the requirement. There is one more good sensor

MAX30100 or MAX30102 for the heart rate measurement using

PPG technique. I'm using a 10k thermistor for temperature

measurement, one can use any temperature sensor such as

LM35 or DS1280 etc.

10
In order to wear a wearable gadget, it should be enclosed in a

proper case in order to protect from damages, so I went ahead

and designed a case which can fit all my sensors and MCUs.

11
Now we need to connect all the required components, earlier I

had a plan of choosing ESP12E as MCU but since it has only one

1 ADC pin and I wanted to interface 2 analog devices I reverted

back to Arduino with a Bluetooth configuration.

With ESP one can directly send the data to the cloud may be a

personal server or website like thing speak and shared directly

to the concerned personnel from there.

Schematic

The earlier cable-based connection had a lot of issues with wire

getting broken due to twist and turn in constrained space, later

I moved to insulated copper wire from the armature of a DC

motor.

12
PROGRAMING:

The basic idea is like this.

The working principle of PPG sensors is basically by

illuminating Light on the fingertip and measuring the intensity

of light by using photo-diode. I have mentioned other

alternatives in the parts section. We will measure the analog

voltage variation at the analog pin 0 which is, in turn, a

measurement of blood flow at the fingertip or at the wrist by

which we can measure the heart-rate and the IBI.

For temperature measurement we are using a 10k NTC

thermistor, mine is extracted from a laptop battery pack. Here,

13
an NTC type thermistor of 10kΩ is used. NTC of 10kΩ means

that this thermistor has a resistance of 10kΩ at 25°C. The

voltage across the 10kΩ resistor is given to the ADC of pro-

mini-board. The temperature can be found out from thermistor

resistance using the Steinhart-Hart equation. Temperature in

Kelvin = 1 / (A + B[ln(R)] + C[ln(R)] ^3) where A =

0.001129148, B = 0.000234125 and C = 8.76741*10^-8 and

R is the thermistor resistance. Note that log () function in

Arduino is actually a natural log.

FUTURE ENHANCEMENTS AND CONCLUSION:

Future enhancements:

• I would like to add the following features:

• Using Tiny ML and Tensor flow lite to detect the anomaly.

• Optimizing battery by using BLE

• Android application for the personalized notifications and

suggestions regarding the health

• Adding a vibration motor for alerting

14
Conclusion:

With the help of open source sensors and electronics, we can

really make changes in the lives of frontline workers by

detecting the COVID-19 symptoms i.e., variation in HRV and

Body temperature one can detect the changes and suggest

them to get quarantined to stop the spread of the disease. The

best part of this device is, it is under 15$ which is a lot cheaper

than any available fitness tracker etc. And hence government

can make these and protect the front line workers.

15
CODE:
#include <math.h> if (Signal < thresh && N > (IBI / 5) * 3) { clearY();
#include <SPI.h> if (Signal < T) {T = Signal;}} pinMode(blinkPin, OUTPUT);
#include <Wire.h> if (Signal > thresh && Signal > P) { Serial.begin(115200);
#include <Adafruit_GFX.h> P = Signal;} interruptSetup();
#include <Adafruit_SSD1306.h> if (N > 250) { display.clearDisplay();
#define pulsePin A0 if ( (Signal > thresh) && (Pulse == false) display.setTextSize(2);
#define OLED_RESET 0 && (N > (IBI / 5) * 3) ) { display.setCursor(0,28);
Adafruit_SSD1306 display(OLED_RESET); Pulse = true; display.print("Raksha");
const int thermistor_output = A1; digitalWrite(blinkPin, HIGH); display.display();
const int WIDTH = 128; IBI = sampleCounter - lastBeatTime; delay(500);}
const int HEIGHT = 64; lastBeatTime = sampleCounter; void loop()
const int LENGTH = WIDTH; if (secondBeat) { {y[x] = map(Signal, 0, 1023, HEIGHT + 10,
int blinkPin = LED_BUILTIN; secondBeat = false; 0);
volatile int BPM; for (int i = 0; i <= 9; i++) { drawY();
volatile int Signal; rate[i] = IBI;}} x++;
volatile int IBI = 600; if (firstBeat) { if (x >= WIDTH)
volatile boolean Pulse = false; firstBeat = false; { int thermistor_adc_val;
volatile boolean QS = false; secondBeat = true; double output_voltage,
int x; sei(); thermistor_resistance, therm_res_ln,
int y[LENGTH]; return;} temperature, tempf;
void clearY() word runningTotal = 0; thermistor_adc_val =
{ for (int i = 0; i <= 8; i++) { analogRead(thermistor_output);
for (int i = 0; i < LENGTH; i++) rate[i] = rate[i + 1]; output_voltage = ( (thermistor_adc_val
{y[i] = -1;}} runningTotal += rate[i];} * 3.301) / 1023.0 );
void drawY() rate[9] = IBI; thermistor_resistance = ( ( 3.301 * ( 10
{display.drawPixel(0, y[0], WHITE); runningTotal += rate[9]; / output_voltage ) ) - 10 );
for (int i = 1; i < LENGTH; i++) runningTotal /= 10; thermistor_resistance =
{ BPM = 60000 / runningTotal; thermistor_resistance * 1000 ;
if (y[i] != -1) QS = true;}} therm_res_ln =
{display.drawLine(i - 1, y[i - 1], i, y[i], if (Signal < thresh && Pulse == true) { log(thermistor_resistance);
WHITE); digitalWrite(blinkPin, LOW); temperature = ( 1 / ( 0.001129148 + (
} else Pulse = false; 0.000234125 * therm_res_ln ) + (
{break;}}} amp = P - T; 0.0000000876741 * therm_res_ln *
volatile int rate[10]; thresh = amp / 2 + T; therm_res_ln * therm_res_ln ) ) ); /*
volatile unsigned long sampleCounter = 0; P = thresh; Temperature in Kelvin */
volatile unsigned long lastBeatTime = 0; T = thresh; temperature = temperature - 273.15;
volatile int P = 512; } display.clearDisplay();
volatile int T = 512; if (N > 2500) { display.setTextSize(1);
volatile int thresh = 525; thresh = 512; display.setTextColor(WHITE);
volatile int amp = 100; P = 512; display.setCursor(0, 0);
volatile boolean firstBeat = true; T = 512; display.print(" Heart Rate = ");
volatile boolean secondBeat = false; lastBeatTime = sampleCounter; display.print(BPM);
void interruptSetup() { firstBeat = true; display.println(" BPM");
TCCR2A = 0x02; secondBeat = false;} Serial.write(BPM);
TCCR2B = 0x06; sei(); display.setTextSize(0);
OCR2A = 0X7C; }// end isr display.setCursor(0, 52);
TIMSK2 = 0x02; void setup() display.print("IBI:");
sei();} { display.print(IBI);
ISR(TIMER2_COMPA_vect) { display.begin(SSD1306_SWITCHCAPVCC, display.print("mS");
cli(); 0x3C); display.setCursor(60, 52);
Signal = analogRead(pulsePin); delay(20); display.print("Temp:");
sampleCounter += 2; display.clearDisplay(); display.print(temperature);
int N = sampleCounter - lastBeatTime; x = 0; display.print("C");

16
x = 0; volatile int thresh = 525; T = 512;
clearY();} volatile int amp = 100; lastBeatTime = sampleCounter;
display.display(); volatile boolean firstBeat = true; firstBeat = true;
delay(10);} volatile boolean secondBeat = false; secondBeat = false;
#include <Wire.h> void interruptSetup() { }
#include <math.h> TCCR2A = 0x02; sei();}
#include <Adafruit_GFX.h> TCCR2B = 0x06; void setup()
#include <Adafruit_SSD1306.h> OCR2A = 0X7C; {
#define pulsePin A0 TIMSK2 = 0x02; pinMode(btnPin, INPUT_PULLUP);
#define OLED_RESET 0 sei();} display.begin(SSD1306_SWITCHCAPVCC,
Adafruit_SSD1306 display(OLED_RESET); ISR(TIMER2_COMPA_vect) { 0x3C);
const int WIDTH = 128; cli(); delay(20);
const int HEIGHT = 64; Signal = analogRead(pulsePin); display.clearDisplay();
const int LENGTH = WIDTH; sampleCounter += 2; x = 0;
const int thermistor_output = A1; int N = sampleCounter - lastBeatTime; clearY();
int blinkPin = LED_BUILTIN; if (Signal < thresh && N > (IBI / 5) * 3) { pinMode(blinkPin, OUTPUT);
#define btnPin 2 if (Signal < T) { Serial.begin(38400);
volatile int BPM; T = Signal;}} interruptSetup();
volatile int Signal; if (Signal > thresh && Signal > P) { display.setCursor(0, 0);
volatile int IBI = 600; P = Signal;} display.print(" Calculating BPM ");
volatile boolean Pulse = false; if (N > 250) { Serial.println(" ");
volatile boolean QS = false; if ( (Signal > thresh) && (Pulse == false) Serial.println(" Calculating BPM ");
enum fcnMode { && (N > (IBI / 5) * 3) ) { display.display();
OFF, Pulse = true; }
LOGO, digitalWrite(blinkPin, HIGH); void loop() {
Beat, IBI = sampleCounter - lastBeatTime; buttonPressed();
TEMP, lastBeatTime = sampleCounter; setMode();}
NBSTATE if (secondBeat) { void buttonPressed() {
}; secondBeat = false; buttonState = pulseIn(btnPin, HIGH,
unsigned long buttonState = 0; for (int i = 0; i <= 9; i++) { 1000000);
int funcState = 0; rate[i] = IBI;}} if (buttonState > 50) {
unsigned long currentMillis1, if (firstBeat) { funcState += 1;
currentMillis2, currentMillis3; firstBeat = false; Serial.print("Button state n: ");
unsigned long previousMillis1, secondBeat = true; Serial.println(funcState);
previousMillis2, previousMillis3; sei(); }
const long interval1 = 100; return;} funcState = funcState % NBSTATE;
const long interval2 = 300; word runningTotal = 0; }
const long interval3 = 500; for (int i = 0; i <= 8; i++) { void setMode() {
int x; rate[i] = rate[i + 1]; Serial.print("Function : ");
int y[LENGTH]; runningTotal += rate[i];} Serial.println(funcState);
void clearY() rate[9] = IBI; switch (funcState) {
{for (int i = 0; i < LENGTH; i++) runningTotal += rate[9]; case OFF:
{y[i] = -1; }} runningTotal /= 10; break;
void drawY() BPM = 60000 / runningTotal; case LOGO:
{ display.drawPixel(0, y[0], WHITE); QS = true;}} display.clearDisplay();
for (int i = 1; i < LENGTH; i++) if (Signal < thresh && Pulse == true) { display.setTextSize(2);
{ if (y[i] != -1) digitalWrite(blinkPin, LOW); display.setTextColor(WHITE);
{ display.drawLine(i - 1, y[i - 1], i, y[i], Pulse = false; display.setCursor(30, 28);
WHITE); } else amp = P - T; display.print("Raksha");
{ break;}}} thresh = amp / 2 + T; break;
volatile int rate[10]; P = thresh; case Beat:
volatile unsigned long sampleCounter = 0; T = thresh;} bpm();
volatile unsigned long lastBeatTime = 0; if (N > 2500) { break;
volatile int P = 512; thresh = 512; case TEMP:
volatile int T = 512; P = 512; temp();

17
break;}} double output_voltage, display.setTextSize(0);
void bpm() thermistor_resistance, therm_res_ln, display.setCursor(0, 52);
{ temperature, tempf; display.print("Temperature in Farenheit
y[x] = map(Signal, 0, 1023, HEIGHT + 10, thermistor_adc_val = = ");
0); analogRead(thermistor_output); tempf = 9 * (temperature / 5) + 32;
drawY(); output_voltage = ( (thermistor_adc_val display.print(tempf);
x++; * 3.301) / 1023.0 ); delay(4000);
if (x >= WIDTH) thermistor_resistance = ( ( 3.301 * ( 10 }
{ / output_voltage ) ) - 10 ); int ThermistorPin = A1;
display.clearDisplay(); thermistor_resistance = int Vo;
display.setTextSize(1); thermistor_resistance * 1000 ; float R1 = 10000;
display.setTextColor(WHITE); therm_res_ln = float logR2, R2, T;
display.setCursor(0, 0); log(thermistor_resistance); float c1 = 1.009249522e-03, c2 =
display.print(" Heart Rate = "); temperature = ( 1 / ( 0.001129148 + ( 2.378405444e-04, c3 = 2.019202697e-
display.print(BPM); 0.000234125 * therm_res_ln ) + ( 07;
display.println(" BPM"); 0.0000000876741 * therm_res_ln * void setup() {
Serial.print(" BPM = "); therm_res_ln * therm_res_ln ) ) ); /* Serial.begin(9600);
Serial.println(BPM); Temperature in Kelvin */ }
display.setTextSize(0); temperature = temperature - 273.15; void loop() {
display.setCursor(0, 52); display.clearDisplay(); Vo = analogRead(ThermistorPin);
display.print(" IBI= "); display.setTextSize(1); R2 = R1 * (1023.0 / (float)Vo - 1.0);
display.print(IBI); display.setTextColor(WHITE); logR2 = log(R2);
display.print("mS"); display.setCursor(0, 0); T = (1.0 / (c1 + c2*logR2 +
x = 0; display.print("Temperature in Celsius = c3*logR2*logR2*logR2));
clearY(); } "); T = T - 273.15;
display.display(); display.print(temperature); T = (T * 9.0)/ 5.0 + 32.0;
delay(10); Serial.print(temperature); Serial.print("Temperature: ");
} y[x] = map(temperature, 0, 1023, HEIGHT Serial.print(T);
void temp() + 10, 0); Serial.println(" F");
{ drawY(); delay(500);
int thermistor_adc_val; x++; }

17

You might also like