Is it possible to wakeup M5stack paper from the shutdown mode using Port A, B or C?
-
Hello,
I have understand that the M5 stack paper can wakeup from the shutdown mode by long pressing the side button but sometimes it is not feasible.Is it possible to configure M5 stack paper in a way that:
- It will wake up from short press of the side button?
- It will wake up using Port A, B or C by connecting the external button? e.g this button from M5
-
Hello @ScheduleDisplay
unfortunately that is not possible; all GPIOs (Port A, B and C) and the GPIO used for the side button go directly to ESP32 which is powered off in shutdown mode.
The only two options (I know of) to wakeup M5Paper from shutdown mode are:
- long press of side button
- RTC alarm
Thanks
Felix -
@felmue Thank you very much for your reply.
-
@felmue
Hello,
Today I did some testing with the external button to wakeup the M5 stack paper from the deep sleep mode.
I connect the button at the PORT B of Epaper. please see the attached pictures.-
Not connected to the charger: The Epaper didn't woke up from the deep sleep, as expected, as you said.
-
Connected with the charger: The Epaper continously keep restarted after executing the shutdown command, until I unplug the button from the PORT B.
Do you have an idea about this behavior, what is going on with Epaper?
This is the code I am running on Epaper
#include <M5EPD.h> #include <Arduino.h> M5EPD_Canvas canvas(&M5.EPD); #define WAKEUP_PIN_26 26 // GPIO pin on PORT B (G26) #define WAKEUP_PIN_33 33 // GPIO pin on PORT B (G26) void setup() { wakeupM5OnButtonPressMode(); } void loop() { } void wakeupM5OnButtonPressMode(){ M5.begin(); M5.EPD.SetRotation(90); M5.EPD.Clear(true); canvas.createCanvas(540, 400); canvas.setTextSize(4); gpio_hold_dis((gpio_num_t)M5EPD_MAIN_PWR_PIN); gpio_deep_sleep_hold_dis(); // Display battery voltage before shutting down Serial.print("\nVoltage before shut down: " + String(M5.getBatteryVoltage() / 1000.0)); // Update the e-ink display with messages canvas.drawString("Press button on PORT B to wake up!", 5, 160); canvas.drawString("Going to sleep in 5 secs...", 5, 200); canvas.pushCanvas(0, 0, UPDATE_MODE_DU4); delay(5000); // Enter deep sleep shutdownEPD(); } void shutdownEPD() { Serial.println("\nShutting down..."); // Display voltage after shutdown (for debugging purposes) Serial.print("\nVoltage after shutdown: " + String(M5.getBatteryVoltage() / 1000.0)); Serial.print("\n*********************************************\n"); // Prepare for deep sleep M5.shutdown(); // Shutdown the display and peripherals M5.disableEPDPower(); // Disable e-paper power M5.disableEXTPower(); // Disable external power supply // Configure GPIO for wake-up on button press (PORT B - G26) pinMode(WAKEUP_PIN_26, INPUT_PULLUP); // Enable internal pull-up for stability esp_sleep_enable_ext0_wakeup((gpio_num_t)WAKEUP_PIN_33, LOW); // Wake when pin goes LOW // Hold power pins to preserve state during deep sleep gpio_hold_en((gpio_num_t)M5EPD_MAIN_PWR_PIN); gpio_deep_sleep_hold_en(); // Enter deep sleep esp_deep_sleep_start(); }
-
-
Hello @ScheduleDisplay
maybe below lines are the issue?
pinMode(WAKEUP_PIN_26, INPUT_PULLUP); // Enable internal pull-up for stability esp_sleep_enable_ext0_wakeup((gpio_num_t)WAKEUP_PIN_33, LOW); // Wake when pin goes LOW
you enable wakeup on GPIO33 while the pullup is set for GPIO26.
Thanks
Felix -
@felmue Hello,
Thank your for the reply.
I updated the typo and now using the correct GPIO26 pin, but the behavior of E-paper is still the same. -
Hello @ScheduleDisplay
in order to use ESP32 deep sleep ESP32 and external power to the Grove ports need to stay on. Grove power is required for the pull-up resistors in the button unit. (Internal pull-up is too weak.)
I can get your sketch to work if I comment the following lines:
// M5.shutdown(); // Shutdown the display and peripherals // M5.disableEXTPower(); // Disable external power supply
and adding this line:
gpio_hold_dis((gpio_num_t)M5EPD_EXT_PWR_EN_PIN);
after the other
gpio_hold_dis()
line.Plus adding this line:
gpio_hold_en((gpio_num_t)M5EPD_EXT_PWR_EN_PIN);
after the other
gpio_hold_en()
line.Thanks
Felix -
@felmue
Thank you very much for your reply and help.
The code is working now. The M5 paper is now waking up with and without the USB charger connection. :)Just a quick question. Now we have commented out the below lines, so does that means that the battery will drain out much faster as the M5 paper is in light sleep mode?
M5.shutdown();
M5.disableEXTPower();
-
Hello @ScheduleDisplay
I am glad to hear it works for you now.
Yes, the battery will drain much faster when using ESP32 deep sleep or light sleep compared to a full shutdown.
You can find the currents for all three modes here.
Thanks
Felix