Abstract

Respiratory rate is an important parameter for many health, home care, work, or sport applications. In this paper, a new wearable sensing system based on a piezoresistive FlexiForce sensor has been developed. The sensor can be attached to any common chest strap. A compact 3D casing has been designed and printed with a 3D printer. This casing integrates the sensor and all auxiliary elements of the system: microcontroller, battery, Bluetooth module, connections, battery charger, and acquisition circuit. To the best of our knowledge, this is the first study presenting a FlexiForce respiration sensor that includes all system elements in a single compact casing. The source files with the design of the casing have been published as supplementary material to be reused by any interested researcher. The sensing system was tested with twenty-one subjects for different breathing rates. Two different algorithms were developed to obtain the respiratory rate from the voltage signals recorded by the sensor. Statistical tests were performed to determine the optimal computation time window and algorithm. This approach is also novel in this field. Low error values were obtained for a time window of 27 s with an algorithm based on the calculation of time between zero-crossings (4.02%) and with an algorithm based on counting them (3.40%). To promote research transparency and reusability, the dataset with the recorded data and the source code of the algorithms and statistical tests have also been published. Therefore, an open, replicable, low-error, wearable, wireless, and compact sensing system to measure respiratory rate was developed and tested.

1. Introduction

Monitoring of physiological vital signs in humans, such as heart rate, respiratory rate (RR), blood oxygen concentration, body temperature, or blood pressure, is a field of growing interest with many applications. Specifically, respiratory rate is widely used in health applications such as detection of abnormal breathing patterns [1] or pulmonary disorders [2]; diagnosis of obstructive sleep apnea [3], chronic obstructive pulmonary disease [4], or asthma [5]; monitoring 7 of anaesthetized patients [6]; monitoring during magnetic resonance imaging (MRI) [7]; indication for cardiac arrest [8], imbalance or failure in the nervous, cardiovascular, or excretory 9 systems [8]; prevention of sudden infant death syndrome [9]; or admission to intensive care unit, among others. Respiratory rate monitoring has also be applied to occupational health [10]. Respiratory rate provides information on the psychophysiological condition of workers, which is especially interesting for pilots, drivers, or operators of critical machines. It can be used to detect alarming symptoms of fatigue or fainting. It is also useful in other fields like home care [11] or sports [12].

There are several wearable approaches to properly measure respiratory rate [13]. One possible way is to detect variations in the velocity or volume of the respiratory airflow. For example, Liao et al. [14] presented a capacitive flow sensor. Pressure changes caused by airflow induced capacitance changes in the sensing plates. Other sensors that detect airflow variations to monitor breathing are described in [15, 16].

There are studies that presented sensors based on the recording of the sound associated with the air flowing through the airways of subjects. In this regard, Nam et al. [17] used built-in microphones of smartphones or simple headset microphones placed under the nose. The built-in microphone was manually held in a fixed position by subjects, assuming no displacement during experiments. The amplitude of the envelope of the respiratory sounds was in the range 0.45-0.9 (amplitude units). For reliable estimates of RR, background noise was kept to a minimum. Respiratory rates could be estimated accurately even if microphones were 30 cm away from the nose.

Another set of studies recorded the temperature of inhaled or exhaled air during breathing. Cao et al. [5] presented a Bluetooth-based hot-film flow sensor. It was based on convective heat transfer. Changes in the fluidic flow condition led to variations in the resistance of the film. The sensor consisted of a micro/nanothin film inserted into a tube. Flow rates covering 0.1-100 L/min were considered in sensor design. Motion was incorporated in the validation tests, and three-axis accelerations were also recorded to assess motion intensity. Similar sensors based on this principle were developed by Huang and Huang [18] and Milici et al. [19].

Several authors registered changes in air humidity to obtain RR. Pang et al. [20] designed a porous graphene network to monitor breathing. It can be used to monitor mouth and nose respiration, including breathing patterns such as normal and deep respiration. The system described is an initial prototype that needs to be improved for commercialization. Other approaches to detect humidity variations were described in the reviews by Farahani et al. [21] and Ascorbe et al. [22].

Chemical sensors have also been used in this field to analyze breathing air components and obtain the RR from the results of analyses. Katagiri et al. [23] presented a sensor to measure carbon dioxide (CO2) based on optical absorption spectroscopy. Other chemical approaches were discussed in the surveys by Imani et al. [24] and Güntner et al. [25].

Images taken with mobile phone cameras were also used to determine RR. The work of Karlen et al. [26] was based on placing a finger on the lens of a mobile phone’s camera and extracting imaging photoplethysmogram from the region of interest to estimate the RR. Motion artifacts were detected and labeled. Then, two algorithms were used to obtain the RR. The system presented a root mean square error of 6 breaths/min, being much higher for respiratory rates greater than 20 breaths/min. Recordings with incorrect counts due to artifacts in the reference device were excluded. The same was done with RR recordings of less than 6 breaths/min or greater than 40 breaths/min. Scully et al. [27] presented a similar approach using intensity changes in the green band of the video signal.

A set of studies measured the changes in electrical bioimpedance that occur during breathing. The work of Metshein [28] presented an electrode shirt to measure electrical bioimpedance using large surface plate electrodes. They were made of aluminium foil and covered with contact gel. Electrical bioimpedance measurements were in the range of 175-300 Ω, approximately. The validation experiments included movements to show the influence of motions of human body on the measured signal. Motions and displacement of the electrodes affected the results. Displacement of the shirt was specially important in long experiments. The best electrode placement configurations were identified, matching the locations of the heart, lungs, and large blood vessels. Similarly, Ansari et al. [29] determined RR from electrical impedance. In this case, it was measured in the arms using only four electrodes.

There are also studies that use radar for the measurement of RR. Kukkapalli et al. [30] presented a micro radar-based system designed as a wearable neck pendant. The system used the relative motion between the radar and the chest wall to estimate the RR. The radar was operated at 24 GHz; a custom active analog amplifier circuit was designed to improve sensitivity. A module with WiFi data transfer was used for data collection. Ten subjects participated in the validation experiments performed in static position. Radar technology has been widely used for RR detection, but mainly in nonwearable systems [31].

Several sensing systems were also proposed to detect chest movements associated with breathing. Dan et al. [4] described an inertial sensor platform to obtain angular velocity waveforms to calculate RR. Sensors were place in the suprasternal notch, which is located on the upper border of the sternum. This position caused noises in signals, which had to be filtered. The sensing system was wired, ensuring stability of signal transmission. Inertial sensors were also used in the works of Hernandez et al. [32] and Estrada et al. [33].

Finally, a set of sensors registered deformations in the chest due to breathing. The sensor developed in this work is based on this principle. Several previous works in this category already exist. Table 1 shows a comparison of the sensing system proposed in this paper with several related works found in the state of the art. Some of the most relevant features of respiratory sensing systems are compared. All studies included in Table 1 detect thoracic movements. They have in common the use a chest strap to attach the sensor to the body, which is the approach adopted in the sensor presented in this study. However, there are large differences in sensing principles, hardware processing units, data processing techniques, or data transfer technologies, among other factors.

Hesse et al. [12] designed a respiration sensor using a force-sensing resistor. Thoracic movements were recorded, and the RR was calculated using a peak detection algorithm. A simple mechanical housing mechanism consisting of two quadratic plates integrated the force-sensing resistor exclusively. The housing mechanism was attached to a chest strap, which included the rest of the elements of the system. Therefore, the mechanical housing mechanism did not contain the microcontroller, memory, battery, or any other auxiliary elements since they were attached to the strap separately. The sensor evaluation was performed with five subjects, obtaining good results for normal and deep breathing. Data were processed locally on the same strap.

A sensor to be worn on the chest was also designed by Mahbub et al. [1]. In this case, the sensing element was a piezoelectric transducer composed of a ferroelectric polymer, polyvinylidene fluoride (PVDF). PVDF had fast response time to vibration due to chest dilation. The sensor was modeled by a first-order equivalent circuit composed of a thermal capacitance shunted by a thermal resistance. The sensor generated charge (peak-to-peak amplitude of 400 pA) in response to vibrations due to breathing. A charge amplifier produces an output voltage proportional to the integrated charge. This voltage ranges from 0.7 to 1 Vpp. A custom integrated circuit was responsible for processing and sending the data wirelessly. The sensor was validated with only one subject, showing respiration detection. Similarly, the works of Ciobotariu et al. [34] and Rotariu et al. [35] presented piezoelectric thoracic belts to measure respiratory activity. The first work is wireless using GSM/GPRS transmission, while the second prototype communicates with a central computer through a USB cable. None of the studies included a structured evaluation of the sensors.

Hoffman et al. [2] estimated respiration volume using a textile integrated force sensor based on the principle of plate capacitors. The sensors were composed of different layers of textiles. A compressible 3D textile was the core of the sensor. On the top and bottom of the 3D textile, conductive fabrics formed the electrodes of the plate capacitor. Expansion of the thorax during breathing caused a change in fabric thickness, which was measured as a change in the value of capacitance. The tightness of the belt that supported the sensor was set at 10 N. The pressure range to be measured was 0.3 to 0.7 N/cm. Position of the belt and the sensor changed frequently during measurements due to body movement. This led to larger errors. The authors stressed that one possible solution could be frequent recalibration of the system. However, this would affect usability and comfort. Eighteen subjects participated in the validation tests and results showed a high correlation of the measurements with respect to a reference device, although the estimation of the respiratory volume was not accurate enough (37.9% error). Tests included activities with movements. Similarly, Grlica et al. [36] presented a capacitive sensor that detected changes in capacitance in the range from 0.1 to 0.5 pF for normal breathing. The sensor consisted of a fixed triangular electrode and a rectangular moveable electrode. Total electrode displacement was approximately 40 mm for deep breathing. The sensor of Yang et al. [37] included a low-energy Bluetooth wireless communication module to transmit capacitance values to a smartphone. This same transmission technology was used in the work of Yang et al. [38] with the sensor integrated in a shirt. Min et al. [39] also presented a capacitive sensor made of conductive fabric and polyester. The sensor designed was linear with sufficient resolution to measure a wide range of breathing from different subjects. Force was increased from 0 to 3 N, producing a capacitance change of 445-510 pF. The authors stressed that the position during tests may affect performance.

Witt et al. [6] designed a system to measure thoracic motion continuously based on optical fiber sensors. Specifically, the sensor was based on fiber Bragg gratings (FBG), macrobending effect, and optical time-domain reflectometry. The sensor was specifically for patients under MRI. It was tested in simulators and in climate chambers. FBG sensor can be stretched up to 3% elongation with a sensitivity 0.32 nm. Results showed that the sensor retained its stability for different elongations. The same principle (FBG) was also used in the sensor of Presti et al. [40]. In that case, an array of 12 FBG was designed. The placement of the 12 FBG in subject’s torso was optimized. Five subjects participated in the validation of the sensor and measurements were analyzed offline, obtaining a minimum error. FBG were also used by Massaroni et al. [41] to monitor compartmental and global volumetric parameters. Six subjects participated in the experiments, obtaining an error in the tidal volume of 14%. Similarly, Yang et al. [42] developed a fiber optic respiratory sensor based, this time, on the microbend effect. That study verified the RR by counting the number of breaths manually. The sensing belt was stretched 20 mm and 40 mm, which corresponded to elongations of 2.14% and 4.28%.

Padasdao et al. [9] presented a respiratory chest sensor based on human energy harvesting. An off-the-shelf dc brushed motor was used to detect thoracic movements as a function of average harvested power. The expansion of the chest due to respiration turned the armature, which transmitted the movement to the gears and the rotor of the machine. The motor was integrated into a plastic casing and mounted on a piece of felt to stabilize the device against the body. Displacements of 1 cm and 3 cm were considered in the experiments. Average output power harvested by the motor was in the range 6-72 μW. To eliminate motion artifacts, voltage outputs were filtered with a low-pass finite impulse response (FIR) filter. The sensor was validated with twenty subjects, obtaining that RR was measured with a low error value.

The proposal of Teichmann et al. [43] is also innovative, since they presented a sensor based on magnetic induction to obtain RR. A coil was the core element of the sensor. The sensor detected variations in the distribution of human impedance due to thoracic movements associated with breathing through electromagnetic coupling. The sensing system was completed with a microcontroller and a Bluetooth module. The sensor was placed on a flexible PCB. All other electronic components (except for the power management) were also mounted on there. The impact of coil deformation was also investigated since the sensor was designed to be carried in the shirt pocket. Four subjects participated in the evaluation. The authors stressed that the spatial fusion of different sensors could allow the cancellation of motion artifacts. However, this was not tested in the study.

This paper presents a compact wireless sensing system based on a piezoresistive sensor (A201 FlexiForce sensor, Tekscan [44]) to monitor respiratory rate. As can be seen in Table 1, the proposal of Hesse et al. [12] is the most related work to the sensing system presented in this paper. A systematic search was conducted in the literature, and no other works were found that use a piezoresistive FlexiForce sensor, to the best of our knowledge. This paper contributes with several novelties to the state of the art: (i)One key aspect of the piezoresistive FlexiForce sensor is the casing, since it determines the sensor detection capabilities. In the work of Hesse et al. [12], a casing was designed only for the sensor, while the rest of the elements (microcontroller, transmission unit, flash memory, etc.) were considered separately. Therefore, the casing did not include them in a compact way. In this paper, we present a wireless FlexiForce sensor integrated in a single casing to measure RR. All system components (FlexiForce sensor, microcontroller, Bluetooth module, battery, etc.) are integrated in the wearable casing. A 3D casing was designed and printed on a regular 3D printer. The files with the 3D design of the casing have been published as supplementary material (available here) to be reused by any interested researcher(ii)The system has been tested with several subjects using a metronome. Two popular algorithms have been used for the calculation of respiratory rate. Additionally, both algorithms have been compared to determine which one measures RR more accurately. Statistical tests have been used for that purpose. The optimal time window of the algorithms has also been determined using statistical tests. This is a novel approach in this field(iii)Another novelty of this work is that a public dataset has been created with all the data recorded in the tests. It is publicly available for use by any interested researcher [45]. In addition, the files with all data processing (algorithms and statistical tests) have been published as supplementary material to this paper. We have not found any other study on respiratory monitoring that makes public all study data and resources

2. Prototype Design

2.1. Physical Prototype

A sensor has been developed to measure respiratory rate by detecting variations in chest movement. The sensing system was designed to be placed around the chest with a strap. The system uses a force-sensitive resistor (FSR) based on the piezoresistive effect (FlexiForce A201 sensor, Tekscan). The characteristic curve of this sensor is not linear, but logarithmic, as shown in Figure 1 (curve provided by the manufacturer). The resistance provided by the sensor drops as the exerted force increases. This sensor is suitable for applications in which force variations must be detected. This is the case of RR measurement. The conditioning circuit for this sensor is a simple voltage divider as shown in Figure 2. An analysis of the typical operating region of the FSR has been performed for the application presented in this paper. For this analysis, the data collected according to the experiments described in Experimental Setup have been used. First, the histogram associated with the voltage recorded by the sensor has been represented in Figure 3(a). For this application, it is important that the voltage varies over a wide range. The typical operating region ranges from 0.2 V to 1.7 V. Second, the histogram of resistance variation is represented in Figure 3(b). Third, Figure 3(c) shows the histogram of the forces related to those resistance values. The typical operating region corresponds to force values in the range of 50-500 g. These force values have been calculated after fitting the equation of the resistance-force curve provided by the manufacturer.

In the typical region of operation , the force can be considered to vary linearly with the conductance, according to the datasheet provided by the manufacturer [46].

The sensing system takes samples from the piezoresistive sensor through an Arduino Pro Mini that operates at a sampling frequency of 50 Hz, and sends the data using an HC-05 Bluetooth module. Data are received by a processing unit with Bluetooth technology (i.e., computer, Android, or iOS device), as shown in Figure 4. Then, they are downloaded to be processed offline in MATLAB or any other numerical computing software. The range of the Bluetooth module is around 10 m with a data transfer rate of up to 3 Mbps [47, 48]. The reliability of the Bluetooth module as part of the sensing system was also measured. For that, four experiments were performed. They consisted of transmitting a known value to the receiving unit at different distances: 1 m, 3 m, 5 m, and 10 m. The transmission frequency was 50 Hz. The sensing system was in motion during the experiments and there were obstacles between the transmitter and the receiver. Each experiment was performed for 30 min. As a result, no corrupted value was received. The average percentage of lost packets was 0.03% (standard deviation of 0.01%).

The sensing unit was powered by a 3.7 V, 150 mAh lithium battery, although the casing was also designed to accommodate batteries of 300 mAh, 400 mAh, and 500 mAh capacity. These batteries were selected since they can be integrated into the casing in a compact way. The current consumption of the different components of the prototype was measured. The average values are shown in Table 2. These values are in line with those provided in the datasheets by the manufacturers [4649]. The battery life of the prototype was also measured, obtaining average values of 3.83 h, 7.88 h, and 13.01 h for batteries of 150 mAh, 300 mAh, and 500 mAh capacity, respectively. A battery was considered discharged when the voltage was below 3.6 V, following the recommendation of Lee et al. [50]. Regarding their safety, lithium-ion batteries are used massively. Statistically, they are very reliable since failure rates for rechargeable units are on the order of one in 10 million cells [51].

A TP4056 board is used to manage battery recharge. It ensures that both current and voltage remain constant during battery charging. The board consists of a processor and a battery protection circuit. It regulates the charging current under conditions of high power operation or high ambient temperature. The board also ends the charging cycle when the current drops 10% of the programmed value. It also has an internal MOSFET battery disconnect switch to avoid negative charging currents [52].

With respect to the operating temperatures supported by the prototype, the values for the different components were extracted from their datasheets: Bluetooth (-20 to 55°C), Arduino Pro Mini (-40 to 85°C), battery charger (-40 to 85°C), and battery (-20 to 60°C). The sensing system is not designed to be submerged in water. However, it is not different from any other object printed with polylactic acid material, which means that the casing can withstand weak levels of rainwater. Figure 5 shows a photograph of the mounted components of the sensing system outside the casing.

A casing to contain all the elements of the sensing unit was designed in the Autodesk software. This casing has two main parts: (i)An element printed with standard polylactic acid (PLA) containing the piezoresistive sensor, the conditioning circuit, the microprocessor, the Bluetooth module, the battery, and the battery charger (Figure 6(a), Figure 7, and pink case of Figure 8)(ii)An element printed with flexible PLA that allows transmitting chest movements to the sensing element (Figure 6(b) and black cover of Figure 8)

The sensing system is attached to the belt through two rings coupled to the flexible part. Figure 9 shows a photograph of the back of the casing. The sensing unit was designed to be worn on a garment, although direct contact with the skin would also be possible. The total size of this prototype is (Figure 8). The internal volume of the pink case is 30.42 cm3, while the weight of the entire prototype is 103 g (21 g for circuitry, 23 g for the 3D printed casing, and 59 g for the belt and the rings). The 3D design of the casing has been published as supplementary material and is available to be reused or reprinted by any interested researcher.

2.2. Data Processing

To measure the respiratory rate of the signals received on the remote unit via Bluetooth, different processing operations are performed. Firstly, data are filtered with a 0.5 Hz-low-pass digital filter, which “smooths” the signals by removing high-frequency noise. A minimum-order FIR or infinite impulse response (IIR) filter with a stop band attenuation of 60 dB and compensation for the delay was used [53]. This frequency has been selected because breathing rates above 30 BPM are rare in daily life activities of humans [54, 55]. An analysis of the system error was also performed considering cut-off frequencies in the range 0.5-4.5 Hz, obtaining the lowest error values for 0.5 Hz. In addition, to prevent that a trend in the signals (systematic increase or decrease) due to sensor or subject movement during the tests affects system performance, a linear fit was made to each signal and was subtracted from the original signal (Figure 10). In this way, systematic shifts were removed. These shifts are not relevant if signals are analyzed in short time windows. However, they affect system accuracy in large windows. Therefore, this preprocessing helps to prevent the algorithm from malfunctioning in large windows due to sensor movements other than breathing.

Then, the maximum and minimum points are obtained in a given analysis time window . For that, a subset of data which includes only the values in the time window is segmented. It has the form of a vector (). This vector is used to calculate the level corresponding to the “zero 280 axis” (ZA), according to the following equation: where is a vector with the filtered data sequence. The length of depends on the time window, which is a parameter whose optimal value has to be selected (see Validation Experiments). The time window slides through the entire signal. To avoid that outliers due to isolated deep breaths may raise the value, peaks with prominence of at least 0.03 V 285 are detected and is set to the amplitude of the median of all the detected peaks. The prominence threshold value was selected after performing simulations in the range of 0.013-0.13 V, since it led to the lowest error values.

will be the reference value used to detect zero-crossings in the data. To detect these crossing points, the segmented data set will be assessed by taking pairs of two consecutive samples . If inequalities 3 are fulfilled, a new zero-crossing will be detected and the time will be added to a vector containing the zero-crossings in the time window (). is the sampling frequency of the sensing system, in this case, 50 Hz.

To avoid detecting two close zero-crossings due to noise, the zero-crossing at position will be removed from if does not differ, at least, a set threshold from the rest of the elements of , that is, if inequality 4 is satisfied. where is the length of vector , is the index of the zero-crossing under analysis, and is the index for the rest of zero-crossings in . The value of has been empirically set to 500 ms.

Then, two different algorithms are used to measure the RR. Figure 11 shows a block diagram of both algorithms. The operation of the algorithms is as follows:

Algorithm 1. This algorithm is based on the time difference between consecutive zero-crossings [4, 39]. Firstly, the mean time difference (MTD) between consecutive pairs of zero-crossings is obtained as follows: Then, with that average value of all times, the respiratory rate RR (in breaths per minute, 305 BPM) is calculated according to the following equation: To obtain that equation, it was taken into consideration that two zero-crossings occur in a breathing cycle (2 MTD s, is a breathing period) and that the RR is given in breaths per minute (if one breath occurs in 2 MTD s, in 60 seconds, there should be 60/2 MTD breaths).

Algorithm 2. This algorithm is based on counting the number of crosses by zero [56]. For that, the length of the vector is obtained, which is directly the number of zero-crossings (). Then, the RR is obtained according to the following equation. where is the duration of the time window (in seconds). Equation (7) is obtained by scaling the number of zero-crossings to 60 seconds , so that the number of zero-crossings in 1 minute is obtained. As each breath is composed of 2 zero-crossings, by dividing this value by 2, the RR is obtained.

The sliding time window used in the algorithms is a parameter that can take any desired value. Once a time window has been selected, the RR is updated every seconds. The methods of counting peaks or zero-crossings or measuring distances between them have been widely used in previous studies to obtain RR [10, 40, 5759].

3. Materials and Methods

3.1. Experimental Setup

An experimental setup was designed to validate the sensor developed. Experiments involved twenty-one subjects. Fifteen were male and six were female. Ages ranged from 19 to 55 years with an average of 35.95 and a standard deviation of 10.5. Subjects’ weights were between 42 and 95 kg (average of 70.76 kg and standard deviation of 14.83 kg). As for heights, they were in the range of 1.52-1.83 m with an average of 1.72 m and a standard deviation of 7.51 cm.

The diameter of the thoracic region was also measured, obtaining values from 68 to 103 cm (average of 87.90 cm and standard deviation of 12.36 cm). The health status of the participants was also noted. Sixteen subjects declared no respiratory problems, while five suffered from breathing allergies and two of them also from asthma. Subjects were asked to wear the breathing sensor placed just below the chest, at the level of the diaphragm, as shown in Figure 12. The sensor was connected via Bluetooth to a computer running a program that was developed specifically for this study. The computer program was written in Processing.

Regarding the validation protocol, each subject was asked to breathe during one minute at the rhythm of a metronome. The metronome was set so that subjects followed a rhythm of 10, 12.5, 15, 17.5, 20, and 22.5 BPM. There are studies in the literature that use this method (metronome as a reference) to validate their sensing systems in a controlled breathing scenario [4, 17, 27, 57, 60, 61]. The reference values of BPM considered are in accordance with the typical respiratory rates in humans [62]. Subjects were asked to repeat the experiment in different positions: sitting without moving, sitting with movement, standing without moving, standing with movement, and walking. A one-minute resting time was given between two consecutive experiments. All participants received written and oral information about the study, and informed consent was obtained from them to publish their data anonymously in a public repository.

Each set of breathing data was recorded in a different text file (two example signals are shown in Figure 13). Thirty files were recorded for each subject (six BPM times five activities). Therefore, a total of 630 files were collected as a result of the experiments. The files were processed offline to obtain the RR according to the algorithms described in Data Processing. MATLAB was used to perform the processing. The MATLAB code is given as supplementary material to this paper.

Figure 13 shows two example of breathing graphs. The upper signal contains nine breathing cycles. A typical breathing signal has an approximate sinusoidal shape with a negative slope for inspiration and a positive slope for expiration. It also has an upper peak corresponding to the situation in which all the air has been exhaled and a lower peak associated with the moment when all the air is inside the lungs. Typical absolute slope values are 0.1-0.2 V/s for low intensity activities, 0.2-0.28 V/s for moderate intensity activities, and 0.28-0.35 V/s for higher intensity activities. These values were estimated theoretically and from the signals recorded in the experiments. Slope values are low since they were measured in the time-voltage graphs and breathing signals are low frequency.

3.2. Validation Experiments

The validation experiments allow in determining the accuracy of the sensor and the optimal processing algorithm and its parameters.

For that, the collected data were processed with the two algorithms described in Data Processing. For each algorithm, a different RR was obtained for each participant and dataset (in total 1260 values, 630 per algorithm). In addition, the algorithms are influenced by the width of the time window used to perform the RR calculation. Therefore, twenty-five different time windows have been considered: from 6 s to 30 s. Windows below 6 s were not considered since the reference BPM value with the lowest frequency had a period of 6 s. At least one period is required to obtain the RR. Windows above 30 s were not considered, since an update time greater than this value may be excessive for many applications [26, 63, 64]. For each time window, the entire analysis was repeated (in total 31,500 RR values; 15,750 per algorithm). The elimination of trends due to movements in the sensor was only applied to large windows (above 21 s for Algorithm 1 and above 19 s for Algorithm 2) since no decrease in error was perceived in shorter windows. Figure 14 shows the structure of the experiments graphically.

To obtain the optimal time window, the one sample -test was used. This test is suitable to compare the mean of one sample with a known reference value. The null hypothesis is as follows: where is the mean of RR and is the reference value of BPM set by the metronome, which was considered the gold standard.

Specifically, this test was performed for each time window and repeated for all reference values of BPM tested. In total, 150 tests were conducted.

As a result of this test, the values greater than the significance level (0.05) were identified. For the time windows and reference values associated with those values, the null hypothesis could not be rejected. In other words, sample means cannot be assumed to be significantly different from reference values. Therefore, we can assume that the sensor is measuring RR accurately for those BPM and time windows. The time windows that have the largest number of values greater than 0.05 could be considered candidates for optimal windows. For those reference values of the candidate windows having values below 0.05 (the mean is significantly different from the reference value), the Cohen’s test can be performed to quantify the effect size [65]. It can be obtained as the ratio of the difference between two mean values (one of them can be the reference value) divided by their pooled standard deviations. Small effect sizes are desirable. This would indicate that the difference between the means of RR and the reference values is small. A quantification of the effect size magnitude (“rule of thumb”) can be made using the thresholds defined in [66]: (negligible effect), (small effect), and (medium effect). Otherwise, the effect can be categorized as large. Therefore, the time window with the smallest effect sizes can be considered optimal.

In parallel, the relative error was calculated according to the following equation: where is a measured RR and is the reference value of BPM set by the metronome. In total, 1,500 error values were calculated (2 algorithms times 6 reference values times 5 activities times 25 time windows). The means of the errors were made for all activities and reference values, obtaining 50 mean errors (25 per algorithm, 2 per time window).

To determine the optimal algorithm for the optimal time window, the paired sample -test was performed since it is appropriate to compare the means between two groups of related samples. This test was performed on the means of the relative errors . The null hypothesis is as follows: where is the mean of differences. If the value is less than or equal to the significance level (0.05), it can be assumed that the two paired samples (algorithm errors) are significantly different. In that case, the algorithm with the lowest error could be considered the best. Figure 14 presents an overview of the validation experiments. All statistical tests have been performed in the R software. The R code is given as supplementary material to this paper.

In relation to the errors, it is important to highlight that some structural errors are already introduced by the sampling frequency or the time window selected, depending on the algorithm. For Algorithm 1 (based on time measurements), there is a quantization error set by the sampling frequency of up to 1/50 s at each zero-crossing. As one cycle has two zero-crossings, the maximum structural error in one cycle can be expressed in relative terms for each reference BPM value (Table 3). For Algorithm 2 (based on counting zero-crossings), the time window already introduces some error. All time windows that are not divisible by integer multiples of half the breathing period under analysis suffer this error. For this algorithm, the quantization error can also affect in some extreme cases in which the appearance or not of a zero-crossing depends on the sampling frequency (zero-crossings that appear exactly at the beginning or end of a window). Taken into consideration both effects (time window and sampling frequency), their associated maximum relative errors (up and down) are estimated in Table 4. It should be noted that the limits of structural errors calculated in Tables 3 and 4 are maximum values for extreme cases. Figure 15 graphically shows an example of two structural errors.

4. Results

Figures 16 and 17 represent the mean error for the twenty-five time windows under analysis and for the two algorithms used to obtain the RR. The standard deviations of these mean values are shown in Table 5. The values of the RR measured and the source code with the calculation of their mean errors and standard deviations have been attached to this paper as supplementary material.

Table 6 shows the values of the one-sample -test for each time window. In view of this table, it is clear that the 27 second window has more values greater than 0.05: four in this case. This means that RR average values and reference values can be assumed to be equal for this time window and BPM. Therefore, this is the optimal window in the terms defined in this experiment.

Cohen’s was calculated for those BPM of the 27 s window that present statistically significant differences. Table 7 presents the results obtained.

For this window, the error values in the calculation of the RR provided by the two algorithms were compared. Table 8 shows the results. It can be seen that the value of the -test for paired samples is above the significance level (0.05). This means that the difference between the two paired means of error values is not significant. Therefore, it is not clear the algorithm that presents the lowest error. Both algorithms seem to behave equally well.

The executable source code associated with all statistical tests has been attached to this paper as supplementary material.

5. Discussion

The accuracy of the sensor designed presents less average error value for Algorithm 2 than for Algorithm 1. However, this difference is not statistically significant. Both algorithms are influenced, at the same time, by the time window considered. The validation results presented have allowed determining the optimal time window.

A time window of 27 s seems optimal to obtain the highest sensing accuracy. This has been verified by different means. Firstly, the mean error values calculated for each time window have the lowest value for 27 s for Algorithm 2 and the second lowest value for Algorithm 1. Their associated standard deviations also show low values for the 27 s window (Table 5). This is an indicator that these low error values also have a low level of dispersion. In other words, the individual errors used in the calculation of the average do not differ much from the average errors obtained. Secondly, the calculated values of the one sample -test provide statistical evidence that the 27 s time window is optimal. This time window has the highest number of BPM tested that cannot be considered different from the reference values. The Cohen’s results showed a moderate effect size for the 12.5 BPM reference value and large for the 10 BPM. Slow breathing seems to have higher error values for all time windows. This is an expected result since the number of cycles used to obtain the RR is less than in rapid breathing. If the optimal time window was adopted, it could provide a fairly accurate measurement of RR every twenty-seven seconds. This time step is suitable for many applications. If shorter time windows were desired (e.g., 16-20 s also have acceptable error rates), they can be adopted at the expense of lower accuracy.

Some time windows had large errors for Algorithm 1. This is the case of short time windows (6 s to 10 s). This is a logical result since the number of cycles used to make the calculation of time difference is very limited. These time windows are specially affected by the movements of the subject or the sensor. It is important to note that the use of time windows greater than 20 s and less than 30 s has quite similar error values. It is also a fact that error values for those windows were not far from the optimal case, so time windows above or around 20 s might also be acceptable.

Regarding the processing algorithm, Algorithm 2 seems more robust to time window variations than Algorithm 1 since its associated error values are small even for short windows. The statistical tests for the optimal window (27 s) did not identify significant differences. According to the typical interpretations of Cohen’s value, the difference between both algorithms was negligible (0.132).

Results show that the designed sensor can determine the RR with an error of 3.40%. If the error value obtained with the proposed sensor is compared with other error values presented in the literature, it is possible to conclude that this value is in line with other studies in this field (Table 9). However, performances among studies cannot be compared fairly, since each study makes personalized tests. There are strong differences among validation experiments, datasets, and performance metrics. The inclusion of movements in the experiments can also compromise system performance. It is also important to highlight that the novelty of this paper with respect to existing studies is that we have presented a compact piezoresistive sensor with a 3D printed casing integrating all required modules into it, which is an advance in terms of wearability.

6. Conclusion

A respiration sensing system based on a piezoresistive FlexiForce sensor to be worn with a chest strap has been developed. This work is novel since it is the first time that this sensor is integrated in a compact casing including all the necessary elements (microcontroller, Bluetooth module, battery, etc.). The casing design has a direct influence on the sensor’s detection capabilities. As part of this work, a compact casing has been designed and printed using a 3D printer. The files with the design have been published as supplementary material to be reused by any interested researcher.

A validation experiment was performed with 21 subjects. Two processing algorithms have been developed to determine the RR. Several statistical tests were conducted to identify both the optimal time window of the algorithms and the best algorithm. A time window of 27 s provides optimal results. This has been verified from the values of the one sample -test and the relative errors. This time window allows updating the RR every twenty-seven seconds, which is a suitable time for many applications. No statistically significant differences were identified between both algorithms for this time window. If shorter time windows were required, they could be used with a slightly larger error. This is a feasible scenario since error values remain fairly constant for a wide set of time windows (from 10 s for Algorithm 2 and from 20 s for Algorithm 1). This process of statistical verification is novel in this field.

Regarding the possible use of the information provided by this sensing system, it could be applied to several fields such as ambulatory health monitoring, home treatment of respiratory diseases, detection of alarming symptoms of faintness or fatigue in machine operators or drivers, health condition assessment, prediction and prevention of dangerous health states, monitoring of physical activity, and analysis of human emotions like anger and stress, among others. Customized data processing should be performed depending on the specific application.

Several commercial products that measure physiological parameters exist. However, it is not possible to know their working principle, electronic design, or results of validation experiments, since these data are generally not published. Additionally, most commercial products require data to be analyzed on their proprietary platforms. This contrasts with the sensing system presented in this paper. Data can be received online by any device with Bluetooth communication. They can then be processed offline in any numerical computing software. In addition, we have designed a 3D compact casing and uploaded the source files to a public repository to be rebuilt by any interested researcher. Another important aspect is the price of the system. Adding the cost associated with all elements of the system, it is below $50. Different commercial chest breathing sensors can be purchased for several hundreds of dollars. However, system design is not available to be reproduced by researchers. In this paper, the breathing dataset with the measurements from the experiments, the files with the error calculations, the source code of the RR computation with the two algorithms, and the source code of the statistical tests have been published as supplementary material to be reviewed or reused by researchers in this field. This increases transparency in research and promotes reusability. It is the first time that we see this approach in a study in this field, to the best of our knowledge.

This work also has some limitations. Although sensor validation using a metronome is a well-known and accepted method, it would be desirable to validate this sensor against a reference breathing sensor taken as a gold standard. More subjects could have been included in the study, and other 3D casing designs could have been investigated. In addition, programming a smartphone app that receives sensor data via Bluetooth is a necessary step for the real-world implementation of the sensing system.

Nevertheless, this paper has shown that the compact FlexiForce sensor with the 3D casing designed together with the algorithm based on measuring times between zero-crossings or counting zero-crossings allows determining the RR with a low error and an acceptable refresh rate.

Data Availability

The dataset with the breathing data recorded in the validation experiments is deposited in a public repository [45]. The files corresponding to the 3D design of the casing, the calculation of errors and standard deviations, the algorithms to obtain the RR from raw data, and the statistical tests are provided as supplementary materials.

Conflicts of Interest

The authors declare that there is no conflict of interest regarding the publication of this paper.

Acknowledgments

The authors gratefully acknowledge the efforts of the twenty-one volunteers who participated in the validation experiments. This work was supported by the European Social Fund (grant number: Programa Operativo FEDER 2014-2020 Construyendo Europa desde Aragon), the Gobierno de Aragon (grant number T49-17R), the Consejo Nacional de Ciencia y Tecnología (CONACyT, grant number 709365), and the Universidad de Zaragoza and Centro Universitario de la Defensa de Zaragoza (grant number UZCUD2019-TEC-02).

Supplementary Materials

The supplementary materials are categorized in four different folders: (A) STL files with the 3D design of the compact casing. The casing consists of eight different pieces. They can be printed separately. (B) MATLAB files with the algorithms used to calculate respiratory rate from the recorded data (the dataset of breathing signals is also included in that folder). (C) Excel file with the calculation of sensor error values and standard deviations for different algorithms, time windows, and reference values. (D) R files with the statistical tests applied in the paper (one sample -test, Cohen’s , and -test for paired samples). (Supplementary Materials)