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

    M5Paper deepsleep with UIFlow ?

    Cores
    2
    6
    8.2k
    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.
    • L
      littlbee
      last edited by

      Hello

      I'd like to create a small app for my M5Paper using UIFlow, that will wake up once per hour at day time to fetch new values (via HTTP or MQTT), update the display then go back to sleep in between updates.

      How to achieve this using UIFlow ?

      Thanks !

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

        Hello @littlbee

        below code connects to WiFi, sends a HTTP request and then shuts down for 10 seconds. After 10 seconds the process repeats itself.

        Note: for the code example to work the code need to be downloaded into M5Paper. If you only execute the code from within UIFlow it will be lost after the restart.

        Note: for the code example to work M5Paper needs to run from battery. If USB is plugged in M5Paper doesn't really turn off and hence the RTC cannot restart it.

        0_1640031017724_UIFlowM5PaperShutdownHttpExample20211220.png

        Thanks
        Felix

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

        L 1 Reply Last reply Reply Quote 1
        • L
          littlbee @felmue
          last edited by

          @felmue thanks Felix. I have no issue with UIFlow to do htttp requests or subscribe to mqtt topics to retrieve whatever data, my question is how can I set the m5paper in some deep sleep mode in between data updates and screen refreshes. In your code sample, you don't do anything specific, if not mistaken, to handle deep sleeps and wake ups. I believe with your code sample, the m5paper is going to just remain powered and connected to the wifi hence draining battery fast.

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

            Hello @littlbee

            the last statement Restart after seconds 10 actually turns everything off except for the RTC. After 10 seconds the RTC powers on the system which restarts the code from the top. While in shutdown mode I measure about 3.5 micro ampere at the battery.

            Thanks
            Felix

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

            1 Reply Last reply Reply Quote 1
            • L
              littlbee
              last edited by

              Felix, thanks a lot. Sorry I missed this "Restart after seconds" block and its purpose.
              Seems to be working fine indeed, my M5Paper app restarts for now every 30 minutes, running since yesterday afternoon and barely any battery consumption yet. Perfect.

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

                Hello @littlbee

                no worries. I am glad to hear you got it working to your liking. And thank you for reporting back.

                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