#### Bosch Sensortec Community

cancel
Showing results for
Did you mean:

## BME280 and BME680 humidity accuracy Member

## Re: BME280 and BME680 humidity accuracy

So my method is given the temp and humidity returned by the sensor, to calculate the dewpoint, then add my correction offset to the temperature and then from this new temp and the dewpoint calculate the new humidity.

``````static double compensate_temp(double t_mes, double t_comp, double rh) {
double new_rh, td;

// Calculate Td
td = 243.04 * ( log(rh/100) + (17.625*t_mes)/(243.04+t_mes) );
td /= 17.625- log(rh/100) - (17.625*t_mes)/(243.04+t_mes);

// Calculate new RH
new_rh = 100 * exp((17.625*td) / (243.04+td)) / exp((17.625*t_comp)/(243.04+t_comp));

return new_rh;
}``````

Something like this above.

On wiki, you can find some equivalent formula but with different coeff.

Hope my method is valid...  Community Moderator

## Re: BME280 and BME680 humidity accuracy

This method looks valid 🙂 Alternatively since td is considered locally constant at t_mes and t_comp, one could further reduce the equation down to rh_comp=f(t_mes, rh_mes, t_comp), e.g.:

``rh_comp = rh_mes * exp(243.12 * 17.62 * (t_mes - t_comp) / (243.12 + t_mes) / (243.12 + t_comp))``