Required PC software

  • Python
  • Arduino
  • Matlab, Excel or any other data processing software


The software consists out two parts, one in written in Arduino and the other in Python. Both are free downloadable.
The arduino part is to program the Arduino Uno, which is the “computer” of the setup. It controls the speed of the air fan and reads the pressure sensors. The file “pressure_drop_arduino_main.ino” needs to be uploaded one time on the Arduino UNO board. In order to do so, the Arduino software is needed on your PC, which can be downloaded for free at
The second software part in python, “”, is to control the Arduino UNO board with your PC. The measurement will be done automatically and a data file will be generated for analysis. The installation of python and instruction for conducting measurements are explained later on.
During the measurement the speed of the air fan is build up, until the fan reaches its maximum speed or the pressure sensors reach their limit. This increases the flow through the mask and the pressure in the system, which are related by the resistance of the mask. When a mask has a higher resistance, it is harder to breath though and the pressure in the system will be higher and less air will flow through.

Installation of Python

  1. Open command prompt and enter “python” (This step is not necessary for MacOS users, proceed with step 3)
  2. Microsoft store will open, install Python 3.8
  3. In the command prompt, enter “pip install pyserial” in order to install pyserial.
  4. In the command prompt, enter “pip install datetime” in order to install datetime.

Instruction for conducting measurements

  1. Open the windows command prompt
  2. Type: “cd directory” (directory is the location on your PC where the Python file is located and where you store the results.)
  3. Make sure that everything is connected to the PC and ready to start measuring
    a. USB connected to PC
    b. Setup is powered up
    c. Setup is configured correctly
  4. Type: “python
    a. Enter the COM-port that is used in the measurement, which can be found in the device manager.
    b. Enter the setup number (You can insert any number, but it is convenient for when using multiple setups)
    c. Enter the sample number of the measurement
  5. The data obtained from the measurement will be saved as:
  6. Go back to step 3

When multiple setups are used simultaneously, open command prompt multiple

Data processing

When matlab available, use the files “importfile.m” and “sweepdata.m”, type the filename of the data you want to analyse in the “sweepdata.m” script and press “RUN” and a flow-resistance graph will be plotted.

In order to analyse data using Microsoft excel the following steps can be performed:

  1. Open the data.csv file
  2. Separate the first line of cells using the comma separation
  3. Select all (ctrl-a) and delete blank rows
  4. Make two new columns where the flow and pressure is calculated:
    a. Flow formula with D2 as flow sensor value cell: = PI()/40,012^2SQRT(2(( (5/1023D2)/(50,4)-1,25)^2525)/(1,2(1-(0,012/0,033)^4)))60000
    This formula calculates the flow in Litre per minute
    b. Pressure formula with F2 as pressure sensor value cell: =( (5/1023F2)/(50,4)-1,25)^2*525 This formula calculates the pressure in Pascal (1 bar = 100 000 Pa)
  5. Make a point scatter of the Flow and pressure.

An example of data processing in excel can be found in “Dataprocessing_excel.xlsx