Doe's anyone has the code or algorithm to calculate vertical speed (or altitude) from barometric pressure?
Thank's
Doe's anyone has the code or algorithm to calculate vertical speed (or altitude) from barometric pressure?
Thank's
You can use following function:
function calc_H_from_P(P) {
// P current barometric pressure (Pa)
var Po = 101325.0; //Average sea level pressure (Pa)
var g = 9.807; //Gravitational acceleration (m/s2)
var M = 0.02896; //Molar mass of air (kg/mol)
var T = 288.15; //Standard temperature (K)
var R = 8.3143; //Universal gas constant (N·m)/(mol·K)
var h = -(R * T) / (M * g) * Math.ln(P / Po);
return h;
}
It is enough if you are looking for vertical speed as you will evaluate altitude difference.
In case you are looking for actual altitude, you must calibrate the result because it will be affected by weather.
Thanks for the formula.