08-13-2019 06:20 PM
I'm thinking of using BME680 and related software with ESP32 using deep-sleep. In deep-sleep, the system turns system RAM off but small part of RAM (RTC_RAM) is kept powered for preserve the state during the sleep. I was thinking of putting data structures from bme680.h, the integration files into the RTC_RAM and initialize everything once during the power-up but after returning from the deep-sleep, I would just trigger measurements (no initializations) as MBE680 is kept all the time powered in (U)LP so it retains its state during the deep-sleep boot-ups.
This part should work fine but I'm not sure if any system data is kept at libalgosec. If there are some data at the algorithm section that needs to be preserved between measurements (or initialized in the library), then this approach would not work and the best I can do is light-sleep. Can you, please, confirm if you store any system data in the algorithm library that would prevent my approach?
01-10-2020 04:07 PM
Hi Dmitry,
I was able to get it work with an experimental branch of the BSEC Arduino library.
ets Jun 8 2016 00:22:57
rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
000959611: BSEC version 1.4.7.4
000959612: setState:
04 07 04 01 3d 00 00 00 00 00 00 00 73 00 00 00
2d 00 01 01 a9 b4 ad 40 de b8 ad 40 98 28 aa 40
67 26 aa 40 00 00 00 00 2c 01 25 25 00 00 40 40
00 00 40 40 00 00 03 00 17 a8 5f 3f 14 0c 00 02
01 69 1d 00 43 f9 f1 a7 42 10 00 03 01 da 20 97
40 48 81 d3 41 a1 e6 ef 41 16 00 05 01 40 ac 9c
d3 de 00 00 00 00 00 00 00 7c fc 8c 52 01 01 0c
00 09 01 40 ac 9c d3 de 00 00 00 08 00 0a 01 17
9a d3 41 00 00 00 00 d9 4c 00 00
000959642: Successfully set state from 957044
000959646: Sensor init done
000959890: Temperature raw 26.46 compensated 26.39
000959891: Humidity raw 29.84 compensated 29.96
000959891: Pressure 97.78 kPa
000959891: IAQ 127 accuracy 3
000959893: Static IAQ 83 accuracy 3
000959896: Gas resistance 53.03 kOhm
000959900: getState:
04 07 04 01 3d 00 00 00 00 00 00 00 73 00 00 00
2d 00 01 01 a5 b4 ad 40 de b8 ad 40 9c 28 aa 40
67 26 aa 40 00 00 00 00 2c 01 26 26 00 00 40 40
00 00 40 40 00 00 03 00 17 a8 5f 3f 14 0c 00 02
01 b9 3a fe 42 12 cc a6 42 10 00 03 01 5a 25 97
40 03 83 d3 41 03 d9 ef 41 16 00 05 01 00 84 c8
7d df 00 00 00 00 00 00 00 7c fc 8c 52 01 01 0c
00 09 01 00 84 c8 7d df 00 00 00 08 00 0a 01 cf
9c d3 41 00 00 00 00 f7 ca 00 00
000959938: Saved state to RTC memory at 959899
000959942: Deep sleep for 2340 ms. BSEC next call at 962648 ms.
You can find the sketch in the experimental branch here. The BSEC outputs are configured for LP so as to see the calibration and data changes sooner.
01-19-2020 06:44 PM
I just wanted to say thank you!
The latest update of the experimental library and code example helped me solve my issue with the timestamp in ESP32 after deep sleep.
I am working on a ESP32 Sensor with epaper and Lora running on battery, so trying to save as much energy as possible.
01-21-2020 09:44 PM
Maybe one additional note:
01-27-2020 02:14 PM
Hi woessmich,
You can override that delay function by passing your custom idle task in the begin function. Note that this is for all the internal delays, even the ones that a span several milliseconds. The format is defined in the BME680 API. Below is a snippet for your reference.
void myDelayMs(uint32_t periodMs)
{
// Go to sleep if periodMs is sufficiently long
}
void setup(void)
{
// Other stuff
iaqSensor.begin(BME680_I2C_ADDR_PRIMARY, Wire, myDelayMs);
//Other stuff
}
06-07-2020 06:13 PM
Hi kgoveas
I have the same problem, the accuracy is 0, and the link you add, is not available, so can you please tell me how you reach the accuracy 3?