# Air pressure and height

Air pressure and height....

Ok, i have a hard time with the air pressure. I should do a calculation with the pressure and determine the height.

I have a pressure sensor which i use for pitot-tube sensing and i have a static sensor of the same kind to measure static reference pressure. I can determine speed with the given values of temperature and pressure differency. But i should also calculate a height where that pitot-tube sensor is. I have a pressure value from the ground level and i use that as a reference value for the height calculation. However, i did find some formulas to calculate the pressure from the given height, but not vice versa.
The basic principle would be like this:

Lets assume that im in a certain level from a sealevel, that height is unknown but lets say its within few hundred meters.
I have the air pressure of 102kPa and i move upwards into a point where the air pressure is 101kPa, now the big question is, how much is the elevation in meters? The height from a sealevel is not important and not even known, only thing matters is how much i elevated from point A to B. Is that possible to determine with only temperature and a reference pressure and a current pressure which is altered by height? The accuracy also is not critical, lets say we dont take count the gravity changes or climate pressure changes during the measurements. Only temperature and pressure.

TechSpec

Last edited:

rcgldr
Homework Helper
Here's a two stage formula for pressure versus altitude (I can't remember what the default temperature at sea level was, maybe 70 degrees farenheight). There's a third stage for very high altitudes (spacecraft and weather balloons would need this), but I didn't have this in my archive of various junk.

dAlt = altitude in feet.
dPressure is pressure in psi.

Code:
    if(dAlt < 36089.24)
dPressure = 14.7*pow(1-6.8755856E-6*dAlt, 5.2558797);
else
dPressure = 14.7*.2233609*exp(-4.806346E-5*(dAlt-36089.24));

True, but...

That is the formula i found too, but it solves the pressure, not the height. And i have no method of opening that formula to solve the height with a given pressure..
so i made this really really really stupid method of doing it and it is highly simplified, but you can see the principle.

for(i=0;i<counts;i++)
{
altitude=1; .......................................// start from the lowest alt
pressure=calculate_pressure(altitude);....// count the pressure
if(pressure == sensor_output)...............// must have tolerance !!!!
{
return altitude;
}
else
altitude++;

if (counts > 10000).............................// too high altitude
return error;
}

It might work but its very slow method and i HATE to do it like that..
So if i could calculate it the correct way i would save a lot of time, and get the accuracy.

TechSpec