Can Argon (or Xenon) Read the Battery State?

Has anyone found a way to tell when the battery is being charged? I’m not seeing > 4.3v while charging like @armor suggested. Instead the voltage slowly goes up but also drops occasionally so the best way I can think to detect battery charging is to monitor and average the values over time to see if they rise.

By the way, I gave up trying to produce a formula. I’m seeing roughly a doubling of battery life with the 0.9.0 firmware, even though I haven’t implemented any sleep modes. Perhaps my tweaks to my code have helped but regardless it illustrates the underlying issue. I’d have to re-evaluate the discharge rate for each battery + firmware/hardware combination. Instead I’ve switched to realtime monitoring, tracking the drop in voltage over a few hours. As long as you average the results and compare over a sufficiently long enough period of time (or large enough change) it works well.

1 Like

There is a post - which I can’t find the link to where @rickkas7 provided a reference to a digitalRead() which tells you whether the battery is being charged. >4.2 volts is fully charged.

Yes, the code here will tell if you're charging or not on the Argon and Xenon (it's different on the Boron):

2 Likes

Any tips for reading voltage if powering from a non-Li Ion battery (AA batts and a booster)?
Will a standard voltage divider be the best way? Or is there something on-board I can take advantage of?

Have you tested the code recently? I’m getting some odd results. I flashed it on a Xenon (w/0.9.0) and the USB & CHG was always 1. Another Xenon returned the correct USB value but CHG was always 0. A 3rd Xenon shows CHG is always 1, not sure on USB, don’t have a battery for that one.

Nevermind, in another thread ScruffR said you can determine charging via (PWR && !CHG) and in my limited testing that's working.