Esp32 Wroom and CCS811 in deep sleep

meneldor
Posts: 75
Joined: Mon Dec 25, 2017 7:28 am

Esp32 Wroom and CCS811 in deep sleep

Postby meneldor » Sun Mar 25, 2018 5:40 pm

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.


meneldor
Posts: 75
Joined: Mon Dec 25, 2017 7:28 am

Re: Esp32 Wroom and CCS811 in deep sleep

Postby meneldor » Mon Apr 02, 2018 11:20 am

Thank you, WiFive!

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Esp32 Wroom and CCS811 in deep sleep

Postby Deouss » Mon Apr 02, 2018 11:53 am

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

meneldor
Posts: 75
Joined: Mon Dec 25, 2017 7:28 am

Re: Esp32 Wroom and CCS811 in deep sleep

Postby meneldor » Thu Apr 05, 2018 2:00 pm

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.

Who is online

Users browsing this forum: No registered users and 92 guests