Altitude Comparison: barometer vs GPS


This might be a common knowledge, but in the last months I haven't seen a similar post. Maybe someone new to barometers might be interested in this data.

The GPS receivers return altitude data, but this is inaccurate. The error margin depends on the satellite constellation geometry and whether or not you have SBAS DGPS on. I was under the impression that the error was 5-10 meters, but as it turned out, I was wrong.

Recently, I embedded a BMP085 barometer in my autopilot board and operated it with this library:

Barometers can be and are effectively used to calculate altitude, once initialized and zeroed.

So the figure above displays a short manual flight whose altitude is measured both by a barometer and a GPS. The barometer is zeroed upon power-up. The GPS altitude is zeroed, based on the altitude returned before taxiing. It is the time between 20 and 30 seconds. The plane lands at 150 seconds in the exact same place it took off. However, the GPS altitude measurement has already drifted 16m away.

This goes to show that GPS should not be used for altitude measurement, unless a very coarse albeit offset-free measurement is required.

A barometer is a much more accurate and fast device to extract altitude, when operated correctly.

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • Maybe it could be a good add to next firmware versions...

  • With a quick glance of the u-blox 6 datasheet (the GPS type used by the ardupilot), I see that it communicates packets of data to the autopilot in the syntax of NMEA messages, which was expected.

    It is a reasonable assumption that the arduplane software receives the VDOP value, decodes it, maybe use it, and then dumps it, not storing it anywhere.

    Two options come to mind.

    1. Tamper with the arduplane firmware code to write the VDOP values to the dataflash file.

    2. Listen to the NMEA sentences in parallel with another microcontroller and fiddle with them as you see fit; storing them to an onboard SD card is an option.

    None of the above is a day-log project.

  • Ok, thanks Georacer... Does anybody knows if we could get the VDOP value in our APM2.5?

  • I took those measurements using my own autopilot board. I was receiving the full GSA NMEA message which included the VDOP metric. I just didn't send it in the onboard SD card and thus it is now lost.

    RelAlt is (badly named) the GPS altitude fused with measurements from the barometer and accelerometer. It should be a more informed guess of your vehicle's altitude. It should not necessarily start from 0, it is not relative altitude.

  • I thought that apm logs would record the VDOP but, I'm looking and I don't find it...(If anybody knows where, please...) Usually when I compare the HDOP and VDOP in field in my smartphone, VDOP usually doubles the HDOP value and some times worse... So that means that the precision on the altitude values usally goes meters away from the real value and maybe if you loose one of the satellites near the horizon the VDOP could increase too much...

    So I've one question... The values for RelAlt is the altitude values set to 0ft when armed?
    If that's right, please could somebody explain this:


    I started 5 meters above the sealevel and my relative is near 0m... that's perfect during the first 3'30'', then, the relative and the GPS alt became the same value and later again 5m +- different... Finishing at the same altitud... Could anybody explain this?

    Thank you !

  • @Jose,

    I did a typo there. I meant 20Pa, which is 0.2hPa error is 20Pa, which still gives 1.7m of error by your method. I know I got better performance by this sensor. Maybe there is still something in that datasheet that I read wrong.


    Unfortunately I didn't keep logs of the VDOP measurement, so I can't comment on that. What would be a good value for VDOP for your standards?

  • Hello, how was the VDOP and satellites count during that flight? Maybe a loose of one satellite may reduce the VDOP and increase the GPS altitude error?

  • Georacer Quote

    ""Temperature inside the cockpit would indeed rise. Roughly speaking, about 5oC in the first 2-3 minutes after powerup and then stay steadily there. As we all know, ventilation isn't an option with the BMP085 sensor, since air currents mess up the measurements pretty bard."

    You are measuring anyway the cabin temperature that is not the same of  outside air temperature . To compensate for temperature deviation, for example,  from standard ISA model you need to know the atmospheric temperature.  Cabin temperature is anytime different from the outside air temperature.

    Georacer Quote

    "It advertises an accuracy of 200Pa"

    200 Pa of error on pressure is orrible!

    Use the calculator a this link rather than routines at the  link I previously sent.

    Try 16.7 m altitude => 101125 Pa

    Try then 0 m => 101325 Pa

    We have a variation of pressure of 200Pa in 16.7m

    It seems not so accurate :-))

  • About sensor fusion, yes, I know that it's the best of both worlds, and a Kalman filter backed with a good model would probably be the best solution, but it's black magic for me, as of now.

  • I used the Bosch BMP085 hardware solution that ardupilot uses. Actually, I bought the breakout board of the sensor from 3DR. It incorporates a barometric sensor and a thermometer. It advertises an accuracy of 200Pa, but I can't find the resolution figure right now. The datasheet is pretty well-written.

    I modified this library, and used it more or less as-is to calculate barometric altitude. It follows exactly the datasheet pseudocode.

    The reason I modified it was that the sensor needs 35ms in the highest accuracy setting to execute the measurement and only then be read for its value. Thus I needed to break the prepping/reading procedure in two, since I couldn't let my autopilot stall for 35ms, waiting for the measurement to be prepared.

    Temperature inside the cockpit would indeed rise. Roughly speaking, about 5oC in the first 2-3 minutes after power up and then stay steadily there. As we all know, ventilation isn't an option with the BMP085 sensor, since air currents mess up the measurements pretty bard.

    A more involved heatsink installation would be required. But, on the other hand, wouldn't altitude reset after the sensor heats up work just the same?

This reply was deleted.