Understand MPX5700DP

Hi there,

I'm try to experience with sensor pressure with the scope to be able to understand when a tank is full and automatically stop the refilling pump.
I'm starting from the following code pickup from this post:

int rawValue; // Lectura A/D
int offset = 45;//45; // Ajuste en cero (valor recomendado 410)
int fullScale = 980;// 980; // ajuste en presión maxima (valor recomendado 9630)
float pressurekpa; // presion en kpa
float pressurepsi; // presion en psi

void setup() {
 
  Serial.begin(9600); // monitor para probar sensor por software
  
}

void loop() {
  rawValue = 0;
  for (int x = 0; x < 10; x++) rawValue = rawValue + analogRead(A0);
  pressurekpa = (rawValue - offset) * 700.0 / (fullScale - offset); // conversión de la presion
  pressurepsi = pressurekpa/6.895; // de kpa a psi
  Serial.print("Raw A/D is  ");
  Serial.print(rawValue);
  Serial.print("   Pressure kpa is  ");
  Serial.print(pressurekpa, 1); // un decimal
  Serial.print("   Pressure hpa is  ");
  Serial.print(pressurekpa/10, 1); // un decimal
  Serial.print("   Pressure psi is  ");
  Serial.println(pressurepsi, 1); // un decimal
  delay(500);
}

the expectation was to read the atmospheric pressure, but probably I'm wrong, the right value must be 1027 hPa but me code return :

Raw A/D is 8070 Pressure kpa is 6008.0 Pressure hpa is 600.8 Pressure psi is 871.4
Raw A/D is 8070 Pressure kpa is 6008.0 Pressure hpa is 600.8 Pressure psi is 871.4
Raw A/D is 8070 Pressure kpa is 6008.0 Pressure hpa is 600.8 Pressure psi is 871.4
Raw A/D is 8070 Pressure kpa is 6008.0 Pressure hpa is 600.8 Pressure psi is 871.4

where is my fault ?

Did you forget a divide by ten for your average calculation?

I have done the same consideration, but no one in the other posts have underline to divide the average per the number of reads.

But the point is, it is correct to expect to read the atmospheric pressure?

They scaled offset and fullScale by ten, or so it looks to me.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.