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

    Deep Sleep with MicroPython

    Scheduled Pinned Locked Moved M5 Stick/StickC
    2 Posts 2 Posters 5.0k Views
    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 Offline
      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 Offline
        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

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post