I am using a pressure sensor like this:"
https://www.banggood.com/200PSI-Pressur ... 20789.html
I followed this youtube guide: https://www.youtube.com/watch?v=AB7zgnfkEi4
The mcu I am using is a ESP32. The sensors gets 4.75volt power and the ESP32 gets 3.3v
The sensors read out fine but the results are very unstable.
Analog value - voltage - pascal - bar:
384 - 0.47 - -3750.00 - -0.00
362 - 0.44 - -84316.41 - -0.08
400 - 0.49 - 54843.75 - 0.05
396 - 0.48 - 40195.31 - 0.04
384 - 0.47 - -3750.00 - -0.00
368 - 0.45 - -62343.75 - -0.06
416 - 0.51 - 113437.50 - 0.11
352 - 0.43 - -120937.50 - -0.12
376 - 0.46 - -33046.87 - -0.03
480 - 0.59 - 347812.50 - 0.35
368 - 0.45 - -62343.75 - -0.06
368 - 0.45 - -62343.75 - -0.06
384 - 0.47 - -3750.00 - -0.00
361 - 0.44 - -87978.52 - -0.09
365 - 0.45 - -73330.08 - -0.07
400 - 0.49 - 54843.75 - 0.05
This is in my room, so 0.47 voltage seems to be the best result, 0.00.
But when I blow in the pressure sensor the voltage goes up and so does the bar.
I don't know what I do wrong but would like to fix the unstable results.
Does anyone have an idea what could go wrong?
This is the code:
Code: Select all
float getSensorvalue(int analoge){
int sensorVal=analogRead(analoge);
Serial.print(sensorVal);Serial.print(" - ");
float voltage = (sensorVal*5.0)/4096.0;
Serial.print(voltage);Serial.print(" - ");
float pressure_pascal = (3.0*((float)voltage-0.47))*1000000.0;
Serial.print(pressure_pascal);Serial.print(" - ");
float pressure_bar = pressure_pascal/10e5;
Serial.println(pressure_bar);
delay(100);
return pressure_bar;
}
void loop(){
getSensorvalue(34);
getSensorvalue(35);
getSensorvalue(32);
delay(1000);
}