Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BME280 relative altitude not stable

    BME280 relative altitude not stable

    Established Member

    Hi all,
    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));



    • p1 -> current pressure
    • p2 -> reference pressure taken at ground level

    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?

    Thank you

    4 REPLIES 4

    Occasional Contributor

    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?

    Established Member

    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;



    • p0: reference pressure
    • p1: current pressure
    • temp: current sensor temperature

    Attached a 30' plot of the relative altitude

    Hi Myzhar,

    Your plot suggests a testing time of of 30 minutes. Without a reference sensor, there is no way to real real pressure change (Building ventilation, doors/windows opening, weather, etc.) with sensor drift.

    Do you have access to a reference pressure sensor?


    Established Member

    I have not a pressure reference sensor... I search for one. Any suggestion?