M5stack Timer Camera F: advice on using power.isCharging()



  • Hello everyone,

    I'm currently working on a project using the M5Stack Timer Camera F board with the ESP-IDF (Espressif IoT Development Framework) environment. I need to determine whether the device is currently charging or not, and I came across the power.isCharging() function provided by the M5Stack library.

    However, since I'm using the ESP-IDF and there is no mention of the timer camera in the library documentation, I'm unsure how to correctly use this function within my project or if it is possible at all.

    Could someone please guide me on how to use the power.isCharging() function in the M5Stack Timer Camera F with the ESP-IDF environment? Specifically, I'm interested in understanding the necessary setup and any additional configurations or code snippets required to access this functionality.

    Any advice, examples, or insights would be greatly appreciated.

    Thank you in advance for your help!

    Best regards,
    Simone



  • Hello @simoc

    AFAIK power.isCharging() is a function from M5Stack devices (Base, Fire, etc.) which use a power management chip (IP5306) which allows to read this information via software (I2C).

    In Timer Camera F a different solution is used to charge the battery which doesn't have I2C and therefore doesn't allow to check whether the battery is being charged via software.

    As you can see from below picture (taken from this schematic), the charger IC doesn't have I2C and also the CHRG pin is not connected to anything.

    0_1684396853931_M5StackTimerCamFBatCharger20230518.png

    I see two possibilities:

    • you could try to read the battery voltage via ADC as there is a connection from the battery through a voltage divider to GPIO38. However it will be difficult to determine from that whether the battery is actually being charged or not.
    • you could modify the hardware and connect the CHRG output to a free GPIO of the ESP32.

    Thanks
    Felix



  • Dear @felmue

    Thank you very much for your quick response!

    Unfortunately, it is what I expected, but you were very kind!

    Best,
    Simoc