How frequently should I read the BME280 sensor?

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
FBminis
 
Posts: 3
Joined: Thu Oct 21, 2021 1:21 pm

How frequently should I read the BME280 sensor?

Post by FBminis »

I'm a beginner trying to go further than the example sketches in the library (which I was able to run correctly).

I would like my device placed outside to send me readings every 30min, as well as to Thingspeak. Ive read the datasheet for the sensor, particularly the different sampling modes, and I'm not sure if I need to keep updating the values from the sensor like:

Code: Select all

float temp, hum, pres;

setup(){
// get things ready, etc
}

loop(){
temp = bmp.readTemperature();
temp = bmp.readTHumidity();
pres = bmp.readPressure() / 100;
 
if (30minHavePassed){
sendToMe();
sendToThingspeak();
}
Or otherwise only call the functions and read the sensor when 30min have passed:

Code: Select all

float temp, hum, pres;

setup(){
// get things ready, etc
}

loop(){
if (30minHavePassed){
readings();
sendToMe();
sendToThingspeak();
}

readings(){
temp = bmp.readTemperature();
temp = bmp.readTHumidity();
pres = bmp.readPressure() / 100;
}
Thank you

User avatar
sj_remington
 
Posts: 994
Joined: Mon Jul 27, 2020 4:51 pm

Re: How frequently should I read the BME280 sensor?

Post by sj_remington »

To reduce sensor noise, read the sensor a number of times and average the readings. For a noisy pressure sensor, it is reasonable to average 100 readings. Some sensors have this process built in, as an option. The BME280 includes an IIR filter that optionally averages 2 to 16 of the most recent readings.

You can also improve measurement precision (to a limited extent) using a similar approach. For example, add up 100 readings and divide by 10 to get an extra decimal place in the result.

Obviously this takes time, so the question of "how frequently" may be moot.

User avatar
FBminis
 
Posts: 3
Joined: Thu Oct 21, 2021 1:21 pm

Re: How frequently should I read the BME280 sensor?

Post by FBminis »

The sensor should be read every 60 seconds when in Forced mode, according to the datasheet and Adafruit library

https://www.bosch-sensortec.com/product ... rs-bme280/

https://github.com/adafruit/Adafruit_BM ... ttings.ino

https://www.esp8266.com/viewtopic.php?f ... 0&start=28

https://github.com/finitespace/BME280/issues/23

```
// weather monitoring
Serial.println("-- Weather Station Scenario --");
Serial.println("forced mode, 1x temperature / 1x humidity / 1x pressure oversampling,");
Serial.println("filter off");
bme.setSampling(Adafruit_BME280::MODE_FORCED,
Adafruit_BME280::SAMPLING_X1, // temperature
Adafruit_BME280::SAMPLING_X1, // pressure
Adafruit_BME280::SAMPLING_X1, // humidity
Adafruit_BME280::FILTER_OFF );

// suggested rate is 1/60Hz (1m)
delayTime = 60000; // in milliseconds```

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”