#ESP32-S3 Deep Sleep from Circuit Python

1 messages · Page 1 of 1 (latest)

crisp needle
#

I am a bit of a noob, and I am trying to get my Feather into deep sleep in my Circuit Python code. I have been looking for a code example, and only found non-CP examples. Can anyone help point me in the right direction? Thank you!

golden knoll
#

I found some examples in there that helped me get into the whole sleeping thing.

crisp needle
#

That's a good lead. I'll give it a read. Thanks!

crisp needle
#

OK... I think I have deep sleep working. Now, trying to figure out how to power down the I2C bus (sensor has an LED on it, want that OFF), and the power to the screen. I note that there are pins for this, but the coding has eluded me.

#

(hardware is ESP32-S3 Rev TFT with a SHT4x hanging on the I2C bus)

crisp needle
#

Will this work?

import digitalio
import board

i2c_power = digitalio.DigitalInOut(board.I2C_POWER)
i2c_power.switch_to_input()```
crisp needle
#

After much gnashing of teeth, I got this working.

        print ("TFT, I2C, NEO powering down")

        #Turn off power to the TFT, I2C bus.  This is not working yet.
        TFTpwr = digitalio.DigitalInOut(board.TFT_I2C_POWER)
        TFTpwr.direction = digitalio.Direction.OUTPUT
        TFTpwr.value = 0

        print ("")

        NEOpwr = digitalio.DigitalInOut(board.NEOPIXEL_POWER)
        NEOpwr.direction = digitalio.Direction.OUTPUT
        NEOpwr.value = 0


        # Create a an alarm that will trigger TestInterval seconds from now.
        time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + TestInterval*NormalReportIntervals)

        # Exit the program, and then deep sleep until the alarm wakes us.
        alarm.exit_and_deep_sleep_until_alarms(time_alarm)

        # Does not return, so we never get here.