BMP280- Wie kalibriert man den Luftdruck bzw. auch die anderen Parameter wie Temperatur?

Hallo, ich bin neu hier in diesem Forum kenne mich noch nicht Weltklasse mit einem Arduino aus, aber ein bisschen was kann ich schon. Meine Frage ist, wie kann man den BMP280 Luftdrucksensor kalibrieren? Ich baue eine Höhenmessung, aber der Sensor spuckt falsche Werte aus. Ich habe in meinem Wohnort einen momentanen Luftdruck von 1010,6 hPa, aber der Sensor zeigt mir einen Luftdruck von 900 hPa an?

Code:

/***************************************************************************
  Projekt: Höhenmessung Wasserluftdruckrakete
  Datum-beginn: 18.09.2019

  This is a library for the BMP280 humidity, temperature & pressure sensor
 ***************************************************************************/

//Ground Settings- Including Library's
#include <Wire.h>
#include <SPI.h>
//Including Adafruit BMP280 Library
#include <Adafruit_BMP280.h>


//BMP280-Code
//Define BMP280- Sensor Ports
#define BMP_SCK  (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS   (10)

//define global variables, this values can used everywhere in the code
double localpressure=1010.6;
double startheight= 0;
double maxheightreal=0;
double maxflyheight=0; 

//call the BMP280 Funktion
Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);


void setup() 
{  
//Code Settings- BMP280 function Test
  Serial.begin(9600);
  Serial.print("BMP280 test\n");

  if (!bmp.begin(0x76)) 
  {
    Serial.print("Could not find a valid BMP280 sensor, check wiring!\n");
    while (1);
  }

//Code Settings- BMP280 set paramters back to the default precision
  /* Default settings from datasheet. */            /* Set all parameters back to default*/
  bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,     /* Operating Mode. */
                  Adafruit_BMP280::SAMPLING_X2,     /* Temp. oversampling */
                  Adafruit_BMP280::SAMPLING_X16,    /* Pressure oversampling */
                  Adafruit_BMP280::FILTER_X16,      /* Filtering. */
                  Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */
             
//Code Settings- BMP280***
  for(int i=0; i < 10; i++)
  {
  startheight=bmp.readAltitude(localpressure);
  delay(1000); 
  }

//Read the local pressure
  Serial.print(F("Start Pressure = "));
  Serial.print(bmp.readPressure()/100);                //the function readPressure has to divide with 100 to get the pressure in hPa
  Serial.println(" hPa");
  
//Read the local start high from the sensor
  Serial.print(F("Start altitude = "));
  Serial.print(bmp.readAltitude(localpressure));        // Adjusted to local forecast! 
  Serial.println(" m\n");

  delay(1000);
}


void loop() 
{
//BMP280-measure height
if(maxheightreal < bmp.readAltitude(localpressure))        //look, if the real safed maximum height is smaller than the current measured high!  
{
  maxheightreal=bmp.readAltitude(localpressure);
}

/*the following code, which write the current height on the screen can be replaced with the writing funktion of the sdcard module. The sdcard- modul should every time safe:
the start heigth, the current height, and the maximum hight on the sd card! */

 Serial.print(F("Current altitude = "));          //write the current height on the screen, which the sensor measure
 Serial.print(bmp.readAltitude(localpressure));   // Adjusted to local forecast!  
 Serial.println(" m\n");

 maxflyheight= maxheightreal-startheight;         //callculate the max fly height, which was measured at the whole fly
 Serial.print("Erreichte maximale Flughöhe: ");
 Serial.print(maxflyheight);
 Serial.print("m\n");
 
 delay(1000);                                    //this delay is written by a high value, because of controlling the scatch, after finishing the code, you must set this value to 1000 or smaller...
}

Hallo Stefan,

eventuell liegen die Messungenauigkeiten daran, dass du die Adafruit Library verwendest.
Probier doch mal dein Programm mit Blockly zu bauen. Dort ist die senseBox MCU Library eingebunden, sodass du auf die Adafruit Library verzichten kannst.

Liebe Grüße
Björn