From 2f673354d1f03704c1e42689cce8ddcf61bec310 Mon Sep 17 00:00:00 2001 From: kunosee Date: Wed, 26 Feb 2014 15:06:52 +0100 Subject: [PATCH 1/2] Update Adafruit_BMP085_U.h add new function: float seaLevelForAltitude(float altitude, float atmospheric, float temp); which converts the measured pressure at a give altitude to sealevel-pressure. This is useful, when you will use the BMP for weather-reporting. --- Adafruit_BMP085_U.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Adafruit_BMP085_U.h b/Adafruit_BMP085_U.h index 67bd007..adbf8ea 100644 --- a/Adafruit_BMP085_U.h +++ b/Adafruit_BMP085_U.h @@ -99,6 +99,7 @@ class Adafruit_BMP085_Unified : public Adafruit_Sensor void getTemperature(float *temp); void getPressure(float *pressure); float pressureToAltitude(float seaLevel, float atmospheric, float temp); + float seaLevelForAltitude(float altitude, float atmospheric, float temp); void getEvent(sensors_event_t*); void getSensor(sensor_t*); From 8192b6957672675550b8a23e8c2bb65da763ba34 Mon Sep 17 00:00:00 2001 From: kunosee Date: Wed, 26 Feb 2014 15:12:07 +0100 Subject: [PATCH 2/2] Update Adafruit_BMP085_U.cpp add new function: float seaLevelForAltitude(float altitude, float atmospheric, float temp); which converts the measured pressure at a give altitude to sealevel-pressure. This is useful, when you will use the BMP for weather-reporting. --- Adafruit_BMP085_U.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Adafruit_BMP085_U.cpp b/Adafruit_BMP085_U.cpp index 4296209..37542c2 100644 --- a/Adafruit_BMP085_U.cpp +++ b/Adafruit_BMP085_U.cpp @@ -364,6 +364,22 @@ float Adafruit_BMP085_Unified::pressureToAltitude(float seaLevel, float atmosphe * (temp + 273.15F)) / 0.0065F; } +float Adafruit_BMP085_Unified::seaLevelForAltitude(float altitude, float atmospheric, float temp) +{ + /* Hyposometric formula: */ + /* */ + /* P0=((((h*0.0065)/(temp + 273.15F))+1)^(^/0.190223F))*P */ + /* */ + /* where: h = height (in meters) */ + /* P0 = sea-level pressure (in hPa) */ + /* P = atmospheric pressure (in hPa) */ + /* T = temperature (in �C) */ + + return (float)pow((((altitude*0.0065)/(temp + 273.15F))+1), (1.0/0.190223F))*atmospheric; +} + + + /**************************************************************************/ /*! @brief Provides the sensor_t data for this sensor