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, 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?
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.
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:
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.