*3.1. YF-S201 Flow Sensor*

The flow sensor YF-S201 (Sea brand) has been widely used to measure water flow in pipes. It consists of a valve, containing inside it a propeller rotor and a Hall effect sensor, which is commonly used by supply companies to monitor water consumption [43–47]. The rotor has a toroidal magnet that produces an alternating magnetic field as the rotor rotates [49]. The magnetic field interacts with the Hall effect sensor, which in turn produces digital pulses that correspond to the rotor speed. The rotor speed corresponds to the average speed water flowing through the valve [50,51].

Unlike other applications involving YF-S201 sensor, this work is the first one which uses it for measuring air volume and performs spirometric feedback in ventilation maneuvers during CPR using medical simulators or training manikins, in real-time.

Figure 1 shows the different views of the sensor. According to Figure 1a–c, there is throttling in the diameter of the sensor inlet channel (the area I relative to 1). Also, there is no difference in the diameter of the output channel (the area 2 relative to O) of the YF-S201 sensor. Therefore, considering the model presented in Section (2) and starting from Equation (10), we can write

$$\mathbf{v\_1 = v\_0 = v\_2.} \tag{11}$$

**Figure 1.** YF-S201 flow sensor: (**a**) Input profile; (**b**) Control volume; (**c**) Output profile; (**d**) Propeller compartment; (**e**) Airflow profile; (**f**) Detail of the propeller.

According to the details of the control volume, shown in Figure 1e, the mass flow in section I is a function of mass flows in Sections 1, 4 and 2. Considering Equation (5) and the flow in the permanent regime, the volume flow of I, 1, 4, and 2 are constants, that is, *v*<sup>1</sup> = *v*<sup>4</sup> = *v*<sup>2</sup> and the rate of temporal variation of the mass contained in the control volume results in:

$$
\dot{\mathbf{m}}\_{\rm I} = \dot{\mathbf{m}}\_{\rm I} + \dot{\mathbf{m}}\_{\rm I} + \dot{\mathbf{m}}\_{\rm 2}. \tag{12}
$$

Substituting Equation (7) into Equation (12), we obtain

$$\mathbf{v}\_{\rm I} = (\mathbf{S}\_{\rm I} + \mathbf{S}\_{\rm I} + \mathbf{S}\_{\rm I}) \frac{\mathbf{v}\_{\rm I}}{\mathbf{S}\_{\rm I}}.\tag{13}$$

In Figure 1e we can see that

$$\mathbf{S}\_1 = \frac{\pi \mathbf{d}\_1^2}{4},\tag{14}$$

$$\mathbf{S}\_2 = \frac{\pi \mathbf{d}\_2^2}{4} \tag{15}$$

and

$$\mathbf{S\_4} = \mathbf{b} \mathbf{h};\tag{16}$$

where b is the base (m), and h is the height (m) of area 4 oriented entering the plane of the paper in Figure 1e. Thus, the input flow is

$$\mathbf{Q\_{I0}} = \mathbf{Q\_{I}} = \mathbf{S\_{I}} \mathbf{v\_{I}}.\tag{17}$$

Substituting Equations (13)–(16) into Equation (17) we found

$$\mathbf{Q\_{IO}} = \mathbf{k\_1v\_{1\prime}} \tag{18}$$

where k1 is a constant which depends on the areas, that is, the geometry of the sensor.

Figure 1d shows the propeller of the YF-S201 sensor, which rotates according to the flow of air passing through it. Figure 1f shows the detail of the propeller, which has a Hall sensor for providing digital pulses proportional to its angular velocity. An ATmega328 microcontroller measures the digital pulses using external interrupt, along with a real-time scheduling and multitasking software [52].

Besides of the Hall effect sensors being widely used in fluids flow measurements [53–55], they are also used as magnetic sensors [56–58] in numerous applications such in water pump flow measurement [41], infiltrometers [49], energy monitoring [59], electromagnetic flowmeters used in industrial and physiological techniques [60], hydrometers [61], induction-frequency converters [62], among others.

To make the sensor suitable for measuring airflow, we use the relation of the linear velocity *v*<sup>1</sup> (m/s) with the angular velocity ω (rad/s) [47], this is

$$w\_1 = \frac{d\_h f}{2},\tag{19}$$

where *dh* (m) is the diameter of the helix and *f* (HZ) is the rotation frequency of the helix.

Applying Equation (19) in Equation (18), we have

$$Q\_{IO} = kf \tag{20}$$

where

$$\mathbf{k} = \mathbf{d}\_{\mathbf{h}} \left[ \frac{\pi}{8} (\mathbf{d}\_1^2 + \mathbf{d}\_2^2) + \frac{\mathbf{b}\mathbf{h}}{2} \right] \tag{21}$$

is a constant equal to (261 <sup>±</sup> 3) <sup>×</sup> <sup>10</sup>−<sup>8</sup> m3, calculated according to the sensor dimensions. The calculation of the geometric constant k, according to the mathematical modeling presented in this work (Equation (21)), is the first step to adjust the sensor output signal to the unit of measurement: flow (m3/s).

From (20), the volumetric flow is

$$V = Q\_{IO} \cdot t\_\prime \tag{22}$$

where *V* is the volume of air (m3) flowing inside the lung (reservoir) of the dummy during the time interval Δ*t* (s).
