Get charging state (plugged in/not) SparkFun Battery Shield

I have a SparkFun battery shield, with an external power source plugged into VIN. The Photon runs off battery, or charges the battery when plugged in - things seem to work.

I’d like to turn on an LED when plugged in, like a “charging light”. How can I monitor the plugged in state?

@bkanuka there seems to be a charge led on the shield? - https://learn.sparkfun.com/tutorials/photon-battery-shield-hookup-guide#battery-shield-overview

Otherwise, you can make use of the fuel gauge and check for the % of charge and control and external led accordingly: https://learn.sparkfun.com/tutorials/photon-battery-shield-hookup-guide#using-the-max17043-lipo-fuel-gauge

Thank you. I came up with the same solutions and came back to write them when I saw your reply.

I ended up soldering a short wire to the surface mount charge LED and then to a digital pin (although I assume an analogue pin would have worked too). This works.

I didn’t want to just monitor the charge level in case it was a “noisy” measurement. This also would take more software than I liked :slight_smile: I monitor the charge level to turn my charge LED green when the battery is >90% full.

1 Like