Fall/Collapse Detection Problem - BME280

As a former software developer, I am newly interested in arduino, my goal is to get the information about whether my tree has fallen over or not. I don't want to do it using IMU (I found and used similar codes for IMU), I bought BME280 and I want to do it with it.

If you ask why I don't use lidar sensors, my tree can be 5 meters or 50 meters or 50cm, so I didn't want to use it or I didn't want to use it because I don't know which direction the tree will fall when it falls.

I wanted to calculate using BME280, I can pull the data from the meteorological center in my country every minute, I use the pressure information reduced to sea level from the data I pull (I use it instead of 1013.25 value. ) My problem is that as I threw in my codes, the incoming data is constantly moving +-2 meters in meters (I didn't take a long test, I'm sure it will be more mobile), which causes errors, now the sensor is just standing on my desk, I don't touch it in any way. According to the datasheet, it says that there may be +-7cm drift, but it upsets and surprises me that there is so much drift.

I don't understand if I'm making a mistake somewhere, in fact, all I want is for the sensor to take a fixed position, for example at 20 meters, and I want to be able to get how many cm it moves up and down, I don't care about values such as pressure, temperature, humidity, I just want information about the change of the position of the device. I have MPU6050, MPU6500 and 9DoF sensor but I want to do this with BME280 if possible, please help me, sorry for my English.

bme.setSampling(Adafruit_BME280::MODE_NORMAL,
                Adafruit_BME280::SAMPLING_X16,   // temperature
                Adafruit_BME280::SAMPLING_X16,   // pressure
                Adafruit_BME280::SAMPLING_X16,   // humidity
                Adafruit_BME280::FILTER_X16,
                Adafruit_BME280::STANDBY_MS_500);

void getPressure() {
  pressure = bme.readPressure();
  pressure = bme.seaLevelForAltitude(ALTITUDE, pressure); // ALTITUDE is coming on https://whatismyelevation.com my location
  pressure = pressure / 3386.39;  // Convert hPa to in/Hg
  Serial.print("Pressure: ");
  String pressureString = String(pressure, 2);
  Serial.print(pressureString);
  Serial.println("");
}

void getAltitude() {
  altitude = bme.readAltitude(SEA_LEVEL_PRESSURE); // this data is coming on local
  Serial.print("Altitude: ");
  String altitudeString = String(altitude, 5);
  Serial.print(altitudeString);
  Serial.println(" m");
}

the incoming data is constantly moving +-2 meters

You need to average a large number (e.g. 100) of BME280 readings to get reasonably stable values.

With averaged values you should be able to measure 20 cm difference in altitude, or about 3 Pa change in ambient pressure near sea level.

it upsets and surprises me that there is so much drift

Temperature and weather changes cause pressure measurement drift, but keep in mind that the BME280 is not the best choice of pressure sensor.

Thank you sir,

"With averaged values ​​you should be able to measure 20 cm difference in altitude, or about 3 Pa change in ambient pressure near sea level."

I don't fully understand this part, I think it's because I used translation. I'm sorry, but I have to say that using the WINDOW_SIZE logic, I take an average of 100 readings, sort these data from largest to smallest, subtract the first 10% and last 10% of the data, add the remaining 80 data, divide by 80 and take the average. . I still experience deviations when I use this, it may be because I use the delay time as 10-20ms, currently the delay time is set to 1 second, I don't know how much delay I should make if I use window logic.

Frankly, I am looking for an absolute and clear solution because there is nothing I haven't tried.

There may be a problem with that sensor, or you are doing something wrong.

For help on this forum, you need to post basic information, like the code and wiring. See the "How to get the best out of this forum" post for instructions.

In any case, I recommend to get a better sensor. Bosch sensors are NOT state of the art. The LPS22 and LPS25 are vastly more stable and accurate than what you report for the BME280.

Thank you for your reply sir, I understand what you mean; I connect to ESP8266 via SDA and SCL, I know there is no problem on the installation side, I use I2C (via 0x76) as a library; I am using Adafruit BME280, thank you for warning me that this information is needed.
The sensors you mentioned directly are not sold in my country, so what's next? What should I do?

I didn't think Bosch could cause this much of a problem. While it says +-7cm on the site, what can I do about the shift in meters now? I would appreciate it if you could share the code or something.

Something is wrong, but you have not provided enough information for anyone to know what that is.

Good luck with your project.

Hello sir, can you share the information you want to know? I think I have shared all kinds of information, please be more descriptive.

I can share the full codes if you want, please tell me whatever you want.

I did the wiring this way, temporarily; The only thing I wonder is whether it might be caused by trying to feed two sensors with 3.3v output. I hope this is the issue. Can you share your opinion?

I would recommend something simpler like a tilt sensor / switch. My experience with pressure sensors is to avoid the cheap units if accuracy / stability is required.

Thank you sir, I am already buying it using a tilt sensor, I want to use it with a Barometer to get a more accurate result by using more than one sensor, but I am wondering, as I said, how can there be a difference of meters when Bosch says +-7cm? My sensor is just sitting on my desk, I wonder if it is not in a closed box. I don't know if the room temperature affects it or not.

That would be in the "How to get the best out of this forum" post, as I suggested in reply #4. It is linked at the head of every forum category.

Come on, please, I have already shared all the information, you are just sending the same message, you do not say what the missing information is, I thought I could benefit from the forum very well, but I do not understand your messages, I would like an answer on the subject. If you have any questions, please ask directly.

watching this video, the BME280 should be giving more accurate and stable readings than you are getting. Maybe your sensor is broken