Recovery of ENS160 from deep sleep mode

I sent the text below to the Core Electronics Support email address and was asked to post this here.
Any assistance would be appreciated.

Recently I purchased a couple of ENS160s from you (in separate transactions) and they are basically working well.

However, the device I want to use them with needs to be battery powered (recharged by a solar cell) and so I need the devices to draw as little power as possible when not in use. One of the things that I liked about the ENS160 was that the ’deep sleep’ mode existed and the data sheet shows a very low current draw in tis mode.

As indicated in the below email to the manufacturers, I can put the device into ‘deep sleep’ but I don’t seem to be able to recover from that state successfully.

I sent the attached email (and a reminder) to the device manufacturers but as yet I have not received a response.

Therefore I am writing to you to see if your ‘wizards’ are able to provide me with he correct way to move from ‘deep sleep’ back to an operational state, and possibly (as a company rather than an individual) get the support from the manufacturer.

I imagine that others would e interested in this as well and so it might make a good item for your web site.



Text to

Hello tech Support,

I have an ENS160 on a PiicoDev board connected to an Digi XBee3 via I2C. The Xbee3 is running the Digi Micropython. The code is based (very heavily) on the code at GitHub - CoreElectronics/CE-PiicoDev-ENS160-MicroPython-Module: CE PiicoDev ENS160 MicroPython Module

Normally it is working well and providing me with the results I need.

However I now want to use the ‘deep sleep’ mode (to preserve battery) and I am having problems getting the sensor to work once I come out of deep sleep.

On the initial power up and after the initialisation if the ENS160 (as per the class initialisation function in the above link), the status is 0x87 and the various values are read with reasonable values.

I set the OPMODE register to 0x00 and then sleep the XBee3. When it wakes I set the OPMODE register to 0x01 (which I can see works by reading it back) and then to 0x02 before looping back to read the status and AQI, eCO2 and TVOC values again.

However the time the status is 0x01, the temperature (DATA_T after the supplied calculation) is -273.15 and humidity (DATA_RH again after the calculation) is 0. The AQI, TVOC and eCO2 are all 0.

I cannot see in the data sheet anything about how to switch between the various OPMODEs other than the state transition diagram in Section 15 and section 16.2.2. This does no indicate that any other delays or commands are required when switching between the various modes (although I do wait about 20uS between my mode switching, following the example in the initialisation code of the liked file above).

What’s the correct command sequence required to restore operation after a deep sleep?

Does the ENS160 require re-initialisation after coming out of deep sleep?




Hey @Susan109576 - welcome to the forums!

It looks like you’re doing everything you’re supposed to! I have a couple of questions about the finer details:

  • Are you reading the DATA_XXX registers multiple times and repeatedly getting the same default values? It may be that multiple reads will resolve the default-data problem. This might also reveal any timing quirks. It’s not strictly necessary to check the status before a read. If you continuously read from the sensor it might reveal where the problem is. Which brings me to:
  • NEWDAT is bit1 (not bit0), are you reading the correct bit?

The update rate on this sensor is quite slow! From memory it’s only about 1Hz or so. You may be reading from the data registers too early.

As an sanity check, you may just want to re-initialise the sensor when you come out of deep sleep. It seems unnecessary, but may be an instructive stepping stone to a more elegant solution.

Hope this helps - we’d love to see a more detailed project write-up :smiley:


Hello Michel.
Thank you for the assistance - you have pointed me in the right direction. It appears that you need to wait for 1 second after restoring the ‘STANDARD’ op-mode before the data is correct.
BTW my comment about the status (DATA_STATUS) being 0x01 (i.e. the whole register value) relates to the fact that (as you point out) the NEWDAT bit is ‘bit 1’ and so is NOT set in that status reading. (Actually I note that the status comes back as 0x81 when the data can be read - so the NEWDAT bit does not seem to be as important as the STATAS (‘…OPMODE is running’) bit.
Anyway, waiting the 1 second before trying to access the data after going through the state transitions (as per Figure 17 of the ENS160 datasheet) does the trick. I must admit that I can’t see any reference to this anywhere (other than reference to using the interrupt or polling) so this might help anyone else tring to use the DEEP SLEEP mode.