 # Spotlight: Barometric Pressure Sensor

#1

The 10DOF (degrees of freedom) IMU (inertial measurement unit) included in the Ardusat Space Kit has a `BMP180` Barometric Pressure Sensor. This sensor measures the raw atmospheric pressure in hPa (hectopascal), which can be used to detect altitude, or observe changes in the weather. This post should help you understand the measurement values you can get, and how to use them in your experiments and projects.

### What does the sensor measure?

The sensor measures the raw atmospheric pressure at the sensor. At sea level with a so-called “standard atmosphere”, this value will be 1013.25 hPa. However, this value goes up and down with changes in the weather, and goes down with altitude as you get higher above sea level.

### Measuring Altitude

Pressure goes down as altitude goes up according to the following relationship:

``````p = 101325 (1 - 2.25577 10^(-5) h)^(5.25588)
h = height above sea level (meters)
p = pressure (Pa)
``````

If sea level pressure never changed, we could simply measure the pressure at the barometric sensor, and we’d be able to directly calculate altitude. However, pressure at sea level changes with the weather (that’s what the “H” and “L” icons on TV weather maps correspond to - high and low pressure), so it’s not that simple.

To calculate altitude from current measured pressure, we need to know what the current sea level pressure is for our location. Put another way, this is the pressure that the barometer would measure at sea level, given the current weather, if we were standing at sea level, instead of whatever elevation we happen to be at. Once we know this value, we can calculate the altitude from our raw pressure reading. Fortunately, the National Weather Service measures sea level pressure at thousands of weather stations throughout the country, and we can easily go to http://forecast.weather.gov/, enter the location where we are measuring, and see the current Barometric Pressure measured at a near by site. From here, we can calculate our altitude using the readings from the sensor.

### Measuring current atmospheric pressure

By the same token, it is sometimes useful for us to measure current sea level atmospheric pressure, and track it as the weather changes. For example, this would allow us to see that low pressure is moving in (generally associated with more stormy weather). To do this with the barometric pressure sensor, we can use our known altitude (using maps or GPS) and then calculate sea level pressure from that.

### Performing the calculations

The easiest way to perform these calculations is to use the Ardusat SDK. The SDK has two functions built in to perform conversions from raw barometric pressure as measured by the sensor to altitude or sea level pressure. `pressureToAltitude()` function takes the known sea level pressure and current measured pressure to calculate altitude. `seaLevelPressureForAltitude()` takes the known altitude and current pressure to give us the current sea level pressure. More details can be found at https://github.com/ArduSat/ArduSatSDK#reading-sensor-data (scroll down to read about these functions)

If you want to perform these calculations manually, the following formula gives altitude in meters as a function of temperature, measured pressure, and sea level pressure ``````P0 = sea level pressure
P = measured pressure
T = temperature (C) (use 15 C for standard atmosphere if not measured)
``````

I hope this helps make some sense of this complicated topic! Be sure to post any questions if you have them, and let us know what you want to measure with the barometric pressure sensor!