Did you buy your BMP280 from a reputable supplier? Is it supplied with a stable 3.3V? Which oversampling setting are you using?why the bmp 280 altimeter showing false result and whay it varies continuously after each disconnecting and connecting
[/U]
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BMP280.h>
#define BMP_SCK (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS (10)
Adafruit_BMP280 bmp(&Wire2); // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);
void setup() {
Serial.begin(9600);
while ( !Serial ) delay(100); // wait for native usb
Serial.println(F("BMP280 test"));
unsigned status;
//status = bmp.begin(BMP280_ADDRESS_ALT, BMP280_CHIPID);
status = bmp.begin();
if (!status) {
Serial.println(F("Could not find a valid BMP280 sensor, check wiring or "
"try a different address!"));
Serial.print("SensorID was: 0x"); Serial.println(bmp.sensorID(),16);
Serial.print(" ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
Serial.print(" ID of 0x56-0x58 represents a BMP 280,\n");
Serial.print(" ID of 0x60 represents a BME 280.\n");
Serial.print(" ID of 0x61 represents a BME 680.\n");
while (1) delay(10);
}
/* 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_1); /* Standby time. */
}
void loop() {
Serial.print(F("Temperature = "));
Serial.print(bmp.readTemperature());
Serial.println(" *C");
Serial.print(F("Pressure = "));
Serial.print(bmp.readPressure());
Serial.println(" Pa");
Serial.print(F("Approx altitude = "));
Serial.print(bmp.readAltitude(1019)); /* Adjusted to local forecast! */
Serial.println(" m");
Serial.println();
delay(1);
}
[U]
Pitch Error
and Roll Error
and several lines with 12 datapoints.delay(1);
from delay(2000);
. bme.setSampling(Adafruit_BME280::MODE_NORMAL,
Adafruit_BME280::SAMPLING_X8, // temperature
Adafruit_BME280::SAMPLING_X16, // pressure
Adafruit_BME280::SAMPLING_X1, // humidity
Adafruit_BME280::FILTER_X16,
Adafruit_BME280::STANDBY_MS_0_5 );
You need to measure outside because buildings can be subject to wind-induced and/or A/C pressure noise I think.Are we sure elevations will be the same even if in the same location? I'm pretty sure these units compute elevation from pressure. The constant passed into readAltitude() simply compensates for atmospheric pressure at sea level. The problem with these units is using pressure to compute altitude--namely because pressure changes frequently--especially from changing weather.
Here are results from my BME-280 sitting on my desk for 60 minutes. Notice the 7 feet of elevation difference even though the unit is in a static location. I've even tried other sensors such as the MS583702BA01-50 (13cm altitude resolution), but the same issue. I've had to add "zeroing" code to get a reliable starting point.
yes the atached result photo was for the my flight computer code which includes bmp280 also. here in this atached file i gave a result from i2c example of the adafruit bmp280 library and as it aoears the altitude is 49 meter while it was 41.3 in past photo.The serial monitor dump you show is not from the code you included in above message.
I seePitch Error
andRoll Error
and several lines with 12 datapoints.
Did you also run the exact sketch that you included above? I guess you took the sketch from here and changed the last line todelay(1);
fromdelay(2000);
.
Paul
thanks for your widly explantation. the sea level pressure on my place was 1019 as i saw it on weather website and today it is 1018 in some websites and 1020 in others. the problem is even i put 1018 in the code the result still varying but in small range(2 or 3 meter). so the question is, how i can control my rocket in the air and make it stable if there are 2 or 3 meter varies in altitude detection? and there is a way to make the sensing more precise?Very confused on what you mean by false result - if you mean that your reading will be different from day to day or hour to hour. Yes it will be if you don't update your sea level pressure for the area close to.... Note the sea level reading will also be varying just as a note but it looks like you have sea level pressure fix at 1019mb.
The 1019mb is the standard sea level pressure but you need to use the one for your area. For instance I have a major airport (LGA) near me so I use METAR data (https://aviationweather-bldr.ncep.noaa.gov/metar) from the airport. For me right now sea level pressure is 1013.4mb not the standard 1019.
Other note is that the higher the oversampling rate is for pressure and temperature the more accuarate the altitude so you need to make adjust accordingly. Even with that you altitude will not be absolute - may vary by as much as 0.3meters or more depending on your settings.
I don;t have a bmp280 but I do have a bme280 - settings that I am using now are:
Code:bme.setSampling(Adafruit_BME280::MODE_NORMAL, Adafruit_BME280::SAMPLING_X8, // temperature Adafruit_BME280::SAMPLING_X16, // pressure Adafruit_BME280::SAMPLING_X1, // humidity Adafruit_BME280::FILTER_X16, Adafruit_BME280::STANDBY_MS_0_5 );
Hope this helps - may want to read the data sheet as well for the BMP280
ok thanksAre we sure elevations will be the same even if in the same location? I'm pretty sure these units compute elevation from pressure. The constant passed into readAltitude() simply compensates for atmospheric pressure at sea level. The problem with these units is using pressure to compute altitude--namely because pressure changes frequently--especially from changing weather.
Here are results from my BME-280 sitting on my desk for 60 minutes. Notice the 7 feet of elevation difference even though the unit is in a static location. I've even tried other sensors such as the MS583702BA01-50 (13cm altitude resolution), but the same issue. I've had to add "zeroing" code to get a reliable starting point.
You could consider using something like this, a Radio Altimeter intended for use by modelers that compete in international rocketry competitions.
EDIT:
Oops Wrong, this uses Barometric Pressure as well, Sorry