I’d like to take (and send) battery readings. I can do this with Sodaq boards because they have a voltage divider on the Lipo charge circuit. Here’s the code to read it (NB: pin A6):
#define ADC_AREF 3.3
#define BATVOLTPIN A6
#define BATVOLT_R1 4.7
#define BATVOLT_R2 10
float getRealBatteryVoltage() {
uint16_t batteryVoltage = analogRead(BATVOLTPIN);
return (ADC_AREF / 1023.0) * (BATVOLT_R1 + BATVOLT_R2) / BATVOLT_R2 * batteryVoltage;
}
So my question is can I do this with the Sparkfun board? Looking at the schematic I see there is a divider with VBATT_LVL marked and as far as I can see this is on A5. So can I use the same code (changing to A5 of course)?