BME688 with Deep Sleep

I have configured a BME688 sensor in ULP mode on an ESP32 to go to 20min deep-sleep and then wake up for couple of seconds:

bme68x_bsec2_i2c:
  address: 0x77
  model: bme688
  sample_rate: ULP
  supply_voltage: 3.3V

deep_sleep:
  run_duration: 30s
  sleep_duration: 20min

It looks like this works well for temperature/humidity/pressure measurements, but not for the IAQ. The accurracy measurement is always “unknown” after wakeup and then “stabililzing”. As far as I understand the documentation, the value is only stored after 6h (or whatever value is configured in state_save_interval) and thus the calibration starts all over.

Is it safe to set state_save_interval to, for example 20s, so it would save the state for every wake cycle? Or is deep-sleep something that does not go well together with a BME688?
Would I need to run the sensor several hours to do an initial calibration, before I can properly use deep-sleep?

As far as I know waking drom deepsleep is a restart.

Spiro is correct … deep-sleep is misnamed. It is actually a power off and power on operation which you can see in the ESPHome Log taken from a USB or serial terminal. And mentioned in the Notes on ESPHome deep_sleep thread.

Fortunately global variables are stored in non-volatile RAM so are retained through the “sleep”.

I recall seeing in ESPHome docs some device which specifically advised against deep_sleep because it has to start the long calibration process each time. I wondered if it was BME280; but no, it was MAX17043 battery fuel gauge.

Note also that ESPHome is multi-threaded … meaning that measuring sensors thread starts before the on_boot thread has finished - which can cause initial values to be incorrect. You might need to wake for a while longer for the IAQ reading to stabilize.

I see. I have another (mains-connected) sensor and the calibration can take several hours and it jumps between calibrating and calibrated also several times a day (the battery powered one does not even reach the calibration stage). So it is apparently not really feasible for this sensor to do the IAQ.

Before, I had it the sensor’s VCC hooked up to a GPIO, to save even more battery. But that lead to errornous readings after deep sleep (all would be too high and then settle after a few seconds). Running the sensor in ULP and keeping it connected to the battery definitely helped, but I thought that also calibration data can be stored - but as far as I understand it, this calibration is something that is done on the ESP and not on the sensor, right? Thus the ESP has to continously get data to do it?
I guess for this particular sensor, I would either need to think about a solar panel or going back to just measuring temp/humid/pressure, as this is an outdoor sensor any way.

I’ve been running outside temp sensors with deep sleep since 2021 with a cell+ solar panel and found the BMP280 would run well for several months then stop reading and only work again if I disconnected the cell and reconnected it. My suspicion was it was changing from i2c to SPI. 2 years now and still no proble with the SHT.

BMP280 is different than BME688…

True , but it is a Bosch sensor that runs on spi or i2c. It seems overkill to put this more expensive sensor outdoors and not perhaps be able to use some of it’s more advanced features as intended. The sensor will get weathered.
What sort of project box have you got it in? Please send a pic.

Yes, it is certainly overkill :wink: I had a bmp280 installed before (and before that a sht21), which however got faulty humidity reading after two years while. I havn’t tried the IPA approach yet and had a spare bme688 here…

The sensor is at my balcony and well protected from rain and direct sunlight. The esp is however still in a plastic bag, because I did not had the time to 3d print a proper enclosure :smiley: I can take some pictures later if interested.

However, I think I’ll revert to something like sht45 + separate pressure sensor and use the BME somewhere else.

I always like to see what others have tried for outdoor projects involving ESPs. I have gone through several variations of cases.

It’s not an ESP, but a STM32 device (way less energy consumption than an ESP).

This is what it looks like after being outside for 5 years with still the same single AA Alkaline battery. Battery voltage currently: 1,388V
Expected Battery Liftetime: 10 years.

Some infos about the project:

Product page:

When comparing the pic from the product page to the current picture, you can see some UV light influence which changed the colour of the ABS enclosure. And there seems to be some rust on the screws now. But apart from that it’s still working and still sending every 30 seconds (yes: seconds) temperature + humdity with 2 decimal places, and once per hour its battery voltage.

P.S.: internal sensor used: SHT40

PPS: I’m working on different enclosures right now - to make the product more “sexy” because people often judge a book by its cover.

3 Likes

I guess that anything else than wifi will already give a huge energy saving :wink:

Yes, WiFi is meant for high speed transmissions (high data rate), not for low data rate / low power.


In my back yard I have a cheap 433mhz temp/humidity sensor that runs on 2AA cells. I replaced the cells with a TP4056+lithium cell from a discarded vape with a 30mmx90mm 5V solar panel. The sensor is put in a outdoor junction box and never gets direct sunlight. Solar is on other side of wall facing west. Only running with lithium cell for 6 months and I had to open box once as soldered wire to battery compartment had come off.
You can see the difference between front of house temp which gets the sun directly and the back of the house.