University of Technology -Iraq
Collage of Electrical Engineering
Department of Electronic Engineering
Fourth Year 2024-2025
Design and Implementation Sleep Apnea Detection Device
{Graduation project}
Prepared by students:
1-Hussein Abdullah Sayyed
2-Banen Mohammed Jary
1
Chapters:
Chapter one: introduction
From page 1 to page 4
Chapter two: Literature Review
From page 5to page 11
Chapter three: Practical Section
From page 12 to page 23
Chapter four: Analysis of results
From page 24 to page 27
Chapter five: References
From page 28 to page 29
2
Chapter 1: Introduc on
Background of Sleep Apnea
What is Sleep Apnea?
Sleep apnea is a sleep disorder characterized by pauses or complete
cessation of breathing for 10 to 20 seconds, leading to oxygen deprivation
and frequent awakenings during sleep.
Sleep apnea affects adults and the elderly, especially those who are obese,
and can also affect young children due to underlying health problems such
as enlarged tonsils and adenoids.
Sleep apnea is usually more common in males than females before the age of
50, but after this age, the incidence is equal in both sexes
1
Problem Statement
The goal is to design a sleep apnea device to be a lifesaver for patients
suffering from this condition during sleep
It is used to reduce the occurrence of sleep apnea by:
1- Monitoring blood oxygen levels
2- Monitoring heart rate
This is because sleep apnea is harmful and directly affects a person's comfort
when going to sleep at the end of a tiring day
2
The device's ability lies in sending very precise signals at high speed to
issue an alert when the blood oxygen level drops and the heart rate deviates
from the person's normal level during sleep.
The need to study this disorder and shed light on its causes, effects, methods
of diagnosis, and treatment arises because the lack of health awareness in
society, despite the widespread prevalence of sleep apnea, has made it
difficult to deal with the disease correctly, leading to an exacerbation of its
associated health complications.
Significance of the Project
Objectives of Research on Sleep Apnea Detection Devices
1- To define sleep apnea, its duration, and types.
2- To highlight the importance of a device for quickly detecting breathing
during sleep.
3- To clarify the symptoms using the device and display them on an alarm
or screen.
4- To identify the causes of insufficient breathing during sleep
5- To explain the reasons leading to sleep apnea.
6- To discuss pathological diagnostic methods.
7- To understand the device's capabilities and effectiveness.
8- To provide detailed device specifications.
9- To identify the areas affected by sleep apnea.
10- To raise medical awareness of this condition.
3
Research boundaries
Research into sleep apnea devices is limited to understanding and
diagnosing the causes of the disease, detecting sleep apnea, and focusing on
developing a suitable device to help people suffering from sleep apnea
quickly enough to alert and assist them, as early diagnosis and treatment
contribute to reducing the resulting complications that directly affect a
person's physical and mental health.
Research Structure
The research consists of five chapters. Chapter 1 provides a general
introduction, while Chapter 2 reviews the theoretical background and
previous studies related to sleep apnea. Chapter 3 outlines the research
methodology, Chapter 4 presents the results, and Chapter 5 includes the
discussion, conclusions, and recommendations.
4
Chapter 2: Literature Review
introduction
This chapter will focus on the theoretical and scientific background of this disease.
That is, the general concept of the disease, its types, and its mechanism of action
will be explained through general studies of this disease using various
methodologies. We will also learn about the causes of this disease and the resulting
health complications, based on current medical sources used in general medicine.
5
Definition of sleep apnea
Sleep apnea, respiratory condition characterized by pauses in breathing
during sleep. The word apnea is derived from the Greek apnoia, meaning
‘without breath.’ There are three types of sleep apnea: obstructive, which is
the most common form and involves the collapse of tissues of the upper
airway; central, which is very rare and results from failure of the central
nervous system to activate breathing mechanisms; and mixed, which
involves characteristics of both obstructive and central apneas. In obstructive
sleep apnea (OSA), airway collapse is eventually terminated by a brief
awakening, at which point the airway reopens and the person resumes
breathing. In severe cases this may occur once every minute during sleep
and in turn may lead to profound sleep disruption. In addition, repetitive
interruption of normal breathing can lead to a reduction in oxygen levels in
the blood
1. Obstructive sleep apnea (OSA):
Obstructive sleep apnea (OSA) is the most common form of sleep-
disordered breathing and is characterized by recurrent episodes of complete
or partial upper airway obstruction during sleep, resulting in oxygen
desaturation, autonomic dysfunction and sleep fragmentation. It can affect
both children and adults, and the main clinical symptoms include loud
snoring, noticeable apneas and breathing difficulties during sleep
6
2. Central Sleep Apnea (CSA):
Central sleep apnea (CSA) is characterized by recurrent apneic
episodes with no associated respiratory effort. Compared to
obstructive sleep apnea (OSA) it is not as commonly seen in sleep
centers accounting for about 5-10% of clinic patients. It is, however,
quite common in patients with heart failure, in patients with some
neurological disorders and in those on high dose opiates. Complex
CSA is now well recognized in continuous positive airway pressure
(CPAP) treated OSA. Symptoms of CSA include sleep fragmentation,
insomnia and daytime hypersomnolence, which is usually not as
7
severe as in OSA. Despite a lot of research into CSA in the past two
decades the condition is still poorly understood and treatment
is still suboptimal perhaps owing to its etiological and
3. Mixed Sleep Apnea
According to medical literature, Mixed sleep apnea is a combination
of obstructive and central sleep apnea, where episodes of apnea
include elements of both upper airway obstruction and lack of
respiratory effort
8
Pathophysiology
- Obstructive sleep apnea Occurs when airflow is absent or nearly absent
but ventilator effort persists. It is caused by complete, or nearly complete,
upper air way obstruction. Due to the rattling of the tongue and soft
palate, Obstructive sleep apnea can cause snoring. It can also make a
person feel as if they are unable to breathe when they wake up. The lungs
function normally, and the body tries to breathe, but it is impossible to get
enough air into the upper airway
- Central apnea occurs when both airflow and ventilator efforts are absent
. It does not, however, develop as a result of upper airway obstruction.
Rather, the source of the problem is neurological. In contrast to
obstructive sleep apnea central sleep apnea causes no snoring since the
body does not try to breathe. Instead, the person stops breathing because
the brain and nervous system do not consistently provide a signal to do so
- Mixed Sleep apnea It is a mix of intervals during which no respiratory
efforts occur (i.e., central apnea pattern) and intervals during which
obstructed respiratory efforts occur. In other words, it combines between
obstructive sleep apnea and central sleep apnea. Sometimes, mixed sleep
apnea syndrome is obvious in an initial sleep study. Other times, it
becomes apparent after the apnea does not resolve with a typical
continuous positive air way pressure machine or other traditional
obstructive sleep apnea treatments
9
Causes and Risk Factors
Several medical and lifestyle factors have been identified as increasing the
risk of sleep apnea. Age and genetics contribute to structural and functional
airway characteristics that predispose individuals to breathing interruptions
during sleep. Obesity, especially with increased fat deposits around the neck,
can narrow the upper airway and increase collapsibility. Lifestyle habits such
as smoking and alcohol consumption also elevate risk by relaxing throat
muscles and causing inflammation. Additionally, men are more commonly
affected than women, and there is a higher prevalence in older adults.
Certain comorbid conditions, including hypertension, cardiovascular disease,
and metabolic disorders, have been associated with a higher prevalence and
severity of sleep apnea
10
Complications
Obstructive sleep apnea (OSA) is a serious, potentially life-threatening
condition. Epidemiologic studies show that sleep apnea increases
cardiovascular diseases risk factors including hypertension, obesity, and
diabetes mellitus. OSA is also responsible for serious illnesses such as
congestive heart failure, stroke, arrhythmias, and bronchial asthma. The aim
of this systematic review is to evaluate evidence for the association between
OSA and cardiovascular disease morbidities and identify risk factors for the
conditions. In a review of 34 studies conducted in 28 countries with a
sample of 37,599 people, several comorbidities were identified in patients
with severe OSA—these were: heart disease, stroke, kidney disease, asthma,
COPD, acute heart failure, chronic heart failure, hyperlipidemia, thyroid
disease, cerebral infarct or embolism, myocardial infarction, and
psychological comorbidities including stress and depression. Important risk
factors contributing to OSA included: age > 35 years; BMI ≥ 25 kg/m2;
alcoholism; higher Epworth sleepiness scale (ESS); mean apnea duration;
oxygen desaturation index (ODI); and nocturnal oxygen desaturation
(NOD). Severe OSA (AHI ≥ 30) was significantly associated with excessive
daytime sleepiness and oxygen desaturation index. The risk of OSA and
associated disease morbidities can be reduced by controlling
overweight/obesity, alcoholism, smoking, hypertension, diabetes mellitus,
and hyperlipidemia
11
Chapter 3: Practical Section
Introduction
This chapter aims to design a special device for sleep apnea patients by
reading the oxygen level in human blood using a special oxygen sensor
connected to a microcontroller and alarm.
Arduino uno R3
The Arduino UNO is the best board to get started with electronics and
coding. If this is your first experience tinkering with the platform, the UNO
is the most robust board you can start playing with. The UNO is the most
used and documented board of the whole Arduino family.
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 ceramic resonator, a USB connection, a power jack,
an ICSP header and a reset button. It contains everything needed to support
the microcontroller simply connect it to a computer with a USB cable or
power it with a AC-to-DC adapter or battery to get started. You can tinker
with your UNO without worrying too much about doing something wrong
12
Arduino Uno Pinout Configuration
Pin Category Pin Name Pin Description
Power Vin, 3.3V, 5V, Vin: Input voltage to Arduino when using
GND an external power source. 5V: Regulated
power supply used to power
microcontroller and other components on
the board. 3.3V: 3.3V supply generated by
on-board voltage regulator. Maximum
current draw is 50mA. GND: ground pins.
Reset Reset Resets the microcontroller.
Analog Pins A0 – A5 Used to provide analog input in the range
of 0-5V
Input/Output Digital Pins 0 - Can be used as input or output pins.
Pins 13
Serial 0(Rx), 1(Tx) Used to receive and transmit TTL serial
data.
External 2, 3 To trigger an interrupt.
Interrupts
PWM 3, 5, 6, 9, 11 Provides 8-bit PWM output.
SPI 10 (SS), 11 Used for SPI communication.
(MOSI), 12
(MISO) and 13
(SCK)
Inbuilt LED 13 To turn on the inbuilt LED
13
TWI A4 (SDA), A5 Used for TWI communication
(SCA)
AREF AREF To provide reference voltage for input
voltage.
Arduino Uno Technical Specifications
Microcontroller ATmega328P – 8 bit AVR family microcontroller
Operating 5V
Voltage
Recommended 7-12V
Input Voltage
Input Voltage 6-20V
Limits
Analog Input 6 (A0 – A5)
Pins
Digital I/O Pins 14 (Out of which 6 provide PWM output)
DC Current on 40 mA
I/O Pins
14
DC Current on 50 mA
3.3V Pin
Flash Memory 32 KB (0.5 KB is used for Bootloader)
SRAM 2 KB
EEPROM 1 KB
Frequency 16 MHz
(Clock Speed)
15
MAX30102
- General Description
The MAX30102 is an integrated pulse oximetry and heart-rate
monitor module. It includes internal LEDs, photodetectors, optical
elements, and low-noise electronics with ambient light rejection. The
MAX30102 provides a complete system solution to ease the design-in
process for mobile and wearable devices. The MAX30102 operates on
a single 1.8V power supply and a separate 5.0V power supply for the
internal LEDs. Communication is through a standard I2C-compatible
interface. The module can be shut down through software with zero
standby current, allowing the power rails to remain powered at all
times.
- Applications
I. Wearable Devices
16
II. Fitness Assistant Devices
- Benefits and Features
I. Heart-Rate Monitor and Pulse Oximeter Sensor in LED
Reflective Solution
II. Tiny 5.6mm x 3.3mm x 1.55mm 14-Pin Optical Module
• Integrated Cover Glass for Optimal, Robust Performance
III. Ultra-Low Power Operation for Mobile Devices
• Programmable Sample Rate and LED Current for Power
Savings
• Low-Power Heart-Rate Monitor (< 1mW)
• Ultra-Low Shutdown Current (0.7µA, typ)
IV. Fast Data Output Capability
• High Sample Rates
V. Robust Motion Artifact Resilience
• High SNR
17
VI. -40°C to +85°C Operating Temperature Range
Analog Sound Sensor
The sound sensor module provides an easy way to detect sound and is
generally used for detecting sound intensity. This module can be used
for security, switch, and monitoring applications. Its accuracy can be
easily adjusted for the convenience of usage. It uses a microphone
which supplies the input to an amplifier, peak detector and buffer.
When the sensor detects a sound, it processes an output signal voltage
which is sent to a microcontroller then performs necessary processing
o Specifications
18
- Operating voltage 3.3V-5V
- Output model: digital switch outputs (0 and 1, high or low level)
- With a mounting screw hole
- PCB size: 3.4cm * 1.6cm
o Schematic Diagram
o Pin Configuration
1. VCC: 3.3V-5V DC
2. GND: ground
3. DO: digital output
19
4. AO: analog output
9V Battery
Connecting wires
Buzzer
20
It is a bell that sounds an intermittent alarm when breathing stops and
the sensors stop signaling. If no breathing occurs within 15 seconds of
the sensor being activated, the bell sounds and stops when breathing
returns to normal.
21
The final connection will be like this
The connection steps are:
Take the positive and negative leads and insert them into the
breadboard.
2- Insert the MAX30102 sensor into the breadboard.
3- Power the sensor using the positive and negative leads.
4- Connect the SDA pin to A4.
5- Connect the SCL pin to A5.
6- Insert the snoring sensor and power it using the positive and
negative leads.
7- Connect the sensor's analog pin to A3.
22
8- Add a LED in place of the buzzer and connect its positive lead
to digital pin 13.
9- Connect the negative lead to a resistor and connect the resistor
to ground.
10- Add the Arduino programming code and turn on the device.
23
Chapter Four: Results
Introduction:
In this chapter, we present the results of experiments related to the SpO2 and
heart rate measurement project using Arduino, MAX30102, and a sound
sensor, along with an analysis of performance and effectiveness.
Measured data
The device was installed on a person to test it while they slept, and the data
was collected via the Arduino application's serial monitor. The results are
shown in the images below.
Case 1:
24
The image above shows that the blood oxygen reading is between 98% and
99%, which is perfectly normal and there are no problems in this case.
Case 2:
The image above shows fluctuations and imbalances in blood oxygen levels,
which reached 79% during sleep.
Analysis of results:
The first image of the first case tested with the device showed that the blood
oxygen level was stable and there were no problems; there was only an
increase in heart rate due to the patient's movement during sleep.
In the second scenario, when sleep apnea occurs, the blood oxygen level
drops to 79%, which is abnormal during sleep. Therefore, in this case, an
alarm will sound to wake the patient or alert their companion.
25
Accuracy
The question here is, what is the sensing accuracy of this device?
- The accuracy of the sleep apnea detector depends directly on the
Max30102 sensor. According to data, the SpO2 blood oxygen
saturation sensor provides an accuracy of -2% to +2% within a
range of 70% to 100%. Experimental results showed readings close
to physiological measurements, indicating acceptable accuracy for
the sleep apnea detector.
Factors affecting accuracy
• Hand movement during sleep
• Sensor placement
• Ambient light
• Skin tone differences
• Weak skin contact
The obtained results demonstrate that the measured SpO₂ values are
within the expected accuracy range of the sensor, confirming the
reliability of the proposed system for sleep apnea monitoring
Future Work
Future improvements to this project may include integrating wireless
communications such as Bluetooth or Wi-Fi to transmit data to the
mobile phone application, adding automatic location-based phone
calls via GSM, adding a radio communication tool because there are
26
weak SMS networks in some places and hospitals, adding data
logging for long-term monitoring, improving signal processing
algorithms, and using vibration alerts instead of sound alarms to
enhance user comfort during sleep.
Conclusion
In this project, a simple and low-cost sleep apnea detection device was
designed and implemented using Arduino Uno, MAX30102 sensor,
and a sound sensor. The device was able to measure blood oxygen
saturation (SpO₂) and heart rate during sleep and trigger an alarm
when abnormal values were detected.
The experimental results showed that the system can effectively detect
drops in oxygen level that may indicate sleep apnea events. The
accuracy of the readings was within the acceptable range of the sensor
specifications, making the device suitable for monitoring and early
warning purposes.
Although the proposed system does not replace clinical medical
devices used in hospitals, it provides a practical prototype that can
help increase awareness and improve safety for people suffering from
sleep apnea. The project demonstrates the ability to apply electronic
engineering concepts in a medical application and achieve reliable
results using simple hardware components.
27
References
American Academy of Sleep Medicine. (2014).
International classification of sleep disorders (3rd ed.). American Academy
of Sleep Medicine.
National Heart, Lung, and Blood Institute. (n.d.).
Sleep apnea: Causes, symptoms, and treatment. U.S. Department of Health
& Human Services.
Mayo Clinic. (n.d.).
Sleep apnea – Symptoms and causes. Mayo Foundation for Medical
Education and Research.
Sleep Foundation. (n.d.).
What is sleep apnea? Sleep Foundation Publications.
Jordan, A. S., McSharry, D. G., & Malhotra, A. (2014).
Adult obstructive sleep apnea. The Lancet, 383(9918), 736–747.
Punjabi, N. M. (2008).
The epidemiology of adult obstructive sleep apnea. Proceedings of the
American Thoracic Society, 5(2), 136–143.
Somers, V. K., White, D. P., Amin, R., et al. (2008).
Sleep apnea and cardiovascular disease. Journal of the American College of
Cardiology, 52(8), 686–717.
Oldenburg, O., Lamp, B., Faber, L., et al. (2007).
Central sleep apnea in patients with heart failure. The Lancet, 369(9569),
188–196.
Guyton, A. C., & Hall, J. E. (2016).
Textbook of medical physiology (13th ed.). Elsevier.
Webster, J. G. (2010).
Medical instrumentation: Application and design (4th ed.). Wiley.
Arduino. (n.d.).
Arduino Uno Rev3 – Technical specifications and pin configuration. Arduino
Official Documentation.
Microchip Technology Inc. (n.d.).
ATmega328P microcontroller datasheet.
28
Maxim Integrated. (n.d.).
MAX30102 pulse oximeter and heart-rate sensor datasheet.
Ganesh, R., Subramaniam, R., & Balakrishnan, S. (2009).
Pulse oximetry: Principles and limitations. Indian Journal of Anaesthesia,
53(1), 53–58.
Generic Electronics Documentation. (n.d.).
Analog sound sensor module datasheet.
29