🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Deep Sleep with MicroPython

    M5 Stick/StickC
    2
    2
    4.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      koichirose
      last edited by

      Hi, I'd like to press the M5 button on my M5StickC-Plus, do something, turn it off/deep sleep and turn it back on with the 'M5' button, as it is easily accessible. Basically I think this is how one of those Dash buttons used to work.

      I tried with:

      axp.setLDO2State(False)
      axp.setLDO3State(False)
      

      The screen turns off, but the device seems very much alive (I tried issuing commands from the REPL) and, when unplugged, completely discharges in a short period of time (maybe a few hours?)

      Is there a way to do this? I saw there may be something for Arduino, not sure if it works reliably, but I'd be willing to port my code to Arduino to have this functionality.

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by

        Hello @koichirose

        here is how I managed to get M5StickC Plus into deep sleep using MicroPython:

        p37 = machine.Pin(37, mode = machine.Pin.IN, pull = machine.Pin.PULL_UP)
        p37.irq(trigger = machine.Pin.WAKE_LOW, wake = machine.DEEPSLEEP)
        machine.deepsleep(20000)
        

        It wakes up from deep sleep either after 20 seconds or when button A is pressed.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        1 Reply Last reply Reply Quote 0
        • First post
          Last post