So it turns out that BMP180.py driver calculates altitude wrongly as it is showing me that I live on a mountain (870+ meters) while im almost sitting at the beach
p = -7990.0*math.log(self.pressure/self.baseline)
i have changed it to
p = (44331.5 - 4946.62 *self.pressure**(0.190263)
using the part of the code from
https://pvlib-python.readthedocs.io/.../atmosphere.html
and it came back with the same results - 870+ meters while google maps are saying im at 7+ meters.
Is it wrong if I divide by 10 the result of one of the formulas? f/e
p = (44331.5 - 4946.62 *self.pressure**(0.190263))/10
Altitude with BMP180
Re: Altitude with BMP180
I do not know which driver you use, but in my driver I use:
where _baseline is the actual pressure at sea level, which will change all the time. You get that pressure typically from the weather reports, which tell you this "normalized" value. You cannot calculate the height just using the pressure without reference to the actual sea level pressure, which is the zero level of your scale.
Code: Select all
p = 44330 * (1.0 - math.pow(self.pressure /
self._baseline, 0.1903))
Re: Altitude with BMP180
Thank you for your input. I will look into it. And yes I do update QNH (local baro pressure at sea level) every two hours.
I will update the formula and see what happens
I will update the formula and see what happens
Re: Altitude with BMP180
What is your source of your code?Roberthh wrote: ↑Wed Mar 09, 2022 8:37 amI do not know which driver you use, but in my driver I use:
where _baseline is the actual pressure at sea level, which will change all the time. You get that pressure typically from the weather reports, which tell you this "normalized" value. You cannot calculate the height just using the pressure without reference to the actual sea level pressure, which is the zero level of your scale.Code: Select all
p = 44330 * (1.0 - math.pow(self.pressure / self._baseline, 0.1903))
Re: Altitude with BMP180
My driver is here: https://github.com/robert-hh/BMP085_BMP180
As told, is was derived from a different implementation.
As told, is was derived from a different implementation.