Sleep / low power on Paper V1.1 without clearing the display on Wake?

  • Sorry if this is the wrong category, please feel free to move. I have the M5 Paper V1.1 and would like to use it as a graphical clock. The battery doesn't need to last months between charges but the longer the better. I need RTC and not much else. I'm looking for a way to put the device into the lowest possible power mode and update the display once per minute, or so.

    I tried code kindly provided by @felmue in a thread about sleeping (and thoroughly confused myself that shutdown() behaviour appears to be very different when USB power is connected). However, that shutdown() function appears to place the processor into a reset state when it returns/wakes, which in turn clears the display during setup().

    Are there any different ways of managing sleep/low power modes that will retain RAM and resume running in loop() where it left off? If not, are there any tips about how to structure setup() so as to provide the visually smoothest display update regime, while still benefitting from low power shutdown()?

  • Hello @simonm

    if you want a sleep mode which resumes in loop() you'll need to look into ESP32 light sleep mode. Please note: this only puts ESP32 into light sleep mode; everything else is still powered which means the battery doesn't last very long. You can find some measurements here.

    ESP32 deep sleep mode and shutdown mode both restart the ESP32 after sleeping. ESP32 deep sleep mode is not much better than ESP32 light sleep in regard of saving battery power.

    The lowest mode is shutdown mode which turns off everything except the RTC chip. You can find a counter example here. It includes restoring the display and smooth updates of the counter.


  • In order to keep the data on screen after sleep or shutdown, you first have to put the screen into HV mode and then write to the screen. if you don't trigger the HV mode before writing, the display doesn't retain the data you wish to keep displayed.

  • @felmue thanks great explanation and example. In your example, is there any issue restructuring it:

    void setup()
        // First draw old count
        myCount = readEEPROM(EEPROM_ADDR, 0);
        snprintf(myBuf, 10,  "%04d ", myCount);
        CountPageSprite.drawString(myBuf, 20, 20);
        CountPageSprite.pushCanvas(0, 0, UPDATE_MODE_DU4);
    void loop()
        // Then draw new count
        writeEEPROM(EEPROM_ADDR, 0, myCount);
        snprintf(myBuf, 10, "%04d ", myCount);
        CountPageSprite.drawString(myBuf, 20, 20);
        CountPageSprite.pushCanvas(0, 0, UPDATE_MODE_DU4);
        delay(250); // required, else no update
        // This part is only executed if running from USB power
        // Undo what shutdown did
        // Kill some time
        Serial.println("Should not be reached when battery powered 1");
        Serial.println("Should not be reached when battery powered 2");

    to avoid needing to use the GOTO? I realise it will work perfectly well as-is. I think I would like to try and use the shutdown mode, as I can be asleep for most of the time, with updates once per minute at most.

    I find it very unusual that the API docs don't seem to mention that USB power vs battery power makes a difference to whether shutdown() will result in any change to the power state.

    @ajb2k3 thanks for your reply. Please could you elaborate on what HV mode is? I had a look at the Paper API for canvas and power/system but couldn't see anything relating to 'HV'. Do any of the existing API functions already take care of this?

  • Hello @simonm

    thank you for pointing that out. I think I was adapting my code from some other example at the time and I took over the GOTO without questioning it.

    As for the documentation about shutdown and USB power. There is one note about that here. In section Description in the blue marked box.

    When using USB power supply, it cannot be shut down.


  • @felmue thanks for pointing out where that note lives! I'm still getting used to M5 stuff.

  • HV mode stands for High Voltage Write Mode. it is the mode that has to be set on E-Ink displays that need to retain data on power off.
    I don't know what the arduino version is but I know the command must be used before the writing of data.

  • @ajb2k3 thanks so much for that insight. Do you have an implementation of HV write mode for the Paper display in a different platform (UIflow etc)? Don't worry if not, because it seems that existing shutdown() is able to retain images according to @felmue's example.