## 2 Materials and Methods
### Chest Band's Firmware for Measuring the Breathing Parameters
If t\({}_{\mathrm{2}}\) is greater than t\({}_{\mathrm{1}}\), TE is calculated as t\({}_{\mathrm{2}}\) - t\({}_{\mathrm{1}}\); else, TI is calculated as t\({}_{\mathrm{1}}\) - t\({}_{\mathrm{2}}\). Then, the obtained inhalation and exhalation times are checked, verifying if they belong to admissibility ranges fixed according to physiological reasons. Specifically, TE must be between 0.2 and 3 s, whereas TI must be between 0.2 and 2 s. If the related condition is verified, instantaneous TE and TI values are added to the respective cumulative variables (i.e., _TE_sum_, _TI_sum_) used to calculate the average value at the end of the T\({}_{\mathrm{W}}\) time window. For this purpose, the corresponding counting variables (i.e., _TI_count_, _TE_count_) are increased, and _t1_prev_ and _t2_prev_ are updated. When the 30 s time window T\({}_{\mathrm{w}}\) ends, the breathing parameters are calculated using the following equations:  
\[\mathrm{RR}=\mathrm{peakCounter}\times\frac{60}{\mathrm{T}_{\mathrm{w}}} \tag{3}\]  
\[\mathrm{TI}_{\mathrm{med}}=\frac{\mathrm{TI}_{\mathrm{sum}}}{\mathrm{TI}_{ \mathrm{count}}} \tag{4}\]  
\[\mathrm{TE}_{\mathrm{med}}=\frac{\mathrm{TE}_{\mathrm{sum}}}{\mathrm{TE}_{ \mathrm{count}}} \tag{5}\]  
\[\mathrm{IER}=\frac{\mathrm{TI}_{\mathrm{med}}}{\mathrm{TE}_{\mathrm{med}}} \tag{6}\]  
\[\mathrm{V}=\frac{\mathrm{V}_{\mathrm{t}}}{\mathrm{TI}_{\mathrm{med}}}\times 60 \tag{7}\]  
The respiratory rate is measured by counting the number of inspirations that occur in the time window (e.g., 30 s) and calculating it using Equation (3); therefore, it must be intended as a mean value in the observation interval. The obtained measurements are compared with the inspiratory count taken during the time window, as reported in Section 3. The tidal volume (V\({}_{\mathrm{t}}\)) is estimated starting from the user's height and calculating the ideal body weight (IBW) [46]. The tidal volume is calculated from the IBW by Equation (10). \[IBW=50\;\mathrm{Kg}+0.91\times(\mathrm{h}[\mathrm{cm}]-152.4\;\mathrm{cm})\; \;(\mathrm{for\;men}) \tag{8}\]  
\[IBW=45.5\;\mathrm{Kg}+0.91\times(\mathrm{h}[\mathrm{cm}]-152.4\;\mathrm{cm})\; \;(\mathrm{for\;women}) \tag{9}\]  
Figure 5:0The flow rate (V, expressed in LPM) is calculated as the ratio of the air volume moved in each respiratory cycle (V\({}_{\rm t}\), expressed in liters) and the inhalation time (TI, expressed in minutes). Then, the packet containing the determined parameters is transmitted to the host device through the BLE module, all the variables are reset, and another time window starts. The RR in adult patients ranges from 12 to 20 BrPM, depending on the physical effort and sleep. In ill patients, an increase in RR can be attributable to hypoxia, cardiac insufficiency, pain, or metabolic disorders. In contrast, an RR reduction can signal neurologic depression or severe hypoxia cases [47]. In particular, several clinical studies demonstrated that RR is a significant indicator of cardiopulmonary arrest and imbalances, in addition to gastrointestinal and renal diseases [48]. In addition, monitoring respiratory parameters during sleep can be used to support the diagnosis of sleep disorders such as apnea or hypopnea. Moreover, monitoring inhalation and exhalation times and their ratio (i.e., IER) are essential as they are correlated to the heart rate variability and physical and psychological relaxation. In [49], the authors demonstrated that IER is a crucial parameter affecting the self-reported effects on relaxation resulting from controlled breathing exercises. Specifically, an IER lower than 0.46 positively affects self-perceived stress, relaxation, and mindfulness. Similarly, in [50], the authors demonstrated that respiratory patterns with lower IER induce a higher cardiac vagal activity (CVA). Finally, the flow rate is the volume of air inhaled by a patient. An inspiratory flow rate of 20-30 liters per minute (LPM) is typical at rest during tidal breathing.