Smartphone Based Respiratory Signal Monitoring and Apnea Detection Using Bluetooth Comunication

Patients with sleep apnea have increased, almost more than 80% of patients are undiagnosed,it necessary to monitor breathing signals in real time. Sleep apnea is the occurrence of breathing stops for more than 10 seconds. The purpose this study was design an apnea monitor device order to detect symptoms of sleep apnea by monitoring patient's respiratory signals. The contribution in this study by remote monitoring of abdominal breathing in patients while sleeping that can monitor patient even though they not accompanying. In order to facilitate monitoring, Bluetooth-Based Apnea Monitor to Show Android Signals, by displaying respiration signals on Android so treatment can be immediately carried out when patient stops breathing (apnea). Design uses piezoelectric as sensor for detecting respiratory signals placed on patient's stomach. The ESP32 microcontroller as respiration signal processing then sent to android device using Bluetooth network. If breath stop detected for 10 seconds, the indicator/buzzer will on. In this study, there’re 5 respondents who had been tested by comparing Respiration Rate with Patient Monitor tool, results of measurements and calculations obtained highest error value was 2.9%, and could transmit good data without data loss with a distance of 5 meters in room and 10 meters away. meters in different rooms. It can be concluded that piezoelectric (pressure) sensor is effectively used as respiratory signal detector and processed into a wireless sleep apnea detector. This development can remotely monitor patient's breathing and also detect respiratory arrest on Android, that can be implemented in patient monitoring process to reduce sleep apnea sufferers. INDEX TERMS Apnea Monitor, Respiration Monitoring, ESP32 Microcontroller, Bluetooth, Android.


I. INTRODUCTION
Apnea monitor is a medical device that is used to monitor breathing and provide a warning in case of respiratory arrest (apnea), especially during sleep. According to WHO, Apnea monitors detect respiratory arrest (apnea) in infants and adults who are at risk for respiratory failure, thereby alerting parents or staff to the condition. [1]. Apnea monitors can also diagnose the occurrence of sleep disorders or what is known as sleep apnea Sleep apnea (SA) is one of the most common forms of respiratory distress that occurs during sleep. Sleep apnea is characterized by the cessation of air flow to the lungs, where when breathing stops for more than 10 seconds, this event is said to be apnea [2]. When sleep apnea occurs or stops breathing, there will be a decrease in oxyhemoglobin saturation of more than 3% or it ends with awakening from sleep [3]. Sleep apnea has a serious impact on patients, especially it can cause heart problems (hypertension, coronary artery disease, and arrhythmias) [4]. In addition, disruption of the sleep cycle can also have a negative impact on quality of life. This often causes depression, daytime fatigue and sleepiness. Sleep apnea events are divided into 3 classes, namely: obstructive sleep apnea (OSA), central sleep apnea (CSA), and mixed sleep apnea (MSA) [5]. Obstructive sleep apnea (OSA) is a breathing disorder or disorder characterized by apnea and hypopnea due to airway obstruction during sleep. OSA can be diagnosed by the frequency of decreased airflow which usually occurs more than 5 times in 1 hour of sleep [2]. Obstructive sleep apnea (OSA) is often not detected when the patient is asleep. Statistics show that approximately 100 million people worldwide, of which in the US from 18 to 50 million people, are suspected of having OSA, and of these more than 80% remain undiagnosed [6]. The apnea-hypopnea index (AHI) was used to describe the incidence of apnea per hour of sleep to assess the severity of the OSA syndrome. OSA disorders that remain untreated will increase the risk of hypertension, stress on the cardiovascular system which causes the heart and lungs to work harder [7]. Based on the data above, an apnea monitor is needed to diagnose and recognize the symptoms of sleep apnea or the occurrence of cessation of breathing [8]. Breathing is made possible by the work of the diaphragm and external intercostal muscles [9]. The diaphragm contracts and moves downwards creating a pressure difference that causes air to enter the lungs [10]. Contraction of the intercostal muscles causes the ribs to lift which results in expansion of the chest cavity allowing a greater volume of air to enter [11] [12]. The process of this pressure change can be measured using a pressure sensor so that the respiration value can be obtained. One of them is a piezoelectric sensor, piezoelectric sensor is a sensor that can convert pressure into a voltage value [13] [14]. This sensor has advantages such as a small sensor shape, and easy use. This sensor has also been applied to detect and even monitor respiration values [15] [16]. In 2018 the Measurement of Respiratory Rate Using Piezoelectric Sensor was made, by Shankar N, et al. detects breathing placed on the patient's chest. However, this tool still uses a USB serial RS232 in the system for sending the respiratory value which is then displayed on a PC. Then in 2016 Ifana Mahbub, et al made a tool A Low Power Wireless Breathing Monitoring System Using Piezoelectric Transducer. This tool uses a piezoelectric sensor to monitor breathing which is then sent wirelessly. However, the respiratory rate delivery system is not explained. Then in 2018 a Respiration Rate Belt tool with a Piezoelectric Sensor was also made by Affan Ardiyanto. Using a piezoelectric sensor to detect the respiration of the patient. The respiration measurement system of this device uses a belt that is tied to the stomach and the results of the respiration per minute are displayed on a PC via bluetooth [18]. Based on the literature search data above, the piezoelectric sensor can not only be applied to devices to measure the respiratory rate (respiration), piezoelectric sensors can also be applied to apnea monitors which work in principle [7]. The apnea monitor tool uses a piezoelectric sensor that has been made, among others, in 2017 by Yin Yan Lin, et al with the title Sleep Apnea Detection Based on Thoracic and Abdominal Movement Signals of Wearable Piezo-Electric Bands. The use of a piezoelectric sensor on the device is placed in the position of the chest cavity and abdominal cavity, it turns out to produce different pressure measurement results, meaning that the difference in the placement of the sensor position affects the pressure measurement results [18]. However, in his journal only explained that piezoelectric sensors can be used to detect sleep apnea by using piezoelectric sensors on the chest and abdomen, so in his research this tool did not display the value of breaths per minute. Later in the same year, Erdenepay, et al made an Obstructive Sleep Apnea Screening Using a Piezo-Electric Sensor, This tool detects sleep disturbances (apnea) through the incidence of snoring using a piezoelectric sensor mounted on the neck. Snoring will cause vibrations, where the vibration can be detected on the sensor, in addition to snoring the piezoelectric sensor can also measure the vibrations generated by body movements and coughing during sleep [6]. However, the tool made only calculates the Snoring Index (SI) or the incidence of snoring in sleep so it does not monitor the respiratory rate. treatment can be carried out immediately on the patient. Then in 2020 a Wirelessbased Apnea Monitor tool was created, by Fuad N. This tool detects sleep apnea through the cessation of breathing for 10 seconds. The sensor used is piezoelectric which is installed in the abdominal cavity to produce respiration rate as a parameter [26]. However, this tool does not display a respiratory signal which makes the device a weakness. In 2019, the Apnea Monitor tool based on Bluetooth with Android Interface was created by I Dewa Made Wirayuda. This tool functions as a sleep apnea detector by using a flex sensor placed on the patient's abdomen. [27] lack of sensors that are less effective for detecting respiratory signals. Based on the results of the identification of the problem above, the author wants to make a Bluetooth-based Apnea Monitor tool to display Android signals using a piezoelectric sensor and displaying respiration signals on Android. The relatively small sensor size makes this tool more efficient and convenient to use. Piezoelectric is used as a sensor because there is a potential difference generated when the sensor experiences pressure changes such as contraction and relaxation of the diaphragm and external intercostal muscles. This study aim is designed to place a sensor in the abdominal cavity as a measure of respiration in patients. The use of a bluetooth system and displaying signals on android aims to facilitate the monitoring process for patients so as to prevent the risk of heart attacks and other diseases such as stroke.

II. MATERIALS AND METHOD A. Experimental Setup
The piezoelectric sensor that has been installed on the Velcro belt is then fitted to the patient's abdomen, then the piezoelectric sensor output is connected to the Analog Filter circuit input. Connecting the ESP32 Microcontroller and Android via Bluetooth network media to display the respiration signal and value on Android. This paper is comprised of: piezo electric sensor, analog filter (low pass filter), non inverting amplifier, esp32 microcontroller, Android phone.

1) Experiment
In this study, after the design was completed, the respiratory signal response of this device was tested using a Patient Monitor to adjust the signal on the device. For the respiratory value, it will be compared with the RR value of the Patient Monitor tool.

B. The Diagram Block
The piezoelectric sensor which is placed on the patient's abdomen functions as a detector of pressure changes that 51 Homepages: teknokes.poltekkesdepkes-sby.ac.id occur when breathing. This pressure change causes a change in the output voltage of the piezoelectric sensor. The output of the piezoelectric sensor then enters the signal conditioning circuit circuit to form a signal. Furthermore, the output signal from the signal conditioning circuit enters the microcontroller to be processed into a breathing signal and respiration value every minute, when breathing occurs, the LED indicator will light up, the respiratory signal and respiration value are sent to Android via the Bluetooth network. and when a breath stop is detected for more than 10 seconds, the led indicator and buzzer will light up as a warning of apnea (FIGURE 1).

Part Of Abdomen
Piezzoelectric Sensor Signal conditioning circuit  This flowchart begins with a wireless connection using the help of a Bluetooth network. The data received by Bluetooth on Android is then processed in the Android application which will display the respiration rate per minute. If breathing stops or apnea is detected, there will be a notification on Android that serves as a warning to the user to take immediate action FIGURE 2.

D. Analog Circuit
The most important part in this design is the analog signal conditioning circuit (SIGNAL CONDITIONING CIRCUIT), which consists of a low pass filter circuit with a cut off frequency of 1Hz and a non-inverting amplifier circuit with an amplifier of 11 times. Therefore, an ESP32 microcontroller is needed to process the output of the analog circuit into digital. This circuit is used to check the output signal directly from the piezoelectric sensor as shown in FIGURE 3.

FIGURE 3. Piezzoelectric Sensor Test Point Signal Output
In this low pass filter circuit, a cut off frequency of 1 Hz is used in order to avoid noise signals because all that is needed is a pressure signal from the piezzo sensor (FIGURE 4).

FIGURE 4. Low Pass Filter Circuit Signal Output
Suite Non-Inverting Amplifier is an amplifier circuit that serves to amplify the signal and the result of the amplified signal remains in phase with the input signal. In measuring the output of the non-inverting amplifier circuit, the signal at the time of inspiration and expiration looks bigger, that's because the non-inverting amplifier output signal is an amplifier of the signal formed by the piezoelectric sensor and then amplified with a gain of 11 times.
Made by Espressif Systems, the ESP32 is a low cost, low power on chip series (SoC) with Wi-Fi & dual-mode bluetooth capability. The ESP32 family includes the ESP32-D0WDQ6 (and ESP32-D0WD) chips, ESP32-D2WD, ESP32-S0WD, and the ESP32-PICO-D4 in-pack system 52 Homepages: teknokes.poltekkesdepkes-sby.ac.id (SiP). The ESP32 module is the successor of the popular ESP8266 module for IoT applications. In ESP32 there is a CPU core and faster Wi-Fi, more GPIO, and supports bluetooth low energy. At a minimum, this system functions to process data generated from a piezoelectric sensor circuit and then at a minimum this system will control the Bluetooth module to transmit data that has been sent. processed to android (FIGURE 5 and FIGURE 6).

III RESULTS
In this study, the system was tested and compared using Patient Monitor. The recording results show that the recording is suitable for recording ECG signals from the human body (FIGURE 7 and FIGURE 8). In this study, the author made an Apnea monitor device using abdominal respiration signals and processed it into a signal display on the roboremo application by sending data via a bluetooth network with an ESP32 microcontroller as a bluetooth module, with respiration indicator features, led indicators, and buzzers as reminders when they occur. Apnea in patients. When the device is first turned on or reset, the module will automatically look for a reference from the incoming signal via pin IO34 (analog 34). This reference serves to limit the value of the respiratory signal.  9);} When the input signal is greater than the reference that has been automatically set at the start of the module being turned on, the module will automatically calculate the respiration value and turn on the breathing indicator LED. Then after there are 3 breaths, the module will automatically calculate the respiration value per minute which is then sent via the Bluetooth network to the android. 14 The sub-program below is a setting on the ESP32 microcontroller with a Bluetooth network so that it can be connected to the roboremo application, the roboremo application uses a Bluetooth network to be connected to the ESP32 microcontroller as a data processor and in the next program to synchronize with the id on the item in the roboremo application and run the program for reading the respiratory signal plotting and respiration value and then sending it to the roboremo application. The Bluetooth distance test is carried out in 2 ways, namely using a Bluetooth network in a different room with a distance of 5 meters and using a Bluetooth network in the same room with a maximum distance of 10 meters (TABLE I and TABLE  II).  10 TRUE (no data loss)

FIGURE 9. Signal Output on Roboremo Application Display
The FIGURE 9 is the result of the graphic data after being processed using Ms. Excel. Based on the graph above, the amplitude measurement in Respondent 1 obtained the highest amplitude is 0.57Volt. The picture above is the result of graphic data after being processed using Ms. Excel. Based on the graph above, the amplitude measurement in respondent 2 obtained the highest amplitude is 1.6Volt.
Amplitude measurement results in respondent 5 obtained 1.9Volt. In the five respiratory signal data above, the highest amplitude is 1.9Volt, large or small signal amplitude, there are several factors, including body posture or abdominal size of the abdomen in each respondent, the position of piezoelectric placement on the abdomen. . In measuring the signal on the 5 respondents above, the results obtained are shown in the following table. From the table above, the measurement results of each respondent vary and the error value is still large, this is due to several factors, namely, the placement of the piezoelectric sensor, respondents who do not relax, resulting in interference with the respiration signal, and unstable Bluetooth network connection. The error value of the tool timer against the comparison is 1.1%. This error occurs due to several factors, namely the accuracy of the author when testing the timer time, the timer program on the microcontroller which affects the accuracy of the timer itself, and also the bluetooth network connection to send the Alarm command.

IV. DISCUSSION
Tapping the occurrence of respiration is carried out by a piezoelectric sensor. The piezoelectric sensor is a pressure sensor and converts it into voltage. The piezoelectric sensor will produce a voltage when the pressure value changes where the voltage value depends on the amount of the pressure. Therefore piezoelectric sensors are used to detect the occurrence of breathing, especially abdominal breathing. The abdominal breathing mechanism that expands and contracts resulting in a change in the pressure value is later detected by the piezoelectric sensor during the inspiration and expiration phases. Although this piezoelectric sensor converts pressure into voltage, the output voltage generated by the piezoelectric sensor is unstable, so it requires a pull down resistor which is connected in parallel with the sensor. The output signal generated by the pull down resistor circuit still contains noise that still interferes and affects the shape of the signal. Therefore, a low pass filter circuit which has a cut off frequency of 1 Hz is added, so that it can reduce large and unnecessary frequencies.
Although the respiration signal formed by the low pass filter circuit is no longer visible, the noise is still very small, making it difficult to identify the signal. So for that we need a non-inverting amplifier circuit that functions to amplify the input signal from the sensor and there is also a gain of 11 times to be able to distinguish the inspiration and expiration phases during breathing The output signal from the non-inverting amplifier circuit is then connected to the ADC pin of the ESP32 microcontroller. When the module is turned on, the Bluetooth module will automatically search for a Bluetooth network in accordance with the program settings on the ESP32 microcontroller, once connected, the microcontroller will detect a change in the signal on the ADC pin which is formed from changes in the piezoelectric sensor pressure value during inspiration and expiration then the signal will be processed and calculated if the signal exceeds the reference determined by the microcontroller it will count one breath and so on. If 3 breaths have been detected, the microcontroller will automatically calculate the respiration rate per minute which is then sent to Android on the Roboremo application via the Bluetooth network.
The roboremo application on android functions to display respiration signals and respiration values that have been processed and sent by the ESP32 microcontroller in real time and also to provide warnings in the form of sound and writing or notifications when apnea occurs.
When apnea occurs, the tool will also turn on an apnea indicator LED, this LED indicator and buzzer will continue to live as long as no breath is detected.

V. CONCLUSION
After carrying out the process of making and studying literature, testing modules and collecting data, the authors can conclude as follows, Piezoelectric sensors can be used to detect breathing. In the module that the author made using a non-inverting amplifier circuit to increase the signal value from the piezooelectric sensor because the output from the piezoelectric sensor is still small in units of milli volts, it is still very small with a gain value of 11 times.
To produce a breath signal that is better and clearly visible, a filter circuit is needed to remove noise or unneeded frequencies contained in the signal. The author uses an LPF filter with a cut-off frequency of 1Hz.The ESP32 microcontroller module can be used as a respiration signal processing and processed into respiration per minute values.The roboremo application on android can be used to display respiration signals and respiration rate per minute (respiration rate), and can display alarms/notifications and siren sounds as a reminder when apnea occurs. Can be made a timer to detect apnea where the average error timer indicator tool is 1.1%.For sending value data from the module to Android, a Bluetooth module that is integrated with the ESP32 microcontroller can be used, where this Bluetooth module can transmit data properly and without data loss with the furthest distance of 5 meters indoors and 10 meters outdoors.After measuring 5 respondents, measured and compared with patient monitoring tools, the highest module error was 2.9%.