Skip to content

[Feature Request]: Detect charging status by measuring current flow with configured INA219 battery sensor #5226

Description

@nebman

Platform

NRF52, ESP32

Description

Nodes that use an e.g. INA219 for monitoring the battery voltage (explicitly set address in the power settings) could detect the charging status by measuring the current flow across the shunt. The current implementation in AnalogBatteryLevel doesn't make much use of the isCharging() function.

If the current is negative, that indicates the battery is being charged.

I forked the repo and created a minimalistic implementation for the INA219 only (I can expand that to the INA3221 and INA260 classes although I can't test those). It works pretty well on two of my nodes. Link to my fork/branch
The patch includes two defines to either disable or swap the detection direction (for those who wired VIN+/VIN- the opposite way or just have one of those bad designed modules which reference one input directly to gnd).

Thoughts? Should I go ahead and submit a PR?

Pictured: Node with INA219 not charging (left) and charging (right).
charging_indicator

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions