Example Code for Arduino-Get Air Flow

Last revision 2026/01/07

This blog post offers a comprehensive guide to measuring air flow using an Arduino UNO board and F1031V Air Flow Sensor, including hardware and software preparations, a wiring diagram, and sample code, along with important precautions to ensure accurate measurements and prolonged sensor life.

Hardware Preparation

  • 1 x Arduino UNO board
  • 1 x F1031V Air Flow Sensor
  • Wires

Software Preparation

Wiring Diagram

SEN0360CONNECT

Other Preparation Work

  1. It is forbidden to use the sensor in the environment with strong corrosive gas, toxic gas or explosive gas.
  2. Dirt in the gas flow medium will reduce the sensor's service life, so it is recommended to install a 5-micron precision filter at the sensor inlet.
  3. When contacting with water or being immersed in water, the sensor may be damaged or the sensitivity of sensor will decline.
  4. Pay attention to the polarity of power in case of burning the internal circuit.

Please change the appropriate reference voltage according to mainboard.

Sample Code

#define RANGE              150    //Measurement Range
#define ZEROVOLTAGE        0.5    //Zero Voltage 
#define FULLRANGEVOLTAGE   4.5    //Full scale voltage
#define VREF               5      //Reference voltage

int sensorPin = A0;    // select the input pin for the air meter
float sensorValue = 0;
void setup() {
  Serial.begin(9600);
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin)*VREF;
  sensorValue = sensorValue / 1024;
  sensorValue = RANGE*(sensorValue - ZEROVOLTAGE)/(FULLRANGEVOLTAGE - ZEROVOLTAGE);
  Serial.print(sensorValue);
  Serial.println(" SLM");
  delay(500);
}

Result

SEN0360 Result1

Was this article helpful?

TOP