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

IOT BASED HOLIASTIC HEALTH

MONITORING SYSTEM
Submitted in partial fulfillment of the requirements for the
award of the degree of

BACHELOR OF ENGINEERING
in
ELECTRONICS AND COMMUNICATION
ENGINEERING
by
MANUKONDA ALEKHYA

GUBBALA MANIKANTA

JONNAKUTI VIJAY BABU

KUKUNOORI S N M HANUMANTRAO

Under the esteemed guidance of

Sri.V. RAMA KRISHNA M-Tech

Assistant Professor in ECE Department

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING

S.R.K.R.ENGINEERING COLLEGE (AUTONOMOUS)


(Affiliated to JNTU, KAKINADA)

(Recognized by A.I.C.T.E., Accredited By N.B.A &N.A.A.C with ‘A+’Grade , NEW DELHI)

CHINA AMIRAM, BHIMAVARAM-534204


(2020-2024)

1
S.R.K.R.ENGINEERING COLLEGE
(Affiliated to JNTU, KAKINADA)

(Recognized by A.I.C.T.E., Accredited By N.B.A &N.A.A.C with ‘A+ Grade , NEW DELHI)

CHINA AMIRAM, BHIMAVARAM-534204

DEPARTMENT OF ELECTRONICS AND COMMUNICATION

ENGINEERING

CERTIFICATE
This is to certify that this project work entitled

HOLISTIC HEALTH MONITORING SYSTEM USING IOT


is the bonafide work carried out by

Mr./Miss…………………………………………………………………….
Regd.No……………………………..of final year B.E along with his/her
batch mates submitted in partial fulfillment of the requirement of the award
of Bachelor’s degree in ELECTRONICS &COMMUNICATION
ENGINEERING during the academic year 2020-2024.

Guide: HEAD OF THE DEPARTMENT:

Dr. N. UDAYA KUMAR


M.Tech, Ph.D, M.I.S.T.E ,S.M.I.E, FILLE
Department of ECE
Asst. Prof. Sri.V.RAMA KRISHNA
M. Tech.
Department of ECE

2
S.R.K.R.ENGINEERING COLLEGE
(Affiliated to JNTU, KAKINADA)

(Recognized by A.I.C.T.E., Accredited By N.B.A &N.A.A.C with ‘A+’ Grade , NEW DELHI)

CHINA AMIRAM, BHIMAVARAM-534204

DEPARTMENT OF ELECTRONICS AND COMMUNICATION

ENGINEERING

BONAFIDE CERTIFICATE
This is to certify that this project work entitled "HOLISTIC HEALTH
MONITORING SYSTEM USING IOT "is the bonafide work of
Miss.M.Alekhya(20B91A04E0),Mr.GManikanta(20B91A0484),Mr.J.Vija
y Babu (20B91A0494), Mr. K.S N M HANUMANTRAO (20B91A04C5)
of the final year B. Tech submitted in partial fulfillment of requirements for
the award of Degree in Bachelor of Technology in Electronics and
Communication Engineering during the academic year 2020-2024.

Guide: HEAD OF THE DEPARTMENT:

Dr. N. UDAYA KUMAR


M.Tech, Ph.D, M.I.S.T.E ,S.M.I.E, FILLE
Department of ECE
Asst. Prof. Sri.V.RAMA KRISHNA
M. Tech.
Department of ECE

3
CERTIFICATE OF EXAMINATION

This is to certify that I have examined the concept and here by accord
my approval of it as a study carried out and presented in a manner
required for its acceptance on partial fulfillment for the award of the
degree of BACHELOR OF ENGINEERING ELECTRONICS
AND COMMUNICATIONS ENGINEERING for which it has
been submitted. This approval does not necessarily endorse or accept
every statement made, opinion expressed or conclusions drawn as
recorded in the report, it only signifies that acceptance of the report
for the purpose for which it is submitted.

EXTERNAL EXAMINER INTERNAL EXAMINER

4
ACKNOWLEDGEMENTS

We express our profound gratitude to our project guide Assistant Prof. Sri

.V.RAMA KRISHNA for this valuable guidance and consistent

encouragement throughout this project, which enabled us to complete our

project successfully in time. We would like to express our thanks to

DR .N. UDAYA KUMAR, Head of the department of ECE for giving us

departmental facilities and advice whenever needed. We thank one and all

who have contributed directly or indirectly to this project.

We are most sincere and grateful to this sanctum, SAGI RAMA

KRISHNAM RAJU ENGINEERING COLLEGE and express our

heartfelt thanks to Dr. M. JAGAPATHI RAJU, principal, for giving us

this opportunity for the successful completion of our degree. We would like

to thank other teaching and non-teaching staff for their assistance and help

extended .I thank one and all that have contributed directly or indirectly to

my project.

---Project Team

5
CONTENT

6
ABSTRACT

This project combines IOT technology with healthcare to create a system


focused on monitoring health and enhancing communication between
individuals and healthcare professionals. The core of the system is the
ESP32 microcontroller, which manages data aggregation and transmission.
Various sensors are integrated into the system, including an
Electrocardiogram (ECG) sensor for monitoring heart activity, a DHT11
sensor for tracking environmental temperature and humidity, a DSB120B
sensor for precise temperature measurement, and a heart rate sensor.

The ESP32 collects data from these sensors in real-time. This data is then
securely transmitted to a Firebase database. Firebase ensures reliability and
accessibility, allowing both users and healthcare providers to access the
collected health data .To make the system user-friendly, a mobile
application is developed using the Flutter framework. This app provides
real-time access to health metrics obtained from the sensors. Additionally,
it facilitates direct communication between users and healthcare
professionals. Users can schedule virtual consultations, share their health
data securely, and receive personalized recommendations and interventions.

Overall, this project aims to modernize healthcare delivery by IOT


technology to empower individuals with proactive health management
tools and streamline communication with healthcare providers.

CHAPTER-1
7
INTRODUCTION

Health is one of the global challenges for humanity. According to the

constitutions of World Health Organization (WHO) the highest attain able

standard of health is a fundamental right for an individual. The healthcare

sector stands at the precipice of a transformative era fueled by the

convergence of Internet of Things (IOT) technology and innovative patient

care solutions. This project sets out to harness the potential of this synergy

by introducing an advanced IOT-based health monitoring system. Its

overarching goal is to empower individuals with proactive health

management tools while fostering seamless communication channels with

healthcare professionals.

At its core, this system revolves around the ESP32 microcontroller, a

versatile central processing unit adept at aggregating and transmitting data.

Integrated with a diverse range of sensors including Electrocardiogram

(ECG), DHT11 for environmental monitoring, DSB120B for precise

temperature sensing, and a heart rate sensor, the ESP32 orchestrates real-

time data collection and analysis. This amalgamation of sensor technology

enables comprehensive health monitoring.


8
The system's functionality lies in its ability to securely transmit collected

data to a Firebase database. This cloud-based repository ensures the

reliability and accessibility of health data for both users and healthcare

providers. Utilizing Firebase as the backbone of data management allows

for seamless integration with a user-friendly mobile application,

meticulously crafted using the Flutter framework .Through this intuitive

mobile interface, individuals gain immediate access to their health metrics,

presented in an easily interpretable format. Beyond mere data visualization,

the application serves as a conduct for direct communication between users

and healthcare professionals. This interactive platform facilitates

personalized consultations, allowing users to seek guidance, share pertinent

health information, and receive tailored interventions in real-time.

In essence, this project epitomizes a paradigm shift in healthcare delivery,

where individuals are empowered to take proactive control of their health.

This innovative system not only fosters personalized care but also cultivates

a symbiotic relationship between patients and healthcare providers, health

outcomes and improved quality of life.

INTERNET OF THINGS

9
The Internet of Things (IOT) is a system of interrelated computing devices,

mechanical and digital machines, objects, animals or people that are

provided with unique identifiers and the ability to transfer data over a

network without requiring human-to-human or human-to-computer

interaction. In the past decade, all human life changed because of the

internet. The internet of things has been heralded as one of the major

development to be realized throughout the internet portfolio of technologies.

The Internet of Things (IOT) is concerned with interconnecting

communicating objects that are installed at different locations that are

possibly distant from each other.

Internet of Things represents a concept in which, network devices have

ability to collect and sense data from the world, and then share that data

across the internet where that data can be utilized and processed for various

purposes. The internet of things describes a vision where objects become

part of internet: where every object is uniquely identified and access to the

network.

IOT communication is quite different from the traditional human to human

10
communication, bringing a large challenge to existing telecommunication

and infrastructure. Furthermore, IOT provides immediate information

regarding access to physical objects with high efficiency. The concept of

Internet of Things is very much helpful to achieve real time monitoring of

sensor data. Internet of Things (IOT) is a kind of network technology, which

is based on information sensing equipment's such as RFID, infrared sensors,

GPS, laser scanners, gas sensors and so on, can make anything join the

Internet to exchange information, according to the protocol, which gives

intelligent identification, location and tracking, monitoring and

management.

In proposing system, we introduced cloud computing technique for

monitoring sensor values on the internet. Cloud computing provides the

access of applications as utilities, over the internet. Cloud computing is a

large scale processing unit which processes in run time and it is also a very

low cost technology based on the IP. The application area of IOT includes

building and home automation, smart city project, smart manufacturing of

various products, wearable, health ca systems and devices, automotive.

CHAPTER-2

SENSORS

11
SP02 SENSOR:

SpO2 sensors typically emit two wavelengths of light, usually red light

(around 660 nm) and infrared light (around 940 nm), through a transparent

part of the body, such as a fingertip or earlobe.

Photo detectors on the other side of the body measure the intensity of the

transmitted light after it has passed through the tissue .The photo detectors

measure the intensity of the red and infrared light after passing through the

tissue. The sensor then calculates the ratio of absorption of the red and

infrared light, which is directly related to the oxygen saturation level in the

blood.

SpO2 sensors are calibrated to account for various factors that can affect the

accuracy of the readings, such as skin pigmentation, ambient light, and

motion artifacts. Calibration algorithms adjust the readings to provide

accurate oxygen saturation values. The oxygen saturation level (SpO2%) is

typically displayed on a monitor or device connected to the sensor.

Overall, SpO2 sensors play a vital role in non-invasive monitoring of

12
oxygen saturation levels, providing valuable information for patient care

and management.

If your Pulse Oximeter says 98%, Good blood oxygenation is necessary to

supply the energy your muscles need in order to function, which increases

during a sports activity. If your SpO2 value is below 95%, that could be a

sign of poor blood oxygenation, also called hypoхіa.

Different Stages of Sp02:

TEMPERATURE & HUMIDITY SENSOR:

The DHT11 is a sensor that is useful in a variety of applications. It has a

13
highly accurate sensor that has its calibration done in a humidity calibration

chamber. The sensor then stores calibration coefficients as program

memory, where it retrieves the 0-100% humidity readings as digital signal

output. The 8-bit microcontroller converts the analog signal to a digital

signal for reading the temperature and humidity.

The sensors are small and have a 20-meter signal transmission range while

having very low operating voltage. Temperature regulation in vehicles.

To predict temperature and humidity conditions in weather stations .The

sensor is also helpful in data loggers. In medical equipment that requires

humidity and measurement control. The sensor plays a role in the

automation of specific processes.

DHT11 digital temperature and humidity sensor is a temperature and

humidity composite sensor with calibration of digital signal output. It uses

dedicated digital module acquisition technology and temperature and

humidity sensing technology to ensure that the product has very high

reliability and excellent long-term stability.

Applications: Air conditioning, dehumidifier, agriculture, cold chain

storage, testing and detection equipment, consumer goods, automotive,

14
automatic control, data logger, weather station, home appliances, humidity

regulator, medical, other related humidity detection control.

Operating Voltage: 3.5V to 5.5V, Operating current: 0.3mA (measuring)

60uA (standby), Output: Serial data, Temperature Range: 0°C to 50°C

Humidity Range: 20% to 90%, Resolution: Temperature and Humidity both

are 16-bitAccuracy: ±1°C and ±1%

BODY TEMPERATURE SENSOR:

The digital temperature sensor like DS18B20 follows single wire

15
protocol and it can be used to measure temperature in the range of -

67oF to +257oF or -55oC to +125oC with +-5% accuracy. The range of

received data from the 1-wire can range from 9-bit to 12-bit. Because,

this sensor follows the single wire protocol, and the controlling of

this can be done through an only pin of Microcontroller. This is an

advanced level protocol, where each sensor can be set with a 64-bit

serial code which aids to control numerous sensors using a single pin

of the microcontroller. This article discusses an overview of a

DS18B20 temperature sensor.

The working principle of this DS18B20 temperature sensor is like a

temperature sensor. The resolution of this sensor ranges from 9-bits to 12-

bits. But the default resolution which is used to power-up is 12-bit. This

sensor gets power within a low-power inactive condition. The temperature

measurement, as well as the conversion of A-to-D, can be done with a

convert-T command. The resulting temperature information can be stored

16
within the 2-byte register in the sensor, and after that, this sensor returns to

its inactive state.

If the sensor is power-driven by an exterior power supply, then the master

can provide read time slots next to the Convert T command. The sensor will

react by supplying 0 though the temperature change is in the improvement

and reacts by supplying 1 though the temperature change is done.

ECG SENSOR:

ECG allows you to access the electrical and muscular functions of the heart.

Electrocardiography (ECG or EKG) is the process of recording the electrical

17
activity of the heart over a period of time using electrodes placed on the

skin. These electrodes detect the tiny electrical changes on the skin that arise

from the heart muscle's electro-physiological pattern of depolarizing and

repolarizing during performed cardiology test.

It is a very commonly the electrical impulse moves from the atria, which are

the top two chambers, to the ventricles down below, the voltage

measurement between the electrodes varies, and this produces a graph of

how your heart is performing. This provides the person running the test with

valuable information based on the intensity of the heart's contractions and

the time intervals between those contractions.

A 3-lead ECG is used for continuous monitoring of heartbeat, heart rate, and

heart rhythm in critical situations like when the patient is under anesthesia,

in surgery or being transported in an ambulance to a health center.

18
ECG Waveform:

ECG curve contains waves P, Q, R, S, T, and sometimes U. For description

of ECG are very important intervals and segments between waves. Every

ECG description has to start with description of heart rhythm (regularly or

irregularly, sinus or non-sinus rhythm) and frequency.

P Wave: P wave should be always before QRS complex, separated by PQ

interval. P wave is a sign of normal atrial depolarization.

PQ Interval: PQ interval is a period of atrial contraction. The depolarization

is delayed in AV node.

QRS Complex:

QRS complex represents ventricular depolarization and contraction.

There are two phases of ventricular depolarization:

19
1. depolarization of inter-ventricular septum - the vector is oriented from

left to right and anteriorly

2. depolarization of ventricles - because the left ventricle is more massive

than the right ventricle, the vector oriented from right to left and posteriorly.

ST Segment: ST segment is isoelectric line, period of no electrical activity

of the heart. Should be in the same level as PQ interval. Every elevation or

depression of this line is pathological.

T Wave: T wave represents re polarization of ventricles. The positivity or

negativity should be the same as the major vector of QRS complex.

HEART RATE SENSOR:

The Heartbeat rate information knowing is very useful while doing exercise,

studying, etc. But, the heartbeat rate can be complicated to calculate. To

overcome this problem, the pulse sensor or heartbeat sensor is used. This is

a plug & play sensor mainly designed for Arduino board which can be used

20
by makers, students, developers, artists who can utilize the heartbeat

information into their projects. This sensor uses an easy optical pulse sensor

along with amplification & cancellation of noise to make a circuit. By using

this circuit, we can get fast and reliable heartbeat readings. This circuit can

be operated with 4mA current and 5V voltage to use in mobile applications

Pin-1 (GND): Black Color Wire – It is connected to the GND terminal of

the system, Pin-2 (VCC): Red Color Wire – It is connected to the supply

voltage (+5V otherwise +3.3V) of the system, Pin-3 (Signal): Purple Color

Wire – It is connected to the pulsating o/p signal.

Its diameter is 0.625,Its thickness is 0.125,The operating voltage is ranges

+5V otherwise +3.3V,This is a plug and play type sensor ,The current

utilization is 4mA,Includes the circuits like Amplification & Noise

cancellation, This pulse sensor is not approved by the FDA or medical. So

it is used in student-level projects, not for the commercial purpose in health

21
issues applications.

WIFI:

Wi-Fi, or Wireless Fidelity, is a widely used wireless networking

technology that facilitates high-speed data transmission over short to

medium distances. In the context of the project, Wi-Fi serves as the

communication protocol between the ESP32 microcontroller and the

Firebase database.

22
The ESP32 microcontroller, equipped with Wi-Fi capabilities, establishes a

connection to the local Wi-Fi network, allowing it to securely transmit

collected health and environmental data to the Firebase database for storage

and analysis. This wireless communication eliminates the need for physical

wired connections, providing flexibility and mobility in deploying the

system while ensuring efficient data transfer.

To establish a Wi-Fi connection, the ESP32 microcontroller scans for

available networks, authenticates itself to the selected network using

predefined credentials, and establishes a secure connection. Once

connected, data packets containing health metrics from sensors are

transmitted over the Wi-Fi network using TCP/IP protocols, ensuring

reliable and efficient communication. Wi-Fi's widespread availability,

robust security features, and high data transfer speeds make it an ideal

choice for enabling seamless communication between the hardware

components of the project and the cloud-based Firebase database, ultimately

facilitating real-time health monitoring and analysis.

23
Wi-Fi enables wireless connectivity, high-speed data transmission, and

widespread adoption across various devices, with robust security measures,

coverage range, and continuous evolution.

CHAPTER – 3

CONTROL BOARDS

ARDUINO BOARD :

24
ARDUINO is a both an open source software library and an open source

breakout board for the popular AVR micro-controllers. The Arduino IDE

(Integrated Development Environment) is the program used to write code,

and comes in the form of a downloadable file on the Arduino website.

Arduino board is the physical board that stores and performs the code

uploaded to it. Both the software package and the board are referred to as

"Arduino".

Arduino is an open source physical computing platform based on a simple

I/O board and a development environment that implements the processing/

writing language. Arduino can be used to develop stand-alone interactive

objects or can be connected to software on your computer.

Arduino platform mainly contains a Hardware Board called Arduino Board

and software Arduino IDE to program it. Other external hardware like

Sensor Modules, motors, lights etc. could be attached with the board.

Arduino board description: Arduino Uno is a microcontroller board based

on the ATmega328P. It has 14 digital input/output pins (of which 6 can be

used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB

connection, a power jack, an ICSP header and a reset button. It contains

25
everything needed to support the microcontroller, simply connect it to a

computer with a USB cable or power it with an AC-to-DC adapter or battery

to get started. The Uno differs from all preceding boards in that it does not

use the FTDIUSB-to- serial driver chip. Instead, it features the Atmega8U2

programmed as a USB-to-serial convertor.

ESP32 BOARD:

ESP32 is far superior than Arduino UNO and an ESP8266, which does not

mean that it is ideal for any project, since to get the most out of this

microcontroller, lets learn what it is and how it works and what are its

26
special features when compared with other microcontroller boards. ESP32

is a series of SoC (System on a Chip) and modules which are low cost with

low power consumption.

This new ESP32 is the successor to the well-known ESP8266(became very

popular with its inbuilt WiFi). ESP32 not only has Built in WiFi but also

has Bluetooth and Bluetooth Low Energy. In other words we can define

ESP32 as “ESP8266 on Steroids”. ESP32 is dual core microprocessor with

an operating frequency of up to 240 MHz. On top of all that, it achieves very

low power consumption through power saving features including clock

synchronization and multiple modes of operation. The ESP32

chip’s quiescent current is less than 5 μA which makes it the ideal tool for

your battery powered projects or IoT applications .

ESP32 board description: The ESP32 is a powerful microcontroller

board that's widely used in IoT (Internet of Things) projects. It features dual-

core processors, Wi-Fi and Bluetooth connectivity, ample GPIO pins, and

support for various interfaces like SPI, I2C, and UART. It's popular for its

versatility and ease of use in building connected devices.

27
Overall, the ESP32 board is known for its versatility, low power

consumption, and affordability, making it a popular choice for IoT projects

ranging from simple sensor nodes to complex smart devices.

ARCHITECTURE:

28
The system Block Diagram revolves around the ESP32 microcontroller,

which serves as the central processing unit responsible for data aggregation,

analysis, and transmission. The ESP32 interfaces with a diverse array of

sensors, including an Electrocardiogram (ECG) sensor for monitoring

cardiac activity, a DHT11 sensor for environmental temperature and

humidity monitoring, a DSB120B sensor for precise temperature sensing,

and a heart rate sensor for monitoring heart rate variability.

The ESP32 collects data from these sensors in real-time and transmits it

securely to a Firebase database. Firebase provides a reliable and scalable

29
platform for storing and retrieving health data, ensuring accessibility for

both users and healthcare professionals. The use of Firebase also enables

seamless integration with the Flutter-based mobile application, facilitating

real-time data visualization and communication features.

This data is securely transmitted to a Firebase database for storage and

accessibility. A Flutter-based mobile application provides users with real-

time access to their health metrics and facilitates communication with

healthcare professionals. Backend services manage user authentication, data

processing, and communication between the mobile app and the database.

Optional machine learning algorithms can analyze data for insights and

personalized recommendations. Overall, the architecture is scalable, secure,

and user-friendly, aiming to empower individuals with proactive health

management tools and streamline communication with healthcare

providers.

HARDWARE SET-UP:

• Arduino Board: The central control unit for interfacing with sensors

30
and transmitting data.

• Electrocardiogram (ECG) Sensor: Connects to the Arduino board

for monitoring heart activity.

• Temperature & Humidity Sensor: Measures ambient temperature

and humidity levels.

• Pulse Oximeter: Measures oxygen saturation levels in the blood and

heart rate.

• Node MCU ESP8266: Facilitates wireless communication and data

transmission to a cloud-based platform.

• Power Supply: Provides power to the Arduino board, sensors, and

Node MCU ESP8266 module.

• Cloud-Based Platform: Receives and stores transmitted health data

for access by patients and doctors.

• Internet Connectivity: Enables data transmission to the cloud-based

platform.

• This setup allows real-time collection and aggregation of vital health

data, offering comprehensive monitoring for patients and valuable

insights for healthcare providers.

This setup comprises an Arduino board interfacing with sensors including

an Electrocardiogram (ECG) sensor for heart monitoring, a Temperature &

31
Humidity Sensor, and a Pulse Oximeter for oxygen saturation and heart rate

measurement. The Node MCU ESP32 enables wireless data transmission to

a cloud-based platform, facilitated by internet connectivity. A power supply

ensures continuous operation, powering the components. This system

allows real-time aggregation of health data, accessible to both patients and

healthcare providers for comprehensive monitoring and insights.

CHAPTER-4

REAL-TIME DATABASE

FIREBASE:
32
Firebase is a product of Google which helps developers to build, manage,

and grow their apps easily. It helps developers to build their apps faster and

in a more secure way. No programming is required on the firebase side

which makes it easy to use its features more efficiently.

It provides services to android, ios, web, and unity. It provides cloud

storage. It uses No SQL for the database for the storage of data.

Firebase is a comprehensive platform provided by Google that offers

various backend services essential for building and scaling mobile and web

applications. It includes features for authentication, real-time database

storage, cloud messaging, hosting, and more.

One of the core components of Firebase is its Real-time Database, which is

a cloud-hosted No SQL database that allows developers to store and

synchronize data between users in real-time. This database is particularly

useful for applications requiring real-time updates and collaboration, such

as chat apps or collaborative document editing tools.

Firebase also provides Firestore, a flexible, scalable database for mobile,

web, and server development. Firestore offers powerful querying

capabilities, offline support, and real-time synchronization, making it

33
suitable for a wide range of applications .In addition to databases, Firebase

offers authentication services, allowing developers to easily integrate user

authentication methods such as email/password, social login (e.g., Google,

Facebook, Twitter), and more. This simplifies the process of managing user

identities and securing access to application resources.

Furthermore, Firebase provides hosting services for deploying web

applications, cloud messaging for sending notifications to users across

platforms, machine learning tools for building intelligent features, and

analytics to track user engagement and app performance .Overall, Firebase

is a versatile platform that offers a suite of backend services, enabling

developers to focus on building high-quality applications without worrying

about managing infrastructure or backend systems.

Real-time Database: The Firebase Real-time Database is a cloud-based No

SQL database that manages your data at the blazing speed of milliseconds.

In simplest term, it can be considered as a big JSON file.

34
35
INTERFACE WITH MOBILE:

Flutter is Google’s Mobile SDK to build native iOS and Android apps from

a single codebase. It was developed on December 4, 2018. When building

applications with Flutter, everything is towards Widgets – the blocks with

which the Flutter apps are built. The User Interface of the app comprises

many simple widgets, each handling one particular job. That is why Flutter

developers tend to think of their Flutter app as a tree of devices.

Flutter revolutionizes mobile app development by providing a powerful

toolkit for building native interfaces efficiently. At its core are widgets,

which are not only the fundamental building blocks of the UI but also the

centerpiece of Flutter's reactive framework. This framework enables

developers to create highly dynamic interfaces that respond to user input

and state changes in real-time. With Flutter's extensive catalog of widgets,

developers can easily construct complex layouts and implement intricate

design elements, ensuring a seamless user experience across different

platforms.

One of Flutter's standout features is its support for both Material Design and

Cupertino, the design languages of Android and iOS respectively. This dual-

36
support allows developers to create apps that not only look native but also

feel native on both platforms. By leveraging Material widgets for Android-

like interfaces and Cupertino widgets for iOS-like interfaces, developers can

ensure consistency with platform conventions while maintaining a unified

codebase. This approach not only simplifies development but also

accelerates the time-to-market for cross-platform applications.

Furthermore, Flutter's hot reload feature enhances the development

workflow by providing instant feedback on code changes. This allows

developers to iterate quickly, making adjustments to the UI and seeing the

results in real-time without the need for lengthy compile times or manual

app restarts. Overall, Flutter empowers developers to build visually

stunning, high-performance mobile applications that deliver a native

experience on both Android and iOS platforms.

Mobile Application:

The mobile application developed using the Flutter framework serves as the

primary interface for users to interact with their health data. The application

provides real-time access to vital signs, including ECG readings,

temperature, humidity, and heart rate measurements. Users can view their

37
health metrics in graphical format, track trends over time, and set

personalized health goals.

One of the key features of the mobile application is its ability to facilitate

direct communication between users and healthcare professionals. Through

the application, users can schedule virtual consultations with healthcare

providers, share their health data securely, and receive personalized

recommendations and interventions. This direct communication channel

enhances the user experience and fosters a collaborative approach to

healthcare delivery.

Code:
import 'package:flutter/material.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_core/firebase_core.dart';
import 'dart:async';
import 'package:chart_sparkline/chart_sparkline.dart';
import 'setting.dart';

void main() async {


WidgetsFlutterBinding.ensureInitialized();
FirebaseOptions firebaseOptions = FirebaseOptions(
appId: '1:162167854615:android:959545070b00b30aa9ae52',
apiKey: 'AIzaSyCfxIkB1icXaLgSRHvJCMb6l8V0RrxWGUw',
projectId: 'hhhh-33293',
messagingSenderId: '162167854615',
databaseURL: 'https://hhhh-33293-default-rtdb.firebaseio.com/',
);

await Firebase.initializeApp(options: firebaseOptions);


runApp(MyApp());
}
//String d="asdfghj";
class MyApp extends StatelessWidget {
@override

38
//String d="sdfgh";
Widget build(BuildContext context) {

return MaterialApp(
title: 'Final year project',
theme: ThemeData(
primarySwatch: Colors.blue,
),
debugShowCheckedModeBanner: false,
home: MyHomePage(),
);
}
}

class MyHomePage extends StatefulWidget {


const MyHomePage({Key? key}) : super(key: key);

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {


String da="sdfgh";
int _selectedIndex = 0;

static List<Widget> _widgetOptions = <Widget>[


//Text('Home Screen'),
//Text('History Screen'),
HomeScreen(),
HistoryScreen(),
SettingsScreen(), // Use the SettingsScreen widget here
];

void _onItemTapped(int index) {


setState(() {
_selectedIndex = index;
});
}
//final double samplingRate = 100;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.greenAccent,
title: Text('HOLISTIC HEALTH MONITORING',style:
TextStyle(fontSize: 15),),
actions: [
IconButton(
onPressed: () {
showDialog(
context: context,

builder: (BuildContext context) {


return AlertDialog(
title: Text("Emergency"),
content: Text("Emergency SOS initiated!"),
actions: <Widget>[

39
TextButton(
child: Text("OK"),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
},
icon: Icon(Icons.sos),
),
],
),
body: _widgetOptions[_selectedIndex],
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(icon: Icon(Icons.home), label:
'Home',),
BottomNavigationBarItem(icon: Icon(Icons.history), label:
'History',),
BottomNavigationBarItem(icon: Icon(Icons.settings), label:
'Settings',)
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.greenAccent,
onTap: _onItemTapped,
),
);
}

}
class HomeScreen extends StatefulWidget {
@override
State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {


List<String> queueList = [];
double sps = 0.0;
String df="ghjk";

late DatabaseReference _re;


late DatabaseReference _ref;
late DatabaseReference _tem;
late DatabaseReference _r;
late DatabaseReference _rq;
String _textData = '';
//double sp;
String r1 = '';
String r2 = '';
String r3 = '';
String r4='';
String r5='g/m³';
String BPM='';
String irString='';

40
String S='0';
String sr='';
String rq='°C';
String rq1='°F';
String we='%';
//double sps;
//Int bpm;
List<double> er = [];
List<double> r2List = [];

void enqueue(String item) {


setState(() {
queueList.add(item);
});
}

void dequeue() {
setState(() {
if (queueList.isNotEmpty) {
queueList.removeAt(0);
}
});
}

@override
void initState() {
super.initState();
_re = FirebaseDatabase.instance.ref().child('ECG/Value');
_ref = FirebaseDatabase.instance.ref().child('DHT11/Humidity');
_tem= FirebaseDatabase.instance.ref().child('DHT11/Temperature');
_r = FirebaseDatabase.instance.ref().child('DS18B20/Temperature');
_rq = FirebaseDatabase.instance.ref().child('PulseSensor/BPM');

_re.onValue.listen((DatabaseEvent event) {
setState(() {
r2 = event.snapshot.value.toString() ?? '';
if (r2.isNotEmpty && double.tryParse(r2) != null) {
double r2Double = double.parse(r2);
er.add(r2Double);
updateR2List(r2Double); // Add this line to update r2List
}
});
});
_tem.onValue.listen((event) {
setState(() {
r3 = event.snapshot.value.toString() ?? '';
});
});

_r.onValue.listen((event) {
setState(() {
r1 = event.snapshot.value.toString() ?? '';
});
});
double calculateSpO2(double bpm) {
// This is just a simple example formula for demonstration
purposes
// In real-world scenarios, you would use more sophisticated

41
models or lookup tables
double spo2 = 95 - ((bpm - 60) / 5); // Example formula
return spo2.clamp(70, 100); // Clamp the value between 70 and 100
}

_rq.onValue.listen((event) {
setState(() {
BPM = event.snapshot.value.toString() ?? '';
if (BPM.isNotEmpty && double.tryParse(BPM) != null) {
double BPR = double.parse(BPM);
double IR=BPR-40;
irString = IR.toString();
sps = calculateSpO2(IR);

//print('f:$IR');
print('IR: $sps');
//double bpr = double.parse(BPM); // Assuming default value
is 0 if parsing fails
}//BPM = bpm;
});
});
_ref.onValue.listen((event) {
setState(() {
_textData = event.snapshot.value.toString() ?? '';
});
});
}

void updateR2List(double newValue) {


setState(() {
r2List.add(newValue);
if (r2List.length > 40) { // Limit the list to 20 values
r2List.removeRange(0, r2List.length - 40);
}
});
}

@override
Widget build(BuildContext context) {
return Container(height: 646,
child: Center(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[

Container(color: Colors.black,
height: 240,
width: double.infinity,
//decoration: BoxDecoration(
///color: Colors.black,
//borderRadius: BorderRadius.circular(10),
//),
child:Sparkline(
data: r2List,
lineColor: Colors.white,

42
),
),
Text("ECG GRAPH", style: TextStyle(fontSize: 20,),),
//SizedBox(height: 35),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildSensorBox('ECG DATA:',
r2,r4,Icons.monitor_heart_rounded),
_buildSensorBox('Body Temparature:',
r1,rq,Icons.thermostat_auto_outlined),
],
),
//SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildSensorBox('Humidity:',
_textData,r5,Icons.water),
_buildSensorBox('Temparature:',
r3,rq,Icons.thermostat),

],
),
//SizedBox(height:20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildSensorBox('BPM:',irString,r4,Icons.favorite),

_buildSensorBox('SP02:',sps.toString(),we,Icons.health_and_safety_round
ed),
],
),
//_buildSensorBox('Temparature:', r3),
],
),

),
),
);
}
Widget _buildSensorBox(String title, String data,String
data1,IconData icon) {
return Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.only(bottom: 20),
width: 120,
decoration: BoxDecoration(
border: Border.all(color: Colors.green),
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(fontSize: 15, fontWeight:

43
FontWeight.bold),
),
SizedBox(height: 5),
Row(
children:<Widget>[
Icon(icon),
//Icon(Icons.favorite, color: Colors.red, size: 24.0),

Text(
data,
style: TextStyle(fontSize: 12),

),
Text(data1)
//Icon(Icons.warning),
//Icon(Icons.favorite, color: Colors.red, size: 24.0)

],
),
],
),
);
}
}

class HistoryScreen extends StatefulWidget {


@override
State<HistoryScreen> createState() => _HistoryScreenState();
}

class _HistoryScreenState extends State<HistoryScreen> {


List<double> data = [0.0, 1.0, 1.5, 2.0, 2.5, 2.0, 1.5, 1.0, 222.5];
List<String> queueList = [];
double sps = 0.0;
String df="ghjk";

late DatabaseReference _re;


late DatabaseReference _ref;
late DatabaseReference _tem;
late DatabaseReference _r;
late DatabaseReference _rq;
String _textData = '';
//double sp;
String r1 = '';
String r2 = '';
String r3 = '';
String r4='';
String r5='g/m³';
String BPM='';
String irString='';
String S='0';
String sr='';
String rq='°C';
String rq1='°F';
String we='%';
//double sps;
//Int bpm;
List<double> er = [];

44
List<double> r2List = [];

void enqueue(String item) {


setState(() {
queueList.add(item);
});
}

void dequeue() {
setState(() {
if (queueList.isNotEmpty) {
queueList.removeAt(0);
}
});
}

@override
void initState() {
super.initState();
_re = FirebaseDatabase.instance.ref().child('ECG/Value');
_ref = FirebaseDatabase.instance.ref().child('DHT11/Humidity');
_tem= FirebaseDatabase.instance.ref().child('DHT11/Temperature');
_r = FirebaseDatabase.instance.ref().child('DS18B20/Temperature');
_rq = FirebaseDatabase.instance.ref().child('PulseSensor/BPM');

_re.onValue.listen((DatabaseEvent event) {
setState(() {
r2 = event.snapshot.value.toString() ?? '';
if (r2.isNotEmpty && double.tryParse(r2) != null) {
double r2Double = double.parse(r2);
er.add(r2Double);
updateR2List(r2Double); // Add this line to update r2List
}
});
});
_tem.onValue.listen((event) {
setState(() {
r3 = event.snapshot.value.toString() ?? '';
});
});

_r.onValue.listen((event) {
setState(() {
r1 = event.snapshot.value.toString() ?? '';
});
});
double calculateSpO2(double bpm) {
// This is just a simple example formula for demonstration
purposes
// In real-world scenarios, you would use more sophisticated
models or lookup tables
double spo2 = 95 - ((bpm - 60) / 5); // Example formula
return spo2.clamp(70, 100); // Clamp the value between 70 and 100
}

_rq.onValue.listen((event) {
setState(() {
BPM = event.snapshot.value.toString() ?? '';

45
if (BPM.isNotEmpty && double.tryParse(BPM) != null) {
double BPR = double.parse(BPM);
double IR=BPR-40;
irString = IR.toString();
sps = calculateSpO2(IR);

//print('f:$IR');
print('IR: $sps');
//double bpr = double.parse(BPM); // Assuming default value
is 0 if parsing fails
}//BPM = bpm;
});
});
_ref.onValue.listen((event) {
setState(() {
_textData = event.snapshot.value.toString() ?? '';
});
});
}

void updateR2List(double newValue) {


setState(() {
r2List.add(newValue);
if (r2List.length > 40) { // Limit the list to 20 values
r2List.removeRange(0, r2List.length - 40);
}
});
}

@override
Widget build(BuildContext context) {
return SingleChildScrollView(scrollDirection: Axis.vertical,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Temparature data',
style: TextStyle(fontSize: 24),
),
SizedBox(height: 20),
Container(
width: 300,
height: 200,
child: Sparkline(enableGridLines: true,
data: data,
lineColor: Colors.blue,
pointsMode: PointsMode.all,
pointSize: 8.0,
),
),
SizedBox(height: 35),
Text(
'heartbeat data ',
style: TextStyle(fontSize: 24),
),
Container(

46
width: 300,
height: 200,
child: Sparkline(enableGridLines: true,
data: data,
lineColor: Colors.blue,
pointsMode: PointsMode.all,
pointSize: 8.0,
),
),
SizedBox(height: 35),
Text(
'spo2 data ',
style: TextStyle(fontSize: 24),
),
Container(
width: 300,
height: 200,
child: Sparkline(enableGridLines: true,
data: data,
lineColor: Colors.blue,
pointsMode: PointsMode.all,
pointSize: 8.0,
),
),

],
),
),
);
}
}

class SettingsScreen extends StatefulWidget {


@override
State<SettingsScreen> createState() => _SettingsScreenState();
}

class _SettingsScreenState extends State<SettingsScreen> {


@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Developers'),
),
body: Center(
child: Column(
children:<Widget>[ ProfileRow(
photo: AssetImage('assets/profile_photo.jpg'),
name: 'K S N M HANUMANTHARAO',
destination: 'B.tech',
),
ProfileRow(
photo: AssetImage('assets/profile_photo.jpg'),
name: 'M ALEKYA',
destination: 'B.tech',
),
ProfileRow(
photo: AssetImage('assets/profile_photo.jpg'),

47
name: 'J VIJAY BABU',
destination: 'B.tech',
),
ProfileRow(
photo: AssetImage('assets/profile_photo.jpg'),
name: 'G MANIKANTA',
destination: 'B.tech',
),
Text('Mentor',style: TextStyle(fontSize: 35),),
ProfileRow(
photo: AssetImage('assets/profile_photo.jpg'),
name: 'Sri.V. RAMA KRISHNA ',
destination: 'M.tech(Assistant Professor,Srkrec)',
),
] ),
),
);
}
}

class ProfileRow extends StatelessWidget {


final ImageProvider photo;
final String name;
final String destination;

const ProfileRow({
required this.photo,
required this.name,
required this.destination,
});

@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(10),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CircleAvatar(
radius: 30,
backgroundImage: photo,
),
SizedBox(width: 20),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
name,
style: TextStyle(fontSize: 20, fontWeight:
FontWeight.bold),
),
Text(
destination,
style: TextStyle(fontSize: 16, color: Colors.grey),

48
),
],
),
],
),
);
}
}

49
50
51
CHAPTER-5

RESULTS

52
53
54
ADVANTAGES:

PATIENTS:

• Timely & Proper treatment at an early stage.

• Multiple doctors can evaluate the condition from the remote

locations.

• Proximity to home and community.

• Reduced travel and wait time.

• Rapid diagnosis & fast intervention by the doctor.

• Predictability of heart attacks and other diseases.

DOCTOR:

• Real-time visualization of patient health and medical parameters.

• Increase operational efficiency, planning & compliance.

• Reduces the workload, clinical productivity solution.

• Save Time & Resources.

• Prediction of Health conditions

CONCLUSION:

55
The proposed IOT-based Holistic health monitoring system represents a

significant advancement in the field of healthcare technology. The ESP32

microcontroller for seamless data aggregation and transmission from

various sensors to a Firebase database. Real-time monitoring of vital health

metrics ensures prompt insights accessible to both users and healthcare

professionals. The user-friendly mobile application developed using the

Flutter framework enhances accessibility, providing real-time health metric

access and facilitating direct communication channels between users and

healthcare providers. By enabling features such as virtual consultations,

secure health data sharing, and personalized recommendations, the project

revolutionizes healthcare delivery, empowering individuals with proactive

health management tools while streamlining communication for enhanced

well-being.

56
FUTURE SCOPE:

•Expansion of Sensor Capabilities: Incorporate advanced sensors for

monitoring additional health parameters beyond the current set, enabling a

more comprehensive health monitoring experience.

•Enhanced Data Analytics: Implement advanced data analytics techniques

and machine learning algorithms to provide personalized health insights and

predictive analytics based on the collected data.

•Integration of Telemedicine Features: Integrate telemedicine

functionalities into the system, allowing for remote diagnosis, virtual

consultations, and remote treatment options, thereby expanding access to

healthcare services.

•Scalability Improvements: Enhance the scalability of the system to

accommodate larger user bases and support seamless integration with

existing healthcare infrastructure, ensuring its viability for widespread

adoption and deployment.

•Continuous Innovation: Stay abreast of emerging technologies and industry

trends to drive ongoing innovation in health monitoring and healthcare

delivery, ensuring that the system remains at the forefront of advancements

in the field.

57
REFERENCES:

• https://www.ijert.org/research/iot-based-system-for-

heart-rate-monitoring-IJERTV9IS070673.pdf

• https://ieeexplore.ieee.org/document/8455124?arnumber

=8455124

• https://ieeexplore.ieee.org/document/8455124?arnumber

=8455124

• https://ieeexplore.ieee.org/xpl/RecentIssue.jsp?punumbe

r=5326

58

You might also like