Air Supply System Manual

Please read over this document carefully!

For further questions, please email [email protected]

Key info

Downloads and Installations

Air Supply Github repo: https://github.com/yuxinliuhubert/Air-Supply

Arduino 2 IDE: https://docs.arduino.cc/software/ide-v2

UART drivers (for communicating between the microcontroller and the computer): https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads

MATLAB: https://software.berkeley.edu/matlab%C2%AE

After that, open Arduino IDE, and set it up to run ESP32 (here is a video version that may help). Then install the following libraries (tutorial) by looking them up in the Library Manager:

  • Adafruit INA219

  • LiquidCrystal I2C

When you complete the above steps, you are good to go!

Electro and mechanical components

Linear Valve

Kelly Pneumatics Miniature Linear Valve Spec Sheet
  • The linear valve works by opening its valve according to the amount of current passing through. In total, there shouldn't be above 1.8 W of power going through the valve.

    • The valve is rated for 0-10 VDC control, and its electrical resistance is about 54 ohms. Generally, when the control signal is above 5V, air will start to flow.

    • A 0.2 A inline electrical fuse is implemented in the system, so if the valve ever stops working, please inspect the fuse.

    • It is calibrated to 50 psi inlet pressure and 0 psi back pressure, meaning that we assume that the operating pressure at the inlet is 50 psi. Starting Page 3 in the pdf above, there are images showing the relationship between flow rates and currents under various pressures. Note that the linear valve in our application uses [10 Volt] and .40" orifice.

Operate the system

The operation procedure after phase 3 will be different than the following.

  1. Plug in the air source. Adjust the regulator so that at least 25 PSI of pressure is fed into the linear valve.

  2. Turn on the linear valve, and adjust it to the desired airflow by typing in a number between 0-255 (the number range may change).

  3. When powering down the system, first unplug the power cable and turn off the air source. Then proceed to disassemble the system.

Calibration

All the calibration code is published in this folder:

Both the MATLAB code and Arduino code is under this folder

Using the Matlab Calibrator

SensorCalibrator.m is the MATLAB file that will read the output from Calibration.ino Arduino program, interpret it, and approximate a linear relationship between the raw values and the real values. In English,final=a×raw+bfinal = a \times raw + b.

  1. Ensure you have downloaded and/or installed all the requirements above!

  2. Edit the Calibration.ino. Change #define CALIBRATION_CASE to 0 or 1 depending on whether you are trying to calibrate PT or flow sensor.

  3. Flash the .ino file into the microcontroller using Arduino IDE.

  4. Test its output (it should be just a number on every line) in the serial monitor.

  1. Open SensorCalibrator.m in MATLAB.

  2. Change the filenName and folderName to something you can identify. Also, change testDevice to either 'PT' or 'FM'.

    • Once you start the calibration sequence, you should not change either the fileName or folderName. The machine automatically puts new data in the same spreadsheet.

  3. Click the Run button on the top, and choose the correct COM port when the machine prompts you.

You will see something like this in the Command Window:


  1. COM5

  2. COM20

  3. COM21

Please enter the number of the COM port you want to use:


The choices might be different. If you don't know which one is the machine you are reading from, type some random number to get through the prompt, unplug the microcontroller, then click run again. You will then see something like this:


  1. COM20

  2. COM21

Please enter the number of the COM port you want to use:


Now you know that, in this case,COM 5 has to be the microcontroller you want to read from. Get through the input prompt again, plug in the device, and off you go!

  1. Now adjust the hardware to the pressure or flow rate you want. When the result on either the pressure gauge or flow meter settles, wait for several seconds more, then click stop.

  2. Now the machine will prompt you for a value. Type in the result you read from the previous step and click enter. Then a graph will pop up.

    • You need at least two data points (run the file two times) to establish a line. So don't panic if you only see one point on the graph. Keep running the file again and again.

  3. Repeat Steps 7-9 multiple times. Each time you can see the linear relationship being approximated. The devices we use should have great linear responses, meaning that if you see the data points are really off the regression line, something is not right.

Make sure that you are choosing calibration values that are reasonably far apart so the estimate is accurate!

  1. When you are happy with the result, open the data file (either click on it in MATLAB or open it with spreadsheet editors like Excel). You should see a column of data points. Row 2 is the value you plug into a, and row 3 is the value you plug into b. These values will be inserted into the system operation program.

If you want to calibrate multiple devices at the same time, simply change the output in Arduino file to the format of data1 data2 data3 ... In the MATLAB file, change dataLength to the number of output you have.

Last updated