Luftdrucksensor (BMP085)

Testmessung über eine Stunde mit dem annähernd lichtdicht eingepackten BMP085:


ungefilterte Messdaten in hPa




gefilterte Messdaten in hPa (Durchschnitt über 20 Messungen)

Testmessung im Treppenhaus




ungefilterte Messreihe


gefilterte Messreihe


Histogramm der Sensormessungen im "High Resolution Mode". ~23000 Messungen über den Zeitraum von einer Stunde. Varianz laut Octave: var(daten) = 0.39



Adresse

A7 A6 A5 A4 A3 A2 A1 W/R
1 1 1 0 1 1 1 0/1



Programmcode:

/*
 *  Taster für BMP085
 *  Durch Betätigen des Tasters wird der Luftdruck bei N.N. angepasst
 *  
 *
 *  Pinbelegung:
 *  - 2(arduino pro mini) - Taster
 */

#include <Wire.h>
#include <Adafruit_BMP085.h>
#include<math.h>;

Adafruit_BMP085 bmp;

int button = 2;              // switch is connected to pin 2
int val;                        // variable for reading the pin status
int buttonState;                // variable to hold the last button state
double altitude = 518.0;
double pressureAtSealevel = 0;
double relativ = 0;


/*****************************************************************************************************************/
/*                                     Funktion für pressureAtSealevel                                           */
/*****************************************************************************************************************/

double setPressureAtSealevel(double high, double pressure) {
  return (double)(pressure/pow(((double)1.0-((double)high/(double)44330.0)), (double)5.255));
}

/*****************************************************************************************************************/
/*                                             void setup()                                                      */
/*****************************************************************************************************************/

void setup() {
  pinMode(button, INPUT);   
  Serial.begin(9600);
  buttonState = digitalRead(button);   // read the initial state
  bmp.begin(BMP085_HIGHRES);
  
 
  pressureAtSealevel = setPressureAtSealevel(altitude, (double)bmp.readPressure() );
  Serial.print("pressureAtSealevel: ");
  Serial.print(pressureAtSealevel);
  Serial.println();
  Serial.print("START loop ");
  Serial.println();
 
}

/*****************************************************************************************************************/
/*                                               void loop()                                                     */
/*****************************************************************************************************************/

void loop(){
    val = digitalRead(button);
    
    if (val != buttonState) {                                              // the button state has changed!
     Serial.println("****************************************");
     Serial.println("Button just pressed");
     pressureAtSealevel = setPressureAtSealevel(altitude, (double)bmp.readPressure() );
     Serial.print("pressureAtSealevel changed to: ");
     Serial.println(pressureAtSealevel);
     Serial.println("****************************************");
    }

    relativ = bmp.readAltitude(pressureAtSealevel) - altitude;
  
    Serial.print(" Pressure = ");
    Serial.print(bmp.readPressure());
    Serial.print(" Pa");
    
    Serial.print(" Real altitude = ");
    Serial.print(bmp.readAltitude(pressureAtSealevel));
    Serial.print(" m");
        
    Serial.print(" Relative altitude = ");
    Serial.print(relativ);
    Serial.print(" m");
    Serial.println();
  
    delay(500);
  
}

 

 

Anhänge:
Diese Datei herunterladen (BST-BMP085-DS000-05 Drucksensor.pdf)Datasheet: Luftdrucksensor(BMP085)[ ]%2012-%09-%26 %1:%Sep%+02:00