Android Barometer Altitude Reading Is Wrong?
Asked Answered
T

3

8

I've been trying to implement a feature to get the correct altitude based on the barometer sensor from Android Galaxy S5 phones. The only problem is, I don't think it is accurate. Based on http://www.whatismyelevation.com on my particular location, it shows that my altitude is around 114 meters. However, on my phone, it shows that it is 210 meters based on the barometer sensor. I am in a tall building, however, but I don't think it is 100 meters tall.

Here is my simple code:

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.configure_settings);
    context = getApplicationContext();

    mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
    sensors = mSensorManager.getSensorList(Sensor.TYPE_PRESSURE);

    if (sensors.size() > 0)
    {
        sensor = sensors.get(0);
        mSensorManager.registerListener(this, sensor,
                SensorManager.SENSOR_DELAY_NORMAL);
    }

}

@Override
public void onSensorChanged(SensorEvent event)
{
    float pressure = event.values[0];
    altitude = String.valueOf(SensorManager.getAltitude(
            SensorManager.PRESSURE_STANDARD_ATMOSPHERE, pressure));

}

Thanks!

Tatty answered 21/7, 2015 at 14:16 Comment(2)
100m = 30 floors, or thereabouts. Regardless, Barometric pressure is dependent on weather and not very accurate indoors. I doubt you can use it to reliably to determine altitude.Syncretize
here are some additional resources: #23581878 #17872235 I suggest a google search to inquire about barometer calibration in android. I found that due to its dependency on weather, it's difficult to maintain a specific calibration.Enthymeme
F
6

First: The barometers are very precise, but not accurate. If you place 10 Android phones next to each other on a table, you can find barometric pressure differences of up to 3 mb between devices. This is one source of error.

Second: Different groups will define 'altitude' differently, so make sure you're using the same definitions. For example, in the Location class, getAltitude is defined as

Get the altitude if available, in meters above the WGS 84 reference ellipsoid.

http://developer.android.com/reference/android/location/Location.html#getAltitude()

Third, the weather will affect the reading of the barometer by up to 40 mb. If you want to get a more accurate altitude reading from the barometer, you will have to offset from the current weather. The atmosphere can change the local pressure by up to 1-2 millibars per hour (in extreme cases)

Fourth: it is not yet possible to get a completely accurate altitude reading using the barometer in a smartphone. Nobody has solved this yet - the barometer alone is insufficient to achieve floor-level detection, for example.

I'm the developer of PressureNet, by the way - I have collected over 2 billion pressure readings from smartphones, and I see all these types of errors every day.

In closing: the reading that the barometer delivers to you requires significant interpretation before using, if you want to achieve a value for 'altitude'. Every value that is read from every barometer is 'wrong' by default; you'll have to do specific work to make it work for you, depending on what your exact needs are.

github.com/cbsoftware/pressurenet

Fuze answered 21/7, 2015 at 20:30 Comment(0)
A
2

The air-pressure sensor of a smartphone-type device has very poor absolute accuracy. I.e. when you are stationary the value read will probably not be equal to what you read from another source.

It is, however, rather good at measuring changes to the air-pressure. So if you read the air-pressure at one altitude and then quickly move to another altitude you will get a fairly accurate measure of the difference in altitude (provided you use the right altitude formula, ex. https://physics.stackexchange.com/questions/333475/how-to-calculate-altitude-from-current-temperature-and-pressure)

I.e. if you know the absolute altitude at one of your locations you can compute a rather accurate value for the other location.

It is also important to remember that air-pressure for any location is variable due to weather changes. In a windy environment you will generally find that values are less accurate unless you do some time-averaging or low-pass filtering of the values.

When it comes to altitude values served by Google, the GPS or other sources they generally refer an altitude for a location to an idealized shape of the earths surface. This shape is typically called a geoid (a spheroid shape that rather closesly resembles the actual shape of our globe). The actual surface of the globe, that be either land or ocean, do deviate in shape from the ideal geoid in most places. For areas that were covered by thick layers of ice during the last ice-age the land may still be 30-50 meters below the geoid reference. More details are found here: https://www.esri.com/news/arcuser/0703/geoid1of3.html.

For normal mapping purposes the altitude is referenced to some form of constant. When close to the sea altitude == 0 at LAT (Lowest Astronomical Tide) and local mapping references to altitude is thus traditionally referenced to this level. Other more 'modern' references are also used. Google, the satellite-based global positioning systems, etc. do not use this reference, hence the altitude you get from them and the altitude you calculate (or read off a map) locally do not generally match.

Auriscope answered 11/7, 2020 at 13:46 Comment(0)
H
0

Just a report for Android 8.1 on Samsung S7 smartphone compared to weather station pressure sensor/algorithms.

Samsung S7 phone=970 millibars
Weather station=1010 millibars (at the same time)

Those are about +/- 2% difference from the arithmetic mean of the two values, 990 millibars.

However, GPS is about 3% error limit for altitude. Within a span of about 5 minutes, consumer grade GPS reports altitude on a hilltop nearby ranged generally from about 1080ft to 1150ft, with isolated readings lower and higher than those. The arithmetic mean is 1115ft, and the lower and upper values are about +/- 3% of the 1115ft value. A National Geodetic Survey map shows the official altitude of the hilltop is 1110ft, which is very close to the mean of the two values.

Hanway answered 18/5, 2020 at 18:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.