• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
M5Stack Community
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

M5paper touchscreen wakeup from sleep

Cores
5
11
12.8k
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.
  • J
    Joonas
    last edited by Joonas Mar 15, 2021, 1:46 AM Mar 14, 2021, 5:45 PM

    I'm looking to find out how to wakeup M5Paper from sleep(light or deep sleep) with the touchscreen. Some people say its possible and some say not. I have not find any solutions for this. I tried quite many things but nothing is working. Could someone help me on this?

    Currently i'm running a program that shows weather on the screen when deep sleeping and refreshes it every 30mins. If i push the side button down (GPIO 39) device wakeup from deep sleep and shows my touch screen home app that i can turn lights on and off. So i'm trying to replace the side button wakeup with touchscreen. A) Because Its quite hard to push the side button correctly B) it takes 5-7 secs to wakeup with this solutions. Also if someone is interested I get about 80 hours of battery on time with this solution.

    1 Reply Last reply Reply Quote 0
    • F
      felmue
      last edited by Mar 14, 2021, 5:55 PM

      Hello @Joonas

      Here is how I put my M5Paper into deep sleep with touch wake up:

      esp_sleep_enable_ext0_wakeup(GPIO_NUM_36, LOW); // TOUCH_INT
      gpio_hold_en(GPIO_NUM_2); // M5EPD_MAIN_PWR_PIN
      gpio_deep_sleep_hold_en();
      esp_deep_sleep_start();
      

      or light sleep with touch wake up:

      esp_sleep_enable_ext0_wakeup(GPIO_NUM_36, LOW); // TOUCH_INT
      esp_light_sleep_start();
      

      Thanks
      Felix

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

      J K 2 Replies Last reply Mar 14, 2021, 6:27 PM Reply Quote 0
      • J
        Joonas @felmue
        last edited by Mar 14, 2021, 6:27 PM

        @felmue
        Big thanks. Now it works.
        I was missing the two lines "gpio_hold_en(GPIO_NUM_2);" & "gpio_deep_sleep_hold_en();" The other lines I already tried.

        Now i will keep testing to make the battery life and wakeup times better.

        1 Reply Last reply Reply Quote 0
        • F
          felmue
          last edited by Mar 14, 2021, 8:24 PM

          Hello @Joonas

          you are welcome. I am happy to hear you got it working to your liking.

          Cheers
          Felix

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

          J 1 Reply Last reply Sep 10, 2021, 3:57 PM Reply Quote 0
          • J
            jcl @felmue
            last edited by Sep 10, 2021, 3:57 PM

            Hello @felmue
            With an M5Paper V1.1 and your code sample, I can't put the device in deep (instant reboot with RTC_IO wakeup cause) or light sleep. This works well with BTN_UP.
            Is there a difference with V1.0 that can explain this behavior or something I missed ?
            Thanks
            JC

            1 Reply Last reply Reply Quote 0
            • F
              felmue
              last edited by Sep 10, 2021, 11:27 PM

              Hello @jcl

              this issue happens with Arduino framework 1.0.5 and when WiFi is enabled before going to sleep. See here for possible work-a-round.

              Thanks
              Felix

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

              1 Reply Last reply Reply Quote 0
              • K
                kelcon @felmue
                last edited by Nov 26, 2021, 9:33 PM

                @felmue - is latency between waking up from deep sleep is low enough to capture the same touch in main code (after wake up)?

                1 Reply Last reply Reply Quote 0
                • F
                  felmue
                  last edited by Nov 27, 2021, 6:13 AM

                  Hello @kelcon

                  yes, the main code can read the same touch which has caused the waking up since the touch IC stores the last touch coordinates for the main code to fetch it.

                  Thanks
                  Felix

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

                  A 1 Reply Last reply Apr 16, 2024, 4:48 AM Reply Quote 1
                  • A
                    actuar @felmue
                    last edited by Apr 16, 2024, 4:48 AM

                    @felmue If I use esp_deep_sleep_start(); with canvas.drawJpgUrl() it restarts every 5 seconds. Works with light.

                    1 Reply Last reply Reply Quote 0
                    • F
                      felmue
                      last edited by Apr 16, 2024, 6:22 AM

                      Hello @actuar

                      well there is different behavior regarding program flow after waking from deep sleep vs waking from light sleep.

                      After waking from deep sleep the program flow is (re-)started from the top. Which looks like a restart as it actually is a restart.

                      After waking from light sleep the program flow continues and does not restart.

                      Thanks
                      Felix

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

                      1 Reply Last reply Reply Quote 0
                      • A
                        actuar
                        last edited by Apr 23, 2024, 8:38 AM

                        Thank you, all clear now, so M5.shutdown(600) will run again the entire setup. Great!

                        Now M5.shutdown(600) it is run actually every 9 minutes and M5.shutdown(3600*11) every 2 and almost a half hour, not 11 hours.

                        In order to avoid charging problems I use:

                        if (voltage<4150) {
                        M5.shutdown(shutdownDuration);
                        }

                        otherwise it restarts every 5 seconds when charging. Is there any other solution when charging?
                        The battery only charges to max 4100 and is dead at 3410: just bought a new M5Paper a week ago.

                        float voltage = M5.getBatteryVoltage();

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