Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7747

General • Re: BMP280 - barometric pressure readings are off

$
0
0
There should be altitude in the module you are using, get it to look at see level pressure for your area and then calculate you altitude.
It one of the thing the BME/P280 was designed for.
Temperature is there for compensation
I carried out a few tests on a mountain in Spain. Here a YT Short for anyone who is interested:

https://youtube.com/shorts/HXCLg-3lAsg?feature=share

The real altitude is 2140 meters AMSL, on the display you see 2005-2064 meters.

I am using those two formulas, delivered by ChatGPT and wikipedia:

Code:

(...)bmp280_read_raw(&raw_temperature, &raw_pressure);        int32_t temperature = bmp280_convert_temp(raw_temperature, &params);int32_t pressure = bmp280_convert_pressure(raw_pressure, raw_temperature, &params); (...)int32_t altitude_A = 8.314*((temperature/100.0)+273.15)/(9.81*0.02896) * log(101325.0/pressure);        int32_t altitude_B = (288.15/0.0065) * (1.0 - (pow((pressure/101325.0), (1.0/5.255)))); // pressure and temperature values according to ISA(...)
Questions remain, for example what do you mean by "should be altitude in the module you are using".

My UseCase is, I am on a mountain in the middle of nowhere, no cell service available, and I want to know what the altitude is.

Would there be any way to calculate the exact altitude beside looking the current temperature/pressure on sea level up beforehand (when cell service is available) and feeding these values to the sensor? I guess not.

Statistics: Posted by FlorianJW — Fri Jun 26, 2026 6:03 am



Viewing all articles
Browse latest Browse all 7747

Latest Images

Trending Articles



Latest Images