IJEEMI, Vol. 1, No. 1, July 2019 DOI:
10.1234/ijeeemi.v1i1.9xx ISSN:2656-8632 Indonesian Journal of Electronics, Electromedical, and Medical Informatics (JEEEMI)
Apnea Monitor based on Bluetooth with Android Interface
I Dewa Made Wirayuda, I Dewa Gede Hari Wisana , Priyambada Cahya Nugraha
Department of Electromedical Engineering Poltekkes Kemenkes, Surabaya Jl. Pucang Jajar Timur No. 10, Surabaya, 60245, Indonesia wirayudadewa@gmail.com , hariwisana88@gmail.com ,  priyambadacn@gmail.com 
 Apnea monitor is a device that is used to give a warning if there is stop breathing. Stop breathing while sleeping is one form of obstructive sleep apnea. This cessation of breath cannot be underestimated, this is related to the main risk factors for health implications and increased cardiovascular disease and sudden death. The purpose of this study is to design an apnea monitor with the Android interface. This device allows the users to get how many times sleep apnea happens while sleeping and got data to analysis before continuing with a more expensive and advanced sleep test. This device used a flex sensor to detect the respiration rate, the sensor placed on the abdomen or belly so it can measure expand and deflate while breathing. The microcontroller uses an Arduino chip called AT-Mega328. Bluetooth HC-05 used to send respiration data to Android, MIT app inventor used for the android programmer, and on the android, there are plotting of respiration value and when the device detected apnea so the android also gives a warning to the user. Based on the results of testing and measurement then compare with another device, the results of the average% error were 3.61%. This apnea monitor design is portable but there are needs some improvement by using another sensor for detected respiration and using a module other than Bluetooth.
 Sleep Apnea, Apnea Monitor, Flex Senso
Apnea monitor is a device that is used to give a warning if there is cessation of breath (apnea) in infants or adults who have the risk of respiratory failure and make parents or alert companion for the condition [1]. Sleep apnea (SA) is form of obstructive sleep apnea (OSA) in the respiratory disorder that most commonly occurs during sleep (sleep apnea). Sleep apnea is characterized by the cessation of air flow to the lungs, it called sleep apnea when breathing stops more than 10 seconds. Sleep apnea cannot be underestimated, this is because it is associated with the main risk factors for health implications and increased cardiovascular disease and sudden death [2]. When sleep apnea occurs, there will be oxygen desaturation or hypoxia
so the body didn’t get
enough oxygen [3]. Sleep apnea has a serious impact for patients, especially can cause heart problems (hypertension, coronary artery disease, and arrhythmias). In addition, sleep disorders can also have a negative impact on quality of life. This often causes depression, fatigue during the day and drowsiness. Sleep apnea events are divided into 3 classes: obstructive sleep apnea (OSA), central sleep apnea (CSA), and mixed sleep apnea (MSA). This disease can occur at any age and sleep apnea is often undiagnosed [4]. Hypoxia caused by OSA can result in hypertension in the lungs, cardiac dysfunction, and even kidney disorders [5]. Statistics show that around 100 million people worldwide, where in the US from 18 to 50 million people, are suspected of having OSA, and among them more than 80% remain undiagnosed. According to the American Academy of Sleep Medicine (AASM), the apnea-hypopnea index (AHI) is used to describe the complete number and incidence of apnea per hour of sleep to assess the severity of OSA syndrome. OSA severity is usually determined as follows, AHI 5-15 shows a mild risk level, 15-30 shows moderate, and more than 30 shows severe OSA syndrome [2]. One factor in the occurrence of OSA is Obesity. The researchers concluded that obese people should be evaluated to determine the occurrence of OSA even though no symptoms were felt [6]. In premature infants apnea occurs because the immature respiratory system is called apnea of prematurity (AOP). Other things that can cause apnea are unstable temperature,  pneumonia, asphyxia and anemia. All infants born less than 34 weeks should be monitored or monitored at least the first week or until the absence of apnea episodes that occur in premature infants again [7]. Based on the results of the identification of the above  problems to diagnose sleep apnea so that it can prevent the risk of cardiovascular disease and complications of other diseases such as hypoxia and sudden death (author death), Therefore, the objective of this study is to develop apnea monitor based on Bluetooth with android interface.
 Experimental Setup
This study uses male and female as a subjects aged 17-40 years. Sampling is randomly by taking data 5 times with a total of 10 samples.
 Materials and Apparatus
This study uses a flex sensor which will be placed on the  patient's abdomen to detect the patient's breathing. Using
 IJEEMI, Vol. 1, No. 1, July 2019 DOI:
10.1234/ijeeemi.v1i1.9xx ISSN:2656-8632 Indonesian Journal of Electronics, Electromedical, and Medical Informatics (JEEEMI)
ATMega328 as a microcontroller, and Bluetooth to send data to android..
In this study the r 
esearchers measured subject’s respiration
 who were randomly selected and compared the results of respiration with standard.
The Diagram Block
In this research, flexible sensors were used to identify the swelling and deflection of the abdomen of the patient during  breathing as seen in Figure 1. The output sensor that is still in the form of resistance will enter the analog signal conditioning circuit so that it can be processed by the microcontroller. While the breathing detected, the microcontroller will send data for respiration value counters to android via Bluetooth. When sleep apnea occurs, the module will activate the alarm on the device and also on android. On the Android display there is also a  patient's respiration value in the form of plotting the graph of respiration value.
Flex Sensor Mikrokontroller Atmega 328Analog Signal ConditioningBluetooth HC-05HandphoneAlarmPlotting of respiration ratePatient
s BellyAlarmLow Battery Indicator Breathing Indicator 
Fig. 1.
The diagram block of the apnea monitor
StartStopDetecting Respiration by Flex Sensor Sending Data via Blueooth to Android Initialization
Fig. 2.
The flowchart of the arduino program
StartStopYesBluetooth Connected?YesApnea?AlarmInitializationReceived Data from Microcontroller 
Plotting of Respiration Value No
 Fig. 3.
The flowchart of the android program
The Flowchart
The Arduino program is based on the flowchart in Fig. 2. After initializing the microcontroller will detect changes in input voltage produced by the flex sensor. Furthermore, this data will  be sent via Bluetooth to Android. The Android program flowchart can be seen in Figure Fig.3, where after initializing, the operator needs to connect Android to Bluetooth from the device. When breathing occurs, the value of the patient's respiration will appear, and when its one minute there will be an update to plot the graph of respiration value on the android display.
The Analog Circuit
The most important part of the design is the analog signal conditioning circuit, as shown in figure 4 which is a voltage divider circuit, the difference amplifier circuit and filter in Figure 5. This circuit serves to process analog signals so that the output is ready to be processed by a microcontroller.
Voltage Divider
The circuit shown in Figure 4 is a voltage divider circuit, where this circuit will experience a change in output voltage when the flex sensor changes the curve caused by the breathing  process of the patient.
 IJEEMI, Vol. 1, No. 1, July 2019 DOI:
10.1234/ijeeemi.v1i1.9xx ISSN:2656-8632 Indonesian Journal of Electronics, Electromedical, and Medical Informatics (JEEEMI)
Fig. 4.
Voltage divider
 Difference Amplifier adn Filter
The difference amplifier circuit shown in Figure 5 using LM358 as the OP-Amp, is a circuit that serves to amplify the output from voltage divider, so that the difference in voltage when the patient is breathing can be seen more clearly, difference amplifier also used to setting sensitivity from the sensor to detected breathing. Furthermore, there is a low pass filter with frequency cut off 1 Hz. The function of low pass filter is to eliminate noise that does not srcinate from breathing.
Fig. 5.
Difference amplifier
For the reinforcement of the difference amplifier it can be calculated using the formula: If (R6=R9, R4=R3) then, Vout =
 ∗ ( − )
 (1) Gain = (
) =
 Bluetooth Connection
The Bluetooth circuit is connected to the ATMega328 microcontroller by connecting the AT-Mega 328 TX pin to the RX Bluetooth pin, and the RX AT-Mega 328 pin to the Bluetooth TX pin.
Fig. 6.
Bluetooth connection
In this study, a trial has been carried out on the tool module  by measuring breathing in patients directly and taking measurements to determine the accuracy of the module
Fig. 7.
Apnea monitor design Fig. 8.
Result of apnea monitor design Fig. 9.
Display mit app for apnea monitor
 IJEEMI, Vol. 1, No. 1, July 2019 DOI:
10.1234/ijeeemi.v1i1.9xx ISSN:2656-8632 Indonesian Journal of Electronics, Electromedical, and Medical Informatics (JEEEMI)
The Apnea Monitor Design
The analog signal conditioning circuit and microcontroller for Apnea Monitor are shown in figure 7. This design consists of a series of voltage dividers, a difference amplifier circuit, and an LPF filter. The difference amplifier circuit uses the LM358 IC which has two op-amp. In the voltage distribution circuit there is multi-turn (50k) which serves to adjust the sensitivity of the flex sensor readings. For the microcontroller this tool uses ATMega328 as a control and uses the Bluetooth HC-05 module as the sender of data through the microcontroller to android.
The Listing Program for ATMega328 Apnea Monitor
In this study, the software was divided into two parts, namely for ATMega328 and for MIT APP Inventor. For the ATMega328 listing program shown in the Program Listing 1. It contains a sensor reading program and sending data to android via Bluetooth HC-05. Listing program 1. Program to send the RR data To Android //=======pencarianReferensi (Autoreferensi)======== Flex = AnalogRead (A0); if(ref<=flex) {ref=flex;} else {ref=ref; hold=(ref*0.8);} //===========pembacaan nilai respirasi=========== if (flex>hold){  beat=1; detik=0; kirim=0; digitalWrite (buzzer,LOW); digitalWrite (ledPernapasan, LOW); } //=============mengirim data Counter RR========= if (flex<(hold*0.8)) { milidetik=0; if (beat==1){ kirim=0; digitalWrite (ledPernapasan, HIGH); if (waktumonostabil>delayMonostabil){ detak++; nafasmanual++; waktumonostabil=0; Serial.print ("a"); Serial.println (nafasmanual);  beat=0; } }} //======mengirim data RR setelah 1 menit========== if (milidetik3>60003){ nafasmenit=nafasmanual; Serial.print ("b");Serial.println(nafasmenit); nafasmanual=0; milidetik3=0
; }
//================deteksi apnea============ if(flex<hold){ if (detik>10000){ if (kirim==0){ Serial.print("c");Serial.println(1); digitalWrite (buzzer,HIGH); kirim=1;}} if(flex>hold){ if (milidetik>10000){ if (kirim==0){ Serial.print("c");Serial.println(1); digitalWrite (buzzer,HIGH); kirim=1;}}
The Listing Program for Mit App Inventor
In Listing Program 2 it explains the program for receiving data sent Bluetooth from the microcontroller by android. Where the data is divided into 3 parts. The first part beginning with the letter "a" is the counter value data for RR. Data beginning with the letter "b" is data for plotting graphics, and data beginning with the letter "c" to trigger an alarm in the MIT App Inventor. Listing Program 2. Program for MIT App Inventor
 IJEEMI, Vol. 1, No. 1, July 2019 DOI:
10.1234/ijeeemi.v1i1.9xx ISSN:2656-8632 Indonesian Journal of Electronics, Electromedical, and Medical Informatics (JEEEMI)
The timer is used to calculate the time of stopping the breath, and when the breath stops more than 10 seconds the tool will give a warning by activating the alarm.
Design (Second) Standard (Second) Difference (Second) 10 10.22 0.22 10 10.20 0.20 10 10.08 0.08 10 10.16 0.16 10 10.20 0.20 After testing the timer there are the difference between timer and standard. The biggest difference is 0.22 seconds and the smallest difference is 0.08.
The Respiration Signal
Respiration signal are measured two times with two difference point from the placement of flex sensor first point on right of umbilical region and the second point on the left of umbilical region. This measurement is done to find out the point that produces a signal with a higher amplitude. (a) (b)
Fig. 10.
Sensor placement to measured the respiration signal (a) left (b) right side Fig. 11.
Respiration signal on the right of umblical region (Subject 1) Fig. 12.
Respiration signal on the left of umblical region (Subject 1) Fig. 13.
Fig. 14.
Respiration signal on the right of umblical region (Subject 2) Fig. 15.
Respiration signal on the left of umblical region (Subject 2) Fig. 16.
Respiration signal on the right of umblical region (Subject 3) Fig. 17.
Respiration signal on the left of umblical region (Subject 3) Fig. 18.
Respiration signal on the right of umblical region (Subject 4)
of 7