Electron - How to tell if a battery is connected

Is there a way, using perhaps FuelGuage or PMIC, to tell in code if a battery is connected or not?

Unfortunately the online docs for these two Firmware libraries are lacking details. I’ve played around a little and discovered that getSoC and getVCell return “reasonable” values even when no battery is connected.

This is actually difficult to detect. The code sample in the last comment to this post works, however.

2 Likes