Design and Implementation of Breathing Rate Measurement SystemBased on Accelerometer Sensor

Respiratory rate is considered as an important factor in analyzing disease disorders, such as sleeping disorders and other respiratory illness. Researchers have considered the detection of respiration presence, however, calculating the respiration rate as an assessment factor to the respiratory disorders was not fully utilized. According to that, detecting the abnormality in the respiration rate will not be possible due to ignoring this important parameter. In this paper, developing a virtual instrument in laboratory virtual instrument engineering workbench (LabVIEW) by using an accelerometer sensor was mandatory. Accelerometer sensors are attached to the chest and abdominal wall to collect the respiration data while breathing. Then, without losing the measured signals, a converter is used to achieve a measured waveform from the collected signals, and by using a threshold level detector, the abnormality for each case can be detected and saved with the measured data on an Excel sheet. The proposed system provides the possibility of observing the breathing rate by monitoring the patients continuously for long time and concerns to the patient recording comfort with data storing possibility and with the possibility of calculating the breath to breath interval.


Introduction
For sustaining life, the breathing system is very important for gases exchange (carbon dioxide and oxygen) between blood and air in alveoli through thin semi-permeable membrane (alveolar-capillary membrane), this process results from inhalation and exhalation of air containing oxygen into the lungs [1,2]. Measuring the respiration rate is animportant factorto achievesufficienthealth observation. Various pathological conditions such as cardiovascular and metabolic disorders can be detected by monitoring the abnormal respiration rate [3]. Thenumber of breaths per minute is defined as the respiration rate, which varies according to the personal needs for the Oxygen and the respiratory rate varies accordingly. Many studies have showed that potentially serious clinical events can be predicted by the alteration of respiration rate and also for monitoring the progression of serious illnesses [4,5]. Such as, predicting chronic obstructive pulmonary diseases, asthma, tuberculosis influenza and lung cancer. The use of both pulse oximetry (SpO2) and respiration rate monitoring was recommended by several medical opinions to assess medical conditions properly. Patients receive oxygen supplement after extubation, for alveolar hypoventilation, SpO2 only can be used as a belatedly indicator [6,7].During the last decade, researchers have been increasinglyusing the respiration rate monitoring to detect the properties of the exhausted gases such as temperature and flow, and the movements of the chest and the abdominal [8,9].At rest, the healthy adult has respiratory rate of 12-20 breaths per minute, which is responsible for exchanging 6-8 liters of air per minute [10]. In hospital wards, the respiration rate has been reported as an imprtant diagnosing tool for cardiac illness. For instance, when the rate was above 27 breaths per minut, the possibility for cardiac arrest is increased [11]. While for higher than 24 breaths per minute and suffering from a serious illness for an intervals of more than 24 hours, the patient is identified at high risk with 95% specificity [12].Tens of millions of Americans are affected by the sleeping apnea. There is an important factor in diagnosing the sleep apnea condition during the sleep by a continuous monitoring to the resperation rate and resperation depth,however, 80% of the cases are remaining undiagnosed [13][14][15][16][17].There are several methods to measure the respiration such as spirometry, impedance plethysmography, inductance pneumography whole-body plethysmography, nasal thermocouples, photo-plethysmography, fiber-optic methods, pneumatic respiration transducers, ECG-based derived methods,and Doppler radar [18,19].Most of these methods are not suitable for continuous measurement because it is very expensive, very difficult in portable solutions or for home usage and it is patients' constraining. This study aims to design and implement a breathing rate measuring system based on a hybrid system that conjunct the Arduino UNO with the accelerometer sensor to collect the data from one side, and the LabVIEW platform to process the achieved data from the other side. By comparing this work to the literature, the result of this study outperforms the accuracy of other researches especially in terms of estimating the respiratory frequency.The remaining of this paper is organized as follows; Section 2 demonstrates the system model of the proposed system, while Section 3 illustrates the respiration rate algorithm. Section 4 presents and discusses the results that are obtained in this paper, and finally, Section 5, concludes this work.

Methodology
The proposed system of this paper consists of an accelerometer pasted on the patient's chestto measure the movement of the chest wall. As shown in Figure 1, the ADXL345 digital accelerometer was selected to measure the breathing movement of the chest wall dueto its high resolution (4 mg/LSB) which enables the measurement of inclination changes less than 1.0 degree to exactly calculate the respiratory rate. The GUI LabVIEW program was used such that, the sensor sends the accelerometer data to the computer via the Arduino UNO and LINX module is selected to interface the Arduino with LabVIEW, then the data is processed and analyzed by the LabVIEW. In regarding to placing the sensors, 0g position has high sensetivity compared to position +1g, which made +1g position more preferable to be selected. In addition, the supine position is selected for further increase to the sensitivity. On the other hand, selecting the lateral position has contributed in a sensitivity issues due to the patients movements and the friction with the clothes. By considering prone position, the sensor can be easily mounted at the bottom of the sternum, which is a desirable place to acquire the clearest signal. The inclination of the accelerometer that is attached to the chest is periodically changing due to the thorax movement as a result of the breathing process.

Respiration Rate Measurement Algorithm
The algorithm for respiration rate measurement was derived from raw data readings (i.e. the accelerometer signal) of the ADXL345 sensor. The data from the sensor is transmitted to the Arduino UNO microcontroller board,while the LINX administrate the use of LabVIEW for interacting with the Arduino. Since the accelerometer signal is oscillatory,it is filtered using Butterworth band pass filter with low cut-off frequency of 0.1 Hz to remove any constant acceleration resulted from gravity, and a high cut-off frequency of 1 HZ. These frequencies are selected based on the breathing frequency which is between 0.1 and 1 Hz. The values for high cutoff frequency f2 and low cutoff frequency f1 must follow the relationship, 0 < f1 < f2 < 0.5fs (1) where f1 is the low cutoff frequency, f2is the the high cutoff frequency, and fs is the sampling frequency. The data is collected and the most recent data is returned by using wavelet analysis (WA) multiscale peak detection function. The respiration rate has been calculated by counting the number of peaks per minute. Using LabVIEW has the advantage of making the users more focused on the results than the process of achieving these results.

Results And Discussions
After the acceleration data has been obtained and passed through the band-pass Butterworth filter, an amplification of 200 times is added to the filtered signal to amplify the very small signal that is obtained from the chest movement.Experiments have shown that the respiration rate can be calculated by using  Figure 3 shows that the peak value of the of oscillatory signal is detected,and by activating the"Detrend" settings of the WA multi-scale peak detectionvirtual instrument (VI) which specifies the settings, this VI is used to remove the trend from the signal.  It is worth noting that during the experimentation,five adults are selected as the subjects and they are asked to be steady in a staticenvironment. Table.1 shows that the breathing rate measurements by WA multiscale peak detection was more accurate than the value calculated using Estimate the respiratory frequency methodcompared to the golden standard value. The variation from actual value was ±1in frequency based method.   10 -20 The respiration rate is obtained by calculating the number of peaks for a specific time and Figure 4 demonstrates the LabVIEW front panel and the breathing rate counter which is obtained from the WA multi-scale peak detection.This system has the ability to calculate the natural breathing rate for different ages and gives a green light indication in the case of normal breathing rate or red light in the case of abnormal rate for each age as shown in Table 1.
One of the most important advantages of this work is that the breathing rate data can be saved on an Excel file and the system gives the details of the time and date of breathing rate records, wherethe vertical axis represents the breathing rate and the horizontal axis is for time.Figure5illustrates thebreathing rate line chart taken for five minutes interval and for an adult with age 32 in thesupine position. This system has the ability to calculate the patient's slop during the measurments to obtain the most accurate result, the results were more accurate when the patient was in the laying on the back position and the following equationis used to calculate the angle of the patient [20], where the inclination angles θ is in radians, AOUTX is the acceleration of the X axis and AOUTY. is the acceleration of the Y axis. By computing the continuous wavelet transform (CWT) coefficients of the accelometer signal using the WA-CWT-VI and the accumulate CWT coefficients we can obtain the signal as shown in Figure6 which represents the respiration rate, and is considered as another way to represent the respiration rate waveform.  Figure 6. Continuous wavelet transform coefficient accumulation.
Breathing pausesare called apnea which can last between from 10 sec to one minute.By calculating the breath to breath intervals, the system can detect any abnormality in the breathing intervals as shown in Figure 7, whichcalculates the periods between any two breaths. While Figure8 shows the time periods between any two breathes to detect the sleep apnea.   Figure 9 shows the alarm circuit that the VI could sound when the calculated period has exceeded the threshold.  Figure 9.VI Alarm circuit.

Conclusion
In conclusion, the proposed system of this paper has calculated the breathing rate for different ages, and it differentiated between the normal and abnormal rates for each age and displayed the differences by a light code indicator that is green for the normal case and red in the abnormal case with sound alarm. In addition the proposed system has shown the ability to calculate the breath to breath interval as a function to determine the sleep apnea period. Finally, it has shown the ability of saving the patients' records in Excel file as a medical history.