Skip to main content

Project Based Engineering Instrumentation High Level Coding and Microcontrollers

Section 23.4 Converting Pressure to Altitude

The pressure data obtained from the CPX/CPB is in hectopascals (hPa) which is the same as millibars (mbar). The standard atmospheric pressure at sea level is 1013.25 hPa. As you go up in altitude the pressure decreases. The equation to convert pressure to altitude assuming a standard atmosphere is as follows:
\begin{equation} h = \frac{1.0-(\frac{p}{p_0}^{1.0/5.25588})}{2.2557 \times 10^{-5.0}}\tag{23.4.1} \end{equation}
where p is pressure and \(p_0\) is the standard atmospheric pressure at sea level (1013.25 hPa). This equation assumes a standard atmosphere and is only accurate up to about 11 km in altitude. Beyond that the equation becomes less accurate and you would need to use a more complex model of the atmosphere to get accurate altitude data. However, for our purposes of launching a hobbyist rocket, this equation will work just fine. It’s also possible to convert altitude to velocity using a first order derivative.
\begin{equation} v = \frac{h_{i+1}-h_i}{t_{i+1}-t_i}\tag{23.4.2} \end{equation}
In order to get that equation to have reasonable results, students typically have to heavily filter their data given the amount of noise in the data. The equation to convert to velocity is shown below but the results and filtering are left to the reader as an assignment. I think students have had a lot of success using moving average and complimentary filters. I’m sure Google and AI tools will be able to help get that working.