Battery voltage
Battery Voltage - Argon
The Argon device does not have a fuel gauge chip, however you can determine the voltage of the LiPo battery, if present.
float voltage = analogRead(BATT) * 0.0011224;
The constant 0.0011224 is based on the voltage divider circuit (R1 = 806K, R2 = 2M) that lowers the 3.6V LiPo battery output to a value that can be read by the ADC.
The charge indicator on the Argon can be read using:
bool charging = !digitalRead(CHG);
In other words, the CHG
input is 0 when charging and 1 when not charging, and the !
inverts this logic to make it easier to use.
On the Argon, the PWR
input is 1 when there is 5V power on the Micro USB connector or VUSB pin. You can use digitalRead(PWR)
to find the value.
On cellular devices with a PMIC, you should use System.powerSource()
instead.
Note:
This technique applies only to the Argon and Photon 2. For the Boron, Electron, and E-Series, see the FuelGauge, below.
The Photon and P1 don't have built-in support for a battery.