Reboot ESP32 Basic Core IoT on battery/USB



  • Hello,

    I use M5Stack ESP32 Basic Core IoT, arduino programming with battery SKU: M002.

    I am doing telemetry.

    I permanently power the ESP32 via USB.

    The battery is there for safety in case of power failure.

    My problem is :

    When I turn off the power, the ESP32 reboots.
    I lose my telemetry data.

    I saw this page on Power
    https://github.com/m5stack/m5-docs/blob/master/docs/en/api/power.md

    I have tried a lot of options but it doesn't work!
    Do you have a solution ?

    Best regards

    Pierre



  • Seems like a place for M5Stack team to get involved with, external memory hat module with lib for grove port communication with memory and uiflow memory blocks that store information, HELLO, M5STACCK TEAM "WAVES"....



  • a video showing the battery reboot problem :

    https://photos.app.goo.gl/SK2xeaiBvxcBfyHE8



  • A simple demo code here :

    #include <M5Stack.h>

    // the setup routine runs once when M5Stack starts up
    void setup() {

    // initialize the M5Stack object
    M5.begin();

    M5.Power.begin();

    // Lcd display
    M5.Lcd.fillScreen(WHITE);
    delay(500);
    M5.Lcd.fillScreen(RED);
    delay(500);
    M5.Lcd.fillScreen(GREEN);
    delay(500);
    M5.Lcd.fillScreen(BLUE);
    delay(500);
    M5.Lcd.fillScreen(BLACK);
    delay(500);

    // text print
    M5.Lcd.fillScreen(BLACK);
    M5.Lcd.setCursor(10, 10);
    M5.Lcd.setTextColor(WHITE);
    M5.Lcd.setTextSize(1);
    M5.Lcd.printf("Display Test!");

    // draw graphic
    delay(1000);
    M5.Lcd.drawRect(100, 100, 50, 50, BLUE);
    delay(1000);
    M5.Lcd.fillRect(100, 100, 50, 50, BLUE);
    delay(1000);
    M5.Lcd.drawCircle(100, 100, 50, RED);
    delay(1000);
    M5.Lcd.fillCircle(100, 100, 50, RED);
    delay(1000);
    M5.Lcd.drawTriangle(30, 30, 180, 100, 80, 150, YELLOW);
    delay(1000);
    M5.Lcd.fillTriangle(30, 30, 180, 100, 80, 150, YELLOW);

    }

    // the loop routine runs over and over again forever
    void loop(){

    //rand draw
    M5.Lcd.fillTriangle(random(M5.Lcd.width()-1), random(M5.Lcd.height()-1), random(M5.Lcd.width()-1), random(M5.Lcd.height()-1), random(M5.Lcd.width()-1), random(M5.Lcd.height()-1), random(0xfffe));

    M5.update();
    }



  • This is expected behavior with the early versions of the M5stack core products (black, grey, Fire, Go).

    For a quick fix, purchase and use the Core2 instead.

    For a DIY fix, read through the details of this thread:
    https://community.m5stack.com/topic/1822/no-reset-when-usb-power-removed-solved



  • Hello Wold101,

    Thanks for your answer.

    I need to continue to use the M5Stack Core as I have made some backplane electronics and need to use the M5Stack stock.

    I didn't know about this post and I already used a diode and had a bug with the ESP. Probably this problem of low battery charge.

    The idea is great to use a MAX40200 but it requires extra wiring.

    I tried with a capacitor. I have some 4700µf in stock at 63V.

    I like this solution, no modification and it works well.

    I will test it over several days.