Page 1 of 1

RTC GPIO output level in deep sleep mode

Posted: Fri Apr 20, 2018 8:58 am
by Railgun
Dear ESP32 users,

I have a question related to the ESP32 deep sleep mode and the RTC GPIO pins. I'm setting up a watering system for outdoor planters, with an ESP32 as the system's command. I want it to last for a few weeks on a single 1Ah lipo, so I need to put the ESP32 in deep sleep mode most of the time. The watering system is commanded using a 4-module relay (https://www.aliexpress.com/item/12V-4-C ... 78055.html, I think 3.3v should work even though it's nominally 5v). It's normally closed, which means if I want my watering system to be off during deep sleep, I need to send a high signal permanently. Now, I know that during deep sleep setup, esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON) keeps the RTC GPIO awake, but I'd like to know how to set these pins as high-level outputs (if possible while not eating through my battery too much).

If I recall correctly, gpio_pullup_en(gpio_num) will set these pins to high, but pullups are for input states only, correct ? However, since a high level means the current won't flow through the relay module's diode, maybe it doesn't matter ?
If I set the corresponding pins to high before deep sleep and then start the deep sleep mode, will they remember these states, or do I need a coprocessor routine to enable then again ?

And thank you for the large amount of I was able to get just reading this forum :).

Re: RTC GPIO output level in deep sleep mode

Posted: Sun Apr 22, 2018 11:16 am
by WiFive
http://esp-idf.readthedocs.io/en/latest ... gpio_num_t

But you probably should be using latching relays or latching solenoid valves

Re: RTC GPIO output level in deep sleep mode

Posted: Mon Apr 23, 2018 11:57 am
by Railgun
Thanks, that's exactly what I needed. That was easier than I expected, too.

Unfortunately, most IoT relay modules are of the normally-closed kind, but with a bit of appropriate software it works fine. :D