Right now I do not have an issue or problem, I just want to share my findings - and as this forum is the first place where I look for solutions if I have a problem with Arduino - I think this is the right place to put it first.
I wanted to read the voltage of the battery like with the MKR1300. I failed. Here is the information what I was able to gather - so others can use (and don’t have to research it for 1/2 day)
- The battery is not connected to an internal analog input on the MKR1310 like on other MKR’s (PB08).
- The on board power chip is connected through I2C bus. (type: TI bq24192l)
- The address of the chip is 107.
- Be careful, when reading the registries - for some bits, the first reading is referring to the time interval since it was read the last time (there is no automatic set back), and it is set back after the reading. So if you want to get the current state, read it twice: 1st read is for the past, 2nd read is the current state.
Some information of the battery state can be read from the REG 08 and REG 09 registers, like:
- REG08; Bit 5&4: 00: Not charging / 01: Pre charging (depleted battery charging) / 10: Fast charging / 11: Charge termination done
- Bit 0: 0: Battery voltage > System minimum voltage, 1: Battery voltage < System minimum voltage (literally: battery low)
- REG09: Bit 0: BATT_FAULT
I would like to check for how long can the board operate and send messages in the the low battery state. (I know it depends on the power usage of the board)
I think a good comparison would be to see: how long can the board operate on a single charge and compare the 2 time intervals:
% = hours run on low battery (bit0=1) / full hours run on battery.
Of course the test should not be made in low power mode… I do not have THAT long time for this test…
But I assume the calculated percentage could also be used with low power mode applications to calculate how long the device will last after the battery voltage has dropped under the V min level.
Or am I missing something? - I always keep the right to be wrong…