Display on during deep sleep?



  • 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)



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

    dernières valeurs et se réveille toutes les X minutes pour mettre à jour les mesures; affichage du nombre d'abonnés twitter, de likes, de visites de pages, etc. Dans tous ces cas d'utilisation, il est utile de laisser le CPU dormir la plupart du temps pendant que l'affichage reste allumé.
    Dans tous les cas, ce serait bien si quelqu'un pouvait présenter une solution de travail. Ce n'est probablement que quelques lignes de code, mais je n'arrive pas à trouver les bonnes.

    Hello,

    I'm editing this old post... Do you have a solution?

    Pierre



  • @PierreD

    Random Nerd Tutorials published by Rui and Sara Santos have a tutorial how to use the deep sleep mode on the ESP32and how to store data in the RTC memory:

    https://randomnerdtutorials.com/esp32-timer-wake-up-deep-sleep/

    I havn't tried it out yet, but it probably should also work with the M5Stack ESP32.

    @PierreD Tu trouves une code exemplaire de programmation pour le sub-ordnateur ESP32-RTC au site de Rui et Sara Santos à https://randomnerdtutorials.com/esp32-timer-wake-up-deep-sleep/

    bonne chance crami25



  • Hello Crami25,

    Thank you for your help.
    I took the time to try, to test.

    For sleep, it's OK.
    I made a small example but it doesn't work every time ???

    On the other hand, I wish to wake up with the buttons.
    I've searched the schematics:
    Button A GPIO39
    Button B GPIO38
    Button C GPIO37

    Following the example of this site:
    https://randomnerdtutorials.com/esp32-external-wake-up-deep-sleep/

    ext0
    In this example, the ESP32 wakes up when the GPIO 33 is triggered to high:

    esp_sleep_enable_ext0_wakeup(GPIO_NUM_33,1); //1 = High, 0 = Low
    Instead of GPIO 33, you can use any other RTC GPIO pin.

    #include <M5Stack.h>

    #define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds /
    #define TIME_TO_SLEEP 10 /
    Time ESP32 will go to sleep (in seconds) */
    //#define BUTTON_PIN_BITMASK 0x8000000000

    void setup()
    {
    Serial.begin(115200);
    M5.begin(true, false, true);
    esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
    Serial.println("Setup ESP32 to sleep for every " + String(TIME_TO_SLEEP) + " Seconds");

    esp_sleep_enable_ext0_wakeup(GPIO_NUM_39,0); //1 = High, 0 = Low

    //esp_deep_sleep_start(); //entre en someil profond

    }

    void loop() {

    M5.update();// update button state

    if (M5.BtnA.wasReleased())
    {
    esp_sleep_enable_ext0_wakeup(GPIO_NUM_39,0); //1 = High, 0 = Low
    }

    if (M5.BtnB.wasReleased())
    {
    esp_deep_sleep_start(); //entre en someil profond
    }

    if (M5.BtnC.wasReleased())
    {
    M5.Lcd.fillScreen(WHITE);
    M5.Lcd.setTextColor(BLUE);
    M5.Lcd.setBrightness(100);
    M5.Lcd.setTextSize(2);
    M5.Lcd.setCursor(40, 60);
    M5.Lcd.print("Temperature: ");
    }
    }



  • Hey @pierred and @crami25 - no offense, but it looks like you are hijacking this thread to discuss a different topic, i.e. how to wake from sleep. The original topic of this thread is "how to enter deep sleep while keeping the LCD on". This is still not solved and I doubt that it will ever be.



  • @m5er During deep sleep the LCD background led draws(a lot of) current. Also you have to refresh your screen 50 times per second
    The only solution to your problem would be adding an e-ink display which doesn't need any refresh during deep_sleep.