You are on page 1of 20

CHAPTER 4

Working Methodology

4.1-Introduction:

There will be few sensors like temperature sensor, pulse sensor to detect
patient’s temperature and heart rate and electrocardiogram (ECG) Sensor. For
this we will need sensors, Adriano Mega and a power source. After taking the
reading from the patient, the data will be sent to the database through GSM
module. All data along with patient’s other information such as name, age etc.
would be stored in the database. Doctor can see the reading from a distant area
only by logging into his/her account. Both the patient and doctor mobile
application will show the patient’s, data.. Internet connection is mandatory to
use this system. GSM modem is used to make the device wearable. The patient
can move from one place to another with the device and this will not cause the
doctor any problem to monitor.

Figure4.1: Work Flow of the System


For the work flow of our system we can articulate that this Patient Health
Monitoring system comprises of both a hardware part and a software part.
Along with the software part we are using a database in a web server as a
storage for the accumulated data from the hardware implementation. A web-
based Mobile Application is also a part of the system.
4.2 System Model

Our system model proposes a system where the vital signs from a patient are collected
using temperature sensor and pulse sensor and Spo2 sensor and ECO sensor. The
arduino receives the data from both the sensors. The GSM modem is turned on and
the network connectivity is established by activating the internet connection. The
wireless transmission of data is then in then in the database.

Figure 4.2 system Model of Patient Health Monitoring System


4.3_ DESIGN AND PLANNING :

Figure 4.3 - Block diagram of Proposed method.

Figure 4.4 - Flowchart of proposed method


Patient monitoring system workflow:
The attached flowchart shows how a patient monitoring system works, which consists
of the following steps:

1. Attach all sensors to the patient's body

In this step, all the necessary sensors to monitor the patient's vital signs are attached to
their body, including a temperature sensor, ECG sensor, heart rate sensor, and oxygen
sensor (SpO2).

2. Initial communication between Arduino with GSM and all sensors

In this step, a connection is established between the Arduino unit, which contains a
GSM chip, and all the sensors attached to the patient's body.

3. Measure temperature

The Arduino unit reads the temperature value from the temperature sensor.

4. Check temperature validity

The temperature value is checked for validity to ensure it is within the normal range,
which is between 18 and 39 degrees Celsius.

5. Send emergency SMS if temperature is abnormal

If the temperature value is outside the normal range, an emergency SMS is sent
containing the patient's ID number and the temperature value.

6. Measure ECG

The Arduino unit reads ECG values from the ECG sensor.

7. Check ECG validity

ECG values are checked for validity to ensure they are normal.
8. Send emergency SMS if ECG is abnormal

If the ECG values are abnormal, an emergency SMS is sent containing the patient's ID
number and the ECG values.

9. Measure heart rate

The Arduino unit reads the heart rate value from the heart rate sensor.

10. Check heart rate validity

The heart rate value is checked for validity to ensure it is within the normal range,
which is between 20 and 120 beats per minute.

11. Send emergency SMS if heart rate is abnormal

If the heart rate value is outside the normal range, an emergency SMS is sent
containing the patient's ID number and the heart rate value.

12. Measure blood oxygen saturation (SpO2)

The Arduino unit reads the blood oxygen saturation value from the oxygen sensor
(SpO2).

13. Check blood oxygen saturation validity

The blood oxygen saturation value is checked for validity to ensure it is within the
normal range, which is 95% or higher.

14. Send emergency SMS if blood oxygen saturation is abnormal

If the blood oxygen saturation value is less than 95%, an emergency SMS is sent
containing the patient's ID number and the blood oxygen saturation value (SpO2).

15. Store all sensor values


All sensor values including temperature, ECG, heart rates, and blood oxygen
saturation, are stored in a local database or on a cloud server.

Notes

More sensors can be added to the system to monitor other vital signs, such as blood
pressure, blood sugar level, and respiratory rate.

The patient monitoring system can be used in hospitals, homes, and other care
settings.

The patient monitoring system can be connected to an alarm system to notify medical
staff in case of any emergency.
4.4 -Operation ,Results and Discussions
In this part, we will talk about the method of connecting each part of the project,
where a group of sensors were used and connected to the Arduino Mage device, and
each sensor has a special guest that performs it in order to monitor the patient’s health
condition.

Figure4.5: Connecting sensors


4.4.1 Arduino Mega 2560
It is a versatile microcontroller board that can be used for a variety of tasks.

It can be used to control a variety of devices, such as lights, music, and video.

It can also be used to control a variety of sensors, such as an ECG sensor, MAX6675
sensor, and SIM800L GSM sensor.

TECHNICAL SPECS OF ARDUINO Mage 2650

ATmega2650P Microcontroller
5V Operating Voltage
7-12V Input Voltage (recommended)
6-20V Input Voltage (limit)
14 (of which 6 provide PWM output) Digital I/O Pins
6 PWM Digital I/O Pins
6 Analog Input Pins
20 mA DC Current per I/O Pin
50 Ma DC Current for 3.3V Pin
32 KB (ATmega328P)
Flash Memory
of which 0.5 KB used by boot loader
2 KB (ATmega328P) SRAM
1 KB (ATmega328P) EEPROM
16 MHz Clock Speed
68.6 mm Length
53.4 mm Width
25 g Weight

Table3.1 :- Specifications of Arduino


4.4.2 Temperature sensor:
It is used to measure temperature.

Data from the MAX6675 sensor can be used to control a thermostat or other devices.

The following table shows how to connect the temperature sensor to the Arduino
Mage .

Arduino Max6675

5V VCC

GND GND

Digital#4 SO(Serial Data out)

Digital#5 CS(chip select)

Digital#6 SCIC(SPI clock)

Table3.2 Wired Max6675 Temperature Sensor with Arduino Mage

4.4.2 Electrocardiogram (ECG) Sensor


It is used to measure the electrical activity of the heart.

Data from the ECG sensor can be used to diagnose a variety of heart conditions.

The following table shows how to connect the Electrocardiogram (ECG) Sensor to the

Arduino Mage.
Arduino AD8232ECG Sensor

GND GND

3.3V VDD

Analog#1 Output

Digital#9 LO+

Digital#8 LO-
4.4.4 Heart
rate and Spo2
Table 3.3 - sensor:
Wired Max6675 Electrocardiogram (ECG) Sensor with Arduino Mage

Using MAX30100 with Arduino Mega 2560 for Heart Rate and SpO2 Monitoring

The MAX30100 sensor paired with an Arduino Mega 2560 can be a powerful tool for
building a basic heart rate and SpO2 monitoring system.

The following table shows how to connect the Heart rate and Spo2 sensor to the
Arduino Mage

Arduino Max30100(Heart Rate and Spo2 Sensor

SV VIN

GND GND

Analog#5 SCL

Analog#4 SDA

Table 3.4 - Wired Max 30100 (Heart rate and Spo2 sensor) with Arduino Mage

Now we have connected these three sensors to the Arduino, as we can see in the tables
above, where each sensor has its own method of connection. Now we will learn about
the rest of the sensors and the connection method for each sensor, as shown in the
figure4.3
4.4.5 GSM With Arduino:Figure4.3- Linking metho
It is a GSM module that allows the Arduino board to communicate with cellular
networks.

The SIM800L GSM can be used to send text messages, make calls, or connect to the
internet.

The following table shows how to connect the GSM to the Arduino Mage.

Arduino SIM800L

5V VCC

GND GND

Digital#2 TXD

Digital#3 RXD

GND GND

Table 3.5 - Wired SIM800L GSM with Arduino


4.4.6 Wired LCD Display
LCD (Liquid Crystal Display) screens are used to display text information and simple
graphics in various electronic projects. The 12864B LCD is a popular choice due to
its large size (128 x 64 pixels) and ease of use with Arduino control boards such as the
Arduino Mega 2560.

The following table shows how to connect the LCD to the Arduino Mage

Arduino LCD12864B

GND GND

5V VCC

Digital#10 RS

Digital#11 R/W

Digital#13 E

GND PSB

3.3V BLA

GND BLK

Table 3.6 - wired LCD Display 12864B with Arduino


How the electronics work:
The ECG sensor measures the electrical activity of the heart.

The ECG sensor signal is amplified by the AD8232 amplifier.

The amplified ECG sensor signal is sent to the Arduino Mega 2560 board.

The Arduino Mega 2560 board analyzes the ECG sensor signal and determines if there
is any abnormal heart condition.

If an abnormal heart condition is detected, the Arduino Mega 2560 board can send a
text message or make a phone call to notify the user.

The MAX6675 sensor measures the temperature.

The MAX6675 sensor signal is amplified by the AMLI NI 30M4 amplifier.

The amplified MAX6675 sensor signal is sent to the Arduino Mega 2560 board.

The Arduino Mega 2560 board analyzes the MAX6675 sensor signal and determines
the temperature.

The Arduino Mega 2560 board can be used to control a thermostat or other devices
based on the temperature.

The Arduino Mega 2560 board can also connect to the internet and send temperature
data to a web server.

The SIM800L GSM can be used to send text messages, make calls, or connect to the
internet.
4.5 -Source Code:
4.5.1 Code Arduino
Calling the libraries :
#include "Arduino.h"
#include "U8g2lib.h"
#include "max6675.h"
#include <SoftwareSerial.h>

4.5.2 Code GSM


Declare the sensors and GSM Pins and :
int thermoDO = 4;
int thermoCS = 5;
int thermoCLK = 6;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
// Pins for Thermo Sensor

SoftwareSerial SIM800(10,11);
// SoftSerial( RX , TX );
// 10 pin connect to TX of GSM SIM 900 Module
// 11 pin connect to RX of GSM SIM 900 Module

U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/


3, /* CS=*/ 2, /* reset=*/ 8);
// Pins for screen

const int buzzer = 7;


//buzzer to arduino pin 7
// display sensors values

int PulseSensorPurplePin = 7;
// Pulse Sensor PURPLE WIRE connected to ANALOG PIN 0

int LED = LED_BUILTIN;


// The on-board Arduion LED

int Signal;
// holds the incoming raw data. Signal value can range from 0-1024 Heart
Rate Sensor

int Threshold = 580;


// Determine which Signal to "count as a beat", and which to ignore for
Heart Rate Sensor.

long instance1=0, timer;


double hrv =0, hr = 72, interval = 0;
int value = 0, count = 0;
bool flag = 0;
#define shutdown_pin 10
#define threshold 100
#define timer_value 10000
// to identify R peak 10 seconds timer to calculate heart rate Variable
for ECG Sensor

4.5.2 Code (Temperature , Heart Rate , Heart Rate):


Function for Display Data on the Screen (Temperature , Heart Rate , Heart Rate
Variability :
void draw(String tem , String Hr, String Hrv)
{
u8g2.setFont(u8g_font_unifont);
u8g2.drawStr( 0, 16, tem.c_str());
u8g2.drawStr( 0, 32, Hr.c_str());
u8g2.drawStr( 0,48, Hrv.c_str());
}
// tem – Temperature , Hr – Heart Rate , HRV – Heart Rate variability
4.5.3 Code SMS:
Function to Send SMS Message by GSM (Sim800L EVB ):
void SendMessage(String sms)
{
Serial.println ("Sending Message");
SIM800.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000);
Serial.println (sms);
SIM800.println("AT+CMGS=\"+Mobilenumber\"\r"); //Write Mobile number
to send message
delay(1000);
Serial.println ("Set SMS Content");
delay(1000);
Serial.println ("Finish");
SIM800.println((char)26);// ASCII code of CTRL+Z
delay(1000);
Serial.println ("Message has been sent ...");
}
4.5.4 code turn on the Arduino
Function for execute the code when turn on the Arduino :
void setup()
{
pinMode(8, INPUT); // Setup for leads off detection LO +
pinMode(9, INPUT); // Setup for leads off detection LO - ECG
pinMode(LED,OUTPUT);
Serial.begin(9600); // Setting the baud rate for Serial com .
SIM800.begin(9600); // Setting the baud rate of GSM Module
Serial.println ("SIM900A Ready");
pinMode(buzzer, OUTPUT); // Set buzzer - pin 7 as an output
Serial.println("MAX6675 test");
// wait for MAX chip to stabilize (temperature sensor )
delay(1000);
// put your setup code here, to run once:
u8g2.begin();
u8g2.clearBuffer();
}

Function to run the code repeatedly :


void loop()
{
Signal = analogRead(PulseSensorPurplePin); // Read the PulseSensor's
value.
if((digitalRead(8) == 1)||(digitalRead(9) == 1)){

Serial.println("leads off!");

digitalWrite(shutdown_pin, LOW); //standby mode


instance1 = micros();

timer = millis();

else {

digitalWrite(shutdown_pin, HIGH); //normal mode

value = analogRead(A0);

value = map(value, 250, 400, 0, 100); //to flatten the ecg values a
bit

if((value > threshold) && (!flag)) {

count++;

Serial.println("in");

flag = 1;

interval = micros() - instance1; //RR interval

instance1 = micros();

else if((value < threshold)) {

flag = 0;

if ((millis() - timer) > 10000) {

hr = count*6;

timer = millis();

count = 0;

hrv = hr/60 - interval/1000000;}


//Serial.println("Signal " + String(Signal));
// put your main code here, to run repeatedly:
u8g2.firstPage();

do
{
draw("Temp: "+String(thermocouple.readCelsius())+ " C", "Heart
Rate :" +String (Signal), "HRV :" + String (hrv));
if ((thermocouple.readCelsius() > 38) || (thermocouple.readCelsius()
< 18)) {
Serial.println("Emergency");
tone(buzzer, 1000); // Send 1KHz sound signal...
delay(1000); // ...for 1 sec
noTone(buzzer); // Stop sound...
delay(1000); // ...for 1sec
SendMessage("Emergency Alarm , "+
String(thermocouple.readCelsius())+ " C");
delay(5000);
}
else if (Signal < 20 || Signal >200){
Serial.println("Emergency");
tone(buzzer, 1000); // Send 1KHz sound signal...
delay(1000); // ...for 1 sec
noTone(buzzer); // Stop sound...
delay(1000); // ...for 1sec
SendMessage("Emergency Alarm HR= , "+ String(Signal));
delay(5000);
}
else if (hrv < 20){
Serial.println("Emergency");
tone(buzzer, 1000); // Send 1KHz sound signal...
delay(1000); // ...for 1 sec
noTone(buzzer); // Stop sound...
delay(1000); // ...for 1sec
SendMessage("Emergency Alarm HRV= , "+ String(hrv));
delay(5000);
}

} while (u8g2.nextPage());

delay(1000);
}

You might also like