4

I have been using a Samsung Galaxy S3 to work on an app that uses the barometer estimate the user's altitude. I use SensorManager.getAltitude(p0, p), and set p0 equal to the sea-level pressure reported at the nearest airport. I set p equal to the value returned by the barometer.

Unfortunately, the altitude returned is systematically 20 meters or so higher than what it actually is. I'm certain that the barometer is returning pressure values that are too low, so SensorManager.getAltitude is returning a higher altitude. I've even driven to an airport from which I have gotten the sea-level pressures and laid my phone level with the runway, to prove this point.

When checking the accuracy of the barometer (with the accuracy field of the SensorEvent), it returns a value of zero, which means "the sensor cannot be trusted" or "calibration is needed" (https://developer.android.com/reference/android/hardware/SensorManager.html#SENSOR_STATUS_UNRELIABLE).

Specifically, my questions are:

  1. Is this normal? I don't have another device with a barometer, so I can't check. How does the phone determine it's sensor "cannot be trusted"?

  2. Is there any way to calibrate the sensor? Ideally, I could check the accuracy of a user's barometer, and then calibrate it (assuming I knew how much the barometric values were off by).

Probity
  • 41
  • 1
  • 2

1 Answers1

0

The method I use for calibrating is to adjust P0 to get the altitude to match the known altitude at the calibration point. I use various methods to get the known altitude but the most automatic is to get a gps position and then use one of the online services to look up the altitude.

With this sort of methodology I don't have to worry too much about the barometer absolute accuracy. if the pressure always reads high by 0.5% that is not really relevant. So long as I can get relatively stable readings when stationary I am happy. I apply various bits of filtering especially when calculating cumulative ascent and descent numbers which I believe are the most important stats I gather for my users.

Ifor
  • 2,825
  • 1
  • 22
  • 25
  • Hi! Thanks for your answer. The issue I have with this is what if the returned value is not 1.005*actual_pressure but something like .6 in hg higher than the actual pressure? Using your solution with the former will generally give good altitudes; using it on the latter will cause measured altitude to deviate at higher altitudes. Once the system tells you the "sensor cannot be trusted", how do you know how the error will behave? Your answer is a good patch, but I was hoping for something that ideally fixed the sensor's calibration. Perhaps that does not exist. – Probity Jul 26 '13 at 15:24
  • I have a good number of users with all the phones with pressure sensors and have not had any specific complaints about this reported. I have not been properly high in the last year myself to test. I do make the users aware of the vagaries of barometric altitude but most of them understand that it's better then GPS especially if what your interested in the ascent and descent. If you want more accuracy you need to feed in the temperature and relative humidity into the calculation which may be possible on an S4 as I understand the spec. – Ifor Jul 26 '13 at 18:11