Skip to content

How to correctly tell if the battery is drained or not? #10

Description

@zekageri

I have an arduino project with ESP32 and I'm using this library ( which is great btw ).
Currently on power on I'm doing the following

boolean RTC::begin(){
    Wire.begin(rtcSDA_Pin, rtcSCL_Pin);
    Wire.setClock(400000);
    if( !rtc.begin() ){
        Serial.printf("[RTC] - Failed to initialize RTC\n");
        return false;
    }
    Serial.printf("[RTC] - RTC initialized\n");
    checkBattery();
    rtc.clockEnable(true);
    return true;
}

void RTC::checkBattery(){
    Serial.printf("[RTC] - Battery is %s\n", rtc.isRunning()?"charged":"drained");
}

If i call rtc.clockEnable(true); the library will tell me that the battery is ok even if it is drained.
But if i don't set the clock to true it will never be ok, even if i replace the battery.

What is the recommended way of handling the low battery? I want to report to the users that they should replace it even at runtime.
So i would call the check battery function periodically.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions