02-18-2019 11:49 AM
using Arduino 1.88 / 1.85 with ESP8266 (lib 2.50 / 2.42) and two BME680 sensors.
Final goal is to use these sensors in portable devices, but at first in normal mode without sleeping process.
If using the config_state sample I can see that the state_save and state_load will not work correct.
what is going on:
1) BME starts - after some time will get right values as expected with accuracy=1
2) some time later have still valid values with accuracy=2, sometimes is falling back to accuracy=1
3) auto save procedure (with accuracy=2 (?) or even 1 (!) ) will be done
(have canged this in code that I allow autosave only if accuracy >=2 - maybe "3" is correct? )
4) After autosave to EEPROM with accuracy=3 reboot the ESP (power loss...)
-> Load values from EEPROM
5) BME start and show at first minutes no valid values and accuracy=0 (maybe correct ?)
6) After some minutes accuracy=2 but IAQ is still 0 - for a very long time (hours).
Resistance is in normal range (as before restarting) - so no changes.
The only way is erase the EEPROM and start at new - then all is fine again (until next restart).
I already made some control procedures - but not sure how to get a valid config_load after restarting.
BTW: I have compared the saved and loaded values before - identical.
Any idea?
Thanks!
Michael
Solved! Go to Solution.
02-19-2019 01:36 PM - edited 02-20-2019 12:05 PM
(modified 20.02.19)
As I found out something make it better - but does not solve the problem for all cases.
Add a definition latest_accuracy to the sketch for saving the best accuracy of s aved value in EEPROM.
Then adding "& iaqSensor.iaqAccuracy >=latest_accuracy" to the periodical save procedure (in "else" ) will not allow to write wrong values into the EEPROM
....
int latest_accuracy=1;
....
....
uint16_t stateUpdateCounter=1; // Modify this from "0" to "1" for starting while accuracy=1
....
void updateState(void) { bool update = false; if (stateUpdateCounter == 0) { /* First state update when IAQ accuracy is >= 3 */ if (iaqSensor.iaqAccuracy >= 3 ) { update = true; stateUpdateCounter++; } } else { /* Update every STATE_SAVE_PERIOD minutes */ if ((stateUpdateCounter * STATE_SAVE_PERIOD) < millis() & iaqSensor.iaqAccuracy >= latest_accuracy & iaqSensor.iaqEstimate > 25) { update = true;
latest_accuracy = iaqSensor.iaqAccuracy; stateUpdateCounter++; } } .........
I have added some other checks in my sketch,... but it is a long time job to check what can help 🙂
Waiting for comment from Bosch - hope somebody read the posts? 😉
02-19-2019 07:25 PM
Thank-you for your report (also about the updateState() function).
This behavior was also reported on Bosch Sensortec's GitHub page just before this Community was launched.
Our experts are currently investigating this topic, including with the help of datasets provided by users. We will keep everyone posted as soon as we can come to a conclusion.
02-20-2019 11:44 AM
Yes, I know, it was in Github before closing the issues section.
I have modified the code part above - becasue the accuracy=1 may be already a value for saving the state.
As I wrote - one of my indoor sensors have still the accuracy=1 after >36hours.
Using this code will allow to overwrite the saved state for same or better accuracy, but never will save a value while recalibration, or a value for a lower state.
In this time it help to save the values (and much time) if restarting the device 😉
Michael
02-21-2019 10:11 AM
I have to correct my statement.The code above is not a solution for the main case - it may work if the state_save / state_load functions will work with right values.
It seems (as previously suspected) that the saved (or loaded) values are not correct and the following calculated results from sensor will be wrong.
We can see in the values that the IAQ estimated it wrong after restart. Gas resistance is also in same range as before loading the saved values.
There is a high difference between static IAQ and estimated IAQ.
Sensor below was running before restarting for 15hours without any drops in values (saving state every 3 hours without reload).
So - it seems there is no workaround - I think it should be fixed by the Bosch development team - and in the meantime we should work without the state_load() function and wait some time for calibration after restarting device (what should not be a major problem in most cases)
Time, device, Timestamp, gas/Ohm, IAQ, IAQ accur., temp/°C, hum./%, staticIaq, co2Eq., VocEq. Feb 21 08:32:16 ,BME680-2, 53998825, 180600.64, 65.05, 1, 21.70, 35.04, 42.50, 569.98, 0.65 Feb 21 08:32:19 ,BME680-2, 54001825, 179242.75, 67.62, 1, 21.70, 35.07, 43.62, 574.46, 0.66 Feb 21 08:32:19 ,BME680-2, Writing state to EEPROM ... Feb 21 08:38:58 ,BME680-2, 54400824, 182776.56, 76.45, 1, 21.38, 34.60, 47.48, 589.90, 0.70 ... Feb 21 08:39:46 ,BME680-2, Begin OTA Feb 21 08:39:56 ,BME680-2, End OTA Feb 21 08:40:07 ,BME680-2, Begin (setup) Feb 21 08:40:07 ,BME680-2, Reading state from EEPROM Feb 21 08:40:07 ,BME680-2, 10909, 193847.34, 67.62, 0, 21.43, 35.82, 32.31, 529.25, 0.56 Feb 21 08:40:10 ,BME680-2, 13909, 180016.17, 67.66, 0, 21.34, 35.92, 36.16, 544.63, 0.59 Feb 21 08:40:13 ,BME680-2, 16909, 180992.41, 67.79, 0, 21.36, 35.77, 37.99, 551.97, 0.61 ... Feb 21 08:43:37 ,BME680-2, 220909, 184596.23, 279.48, 0, 21.31, 35.10, 42.11, 568.44, 0.65 ... Feb 21 08:45:04 ,BME680-2, 307909, 183580.86, 491.39, 0, 21.35, 35.05, 41.80, 567.21, 0.64 Feb 21 08:45:07 ,BME680-2, 310909, 184392.28, 500.00, 0, 21.35, 35.05, 41.27, 565.10, 0.64 Feb 21 08:45:10 ,BME680-2, 313909, 184188.73, 250.00, 2, 21.34, 35.03, 41.09, 564.36, 0.64 Feb 21 08:45:13 ,BME680-2, 316909, 184596.23, 243.53, 2, 21.34, 35.02, 40.63, 562.51, 0.63 Feb 21 08:45:16 ,BME680-2, 319909, 183783.05, 248.75, 3, 21.34, 35.01, 41.00, 564.00, 0.64 Feb 21 08:45:19 ,BME680-2, 322909, 183985.67, 250.08, 2, 21.34, 35.00, 41.09, 564.38, 0.64 Feb 21 08:45:22 ,BME680-2, 325908, 184596.23, 243.84, 2, 21.34, 35.01, 40.65, 562.59, 0.63 Feb 21 08:45:25 ,BME680-2, 328909, 184596.23, 239.39, 3, 21.34, 35.02, 40.33, 561.32, 0.63 Feb 21 08:45:28 ,BME680-2, 331909, 184188.73, 241.16, 3, 21.34, 35.03, 40.46, 561.82, 0.63 Feb 21 08:45:31 ,BME680-2, 334908, 184800.67, 235.07, 3, 21.35, 35.01, 40.02, 560.08, 0.63 Feb 21 08:45:34 ,BME680-2, 337909, 185210.88, 226.09, 3, 21.34, 35.01, 39.38, 557.51, 0.62 Feb 21 08:45:37 ,BME680-2, 340909, 184800.67, 224.77, 3, 21.34, 35.01, 39.28, 557.13, 0.62 ... Feb 21 08:55:40 ,BME680-2, 943912, 185517.63, 237.61, 3, 20.44, 36.63, 40.09, 560.38, 0.63 Feb 21 08:55:43 ,BME680-2, 946912, 183379.13, 261.80, 2, 20.44, 36.62, 41.81, 567.25, 0.64 Feb 21 08:55:46 ,BME680-2, 949912, 185412.78, 254.57, 2, 20.42, 36.62, 41.30, 565.19, 0.64 ... Feb 21 09:00:07 ,BME680-2, 1210912, 186036.78, 57.29, 3, 20.91, 36.71, 27.29, 509.14, 0.52 Feb 21 09:00:10 ,BME680-2, 1213912, 185829.63, 58.87, 3, 20.91, 36.70, 27.40, 509.59, 0.52 ... Feb 21 09:03:31 ,BME680-2, 1414912, 186036.78, 27.54, 3, 21.28, 36.21, 25.18, 500.72, 0.50 Feb 21 09:03:34 ,BME680-2, 1417912, 186244.42, 23.42, 2, 21.28, 36.22, 24.89, 499.55, 0.50 Feb 21 09:03:37 ,BME680-2, 1420912, 186036.78, 22.90, 2, 21.29, 36.17, 24.85, 499.41, 0.50 Feb 21 09:03:40 ,BME680-2, 1423911, 184890.38, 36.05, 2, 21.30, 36.18, 25.78, 503.12, 0.51 ... Feb 21 09:06:31 ,BME680-2, 1594911, 185308.06, 10.38, 2, 21.51, 35.95, 23.97, 495.88, 0.49 Feb 21 09:06:34 ,BME680-2, 1597912, 186244.42, 0.50, 2, 21.51, 35.94, 23.27, 493.10, 0.49 Feb 21 09:06:37 ,BME680-2, 1600912, 186244.42, 0.00, 2, 21.52, 35.93, 22.78, 491.12, 0.48 Feb 21 09:06:40 ,BME680-2, 1603911, 185210.88, 0.94, 2, 21.53, 35.92, 23.31, 493.22, 0.49 Feb 21 09:06:43 ,BME680-2, 1606912, 185203.47, 5.95, 2, 21.52, 35.95, 23.66, 494.63, 0.49 Feb 21 09:06:46 ,BME680-2, 1609911, 185005.55, 11.71, 2, 21.52, 35.95, 24.06, 496.25, 0.49 Feb 21 09:06:49 ,BME680-2, 1612912, 184786.25, 18.21, 2, 21.53, 35.92, 24.52, 498.09, 0.50 Feb 21 09:06:52 ,BME680-2, 1615912, 186452.52, 2.48, 2, 21.53, 35.93, 23.41, 493.65, 0.49 Feb 21 09:06:55 ,BME680-2, 1618911, 186244.42, 0.00, 2, 21.54, 35.93, 22.82, 491.27, 0.48 Feb 21 09:06:58 ,BME680-2, 1621912, 185622.91, 0.00, 2, 21.54, 35.90, 22.92, 491.69, 0.48 ... Feb 21 09:09:25 ,BME680-2, 1768913, 184994.64, 0.00, 2, 21.70, 35.73, 22.03, 488.10, 0.48 Feb 21 09:09:28 ,BME680-2, 1771913, 186244.42, 0.00, 2, 21.70, 35.71, 21.36, 485.43, 0.47 Feb 21 09:09:31 ,BME680-2, 1774912, 186036.78, 0.00, 2, 21.70, 35.71, 21.07, 484.28, 0.47