Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect altitude calculation. #5

Open
fmuntean opened this issue May 23, 2020 · 8 comments
Open

Incorrect altitude calculation. #5

fmuntean opened this issue May 23, 2020 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@fmuntean
Copy link

In order to calculate the altitude the sea level pressure is needed.
your algorithm considers the pressure at sea level = 0 which is wrong.
Maybe it should be a parameter we can pass in so we can change that.

@ludiazv
Copy link
Owner

ludiazv commented May 28, 2020

You are right. I will include a parameter with default value 1013.25hPa.
You can however quick fix this by removing the 0 parameter in this line manually.

pl.altitude_M = BME280.calculateAltitudeMeters(data.pressure_hPa, 0);

@ludiazv ludiazv self-assigned this May 28, 2020
@ludiazv ludiazv added the bug Something isn't working label May 28, 2020
ludiazv pushed a commit that referenced this issue Jun 4, 2020
@ludiazv
Copy link
Owner

ludiazv commented Jun 4, 2020

Updated in master branch the correction

@dachshund-digital
Copy link

The correct solution is to query for the correct data from one of the many weather sites, using a geo location site to get the global coordinates then the actual sea level pressure for the given time and location. The 1013.25 value is a common estimate, but it is not truly accurate. When I wrote my python script to support BME280 sensors, I do get the longitude and altitude, and the valid sea level pressure for the actual location of the sensor, thus I get the most accurate altitude measurement. It is a bit of work, but to get the most accurate result, required. This is one of situations where a GPS reading is of benefit, versus having the user provide the location before sensor sampling.

@ludiazv
Copy link
Owner

ludiazv commented Jun 29, 2020

GPS or query to external service is beyond the scope of this custom node. Nodered have tons of tools to design your own flows with this logic point out. Now the nodes has a configuration option so you can tune this with your value. But make a modificaiton to allow dynamic change of the value using the trigger input.

@dachshund-digital
Copy link

Yes, I just thought it should be noted what the real, true, methodology is to get the altitude correct. Given that you can inject the correct sea-level value, as noted above, into the node, that is reasonable and appropriate.

@dachshund-digital
Copy link

Unfortunately, using 1013.25 as an estimated value of pressure at sea level is still not very accurate. I live about 40 m above sea level but the current code, works the elevation out to be over 90 m.

@fmuntean
Copy link
Author

Maybe it should be a parameter we can pass in so we can change that.

@dachshund-digital
Copy link

It is, you can feed the correct value to the node module. The trick is how you get it, you need the GPS coordinates then query a weather site for the sea level pressure value base on the GPS coordinates, if you do this, this will significantly improve the resulting value from the bme280 chip. For example, using 1013.25 at my location, as the 'estimated' seal level pressure, the bme280 reports my location is about 93m elevation. If I use 1004, which for yesterday was the official sea level pressure at my location, bme280 reports the elevation at about 43m. As validation, the official reported elevation for the city I live in, is 41m. So, 43m is reasonable and comparable to the official value. Whereas, 93m, using the estimated sea level value, is just not even remotely accurate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants