Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensor sanity check #112

Open
baranyaib90 opened this issue Sep 25, 2024 · 2 comments
Open

Sensor sanity check #112

baranyaib90 opened this issue Sep 25, 2024 · 2 comments

Comments

@baranyaib90
Copy link

baranyaib90 commented Sep 25, 2024

Arduino board: Arduino Nano v3
Arduino IDE version (found in Arduino -> About Arduino menu): 2.3.2

Dear Maintainers!
I would like to ask for some improvement of this library to make it more robust in case of wiring issues.
Because of thermal expansion sometimes my wires get loose and I have contact issues. I know, this is my problem, I should have solder it, and so on.
But I would expect to have some sanity check functionality from the library side.

Given the following test scenario:

  1. Running the code of: bme280test.ino
BME280 test
-- Default Test --

Temperature = 28.53 °C
Pressure = 1003.00 hPa
Approx. Altitude = 85.73 m
Humidity = 50.89 %

Temperature = 28.74 °C
Pressure = 1003.03 hPa
Approx. Altitude = 85.46 m
Humidity = 50.77 %
  1. When I disconnect the sensor, I do not get NAN values (except Approx. Altitude), instead invalid values:
Temperature = 179.55 °C
Pressure = -160.23 hPa
Approx. Altitude = nan m
Humidity = 100.00 %

Temperature = 179.55 °C
Pressure = -160.23 hPa
Approx. Altitude = nan m
Humidity = 100.00 %
  1. After reconnecting the sensor, finally there are NAN values:
Temperature = nan °C
Pressure = nan hPa
Approx. Altitude = nan m
Humidity = nan %

Thanks to NAN values, I can call the begin() function again and I can make the sensor work properly.
But I have no workaround for now to avoid the invalid values.
If there would be a possibility to check if the sensor is really connected and responding properly, that would be great!
For example:

  1. sensorID() function could actually querry the sensor ID and not returning a cached value. I don't want to call begin() all the time before measurement.
  2. There could be a isConnected() or similar function which checks if the sensor responds to a command with valid data.

Thank you in advance!

@LeunyEumel
Copy link

LeunyEumel commented Sep 30, 2024

I am facing the same Issue - or have the same feature request

trying to run two bme280 with I2C over long cables frequently the sensor readings got stuck on:
Humidity: 100%
Temperature: 180.59°C
Pressure: -157.83
I assume this is due to the I2C erroring

I would prefer a cleaner way than to check my readings against above values to decide when to reset the sensors/the I2C

(I have seemingly solved this now with 1k pullups to 3V3 on SDA and SCL and going to slightly shorter cat8 cables.
I would feel more confident to deploy longterm though if there was a proper way to detect failed readings)

@LeunyEumel
Copy link

Update: the pullups only partially solved the problem.
Every 12 to 24h approximately the sensor still returns invalid readings.

Seems the Issue might be related to the Sensor itself:
https://community.particle.io/t/bme280-sensor-problem/49627/32

The proposed solution of providing 3v3 via a GPIO and power cycling whenever invalid readings has improved my situation.
I will report back after letting it run for some days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants