Page 1 of 1

Esp32 Wroom and CCS811 in deep sleep

Posted: Sun Mar 25, 2018 5:40 pm
by meneldor
Hello guys,

Im extending my project and added a CCS811 air quality sensor and need some suggestions from anybody using it in its project.
I put rhe board in deep sleep for 1 minute after all readings. The problem is that this IC needs 20 minutes to stabilize every time its initialized(if i understood it properly) so after every esp32 wake it reinitializes the i2c and CCS811 needa another 29 minutes to calibrate.
There is an WAKE pin which should be pulled low for the ic to read and high to put it sleeping. If esp32 is in deep sleep how do i keep the pin high? Or again i did not read the datasheet properly?
This particular project doesn't use battery but i put it to sleep because my board is getting hot and the temperature sensor reads incorrect values. They are in the same enclosure.

Re: Esp32 Wroom and CCS811 in deep sleep

Posted: Sun Mar 25, 2018 7:55 pm
by WiFive

Re: Esp32 Wroom and CCS811 in deep sleep

Posted: Mon Apr 02, 2018 11:20 am
by meneldor
Thank you, WiFive!

Re: Esp32 Wroom and CCS811 in deep sleep

Posted: Mon Apr 02, 2018 11:53 am
by Deouss
That is very helpful - all data must be in rtc memory or it will be erased after wake up
I am reading about sleep modes
https://esp-idf.readthedocs.io/en/lates ... modes.html

Re: Esp32 Wroom and CCS811 in deep sleep

Posted: Thu Apr 05, 2018 2:00 pm
by meneldor
Im really stuck with this sensor :( Im trying to not interrupt its working between the sleeps.
I tried to:
Put the sensor to sleep before esp deep sleep and wake it after.
Initialize/reset it only the first time.
etc, etc, but it seems that the sensor does not keep its calibration between the sleeps (measurements are always 0/400).

This is my sleep function regarding the GPIO pin connected to the WAK pin of the sensor. Im executing it with sleep(true) right before esp_deep_sleep() and sleep(false) to wake it up after DEEPSLEEP_RESET:

Code: Select all

#define WAKE_PIN      GPIO_NUM_4

void sleep(bool slp)
{
    gpio_pad_select_gpio(WAKE_PIN);
    gpio_set_direction(WAKE_PIN, GPIO_MODE_OUTPUT);
    gpio_set_pull_mode(WAKE_PIN, GPIO_PULLUP_ONLY);
    gpio_set_level(WAKE_PIN, (uint32_t)slp);
    if (slp)
        rtc_gpio_hold_en(WAKE_PIN);
    else
        rtc_gpio_hold_dis(WAKE_PIN);
        
        
    printf("CCS811 put to Sleep: %d, WAKE_PIN: %d\n", slp, gpio_get_level(WAKE_PIN));
    vTaskDelay(60 / portTICK_RATE_MS);   
}
Im not sure why but this gpio_get_level() always prints WAKE_PIN: 0. Im not sure what im missing here.