Correct BME280/BMP280 relative humidity

When i first connected BME280/BMP280 i found out that relative humidity varies, if i compare it with official station’s data. Sometimes it was correct, sometimes too low, sometimes too high. After some research i found out that formula, published on ESPHome web site is … well… wrong. Why? Beacuse it takes temperature into account. That’s wrong, because absolute air pressure is aleady temperature-comensated inside BMx280, so doing it again results in wrong results. After some more research i found out old datasheet of BMP180, where formula for “sea level pressure” is given:

Using above formula gave me correct sea-level (or relative air pressure) data. So, final commands for ESPHome would be like this:

  • platform: template
    name: “Relative pressure”
    icon: “mdi:gauge”
    lambda: |-
    const float STANDARD_ALTITUDE = 315; // in meters, see note
    return (id(absolute_pressure).state)/powf((1-((float)(STANDARD_ALTITUDE))/44330), 5.255);
    update_interval: 60s
    unit_of_measurement: ‘hPa’
    accuracy_decimals: 1

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published.