Arduino Barometric Altimeter 31 Jul 2012
Using Sparkfun’s BMP085 sensor board (SEN-09694), I put together some quick Arduino code to measure temperature-adjusted barometric pressure, store the data on an SD card using Adafruit’s data logger shield (v1.0), and then calculate altitude. This is a pretty simple project. In fact, the biggest challenge was getting a suitable formula for calculating altitude from atmospheric pressure.
Testing the sensor was very simple, following the tutorial and schematic on Sparkfun’s site with breadboard wiring.
Now adding the sensor to the data logging shield. Don’t forget which pins are which, because those will be facing the PCB.
And from the other side, where you can see the SDA, SCL, VCC and ground wires connect. Because we are using i2c for the bmp085 readings, the clock data from the data logging shield isn’t available without some modifications. We are capturing milliseconds after start, so it’s not very necessary.
After connecting to a 4XAA (6VDC) battery source, we can mount this to the Easy Star as seen in the build tutorial.
Once you have your data, you need to convert your adjusted pressure readings into altitude. The bmp085 gives you Pascals; after converting to millibar (or hPa) one can use the equation
where:
- psta = measured pressure in millibar (or hPa)
- psealevel = millibar (or hPa) pressure at sea level, or approximately 1013.25. In this example, I use what I know is the pressure at sea level at time=0.
This is a more accurate version of the common heuristic that pressure reduces by 1 millibar per 30ft of elevation. After this crunching we get the graph below, showing that we reached 500m in just under 3 minutes, and you can see what this looks like from the flight video.