Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Adafruit BMP280 faulty barometric pressure
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit BMP280 faulty barometric pressure

by emilsjoeholm on Sat Aug 01, 2020 6:23 pm

Hello guys. Do anyone more than me have an issue were the Adafruit BMP280 sensor is showing the wrong value.
I have 2 different instruments that tells me the current pressure (works with aviation) and they are showing current barometric pressure at 1013 hPa as were Adafruit BMP280 is showing 1003 hPa.
I would say that this is a really big diff.

Any suggestions?

emilsjoeholm
 
Posts: 11
Joined: Wed Apr 19, 2017 10:14 am

Re: Adafruit BMP280 faulty barometric pressure

by adafruit_support_carter on Mon Aug 03, 2020 12:28 pm

Can you post the complete code listing you are using to read the pressure from the BMP280.

adafruit_support_carter
 
Posts: 16922
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit BMP280 faulty barometric pressure

by emilsjoeholm on Mon Aug 03, 2020 3:33 pm

Sure. But i have to warn you. it still in development and like earlier than beta stage. ;)

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_Sensor.h>
#include <Wire.h>
#include <SPI.h>
#include <Servo.h>
#include <Adafruit_BMP280.h>

#define BMP_SCK  (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS   (10)
Servo servo_press;           //for servo needle
const int servoPin_press = 6;    // trinklet pin 6 -> servo pressure needle

Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);

float press; //Variable for holding pressure reading
int servoAngle = 0;    //Servo position in degrees
double conBaro = 0;
double baro = 0;
boolean servo_test = true;



void setup() {
  Serial.begin(9600);
  pinMode(6, OUTPUT);
   


  servo_press.attach(servoPin_press);
  test();


  /* Default settings from datasheet. */
  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. */
}

void loop() {
 
     //Print out value of pressure
    Serial.println("");
    Serial.println("Startar Barometrisk mätning.");
    Serial.print(F("Temperatur = "));
    Serial.print(bmp.readTemperature());
    Serial.println(" *C");
    baro = ((bmp.readPressure()/100)+10); //omvandla till hPa samt kompensera med 100Pa. compensates for error and convert to hPa.
    Serial.print(F("Lufttryck = "));
    Serial.print(baro);
    Serial.println(" hPa");

    Serial.println();
    delay(100);


    press=bmp.readPressure(); //Read Pressure

   

    //for calibration only
    //servo_press.write(23);     // 0 ~ 735; 180 ~ 785

    //show value to needles
    conBaro =(baro*0.75006); //converts hPa to mmhg
    Serial.print("Lufttryck i mmHg: ");
    Serial.print(conBaro);
    Serial.println(" mmHg");
    conBaro = map(conBaro, 735, 785, 0, 180);
    Serial.print("Vinkel på servo: ");
    Serial.println(conBaro);
    servo_press.write(conBaro);
    delay(500); //Delay 1/2 sec.
     
     Serial.println("End of loop");
     Serial.println(" ");
     Serial.println("------------------------------------------------");

     delay(10000); //Delay 10 sec.
}
void test() {
 
Serial.println(F("Servo test"));

   //servo_test = false;
   if(servo_test){
     servo_test = false;
     servo_press.write(0*-2.66+155);
   
     delay(700);
     for(servoAngle = 0; servoAngle<= 50; servoAngle++)
     {                               
     
       servo_press.write(servoAngle*-2.66+155);
       delay(100);

      }
    }

  Serial.println(F("BMP280 test"));

  if (!bmp.begin()) {
    Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
    servo_press.write(0);
    while (1);
  }
}

emilsjoeholm
 
Posts: 11
Joined: Wed Apr 19, 2017 10:14 am

Re: Adafruit BMP280 faulty barometric pressure

by adafruit_support_carter on Tue Aug 04, 2020 12:05 pm

Thanks. That looks generally OK, but for the sake of testing, let's back up and just use the example from the library:
https://github.com/adafruit/Adafruit_BM ... 80test.ino

Run that and see what you get.

What are the other devices that you are comparing the pressure reading to?

adafruit_support_carter
 
Posts: 16922
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit BMP280 faulty barometric pressure

by emilsjoeholm on Tue Aug 04, 2020 5:01 pm

The other devices are 2 different weatherstations for the airport that i work and live next to.

As for the sample file i use that code for this build.
And it returns the same value except for the conversion to Hpa and my correction.

Im wondering if any of this in the code has someting to do with it?
Code: Select all | TOGGLE FULL SIZE
 /* Default settings from datasheet. */
  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. */


As i cant find any explanation to what this is and what it does.

emilsjoeholm
 
Posts: 11
Joined: Wed Apr 19, 2017 10:14 am

Re: Adafruit BMP280 faulty barometric pressure

by adafruit_support_carter on Tue Aug 04, 2020 5:17 pm

Those settings are OK. They are setting various filters and samplings for the readings. The datasheet is probably the best place to read about the details:
http://www.adafruit.com/datasheets/BST- ... 001-11.pdf

I think you're reading is OK. The readings from the airport may not be a fair comparison. Also, the value of 1013 hPa is the standard day value, so maybe the airports are just reporting that. But using values from other locations will also be off simply due to how varied the atmosphere actually is.

You would actually need a secondary sensor co-located with the BMP280 to make a valid comparison.

Do you know the actual altitude for your current location?

adafruit_support_carter
 
Posts: 16922
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit BMP280 faulty barometric pressure

by adafruit_support_bill on Tue Aug 04, 2020 5:27 pm

Airports generally report the barometric pressure corrected for sea-level so that pilots can use it to calibrate their altimeters. Without that correction in your code, you can't compare readings taken at different altitudes or compare to the sea-level corrected pressure reported by the airports. https://keisan.casio.com/exec/system/1224575267#!

adafruit_support_bill
 
Posts: 78733
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit BMP280 faulty barometric pressure

by emilsjoeholm on Wed Aug 05, 2020 3:54 am

my altitude is 103m over the sea level.
I'll grab one of our portable barometric instruments that has been calibrated recently next week and we will see the results.

emilsjoeholm
 
Posts: 11
Joined: Wed Apr 19, 2017 10:14 am

Re: Adafruit BMP280 faulty barometric pressure

by adafruit_support_carter on Wed Aug 05, 2020 10:04 am

Some of the discussion and info in this guide might also help:
https://learn.adafruit.com/clue-altimeter

adafruit_support_carter
 
Posts: 16922
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit BMP280 faulty barometric pressure

by emilsjoeholm on Wed Aug 19, 2020 12:09 pm

Hello guys.
I've just now tested a kestrel 4500 NV Pocket wather tracker to se what the diff is in barometric pressure.
And as i said. The BMP280 shows: 999,57 Hpa and the Kestrel instrument shows 995,6 Hpa.
i have recompiled the sketch with the updated Bmp280 libraries.

emilsjoeholm
 
Posts: 11
Joined: Wed Apr 19, 2017 10:14 am

Re: Adafruit BMP280 faulty barometric pressure

by adafruit_support_carter on Wed Aug 19, 2020 12:14 pm

That amount of variation could simply be sensor-to-sensor variation. How are you ultimately wanting to use the BMP280?

adafruit_support_carter
 
Posts: 16922
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit BMP280 faulty barometric pressure

by emilsjoeholm on Wed Aug 19, 2020 4:20 pm

im using it as a barometric pressure sensor for an instrument that i'm constructing. At this stage just to try some things out.

but when i bought it, i read this:
"This precision sensor from Bosch is the best low-cost, precision sensing solution for measuring barometric pressure with ±1 hPa absolute accuracy, and temperature with ±1.0°C accuracy. Because pressure changes with altitude, and the pressure measurements are so good, you can also use it as an altimeter with ±1 meter accuracy."

so imagine my suprise when it differs 4 hPa.
or if i would use it to messure altitude: 30m.

emilsjoeholm
 
Posts: 11
Joined: Wed Apr 19, 2017 10:14 am

Re: Adafruit BMP280 faulty barometric pressure

by adafruit_support_carter on Wed Aug 19, 2020 4:29 pm

Is this the device you are using for comparison?
https://kestrelmeters.com/products/kest ... ther-meter

adafruit_support_carter
 
Posts: 16922
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit BMP280 faulty barometric pressure

by emilsjoeholm on Thu Aug 20, 2020 1:21 am

yes it is.

emilsjoeholm
 
Posts: 11
Joined: Wed Apr 19, 2017 10:14 am

Re: Adafruit BMP280 faulty barometric pressure

by adafruit_support_carter on Thu Aug 20, 2020 10:44 am

Based on the user manual:
http://cdn.shopify.com/s/files/1/0084/9 ... nglish.pdf
what the Kestrel reports as "barometric pressure" is a corrected value:
kestrel.jpg
kestrel.jpg (72.66 KiB) Viewed 26 times

So it won't compare directly with the static pressure measured directly by the BMP280.

adafruit_support_carter
 
Posts: 16922
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.