I asked a similar question some time ago and in the meantime I was able to find some information about my location, i.e. altitude and pressure correction refered to the local airport.
Everything looks fine, but I still do not understand how these two parameters are dipendent. Here are some sampling I get (taken every 30 sec):
P=1009.2, A=237
P=1009.2, A=237
P=1009.2, A=237
P=1009.3, A=236
P=1009.4, A=235
P=1009.5, A=235
P=1009.6, A=233
P=1009.6, A=233
P=1009.7, A=233
P=1009.7, A=233
P=1009.8, A=232
Actually my altitude should be about 315m.
This is the relavant piece of code I'm using:
#include <Adafruit_BME280.h>
Adafruit_BME280 bme;
#define SEALEVELPRESSURE_HPA 1002
// I use this value against the standard 1013.25 that I read in a number of sketches; this is supposed to be the real Sea Level Pressure at my location
// ratio between local pressure (1013 from local Caravaggio airport) to my absolute reading (978) right now
// I use this ratio to obtain a pressure value close to what expected
#define PRESSRATIO 1.036
float temperature, humidity, pressure, altitude;
void ReadBME() {
temperature = bme.readTemperature();
delay(5);
humidity = bme.readHumidity() + 0.5;
delay(5);
pressure = PRESSRATIO * bme.readPressure();
delay(5);
altitude = bme.readAltitude(SEALEVELPRESSURE_HPA);
...show results ....
}
Why the altitude varies when the pressure changes?
I understood that these parameters are correlated, thus the altitude is calculated from the pressure, but does it mean that I can not have the 2 real values indipendently?