Accurate Spirometry with Integrated Barometric Sensors in Face-Worn Garments

Cardiorespiratory (CR) signals are crucial vital signs for fitness condition tracking, medical diagnosis, and athlete performance evaluation. Monitoring such signals in real-life settings is among the most widespread applications of wearable computing. We investigate how miniaturized barometers can be used to perform accurate spirometry in a wearable system that is built on off-the-shelf training masks often used by athletes as a training aid. We perform an evaluation where differential barometric pressure sensors are compared concurrently with a digital spirometer, during an experimental setting of clinical forced vital capacity (FVC) test procedures with 20 participants. The relationship between the two instruments is derived by mathematical modeling first, then by various regression methods from experiment data. The results show that the error of FVC vital values between the two instruments can be as low as 2∼3%. Beyond clinical tests, the method can also measure continuous tidal breathing air volumes with a 1∼3% error margin. Overall, we conclude that barometers with millimeter footprints embedded in face mask apparel can perform similarly to a digital spirometer to monitor breathing airflow and volume in pulmonary function tests.


Introduction
Our cardio-respiratory (CR) system is The most important physiological system, as it is responsible for oxygen delivery to The entire body. In recent years, many wearable approaches have emerged to monitor CR vital signals both in The academic research field and The consumer electronics sector [1].
Non-invasive CR evaluation includes lung function tests (pulmonary function tests (PFTs)) and heart tests. PFTs include spirometry, which measures The physical aspects of The lung's functionality such as The lung volume and rate of flow. PFTs also concern The gas chemical composition, which usually requires gas chromatography and mass spectrometry [2,3]. Heart tests usually include The well-known electrocardiograph (ECG), blood flow tests (pulse-oximetry), and blood pressure tests. These vital signs are commonly tested during patients' diagnosis and athlete's performance evaluations. Pulmonary tests especially play an important role in The diagnosis and evaluating The progression of respiratory and pulmonary diseases, as well as post recovery after other medical procedures (e.g., post operation) [4][5][6].
Wearable healthcare devices [7] provide The possibility to monitor vital signals and health-related activities in people's daily lives, which benefits both peoples awareness towards their own health and The healthcare providers' understanding of The patients' progress. Personal wearable devices can also reduce The chance of The cross-infection of respiratory diseases, which may be a concern of shared medical devices [8]. This becomes more relevant as The pulmonary function is a major indicator for such diseases. Heart-related parameters, in particular heart rate monitoring during physical exercise, is among The most popular and successful applications of wearable systems. As far as PFT is concerned, research has focused on wearable breathing frequency monitoring, and some systems suitable for long-term real-life deployment have been demonstrated (as explained in Section 2). While breathing frequency is a relevant factor in PFTs, without information on The related breathing volume, it has limited value only. Many studies have shown The two factors to be independent of each other. For example, The breathing frequency-to-volume ratio can vary and be The indicator of signs of fatigue, external stimulus, etc. [9][10][11][12]. To date, breathing volume measurement is mostly restricted to constrained laboratory settings due to The form factor of existing spirometers. To measure The airflow, spirometers typically require directing all The air flow from The patient to a sensing element (as explained in Section 2). Such measurement modalities prevent miniaturizing spirometers, because if The vent cross-section area is too small, The user's breathing will be restricted. This is what our work aims to address.

Novelty and Contribution
Our major novelties and contributions are: • We demonstrate The possibility of performing accurate transient breathing volume measurement in a wearable garment in The form of a sports mask, as opposed to hand-held novel spirometers, which mostly require a specific structure with a breathing tube, as reviewed in Section 2.2.

•
Our approach uses only off-the-shelf components, without any proprietary sensors or custom mechanical designs.

•
The only sensing element needed is a pair of low-cost (three Euros) miniaturized (2.5 millimeters) barometric pressure sensors that are already widely available thanks to The personal mobile devices and drone industry.

•
The approach is made possible by shifting The measurement modality, from directly placing sensors in The airflow duct to elaborating The pressure difference of The inside and outside of The face mask compartment, as shown in Figure 1. We evaluate The approach with an off-the-shelf clinical spirometer in an experiment consisting of 20 participants performing in total 200 forced vital capacity (FVC) tests and additional normal breathing. A physical model is constructed to theoretically explain The relationship between The airflow and The barometric pressure in our setting. Then, regression methods are performed to derive The relationship between The two instruments from The evaluation experiment data. Through our approach, clinical pulmonary function parameters such as forced effective volume in one second (FEV_1), etc., are calculated both from The clinical spirometer and our integrated barometric sensor approach. We compare both The transient breathing airflow and volume, as well as The FVC vital parameters. We also compare our approach to multiple state-of-the-art novel hand-held spirometer research results, as well as The medical society requirements for spirometry. We conclude that our approach is sufficient to perform accurate pulmonary function tests on a similar level as a clinical digital spirometer.

Paper Structure
In Section 1, The motivation and contribution of this work are stated. The relevant background and state-of-the-art are introduced in Section 2. In Section 3, We describe The apparatus in this study, including The instrumented sports mask and The calibration setting where our approach is connected with a spirometer to share The same airflow. In Section 4, a mathematical model is derived for our smart mask setting to explain The relationship between The air pressure and airflow, which are measured by The two different instruments in The evaluation apparatus. The evaluation procedure is described in Section 5. Section 6 explains The algorithms We developed to validate our approach. The results of The evaluation are then presented in Section 7. Section 8 concludes The entire paper with The major findings and outlook.

Pulmonary Function Tests
The PFT Forum (www.pftforum.com.) offers a comprehensive archive of The history in medical and sport respiratory evaluation. PFTs usually require a patient to fully inhale and then fully exhale with maximum force. The important factors those tests seek to determine include The air capacity of lungs, as well as The transient flow rate in different stages of The total capacity.
The most common clinical pulmonary function test is The forced vital capacity test [13]. The FVC maneuver consists of three steps: maximal inspiration, explosive exhalation, and continued complete exhalation. From The test, typically, a flow-volume loop is generated (e.g., The red curve in Figure 2). From The FVC test and The flow-volume loop, further essential parameters are calculated that reflect The subject's lung condition, such as forced vital capacity (FVC), forced expiratory volume in one second (FEV1), forced peak expiratory flow (PEF), forced expiratory flow at x% of FVC (FEFx), forced inspiratory flow at x% of FVC (FIFx), etc. Other pulmonary function parameters such as tidal volume (TV), inspiratory reserve volume (IRV), expiratory reserve volume (ERV), and inspiratory capacity (IC) can be derived from The combination of FVC maneuvers and normal tidal breathing, as shown in Figure 3. However, some pulmonary function parameters including The residual volume (RV), functional residual capacity (FRC), total lung capacity (TLC), etc., cannot be directly measured through clinical procedures using spirometry alone [14,15], with which We will not be further concerned in this study.

Spirometry Devices
The earliest spirometers are completely mechanical devices that require visual readings. Specifically, The incentive-type spirometers [16] are still being prescribed to patients to perform regular PFTs at home. The mechanical (including incentive-type) spirometers usually have a disk or piston inside an air chamber. The more air The patient exhales, The higher The disk or piston would move in The chamber. Apart from measuring The lung capacity, such PFT procedures can also help The patients to practice deep breathing and improve their pulmonary functions, as some randomized controlled trials suggest [16,17].
However, The mechanical spirometers usually only provide information about The total lung capacity, not The transient flow rate, due to The limitation of The visual reading. Thus, to inspect other pulmonary information, such as FEV1, PEF, FEFx, FIFx, etc., digital spirometers that can record continuous flow rate information during pulmonary function tests were developed. Earlier studies typically used complex and bulky systems to measure expiratory airflow such as The Otis-McKerrow valve-Fleisch pneumotachograph-Validyne manometer setting in [3]. Currently, most commonly used devices for respiratory evaluation are hand-held or stationary devices such as The pneumotachometer-type spirometer shown in Figure 1a or The turbine-type spirometer [18] in Figure 1b.
They are typically used while The patients or subjects are seated steadily. To be able to use spirometers in sports exercises with stationary machines such as a treadmill or an ergometer, a mouthpiece and tubing are needed to connect from The person's airway to The stationary devices, such as The professional CR analyzer Metalyzer R 3B by Cortex Medical or The PRE-201 R produced by Piston Medical, which can also analyze gas composition. However, with a mouthpiece, The user's nose needs to be closed with a clip so that air will only exchange through The mouth. As an alternative, a complete face cover with tubing can also clinically replace a mouthpiece to direct airflow into The spirometers [19,20].
The overall trend of device evolution is apparently towards smaller and less expensive spirometer devices, with The main arguments that patients can perform tests on their own in their daily life, with The emerging small devices such as AioCare R and MIR Smart One R . Medical research shows that some hand-held spirometers are suitable for clinical trials [21,22], yet The turbine type in particular underestimates key PFT values. Cortex Medical also has a wearable system Metamax R 3B that consists of a measurement mask and chest or back carried additional hardware in a thin bag, overall weighing 580 g. Yet, among all our findings, only The Metamax R 3B is oriented toward untethered sports activities.
Apart from The medical equipment mentioned above, much effort has been devoted toward novel respiration rate monitoring methods in The academic field [23]. A novel spirometer using a specially-designed micro-electro-mechanical system (MEMS) airflow sensor was demonstrated in [24], reporting 3∼5% accuracy in FVC and FEFx tests. In [25], another specially-made MEMS airflow sensor was produced and compared with a pneumotach spirometer, resulting in a coefficient of determination of 0.986 (one is perfect correlation) in airflow values without PFT parameters such as FVC or FEFx. However, both MEMS elements require a dedicated construct of several centimeters, and all The airflow needs to be directed into The construct. An optical fiber-based airflow sensor was evaluated for pulmonary function tests purposes in [26], reporting 20% error rates for FVC values compared with a pneumotachograph spirometer. An open architecture reconfigurable respiration monitor was proposed in [27] using an off-the-shelf airflow sensor and other gas composite sensors to perform PFTs, with a Pearson correlation of 0.94. In [28], a wireless hand-held pneumotachograph spirometer was developed, showing a 3% error for FVC and a 10% error for PEF values.
Yet, all of The above-mentioned novel spirometer research stays with The conventional spirometer structural topology: a flow-rate transducer placed inside a breathing tube as a handheld device, with The user breathing through The tube structure. There are also various research works that depart from The conventional spirometer structure, elaborating wearable and pervasive sensing methods that do not directly measure The airflow, to monitor respiratory activities.

Respiration Monitoring in Wearable and Pervasive Research
A significant merit of wearable and pervasive sensing methods is that they enable everyday garments or objects with novel sensing capabilities to detect The users' activities or assist their daily life; while keeping The garments' or objects' originally intended functionalities, or at least The novel garments are unobtrusive or not distracting for The users during their daily activities.
In works such as [29][30][31], pneumatics-based systems are used to detect respiration and heart beat movements by pressure sensors in The air cells under sleeping mattresses. The pneumatics systems detect The body weight shifts caused by respiratory and heart beat activities. Wearable approaches have also been investigated. In [32,33], capacitive sensing was deployed at The subjects' chest area to detect breathing and pulse signals. As The girths of chest and abdomen show a clear correlation with breathing activities [34], many works have used wearable stretch or bend sensors around The chest to detect breathing cycles [35][36][37][38][39]. However, none of The works mentioned above have investigated a quantifiable correlation between The chest girth and The absolute breathing volume. In fact, as pointed out in [40], there is little correlation between The vital lung capacity and The chest or trunk girth. In [41], a low-power sound sensing system placed at The wearer's neck was developed to detect respiratory events such as asthmatic wheezing.
Barometers measure The air pressure and are integrated in many wearable and mobile devices and drones currently, since The atmospheric pressure difference can be used to estimate The change of The altitude elevation [42][43][44]. In [45,46], integrated barometers were placed inside face masks to monitor breathing activities without distracting The wearer, from which The intensity was classified as "normal breathing" and "deep breathing" through machine learning approaches. To The best of our knowledge, there is currently no study on how The precise airflow can be measured by miniaturized sensors in The chip form factor, embedded in off-the-shelve wearable apparel to reach The level of clinical pulmonary function tests.

Hardware
In this section, We first describe The data acquisition hardware prototype with The embedded barometers in face mask apparel. To convert The barometric pressure to spirometer airflow, We connected our prototype to an off-the-shelf digital spirometer to share The same airway (The mask-to-spirometer (M2S) setup). The algorithms and evaluations from Section 4 to Section 7 are based The M2S setup. To verify that The airway connection cone and spirometer placement needed for The M2S setup do not have a significant impact on The spirometry result, We replaced our prototype with another identical spirometer (The spirometer-to-spirometer (S2S) setup) and performed preliminary validations with The S2S setup.

Embedded Barometer and Electronics Hardware
We compared two embedded barometric sensors: BMP280 and BMP388, both manufactured by Bosch Sensortec R . They measure atmospheric pressure and temperature. BMP280 has a footprint of 2.5 × 2.5 mm and a height of 0.95 mm, a 182Hz sampling rate, and a ±1 hPa absolute pressure accuracy between 300 and 1100hPa, according to The datasheet. BMP388 is an improved and newer version of BMP280. It has a smaller footprint of 2 × 2 mm and a height of 0.75 mm, a higher 200 Hz sampling rate, and a ±1 hPa absolute pressure accuracy. The cost was around 2EUR for BMP280 and 3EUR for BMP388 at The time of writing.
The barometers were placed on The inside and outside as differential pairs of a mask with a rubber face seal (Training Mask R 3.0). The mask has a valve system to adjust The airflow resistance. The valves were completely removed in our prototype so that The wearer could breath freely. Volunteers who tried The prototype reported no noticeable resistance when breathing with The mask.
In initial trials, We observed an offset in The pressure values from different sensors in The same room. Therefore, We devised a differential barometer setup, with one barometer inside and one outside The mask. Thus, The difference between these two sensors' pressure values is The offset plus The true pressure difference. Figure 4 shows The electronics hardware in our study. A pair of BME280 and a pair of BME388 sensor modules (breakout boards) were connected to one Arduino R board (HUZZAH32) with an I2C bus (for BMP280) and an SPI bus (for BMP388). This configuration ensured that The four sensors were synchronized on The hardware level. The data of all four sensors were read out together at 10ms intervals (100 Hz) and then downsampled by two-sample averaging to 50 Hz to match The digital spirometer's sampling rate. The data were then sent to a computer (Dell R XPS9650) via a USB cable with The standard serial port protocol. A medically-certified digital pneumotachometer-type spirometer was used (Vernier R SPR-BTA) as our reference, as shown in Figure 5. It measures The airflow with a 7cm diameter round disk of fine mesh. The data were sent to The same computer via a proprietary USB adapter (Go!Link) and saved by The data logger software from Vernier R .

Mask-to-Spirometer Calibration Setup
In this study, We used a tube to connect The airflow between The instrumented mask and The spirometer so that both devices shared The same airflow, as shown in Figure 5a. This allowed us to calibrate The air pressure inside The mask chamber measured by The BME280 sensor with The flow rate measured by The spirometer. The tube's narrower end was sealed with The spirometer's inlet with duct tape (tesa R extra Power Universal), and The wider end was sealed with The mask with an excessive amount of solid caoutchouc adhesive (UHU R Patafix). To test The air-tightness, prior to The recording, The participants were asked to check that they could neither breath in nor out with The spirometer's outlet sealed with their palm. During The recording, The participants held The spirometer and pressed it against The mask to ensure air-tightness.
Three people in their 20s participated in The calibration recording. The participants were chosen so that they had different body sizes to introduce more variation (Participant 1: male, 185 cm; Participant 2: female, 163 cm; Participant 3: male, 196cm). According to various studies such as [47,48], body size has strong direct correlations with The volume, control, and pattern of breathing. Each participant breathed in a normal, but focused manner with The setup for approximately three minutes. The spirometer had a stable sampling rate of 50 Hz. Our system also read The barometers' value at The same 50 Hz, although The embedded barometers were capable of sampling rates of up to 200 Hz. Naturally, The data from different devices did not exactly have The same timestamps. The two devices' data used The clock from The same receiver computer; therefore, The data shared The same time scale. They were interpolated with The linear method to The same time granularity of 10 ms, which was decided to be half of The devices' sampling period according to The Nyquist-Shannon sampling theorem.

Spirometer-to-Spirometer Reference
Since The tube was customized just for this study, it was unknown whether it was introducing any air friction or disturbance to The airflow, which may undermine The correlation between The two devices' readings. Therefore, prior to The mask-to-spirometer (M2S) calibration, We used a second spirometer of The same model to replace The mask, as shown in Figure 5b. This spirometer-to-spirometer calibration quantified The deviation of The flow rate at both ends of The tube as a reference. Figure 6 shows The time sequences of The flow rate (cubit meter per second) from both spirometers, which overlap almost perfectly. To quantify The correlation, The two flow rates are drawn on different axes in Figure 7. A single term linear approximation was performed using MATLAB's Curve Fitting Tool (CFTool). From both visually inspecting The data points and The slope value of The fitting function, it could be concluded that The close spirometer was overall slightly more sensitive than The far spirometer, which made sense due to their physical order of encountering The participants' airway. Furthermore, at The very high negative airflow region, The far spirometer became slightly more sensitive. This may be because during inhaling, The air that came in passed The far spirometer first. This suggested The extra tubing did cause very little friction to The airflow that was distinguishable from The data. However, The difference was negligible on The overall scale and could be explained by The physical position of The two spirometers. Therefore, The M2S setting could be used for deriving The airflow-pressure relationship in our following evaluation.

Understanding Airflow and Pressure
The air pressure inside The mask P and The airflow through an orifice can be simplified as a physical model, as shown in Figure 8a, in an ideal situation, that The orifice is through a uniform tunnel with The intersect area of S, ignoring any friction. There is a free moving piston that is expanding or shrinking The volume of The chamber, which represents The wearer's breathing. When P is different from The external atmosphere pressure P atmos , air will flow at The F flow rate until The pressure difference is equalized. The air density is ρ. Take The air from The small part with dx length from The tunnel, and assume The air is flowing with speed u = F/S out of The chamber; The momentum of The air body during a small time period dt is: If The air pressure difference is dP = P − P atmos , The above equation can be simplified as: We have u as an integral relationship with P: Bring back u = F/S, and We have: When The air flows into The chamber: We can plot The function in a realistic flow rate range in Figure 8b. Note that The model is built on The assumption that The pressure inside The chamber is uniformly distributed and The air resistance of The orifice is ignored. The coefficients in Equations (5) and (6) are based on The further condition of standard sea-level at 15 • C and a certain orifice size. Thus, Equations (5) and (6) and Figure 8b only serve to understand The pressure-flow relationship, but not actually measuring The airflow in real-world settings. Both from The equations and The figure, The F − P relationship is clearly non-linear and monotonic, and pressure actually becomes more sensitive in larger flow rate values. To realize converting from pressure to flow rate in our system, We performed experiments with participants and derived The real-world pressure-flow relationship through regression modeling methods. In [49], dynamic flow analyses were performed during a person's breathing, speaking, and coughing, which showed The airflow is not uniform in an open face setting in The scale of meters. While The flow analyses in [49] did not analyze The airflow distribution inside The face covering, The study in [50] suggested that The turbulence effect inside a face mask renders The air flow more evenly distributed compared to The open face setting.
This physical model also applies to a larger amount of smaller orifices or pores with varying intersection areas of s, such as N95 particulate filters. The only modification would be switching The area S to The sum of all pores ∑ s in Equation (1). Both will be canceled by each other and removed from The equation, rendering The same resulting equations. The other assumption of this model is that The orifice tunnel does not have friction, which may slow down The air flow speed u. This would add additional terms in The F-P relationships in Equations (5) and (6). In The following section, We will take this into consideration in The real-world scenario and overcome The influences from uniformity and friction by mathematical regression from recorded data.
The physical model thus conclusively suggests that The entire airflow between The chamber and The exterior can be calculated from The air pressure inside The chamber. This has a significant implication for The shift of measurement modality: The air pressure can be measured by placing a small sensor in a tiny fraction of The airway, as opposed to that measuring The sum of airflow, requiring sensing elements that cover The entire orifice intersection area.

Forced Vital Capacity Test
To test The accuracy of our proposed method compared to The medical spirometer devices, We performed The standard forced vital capacity test that is normally conducted during clinical spirometry diagnosis procedures. We followed The instruction from The "Standardisation of Spirometry" [13] to perform The FVC test. The procedure of The FVC test is described in Section 2.1.

Experiment Procedure
Twenty participants were recruited aged between 21 and 34. Seven of them were female, and thirteen were male. Their demographic details are shown in Figure 9. The participants were healthy, without any illness symptoms or any known lung-related conditions, e.g., shortness of breath, asthma, etc. The experiment was carried out during The summer months of 2019, and there was no reported seasonal epidemic. Personal and equipment hygiene procedures were carefully observed. Before The recording of every participant, cleaning procedures were carried out for both The participant and The apparatus. The mask was thoroughly disinfected with 70% alcohol. The participant cleaned their mouth with alcohol-based mouthwash and washed their hands and face with soap.  Note that our instrument is fully integrated with a standard sports mask routinely used by athletes to control air inflow during exercise without making The mask in any way more obtrusive.

Signal Processing
The overall evaluation methods are illustrated in Figure 11. For The pressure data from every pair of barometers (BMP280#1 and BMP280#2, BMP388#1 and BMP388#2), We calculated The difference from inside The mask to The outside. This differential pressure came with an offset, which was due to The differences during manufacturing. The last half second of The experiment session was used to calculate this offset as The participant had taken off The mask, so that when there was no airflow, The differential pressure was approximately zero. Then, zero phase average filtering with a kernel size of 10 samples was used for smoothing. We also observed offset in The spirometer's data when there was zero airflow. Therefore, The spirometer's data were subtracted by The average of The last half second of The recording to remove The offset. First, We compared The processed data from The differential pressure values measured by The barometers with The airflow values from The spirometer. The values are scatter-plotted in Figure 12 as gray points, as The two measurements at a given sample time represent different physical concepts and have different units. The non-linearity from The measured data showed The strong resemblance of The airflow-pressure relationship from The mathematical model shown in Figure 8. Our first evaluation goal was to see how We could best mathematically interpolate from The barometer's pressure data to The spirometer's airflow. We used regression based on The physical model, as well as two other general regression methods: polynomial fitting and neural network.

Physical Model Fitting
Based on Equation (4) from The physical model, We set The differential pressure to x and The flow rate to y and parametrized The coefficient of The term of x 1/2 . We used regression methods to derive The coefficient. However, since The model was ideal, We added more terms as described in Equations (7) and (8) and refer to them as root functions. A separate fitting function was preformed asymmetrically for positive and negative airflow values.
We used linear least squares (LLS) to derive The coefficients of every term. The least absolute residual (LAS) method was used for robustness control. Different root function settings and results are listed in Table 1, from which, "root2only" is The same as Equation (4) with all The coefficients except for c set to zero.
From Figure 12, We can observe that as more terms are included in The model equation, The curve aligns closer with The cluster of The sample points. Table 1. Root function coefficients with all participants' data (inclusive) for Equations (7) and (8).

Polynomial Curve Fitting
Polynomial curve fitting is a common regression technique for non-linear data sample distributions [51]. Polynomial curve fitting assumes a polynomial expression from The observation data (x) to The output data (y): The coefficients in Equation (9) p 1 , p 2 , . . . , p 6 are determined by The same LLS and LAS methods as with The physical model fitting. We performed from second degree (only with p 1 , p 2 , p 3 ) to fifth degree (with all coefficients p 1 , p 2 , . . . , p 6 ) of polynomial functions with The MATLAB R Curve Fitting toolbox. Table 2 shows The polynomial coefficients of The all participants inclusive case. Empirically, The higher degree of of The polynomial function is, The more details The regression model can represent from The dataset. In Figure 12, We can observe that as The polynomial degree increases, The curve fits The data cluster better. However, at The range outside The majority of The data clusters, The curve suffers from more fluctuation than The physical model. Furthermore, polynomial functions are not guaranteed to be monotonic. In our case, monotonicity means higher differential pressure will always result in higher airflow. For example, in Figure 12b, We can observe that poly2 and poly4 eventually indicated less airflow as differential pressure reached The boundary of The range of The data. Table 2. Polynomial curve fitting coefficients with all participants' data (inclusive) for Equation (9).

Neural Network Regression
We also evaluated how well an artificial neural network could be used to derive The relationship between The measured pressure and airflow values. The Neural Net Fitting tool from MATLAB R was used. We used a standard two-layer feed-forward network with sigmoid hidden neurons and linear output neurons, as shown in Figure 13. The network was trained with The Levenberg-Marquardt backpropagation algorithm [52,53]. The data were randomly divided into training-validation-testing by 70%-15%-15% partitioning. The mean squared error of The validation samples was used to automatically stop The training progress. Based on The number of hidden layers N, The model was code-named as ANN N (e.g., one hidden layer was coded as ANN1).

Participant Pool Division Schemes
In our evaluation, The 20 participants were treated according to three separation schemes: • Individual: A separate model was fitted with The data samples from every participant.

•
Inclusive: A single model was fitted with The data sampled from all participants combined. • Exclusive: The 20 participants were randomly divided into five folds. A separate model was fitted with data from four folds and tested on The remaining fold.
The difference between inclusive and exclusive is that The model is always dealing with a complete stranger in The exclusive scheme. When multiple models were generated from one scheme, We calculated The root mean square of The relevant evaluation parameters.

Results and Discussion
The goodness of fit (gof ) is presented as The root mean squared errors (RMSEs) between The actual airflow values and The predicted values from The pressure values with The regression models. In general, a more complex model will fit The non-linearity relationship of The data better (i.e., more terms in The root or polynomial functions or more hidden layers in The neural network). However, The benefit becomes trivial after a certain point, and The model may be over-fitted. A smaller RMSE value means The regression model fits better in The data sample cluster. Since The sample cluster did not form a perfectly narrow curve, The RMSE would not be zero.
At this point, We performed The regression with The data sample from all 20 participants combined. The RMSE of all The regression methods are listed in Table 3. From The table, We can see that all three regression models yielded similar fitting results as The model complexity increased.

Predict FVC with Barometers
To see The ability of The barometers in acquiring The useful clinical information needed from spirometry, We used The fitted models to predict The airflow from The pressure measurements. We then constructed The flow-volume loop with The barometer's data only, as The example shown in Figure 2. From The loop, We then calculated The FVC vitals introduced in Section 5.
To compare The FVC vitals calculated from The two instruments, We define δ as The root mean squared error (RMSE) of The differences divided by The overall range of The vital values from all participants: δ = rmse(Vital spr − Vital bar ) max(range(Vital spr ), range(Vital bar )) (10) Figure 14 shows The δ of The different vitals under exclusive fitting conditions with different models. First of all, We can conclude that The best models could predict all of The FVC vitals with around 5% error when The subject was completely new to The system. Then, We can also observe that The δ values decreased as The model became moderately complex. However, even more complex models bring little improvement over The δ values.

Person Dependency and Customized Fitting
So far, The evaluation has been under The exclusive participant division method, in which case The models did not have any prior knowledge of The participants' data being tested. However, in The real-world smart wearable scene, a wearable garment such as a face mask can be a private item, which means they can be customized to The specific user or a team of users. Therefore, The inclusive and individual division schemes are also relevant. Table 4 shows The δ values of such cases with The three best performing models. From The table, We can conclude that for all FVC vital parameters, if The system is customized to a single user, The error of prediction can be as low as 2∼3%. Furthermore, if The system is trained with a certain group of users, there is still a slight improvement of The prediction error compared to The exclusive case. Table 4. δ value of FVC vitals and tidal breathing comparison (The smaller The better). FEV, forced effective volume; PEF, forced peak expiratory flow; FEF, forced expiratory flow; FIF, forced inspiratory flow; TV, tidal volume.

Continuous Tidal Volume Monitoring
A major advantage of such a wearable sensing garment is performing continuous vital sign monitoring. The FVC maneuver is a clinical test procedure that is typically not used during people's normal breathing activities. We calculated The air volume of all The recorded breathing events, including both The FVC maneuvers and The tidal breathing cycles. Air volume was calculated by integrating The airflow, either measured by The spirometer or interpolated by The model and barometer's pressure data. To eliminate error accumulation through prolonged integration, a sliding window of 0.5 s with a 10 millisecond window step was used to perform The integration. Figure 3 shows an example of The airflow and calculated air volume from both instruments. From The figure, We can observe that The air volume results from both instruments are on par with each other.
We further calculated The signals' RMSE-range ratio between The breathing airflow and air volume calculated from both instruments for all participants. It is essentially δ as defined in Equation (10), replacing The vitals that are calculated from complete FVC tests with continuous airflow or air volume data. The results of The best performing models from three regression approaches are presented on The right-hand side of Table 4. With The combination of FVC maneuvers and tidal breathing, further lung volume parameters such as inspiratory reserve volume (IRV), expiratory reserve volume (ERV), inspiratory capacity (IC), etc., can be calculated by selecting part of The respiration volume chart, as illustrated in Figure 3. Therefore, The accuracy of those parameters can be expected to be on The same level as The FVC and TV in Table 4.
From The results, We can first conclude that with all methods, The RMSE between The prediction by The barometer and The spirometer's measurement was well below 5% of The signal range. When The model was tailored for individual users, The RMSE was as low as 1.5% with The neural network regression method.

The Newer Barometer Version
We compared The higher performance version of The barometer from Bosch-Sensortec, BMP388, with The older version BMP280 in our application to see if The improvement in sensor quality contributed to The spirometry measurement. The key performance improvement aspects of BMP388 over BME280 are: For The purpose of our system, We compared The goodness of fit (gof ) for The model fitting and The δ for The FVC vitals prediction. With The data from BMP388, The gof of The three fitting methods in The inclusive case were: 0.2177 (root4), 0.2182 (poly5), and 0.2188 (ANN7). Compared with The values of The corresponding methods from BME280 in Table 3, 0.1926 (root4), 0.1921 (poly5), and 0.1954 (ANN7), The BMP388 appeared to result in slightly worse regression fitting. We also calculated The δ values as in Table 4 with The BMP388's measurement. On average, The δ was 0.015 bigger than The values from Table 4, which meant The error margin was 1.5% larger. As The BMP388 was designed to be more sensitive than its predecessors, it is also possible that they are more prone to turbulence, which was also observed and suspected in The study [25]. The bigger margin may also be The result of The microscopic flow unevenness inside The mask chamber.
Thus, We conclude that The newer and more sensitive version of The MEMS barometer BMP388 offers similar performance as The BMP280 sensor, but brings no benefit to wearable spirometry in our system.

Performance and Wearable Prospect
Next, We discuss how our approach can be implemented as a wearable device with real-time measurement. In our evaluation, a USB cable was used to transmit The barometers' data from The microcontroller to The computer. This was to synchronize The barometers' data with The reference spirometer as best as possible, as The Vernier SPR-BTA spirometer sends data to The computer with a USB adapter. In [46], a wireless wearable system CoRSA with a single BME280 barometer (instead of a differential pair as in this current study) and The HUZZAH32 microcontroller module, together with other sensors, were already demonstrated. The CoRSA system is powered by a battery and transmits data to a smartphone via Bluetooth. The users can wear The CoRSA system to perform sports activities without hindering their movement freedom. However, The relationship between The single barometer and The actual spirometry-level airflow measurement was not evaluated in [46].
For The computational power, The system essentially goes through three phases in The online operation considering The flowchart in Figure 11: 1. Conditioning The sensor's raw data through subtraction, removing offset, and filtering, resulting in The differential pressure value. 2. Predicting The air flow from The pressure value using The regression model. 3. Generating results of The pulmonary function test parameters from The flow-volume loop.
Additionally, The regression model should be trained offline with sufficient calibration data. We benchmarked The performance of our method on a 2019, 16-inch Apple R Macbook Pro with 2.4 GHz 8-Core Intel Core i9 processor, running MATLAB R 2020a. Our software implementation only utilized a single processor core.
For The three online phases of conditioning, predicting, and generating results, We evaluate all recorded FVC maneuvers. As The FVC maneuvers lasted for different durations (assume l seconds), The benchmark results were normalized to a uniform five second period of FVC maneuvers (original benchmark result * 5/l). For The offline training, We evaluated The regression fitting process with The entire data recording (approximately one hour of breathing data). Only The most complex models from each model were evaluated as they yielded The least RMSE. The results are listed in Table 5. Note that conditioning and generating results were The same as these two phases were not model-specific.
The benchmark results indicated that The offline training time was less than one second for The root function models and less than 0.1 second for The other models. The signal conditioning and generating The PFT parameters took only 0.0001 s each for raw data segments of five seconds. Once The regression model was trained, The prediction or activation from input barometer data required much less processing power, as The operation was essentially executing Equations (7) and (8), or Equation (9), or activating The neural network depicted in Figure 13. All models could be used to generate flow-rate information and PFT results with less than 0.1 s processing time from raw data of five seconds. Especially with The neural network, The processing time was less than one millisecond.

Summary
Overall, this work proved that inexpensive and miniaturized barometric pressure sensors can be integrated into a piece of consumer mask apparel to perform accurate spirometry and continuous, transient tidal breathing volume monitoring. The approach is compared with an off-the-shelf certified digital spirometer in a setting where both instruments are connected serially to share The same air flow. A physical model is constructed to derive The theoretical relationship between The pressure inside The mask and The air flow through The orifice, which shows a non-linear square-root relationship under ideal assumptions. An experiment is performed with 20 participants and in total 200 forced vital capacity (FVC) tests, separated by normal tidal breathing to quantify our approach. Three regression approaches are investigated to model The differential pressure-airflow relationship of The real-world data. Using The regression models, We calculate The predicted airflow from The barometers and FVC vital values, which resulted from clinical FVC pulmonary tests. Compared with The clinical spirometer, The error margins for The FVC values from our approach are 5% on average for unknown users and 2∼3% when it is customized to individual users. The error margins for continuous tidal breathing airflow and volume (including TV) are between 1∼3%. Table 6 compares our approach with other novel spirometer research prototypes mentioned in Section 2.2. Our approach results in The lowest errors while not requiring direct measurement of The airflow through a breathing tube. It is worth recalling that all The novel spirometer studies are developed from The traditional hand-held spirometer structure: a sensing element placed inside a specially-designed breathing tube; while our approach is modifying an off-the-shelf face mask using off-the-shelf and low-cost barometer chips. Table 6. Comparison with state-of-the-art hand-held spirometer studies.

Wearable Outlook
The major takeaway from our work is that, with miniaturized sensors integrated in face mask apparel, respiratory activities can be continuously measured on not only The breathing frequency, but also The air volume, with The accuracy on par with clinical pulmonary function test equipment. According to The physical model, The requirement of The garment to enable The spirometry functionality with our approach is only that it forms a chamber with an orifice in front of The wearer's airway. The model also applies to masks consisting of numerous pores such as particulate filters. From The sensing modality viewpoint, measuring The air pressure requires only a fraction of The airway, and The sensor does not need to be placed in The vent; while traditional spirometers require a sensing mesh to cover The entire airway. Moreover, The mesh-based spirometers are sensitive to humidity, and during operation, a cotton filter is usually needed between The patient and The device to absorb The moisture. On The other hand, The BME280 sensor's barometer output is independent of The humidity. In fact, BME280 also provides humidity and temperature measurement, as shown in [46]. The form factor of a stand-alone face mask without any extra tubing makes it possible to unobtrusively monitor The user's tidal breathing continuously while The user performs different activities, as well as dedicated FVC tests. As The sensors are commercially available, they can be easily integrated into personal, fashionable garments, which may appeal to a wider range of consumers.