Devices & Components
Arduino Uno Rev3
MPXM2053GS
Standard LCD - 16x2 White on Blue
Instrumentation Amplifier, SO-8, 100 kHz, AD623ARZ
Capacitor Ceramic 0.1uF (generic)
Electrolytic Decoupling Capacitors - 10uF (generic)
Hardware & Tools
Soldering iron (generic)
Project description
Code
Differential pressure to airflow speed in m/s
csharp
Measuring airflow with analog pressure sensor.
1#include <Wire.h> 2#include <LiquidCrystal_I2C.h> 3LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 4 5float CurrentReading; 6float Sum; 7float Average; 8float MeasuresN=2500 ; // number of measures to average 9float Flow; 10 11void setup() 12{ 13Serial.begin(9600); 14lcd.begin(16,2); 15} 16 17void loop() 18{ 19for (int i=0; i<MeasuresN; i++) 20{ 21CurrentReading = analogRead(A0); 22Sum+=CurrentReading; 23delay(1); 24} 25Average=Sum/MeasuresN; 26Sum=0; 27 28// To proper measure from 0 m/s airspeed you will need to find curve equation based on your application- I use linear equation to test on fan I had access to. 29 30//////////////////////////// 31Flow=(Average-68)*0.265+2.7; 32//////////////////////////// 33 34lcd.backlight(); 35lcd.setCursor(0,0); 36lcd.print("Sensor:"); lcd.print(Average); 37lcd.setCursor(0,1); 38lcd.print("Airflow:"); lcd.print(Flow); lcd.print("m/s "); 39 40delay(5); 41}
Downloadable files
Pressure to airflow speed
Pressure to airflow speed

Pressure to airflow speed
Pressure to airflow speed

Comments
Only logged in users can leave comments