I'm using a BME280 sensor to estimate the realtive altitude of an object, but the results are not really stable.
This is the formula I use:
float heightOutput_mm = (44330.77f * 1000.0f) * (1.f - pow((p1 / p0), 0.190294957f));
The problem is that keeping the object STATIC at ground level I get a very highly changing relative altitude in the range [-0.5,+0.5] m
The sensor is configured in as suggested in the datasheet for INDOOR NAVIGATION:
bme280_dev.settings.osr_h = BME280_OVERSAMPLING_1X; bme280_dev.settings.osr_p = BME280_OVERSAMPLING_16X; bme280_dev.settings.osr_t = BME280_OVERSAMPLING_2X; bme280_dev.settings.filter = BME280_FILTER_COEFF_16; bme280_dev.settings.standby_time = BME280_STANDBY_TIME_0_5_MS;
Any suggestion to inprove the stability of the readings?
The relative accuracy for the pressure part of the BME280 is 12pa -> 96cm. The highly changing relative altitude in the range [-0.5,+0.5] m is acceptable.
Could you please provide the ground truth and the height value you measured?
My ground truth is "zero" since I'm not measuring the altitude relatively to the sea level, but to the first value I get from the barometer (the sensor is steady).
This is the formula that I use to estimate the relative altitude:
float rel_height_m = ((pow((p0 / p1), 1.f/5.257f) - 1.f) * (temp + 273.15f)) / 0.0065f;
Attached a 30' plot of the relative altitude