Sleep Apnea Home Monitor and Analysis System

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 10

Sleep Apnea Home Monitoring and Analysis

System

Jagdeesh Patil S
Information Science and Engineering Kshitija Chavi Singh
Department Information Science and Engineering Information Science and Engineering
Nitte Meenakshi Institute of Technology Department Department
Bangalore, India Nitte Meenakshi Institute of Technology Nitte Meenakshi Institute of Technology
jagadish.patil@nmit.ac.in Bangalore, India Bangalore, India
kshithijar098@gmail.com chavisingh@gmail.com

Faizah Ali
Information Science and Engineering Department Bhyravi C
Nitte Meenakshi Institute of Technology Information Science and Engineering Department
Bangalore, India Nitte Meenakshi Institute of Technology
faizah2000@gmail.com Bangalore, India
bhyravi.cs@gmail.com

978-1-6654-9790-9/22/$31.00 ©2022 IEEE


Abstract— Obstructive Sleep Apnea (OSA) is a serious II. RELATED WORK
sleep disorder if left unmonitored it can lead to multiple organ
disorders, hypoxia, and increases the risk of high blood
Sleep apnea is a standard sleep problem that meddles
pressure, recurrent heart attack, and atrial fibrillation. Our with the breathing of an individual on the walls of the throat
project aims at using a clinical-grade biosensor to design an and is loose and limited while sleeping. While resting, the
HRV monitor system with CSV output files for research and muscles of the throat become loose and frail. There are 3
analysis. Arduino is used for AFE initialization. After kinds of sleep apnea, that is obstructive sleep apnea caused
initialization the ECG and RR interval data is read from the by the shrinking of the respiratory tract, central sleep apnea
MAX30003. The valid range of RR interval is checked before caused by the unstable respiratory control communities that
transmitting the data via Bluetooth. The application receives outcome in the brain neglecting to flag the breathing
ECG and RR data via Bluetooth receiver and it is further muscles [2],[3], and mixed complex which is a mix of
processed by HRV activity. As HRV is a sensitive metric which obstructive and central apnea. Sleep apnea is extremely
varies from person to person based on biological age, gender normal, generally found more in men than in women. This
and stress, we have given the provision to set the alert level of condition can happen in patients of all ages, however, is
HRV as prescribed by the doctor. This at-home tele-monitor more normal in the moderately aged patient. Sleep apnea
Heart Rate Variability (HRV) system collects, stores, and can be treated by knowing the side effects or indications of
presents data to the sleep clinician. This HRV system is used as sleep apnea, decreasing the danger factors, and being talked
a precursor to a detailed diagnosis by the sleep clinician. It is
about with the specialist for additional action. The reason
helpful to the sleep clinician to assess the patient's condition as
quickly and precisely as possible. This system also effectively
for this review is to build a classification model to recognize
reduces the overall cost which is incurred by patients in sleep sleep problems from the Heart Rate Variability (HRV)
labs. features that can be acquired with Electrocardiogram (ECG)
signals. In this review, HRV features were handled utilizing
Keywords— Heart Rate Variability, hackers, legitimate, a few classification techniques, for example, N-Bayes, SVM
sensitive data. linear methods, ANN, and KNN. The classification is
performed utilizing a subject-independent scheme and
I. INTRODUCTION subject-specific schema. The simulation results show that
Heart Rate Variability (HRV) is the physiological the SVM strategy achieves higher precision other than three
phenomenon of variation in the time interval between heart- different techniques in recognizing sleep apnea. While, time
beats [1]. There is research going on in various fields of domain highlights show the most prevailing exhibition
health and sports to make use of this natural indicator of among the HRV features [4]. P. M. Mohan et.al. explored
health which is the HRV. There are many HRV devices the ideas of Heart Rate Variability using
available which are either not clinical grade or very Photoplethysmography (PPG) optical sensors. During this
expensive. Many mobile watches which provide HRV for we have likewise attempted to see the stress amount of the
shorter duration to help sports activities and this does not subject from the HRV information. 25 years of clinical
need accuracy for research and durability for longer storage. examination has shown that heart rate variability (HRV) is
Our project aims in bridging this gap and we built a clinical the most substantial measure of stress. Stress can be
grade HRV device and ability of a longer and reliable estimated utilizing respiratory capabilities yet with scaling
monitor with open CSV output file generated from the down the PPG sensors HRV is turning out to be more
android application for research and analysis. We also used demandable on the wearable market. At present no one has
python to deduce sample HRV using ECG data. After trying time and money to spend on clinical checks to measure
AFE MAX86150 and MAX30003 from Maxim, we chose stress subsequently innovation has made it simple and cost-
MAX30003 biosensor because it is having inbuilt Pan– effective PPG sensors. By using running algorithms, it is
Tompkins algorithm for noise filtering and amplified peak reasonable to evaluate pulse and HR related specification
detection. like HRV. To precisely decide the HRV the heart signal has
to be cleaned and improved positively. So in the review of
The paper focusing on helping sleep apnea patients to use this paper they track down how to get HRV from the PPG
our device as they need longer observation. Generally, in signals and figure out the areas under different frequency
sleep labs complicated devices and many types of equipment regions [5]. Obstructive sleep apnea is a customary
are connected to the patient's body for longer observation. It respiratory issue portrayed by regular intervals of breathing
is really hard for the patients to sleep with many biosensors discontinuation because of incomplete or complete blockage
connected to the body from a practical point of view. Sleep of upper airways. In this paper the principal aim was to
labs are expensive for longer duration observation. Since evaluate whether heart rate fluctuation changed in patients
HRV is giving greater hope of identifying the sleep apnea with obstructive sleep apnea. Obstructive sleep apnea leads
markers with various research done across the globe and our to hypoxia, intermittent hypercapnia which regulate
efforts of providing a clinical level HRV will help enhance autonomic nervous system of sleep apnea patients. Major
the researcher’s efforts for more accurate observation and aid consequence of sleep apnea patient is that they have reduced
in further research. The main challenge we faced in this vagal tone and expanded sympathetic reaction which gives
project was reducing noise of the ECG signal and way to sympathetic-parasympathetic irregularity [6].
programming the digital filter. The analysis using Python Whether Heart rate variability (HRV) is the straightforward
helped us to cross verify the accuracy from this device. The solution to recognize sleep apnea. Assigned devices were
future expansion through usage of cloud databases and developed over 15 years to observe sleep apnea at early
machine learning will lead to infinite possibilities to exactly phase utilizing the recordings of oxygen saturation, body
identify sleep apnea markers and other heart and mental position, heart rate and snoring. These devices were utilized
conditions to identify the individual threat of patients enduring sleep
disorder breathing issues which will be then referred to get a
polysomnography. Sleep labs have restricted size for
polysomnography and are very expensive in terms of cost
due to repeated presence of the patient through the night. In
the European Respiratory Journal, it is found that we can In figure 1 it explains as follows mHR is mean of RR
work on the acknowledgment of sleep apnea in view of the intervals; mHRV heart rate variability and it is the aggregate
noninvasive simple recording of electrocardiography (ECG) sum of deviations of both HR and RR spans; SDNN:
and heart rate. Inspection confirmed that from HRV changes standard deviation of all NN spans and a characteristic of all
alone sleep apnea can be recognized at greater extent [7]. HRV;RMSSD: the Square root mean of the amount of the
There is a prototyped wireless ECG (electrocardiogram) squares of contrasts between neighboring NN stretches and
sensor for continuous heart rate variability (HRV) it mirrors the short recurrent changeability in the autonomic
observation, in view of an economically accessible sensor tone that is to a great extent vagally mediated; CVRR:
node. There is an ECG amplifier circuit that is designed on a coefficient of varieties of RR interval and mirroring the
PCB board that is of comparative size to the sensor node parasympathetic sensory system activity is utilized[11].
that achieves a minimum system size. In this execution, the
ECG is identified from both a patient test and a healthy
body. The ECG signal here is bandlimited to 0.05Hz and
100Hz and enhanced multiple times before ADC alteration.
A continuous HRV detection calculation is executed on the
ECG sensor. The object is to decrease the throughput of
wireless information, and subsequently draw out battery
duration. Because of the high examining rate necessity (e.g A Real time QRS Detection Algorithm is a reliable
200Hz) of ECG identification [8]. method which recognizes QRS complexes in a view of
In patients who suffer from a acute myocardial infarction digitized analyses of amplitude, width and slope. A unique
and chronic heart failure it is accepted that the prognostic computerized bandpass filter which lessens the false
information is of two methods in time domain: the standard detection that has been caused by different types of
deviation of the intervals between the NN adjacent intervals interference that is present in ECG signals. There is a
and pNN50 which differs by 50ms there is certain factor in filtering that permits use of low threshold which therein
the percentage that shows whether the patient is suffering increases detection sensitivity. The algorithm naturally
from the disease or whether he is normal. A SDNN value adjusts its parameters and limits intermittently that adapts to
that is less than 50ms or the pNN50 lower than 3% is being such ECG changes as heart rate and QRS morphology [12].
considered that the patient is at high risk, a SDNN of
between 50-100 is indicated as moderate risk, while a value
that is over 100ms or the pNN50 greater than 3% is being
considered as normal. In this paper there was a analysis of
heart rate variability between different parameters like
physical workout, age, weight, lifestyle but not between
genders.[9]. ECG record of Sleep Apnea patients available
on Physionet for Research records fluctuate long from III. FRAMEWORK AND DESIGN
somewhat under 7 hours to almost 10 hours each. Each
recording incorporates a persistent digitized ECG signal, a A. System Design
bunch of sleep apnea explanations (inferred by human Python Biosensor MAX30003 is used to obtain the
specialists based on all the while recorded breath and related ECG sensor data. This data is sent to the Arduino which
signals). The information comprises of 70 records, divided further sends the ECG and RR data to the HC-05 Bluetooth
into a learning set of 35 standards (a01 through a20, b01 module. ECG and RR data is received by the android app
through b05, and c01 through c10), and a test set of 35 from the HC-05 bluetooth module. The ECG and RR data is
standards (x01 through x35), which may all be downloaded processed to get HRV and the same is displayed. The ECG,
from this current page. [10] RR and HRV data are stored in two csv files by the android
app. These two files are used for further analysis and
research in our project. In the figure below there is a
working design flow diagram of the Sleep Apnea Home
Monitor and Analysis System

Fig 1. Equations to compute time domain measures


Fig 2. Sleep Apnea Home Monitor and Analysis System diagram

B. Methodology
The medical grade HRV monitor supporting long
duration observation has been designed from an economical
and practical point of view. This is achieved using
Max30003 initialization, Arduino programming and
Android application.

1. MAX30003 Initialization

The Max30003 to be initialized for ECG and RR interval


interrupts. On receiving interrupts, the ECG data and RR
interval data will be read the respective registers and it will
be plotted against time. There is a flowchart of MAX30003
Initialization below Fig 3. MAX30003 Initialization Flowchart

2. Arduino Programming

Arduino is used for AFE initialization. After


initialization the ECG and RR interval data is read from the
MAX30003. The valid range of RR interval is checked
before transmitting the data via Bluetooth. This figure below
shows the algorithm of Arduino Programming
IV. IMPLEMENTATION

A. AFE
This project needs clinical grade measurement of Heart
Rate Variability (HRV). Most aspects of HRv for sleep
apnea are still under research. We have narrowed two
clinical grade Analog Front End (AFE) from MAXIM
MAX86150 and MAX30003 based on cost, clinical grade
accuracy and longer duration measurements. We started
with MAX86150 initially and we faced many challenges to
filter noise in the ECG signals which is the basis for HRV
measurements. Hence, we migrated to MAX30003 in the
final design.

B. MCU
Found that ATmega328P MCU is capable of receiving
data from AFE MAX30003 through serial peripheral
interface (SPI) protocol or MAX86150 through I2C. We
finalized Arduino UNO during development.

C. Blutooth
We finalized on HC05 serial to Bluetooth module which
Fig 4. Arduino Programming Algorithm converts serial communication to Bluetooth communication.
3. Android Modules

D. Android App
The application receives ECG and RR data via Bluetooth
receiver and it is further processed by HRV activity module.
This HRV is plotted against time in either portrait or
landscape view. Provision to display RR, Heart rate and  Login
HRV values in text format based on radio button clicked by
user. Provision provided to set the alert level of HRV as
prescribed by doctor. The Android application module is
shown below in the figure 5 depicting top level modules and  Receive data on Bluetooth
their interactions.

 Process data for RR interval and calculate HRV

 Store HRV in CSV format with start date and time


as file name. Optionally there is a provision for
ECG storage in CSV format.

 Display

Fig 5. Android Application Modules


i. HRV  Built-In Heart Rate Detection with Interrupt
Feature Eliminates the Need to Run HR Algorithm
on the Microcontroller.
ii. R2R Interval

 Robust R-R Detection in High-Motion


iii. ECG Environment at Extremely Low Power.

 32-Word FIFO Allows You to Wake Up


E. Battery Charger Microcontroller Every 256ms with Full ECG
Lipo(Lithium Polymer) battery with a USB charger is Acquisition.
used for powering the hardware. Since the device is
connected to the patient body, it should never be used when
it is connected to mains charging. It should always be
disconnected from mains in actual use. We are also using an
LDO (Load Drop Out) regulator from the battery to reduce G. Circuit Diagram
noise instead of switching the regulator. Figure 7 depicts the circuit diagram of MAX30003
Evaluation kit. Externally electrode pads are connected to
the patient’s body. The potential difference between the two
corresponding attachments will be measured by a pair of
electrodes.
F. Max30003 Expansion Board

Fig 6. MAX30003 Expansion Board

1. Key Specification

 MAX30003 Biopotential AFE Clinical-Grade ECG


AFE with High-Resolution Data Converter 15.5
Bits Effective Resolution with 5µVP-P Noise.

Fig 7. MAX30003 circuit diagram


 Longer Battery Life Compared to Competing
Solutions 85µW at 1.1V Supply Voltage. H. ECG and RR data communication over Bluetooth
ECG is a continuous data with 125 samples per
second. RR detections happens between two ECG peaks.
The RR value will be obtained from MAX30003 after peak
detection with minimum of a pair of peak detection. The
ECG and RR data is sent over Bluetooth. The differentiation
of RR and ECG is done by the value of 0X7AAA. This
means after the 0X7AAA the next value expected by the
android application is the RR value. This is depicted in
below Figure 8. V. RESULT ANALYSIS

Tested the Sleep Apnea Home Monitor and Analysis


system to display the HRV, R2R Intervals and ECG of the
following test subjects of different age groups:

Fig 8. ECG and RR data communication over Bluetooth

I. Hardware Bring-up  Test Subject 1: 18-year-old female


The proper functioning and initialization of hardware is
basis for the entire project success. To program MAX 30003
complete understanding of datasheet and programming
sequence is required for intended functioning. Following  Test Subject 2: 49-year-old male
sequence of chip initialization programming is done to bring
up the board.

 SW(Software) Reset

 Configuration General

 Configuration EMUX (Electronic Multiplexer)


Fig 9. Test Subject 2: 18-year-old female

 Configuration ECG

 Configuration RTOR1

 Configuration RTOR2
Fig 10. Test Subject 2: 49-year-old male

A. Display
 Enable Interrupts
1. ECG Display
When the user opens the app where he can see four radio
 Manage Interrupts buttons namely ECG, Saved HRV, RR and HRV after the
Bluetooth device is connected. We have provided the option
to click on the ECG radio button and we can see the ECG
display as shown below.
 Read ECG

 Read RR interval
RR display as shown in the figure 14.

Fig 11. Detected and Recognized License Plate

2. HRV Display
Fig 14. RR Display
On clicking HRV radio button, we can see the HRV
display as shown in figure 12. We have given the provision B. Analysis using python in jupyter notebook from the
to set the HRV alert level by the sleep physician as shown in ECG csv file and HRV and RR csv file
figure 13.HRV alert level means there will different After extracting the dataset that we have got from the
measurement of heart rate based on certain criteria such as ECG csv, HRV csv and RR csv file we are going to import
age, weight, physical activity, fitness thus we keep a this dataset in the jupyter notebook and make some analysis
measurement as prescribed by the doctor and check the heart like ECG signals with found peaks which is shown in figure
rate of the patient 15

Fig 15. ECG signals with found peaks)

We find multiple samples for single peak and finding


RR interval would be difficult thus, to get a single value for
each peak we will have to group those sample as one as
shown in figure 16 and find RR interval against time(ms) to
the grouped peak as shown in figure 17

Fig 12. HRV Display

Fig 16. Grouping similar peaks together

Fig 17. RR intervals against time(ms)


Fig 13. HRV Alert level Display
Plotted the HRV graph which we loaded from HRV csv
3. RR Display file plotted against time(sec) shown in the figure 18
The patient or sleep clinician can also view the RR
values by clicking on RR radio button and we can see the
systolic heart failure,” New England Journal of Medicine, vol. 373,
no. 12, pp. 1095–1105, 2015.
[4]. B. Sulistyo, N. Surantha, and S. M. Isa, “Sleep apnea identification
using hrv features of ecg signals,” International Journal of Electrical
and Computer Engineering (IJECE), vol. 8, no. 5, pp. 3940–3948,
2018.
[5]. P. M. Mohan, V. Nagarajan, and S. R. Das, “Stress measurement from
wearable photoplethysmographic sensor using heart rate variability
data,” in 2016 International Conference on Communication and
Signal Processing (ICCSP), pp. 1141–1144, IEEE, 2016.
Fig 18. HRV plotted against time(sec) [6]. V. C. C. Sequeira, P. M. Bandeira, and J. C. M. Azevedo, “Heart rate
variability in adults with obstructive sleep apnea: a systematic
review,” Sleep Science, vol. 12, no. 3, p. 214, 2019.
VI. CONCLUSION AND FUTURE WORK
[7]. T. Penzel, “Is heart rate variability the simple solution to diagnose
sleep apnoea?,” 2003.
[8]. K.-I. Wong, “Real-time heart rate variability detection on sensor
A. Conclusion node,” in 2009 IEEE Sensors Applications Symposium, pp. 184–187,
The project developed a home based sleep apnea IEEE, 2009.
monitoring system by monitoring heart rate variability [9]. C. Marina Medina, T. Blanca de la Cruz, E. Alberto Garrido, S.
which involves development of cost effective hardware by Marco Antonio Garrido, and N. O. Jos´e, “Normal values of heart rate
variability at rest in a young, healthy and active mexican population,”
using sensors ICs which is close to clinical level to measure Health, vol. 2012, 2012.
HRV ,embedded coding for sensors including Bluetooth [10]. G. B. Moody, R. G. Mark, and A. L. Goldberger, “Physionet: a web-
communication to Android, developed an Android app to based resource for the study of physiologic signals,” IEEE
collect ,store ,present and analyze HRV data to physician Engineering in Medicine and Biology Magazine, vol. 20, no. 3, pp.
and patient along with providing provision for setting alert 70–75, 2001.
level as prescribed by sleep clinician .We have also explored [11]. H. Nagendra, V. Kumar, and S. Mukherjee, “Cognitive behavior
HRV using python in Jupyter notebook. There is a lot of evaluation based on physiological parameters among young healthy
subjects with yoga as intervention,” Computational and mathematical
ongoing research in knowing better applicability of HRV for methods in medicine, vol. 2015, 2015.
diagnosing present and future health issues. [12]. J. Pan and W. J. Tompkins, “A real-time qrs detection algorithm,”
IEEE transactions on biomedical engineering, no. 3, pp. 230–236,
REFERENCES 1985.
[13]. N. Q. Al-Naggar, H. M. Al-Hammadi, A. M. Al-Fusail, and Z. A. Al-
Shaebi, “Design of a remote realtime monitoring system for multiple
[1]. H. ChuDuc, K. NguyenPhan, and D. NguyenViet, “A review of heart physiological parameters based on smartphone,” Journal of
rate variability and its applications,” APCBEE procedia, vol. 7, pp. Healthcare Engineering, vol. 2019, 2019.
80–85, 2013. [14]. X. Wang, M. Cheng, Y. Wang, S. Liu, Z. Tian, F. Jiang, and H.
[2]. A. Qaseem, P. Dallas, D. K. Owens, M. Starkey, J.-E. C. Holty, P. Zhang, “Obstructive sleep apnea detection using ecg-sensor with
Shekelle, and C. G. C. of the American College of Physicians*, convolutional neural networks,” Multimedia Tools and Applications,
“Diagnosis of obstructive sleep apnea in adults: a clinical practice vol. 79, no. 23, pp. 15813–15827, 2020.
guideline from the american college of physicians,” Annals of internal [15]. L. Bonek, S. Fenech, N. Sapoznik, A. J. Hanson, S. Masihi, D.
medicine, vol. 161, no. 3, pp. 210–220, 2014. Maddipatla, M. Panahi, and M.Z.Atashbar,“Development of a flexible
[3]. M. R. Cowie, H. Woehrle, K. Wegscheider, C. Angermann, M.-P. and wireless ecg monitoring device,” in 2020 IEEE SENSORS, pp. 1–
d’Ortho, E. Erdmann, P. Levy, A. K. Simonds, V. K. Somers, F. 4,IEEE,2020
Zannad, et al., “Adaptive servo-ventilation for central sleep apnea in

You might also like