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 ?