Display on during deep sleep?



  • Currently, going into deep sleep (or even light sleep) shuts down the display. I was wondering how we can get the M5stack to go in deep sleep without powering off the LCD.

    Say I want to display something and then keep it on for a minute, during which I don't need any CPU/WiFi/BT/etc. functionality, so those can be powered down. After a minute the CPU should boot the sketch again as if it was rebooted/awaken.

    This behavior was possible if I attach my own LCD to the ESP8266 and I believe it is possible with the ESP32, but why does M5stack switch off the display if I only want to make the ESP sleep? I believe the LCD should power down only if I call M5.powerOFF() and not when I call esp_deep_sleep_start().

    TL;DR: how to enter deep sleep while keeping the LCD on?


  • M5Stack

    @m5er
    You can change powerOFF() function

    0_1549942187652_TIM截图20190212112833.png



  • @watson, thanks for the screenshot. However, this solution doesn't work. As mentioned in my original post, the problem is that esp_deep_sleep_start() itself turns off the display. So changing the powerOFF() function won't solve the problem.

    In fact, try this minimal sketch and see how sleeping turns off the display.

    #include <M5Stack.h>
    
    void setup(){  
      M5.begin();
      M5.Lcd.println("Setup");
    }
    
    void loop() {
      if(M5.BtnA.wasPressed()) {    
        // wake up after 5 seconds
        esp_sleep_enable_timer_wakeup(5000000); 
        // start deep sleep. Display goes out!
        esp_deep_sleep_start();  
      }
      M5.update();
    }
    

    Can we have the display on during deep sleep at all?


  • M5Stack

    Hello, @m5er ESP32 can enter 5 kinds of power saving modes. esp_deep_sleep_start(); means deep sleep mode. You can try the light sleep mode by using esp_light_sleep_start()

    0_1550050538952_TIM截图20190213173521.png

    You can refer to this article.
    https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/sleep_modes.html

    Looking forward to your good news~



  • Thanks @watson. As I mentioned, I also tried with light sleep, but the display again turns off. Do you know of any command to put the ESP in sleep mode without turning off the display?



  • Is there a solution to this problem? I find it really strange that we can't have the display on during light/deep sleep. This harms all kinds of low-power applications that rely on a screen.



  • I can't believe this problem has no solution: keeping the display of M5stack ON during light or deep sleep. It should be trivial and yet no one on this forum can present a working solution. This seems to be an impossible task!



  • @m5er said in Display on during deep sleep?:

    I can't believe this problem has no solution: keeping the display of M5stack ON during light or deep sleep. It should be trivial and yet no one on this forum can present a working solution. This seems to be an impossible task!

    The reason no solution exist is because having the screen on goes against the purpose of deep sleep and also because it’s such an unusual question that you have asked, no one has yet to think of a solution in the esp32 world.

    Please be patient, M5Stack is still a young project and not everything is thought off until the end user posses a query. If you discover a way to do please let us know but in the mean time please continue to wait patiently.



  • I agree with @ajb2k3 that M5Stack is a young project, so that indeed explains the lack of such queries. However, I don't think my use case is unusual - I can think of a lot of applications that would benefit from sleeping while the display is on, such as: a clock showing hours and minutes only (so waking up only once a minute); sensor monitoring application (e.g. temperature, humidity, etc.) that constantly displays the latest values and wakes up once each X minutes to update measurements; displaying the number of twitter followers, likes, page visits, etc. In all these use cases it is useful to have the CPU sleep most of the time while the display remains on.

    In any case, it would be great if someone can present a working solution. It is probably just a few lines of code, but I just can't seem to get the right ones.



  • @m5er

    Thank you.
    What some people dont know is that the esp32 is not like an arduino.
    the esp32 has 3 cores, 2 primary and 1 Ultra Low power.
    In true deep sleep, the primary core are deactivated and the basic "Upkeep" code is off loaded to the ULP.
    Because the M5Stack is based on the ESP32 and not much is understood about the ULP, very little progress has been made on deep sleep.
    In theory, from what I have read the ULP could maintain a low power screen for a Like (to use your example) and then wake up the core to take the sensor measurements before storing them (for the ulp to recall and display) putting the cores back to sleep.

    If you are interested in leaning more, look into the ESP32's ULP (Ultra Low Power core)