I have a MS4525DO sensor and want tot run it for airspeed.
I have write the code below and try to make it work
The data responds to the wind I blow into it. However, the result for digital counts and airspeed always show the same several counts when I vary the windspeed
and also the readings are fluctuate
Can someone help?
//#include <WireMW.h>
#include <Wire.h> //I2C library 0x28H
#define TRUE 1
#define FALSE 0
void setup()
{
Serial.begin(9600);
Wire.begin();
delay(100);
Serial.println ("Digital Count \t Pressure \t Wind Speed");
}
void loop() {
byte Address, Press_H, Press_L;
Address = 0x28; //ms4525do type I interface address
int DC;
double PR,V;
Wire.beginTransmission(Address);
Wire.endTransmission();
Wire.requestFrom(Address,2);
Press_H = Wire.read();
Press_L = Wire.read();
DC = ( ( (Press_H << 8) + Press_L ) & 0x3FFF); //In 14bit binary-coded the real value must be computed
PR = ((DC-0.1*16383)*2/(0.8*16383)-0.992599035);
V = sqrt(abs(PR*2*6894.757/1.225));
Serial.print (DC);
Serial.print ("\t");
Serial.print (PR);
Serial.print ("\t");
Serial.println (V);
delay(1000);
}