Possible to disable qwiic bus while Thing Plus C sleeps?

Hi, I have a Thing Plus C with qwiic connected RTC and relay boards. In development I like that the boards each have an LED to show me that they’re connected, however, these LEDs consume more power than the Thing Plus does when it is asleep in a production deployment on battery power.

Is it possible to disable power to the qwiic bus before sleeping and then just turn it on again when the Thing wakes from sleep?

Thanks.

Hi @mhixson,

Yes, you can disable the Qwiic bus power. Please see this example for details:

https://github.com/sparkfunX/SparkFun_E … ontrol.ino

Best wishes,

Paul

Thanks, Paul. That example sketch works on my Thing Plus C. What I’ve found is that as soon as I disable the qwiic power and put the Thing to sleep the qwiic bus immediately gets powered again (the LEDs on both qwiic boards turn back on and stay on while it is sleeping). Any reason why the qwiic bus can’t stay powered down while the Thing sleeps? Is there some other code I need to call to make that happen?

Thank you.

Hi,

I’m not too familiar with the ESP32’s low power states… You need to find a way to make sure that pin 0 remains an output and continues to be low while the ESP32 is asleep. If the pin goes into a “high impedance” state, the Qwiic power will turn back on again.

There is some relevant information here:

https://github.com/espressif/arduino-esp32/issues/2712

It looks like this code might do the trick?

gpio_hold_en(GPIO_NUM_0);

gpio_deep_sleep_hold_en();

Merry Christmas!

Paul

Thank you! That indeed did the trick. One thing I noticed that my board was not turning the qwiic bus back on when it would wake up from timer. I went poking through the Espressif docs here:

https://docs.espressif.com/projects/esp … /gpio.html

And found that I needed to call this at the top of setup() before trying to use my qwiic boards:

gpio_hold_dis(GPIO_NUM_0);

pinMode(qwiicPower, OUTPUT);

digitalWrite(qwiicPower, HIGH);

The last two lines alone aren’t enough to turn the qwiic power back on. The gpio_hold_dis(GPIO_NUM_0); call is what does the trick. Just wanted to mention it in case anyone else runs into this.

Thanks again and Merry Christmas to you too!

-Matt