Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nebman opened this issue Nov 2, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@nebman
Copy link

nebman commented Nov 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant