GPS vs barometric height MPL3115A2


For my project, I am using SparkFun MPL3115A2 to measure the height. The issue that I am facing is that the barometric sensor measures height with reference to sea-level. So, it gives height as 515 feet from the sea-level for my location. iPhone App ‘Gauges’ also displays the same number and calls it Pressure Altitude. It also shows GPS elevation as 620 feet.

But on the internet, I was only able to find the GPS elevation for my location which was coming as 620 feet. Is there a way to find pressure based elevation of a location?

Since the sensor does not calculate GPS height, the elevation height from GPS does not do anything for me.


1 Like

GPS elevations are calculated in 3D from a “standardised” sea level also known as MSL (Mean Sea Level) - this is known as GEOMETRIC altitude. In real life, the sea level changes constantly hence a need for a set point that all measurements agree to.

Barometric height (or Pressure Altitude) also has a set sea level known as AMSL (Average Mean Sea Level) that is not the same as GPS since pressure varies by temperature and it is related to air density at any given point.

In aviation related uses - Pressure altitude was favoured, but was error prone due to localised differences in temperature, humidity etc. and as GPS has become more accurate, it is now the favoured method.

I have summarised the above - but it should be enough to help you to decide what is best for your use case. I am sure that if you explained the use case - many experts here could weigh in and offer advice.

1 Like

Barometric sensors simply measure the weight of the air in the atmosphere above the sensor.
Since the Density of the Air is always changing (Humidity, Temperature, weather patterns), so is the Barometric pressure for a given location.

GPS measurements use a Reference Coordinate System and Elevation Model.
The Raw Elevation from a GPS is the Height above the Ellipsoid.
The Ellipsoid is a mathematical model that approximates the Geoid over a large area.
The Geoid describes the irregular shape of the earth and is the true zero surface for measuring elevations.
The Orthometric Height is what we think about in terms of elevation typically. It’s calculated by the GPS receiver behind the scenes.


The 620’ elevation you mentioned for your location is the Orthometric Height.

An accurate GPS position won’t change over time, as it’s published with the specific Ellipsoid and Vertical Datum used to calculate the Position.
But, the Pressure Altitude for that location will change constantly with weather.

As @shanevanj mentioned, it depends on what you want to accomplish. But the two are not related.


Thanks for the explanation.

I understand that GPS height and barometric height are not related and are calculated in 2 different ways.

My requirement is to calculate the height of a builder where my device will be installed. What would be the best way to accomplish this using the barometric sensor?


Do you want absolute building height or height above MSL?

If you need the absolute height, then take the value at the bottom of the building and then again at the top - this will give you the height (give or take the accuracy level of the sensor)


Thanks for the feedback so far!

I need the absolute height of the building. The issue is that I cannot take two measurements with my device. When the device is installed and powered up on the building roof-top, the expectation is to calculate the absolute height of the building. So, I need the ground-level height upfront and I was thinking that I could find this data on the internet based on the zipcode. Once the device powers up, in the FW, I could easily subtract the sea-level height value with the ground-level height value and get the absolute height of the building.

But the issue is the all the ground-level values that I could find are all GPS based and hence I cannot use it in my subtraction calculation as the values are off.

Any ideas?


Yes - power up the device at the ground level - make it output the value - write it down, edit your code to do the match (or use a Particle.fucntion() to send the value back to the device) - then take it to the top and install it ?

1 Like

Using any sort of geographical reference (such as zip code as you suggested) would require that all the land in that area be perfectly flat. In reality this is almost never the case. Terrain naturally rises and falls in a very localized way, and even varies building to building depending on how the land was graded before construction. Taking two readings as @shanevanj mentioned, or using a different type of sensor (laser?) to measure actual distance to ground are the only ways I know of that you’ll achieve this.

1 Like


Thanks for all the responses.
I cannot take 2 measurements as the devices will be installed by a third party company and it will not be feasible to have them take 2 readings.

After our internal discussion, I think, what my team will do is that we will try to get the ground elevation using weather APIs (available on the web). Basically, the device will just send the barometric height to our Web Application and from there we will try to calculate the ground level height using web APIs and then calculate the absolute height by subtracting the sea-level height with the ground-level height…

We will try it out and see if this will work. I will update you once we have done some testing.

If you could provide some more background we might better understand what you are after.
Barometric hight should only ever be considered as a relative measurement within a “short” period of time and limited area as the change of pressure due to weather impacts the readings considerably.

A reading that is correct today may well be wrong at night or next day.


Barometric, pressure altitude is used in aviation, because airplanes use altimeters which are based on barometric pressure. As others have said, the pressure readings will vary based on the current local pressure. In a plane, you generally set the altimeter to the KNOWN level of the airport before you take off, and/or to the known current pressure at the airport (resulting in the same result) and then, as you fly, you update your altimeter setting every 30 minutes or so, based on the barometric pressure at the closest airport Look up “AWOS” (automated weather observation system) or “ASOS” (Automated Surface observation system) for an airport near you, which you can phone into, or listen on a scanner, and you’ll hear “Current altimeter is 29.92” or something, which tells the pilot what to set.

To do what you’re trying to do, you really care about the DIFFERENCE between the pressure at the base of the building, and at the top, or elevator location. To do this, you can permanently install a sensor at a known level (likely top or bottom for convenience) and then use a radio or wired communication to read the pressure at the known location and the pressure at the movable location at the same time, and subtract to get the difference. You can calculate the height difference of the two sensors fairly accurately with the difference between the two sensors. If you have an airport with AWOS reasonably close by, and can use the internet to pull the pressure from that location as your “known” pressure, you may be able to use that, but just know that the error will be increased when there’s a pressure front coming through, because the pressure will go up or down at one location before the other.

If interested, you can use to find the AWOS or ASOS of a local airport… For example, shows that ASOS is available at PHONE 410-691-1278. Anyone can call that to listen to the current weather.

Hope that helps!!


1 Like


Thank you for all the pointers.
I will look into various suggestions and see what works best for us.

Thanks again,