M5Paper v1.1: Detect charging state and progress

  • I have an M5 Paper v1.1 with ESP32 and it works very nice. I program it in C++ using the Arduino IDE. How can I detect detect whether the device is charging and how can I measure how far the battery is charged? I cannot find that in the documentation.

  • Hello @MauriceX111

    the M5Paper uses an SLM6635 to handle the battery. Unfortunately this IC has no control lines (like I2C) so it cannot be queried about the battery state. It does have two pins which indicate charging and full charge, but both pins are not connected / used in M5Paper.

    All there is, is the battery (through a voltage divider) is connected to GPIO35 of the ESP32.


  • Hi @MauriceX111 I've also just got an M5 Paper v1.1 (my first experience of M5 or ESP32) and it is a very nice product but I'm also struggling to find out things... Very grateful that this community - and especially @felmue - are here, otherwise I'd be completely stuck!

    Felix pointed me at the code that the device ships with.

    Searching this, I found here the following code

        // Battery
        _bar->pushImage(498, 8, 32, 32, ImageResource_status_bar_battery_32x32);
        uint32_t vol = M5.getBatteryVoltage();
        if (vol < 3300) {
            vol = 3300;
        } else if (vol > 4350) {
            vol = 4350;
        float battery = (float)(vol - 3300) / (float)(4350 - 3300);
        if (battery <= 0.01) {
            battery = 0.01;
        if (battery > 1) {
            battery = 1;
        uint8_t px = battery * 25;
        sprintf(buf, "%d%%", (int)(battery * 100));
        // _bar->drawString(buf, 498 - 10, 27);
        _bar->fillRect(498 + 3, 8 + 10, px, 13, 15);

    So that doesn't help with finding out whether the battery is charging; but it does seem to be the best available way to represent the charge level.