Android Barometer Reading Height is wrong?

I am trying to implement a function to get the correct altitude based on the barometer sensor from Android Galaxy S5 phones. The only problem, I don’t think is for sure. Based on http://www.whatismyelevation.com in my specific location, this shows that my height is about 114 meters. However, on my phone it shows that it is 210 meters based on a barometer sensor. However, I am in a tall building, but I do not think it is 100 meters high.

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!

+5
source share
1 answer

First: barometers are very accurate, but inaccurate. If you place 10 Android phones next to each other on the table, you can find barometric pressure differences up to 3 mb between devices. This is one of the sources of errors.

Second: different groups will define "height" differently, so make sure you use the same definitions. For example, in the Location class, getAltitude is defined as

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

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

Thirdly, the weather will affect the reading of the barometer up to 40 mb. If you want a more accurate elevation from the barometer, you will have to compensate for the current weather. The atmosphere can change local pressure up to 1-2 mbar per hour (in extreme cases)

Fourth: it is not yet possible to obtain an absolutely accurate height value using a barometer in a smartphone. No one has decided this yet - just a barometer is not enough to detect the floor level, for example.

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

In conclusion: the readings that the barometer delivers to you require significant interpretation before use if you want to achieve a "height" value. Each value that is read from each barometer is erroneous by default; You will need to do some work to make it work for you, depending on your specific needs.

github.com/cbsoftware/pressurenet

+4
source

All Articles