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

    M5CoreInk wake up by EXT0 (PIR Hat)

    Cores
    4
    8
    10.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.
    • C
      ckuehnel
      last edited by

      I want to wake up an M5CoreInk by EXT0 (PIR Hat).
      If I connect USB counting works. If I disconnect the USB cable the display loses its contrast and the software crashes.
      I have no idea what's wrong. A program with wakeup by timer works.
      The source is saved at https://github.com/ckuehnel/Arduino2020/tree/master/M5Stack/CoreInk_PIR.
      Any hint is welcome.
      best regards, Claus

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

        Hello @ckuehnel

        try adding these two lines before going into deep sleep:

          gpio_hold_en(GPIO_NUM_12); // POWER_HOLD_PIN
          gpio_deep_sleep_hold_en();
        

        This should keep the ESP32 powered even when going into deep sleep.

        Thanks
        Felix

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

        1 Reply Last reply Reply Quote 0
        • ajb2k3A
          ajb2k3 @ckuehnel
          last edited by ajb2k3

          @ckuehnel said in M5CoreInk wake up by EXT0 (PIR Hat):

          I want to wake up an M5CoreInk by EXT0 (PIR Hat).
          If I connect USB counting works. If I disconnect the USB cable the display loses its contrast
          Any hint is welcome.
          best regards, Claus

          The Display loosing contrast is because you need to set the screen HV to true before writing the frame buffer to the screen. In UIFlow there is a block for this but I have no idea about Arduino.
          It sounds like the battery has not charged and so by removing the power you are killing the program.

          As you are using the Arduino, you may want to look into using the ULP to handle the PIR instead of leaving it to the main cores.

          UIFlow, so easy an adult can learn it!
          If I don't know it, be patient!
          I've ether not learned it or am too drunk to remember it!
          Author of the WIP UIFlow Handbook!
          M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

          1 Reply Last reply Reply Quote 0
          • C
            ckuehnel
            last edited by ckuehnel

            @felmue said in M5CoreInk wake up by EXT0 (PIR Hat):

            gpio_hold_en(GPIO_NUM_12); // POWER_HOLD_PIN
            gpio_deep_sleep_hold_en();

            Hi Felix

            This are the last commands in my setup() now - but w/o success:

              esp_sleep_enable_ext0_wakeup(GPIO_NUM_36,1); //1 = High, 0 = Low
            
              //Go to sleep now
              if (DEBUG) 
              {
                Serial.println("Going to sleep now");
                Serial.flush();
              }
              delay(2000);
              gpio_hold_en(GPIO_NUM_12); // POWER_HOLD_PIN
              gpio_deep_sleep_hold_en();
              esp_deep_sleep_start();
            

            0_1636481727413_20211109_170602.jpg
            0_1636481740807_20211109_170613.jpg 0_1636481762005_20211109_170626.jpg

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

              Hello @ckuehnel

              hmm, that is strange. I've just tried your code with the two additional lines and my M5CoreInk stays in deep sleep just fine. No fading display and counting up when GPIO36 goes high.

              My guess is that maybe the battery charge in your M5CoreInk is (too) low. Have you fully charged the battery before testing?

              I don't have the PIR hat so I am only testing with a wire between GPIO36 and GND or 3.3 V. Maybe the PIR hat is using too much power?

              Thanks
              Felix

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

              C 1 Reply Last reply Reply Quote 0
              • C
                ckuehnel @felmue
                last edited by ckuehnel

                Hi @felmue
                It was a good idea to replace the PIR by a wire. I have tried that w/o success.
                I have prepared a Vbat measuring to see if battery is ok when USB is disconnected.
                The CoreInk had now 3588 loops w/o USB connected. The battery goes from 4.1 V to 3.721 V after all these cycles (one second each). The battery is ok.
                Thanks again.
                Claus

                1 Reply Last reply Reply Quote 0
                • T
                  TwoStick
                  last edited by

                  You need also to set the POWER_HOLD_PIN to '1' once. So in your setup:
                  digitalWrite(POWER_HOLD_PIN,1); //needed to put the state to 1
                  gpio_hold_en(GPIO_NUM_12); //needed apparantly to keep the output also in light sleep WTF?

                  T 1 Reply Last reply Reply Quote 0
                  • T
                    TwoStick @TwoStick
                    last edited by TwoStick

                    @twostick
                    FYI; light sleep current pulled out of the battery depend on the battery voltage:
                    <2.7V device wont wake up anymore
                    2.7V 4.4mA
                    3.0V 3.9mA
                    3.7V 3.1mA
                    4.2V 2.7mA

                    This dependacy is caused by the DC-DC conversion that converts the Lipo voltage first to 5Vdc. (SY7088 chip).
                    The 5Vdc gets also down converted to 3v3 (SY8089 chip) .

                    According to the datasheet, the ESP itself should only use 0.8mA in light sleep. So 2mA gets waisted.
                    What a pitty.

                    dd.07-04-22:
                    The above is not completely true. I'm using the M5GFX lib and when I execute the function display.sleep(); before going to deep sleep (esp_deep_sleep_start();) the sleep current drops to a 1.25mA. Still considerable...

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