Is there a way to tell if an Arduino MKR GSM 1400 has lost power and has to rely on the connected battery?

Ideally, I'd like to do this without adding additional circuitry. Alternatively, can I connect VIn to an analogue input pin?

On the schematic, there are two lines that seem promising. One named VBATT\2.4B that go into PB09 of U1 via a voltage divider and another named VBAT\1.4B. Also the BQ24195L is an I2C device which would probably be connected the the main micro controller.

What I need to do is to send an SMS as soon as the incoming power is lost to notify a user that the power supply has tripped. Does anyone have any code samples?

  • did you succeed with this? Looking at the suggested library, the (misnamed) function 'isBattConnected()' returns the DPM_STAT bit from the SystemStatusRegister. I think that this indicates when there is a draw of current from the battery, but I'm not 100% sure about that when I read the spec sheet: (ti.com/lit/ds/symlink/bq24195l.pdf section Dynamic Power Management) Can you share anything you figured out?
    – broc.seib
    Oct 1, 2021 at 18:09
  • It did work, yes. I'm going to have to dig out the code for this, but yes, there is a call to see if I power was lost and it worked perfectly.
    – Gineer
    Oct 4, 2021 at 8:26

1 Answer 1


VBATT/2.4B is used for measuring the batter voltage using the internal ADC of the MCU. It can't really tell if the battery is being used or not - except by maybe monitoring it over time and see if the voltage goes up or down.

However the BQ24195 is where all your hope lies. It has a status register that can tell you all sorts of things.

For example it can tell you if there is incoming power, and what that incoming power is coming from (a USB host, a USB power adaptor, or operating in OTG mode). It can also tell you what the battery is doing - if it's charging, or not for example.

A quick google search throws up this library specifically for the purpose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.