HTCC-AB02A - Reading Battery Voltage - Info

Hi all!

I have recently received couple of HTCC-AB02A cube cell nodes and I was actually investigating the power management associated to the 1/2 AA battery.

As I was trying to leverage the existing code from the demo, I have the feeling that the measurement is not as accurate as I was expecting.

Let first start from the code:

#include “Arduino.h”
#include “LoRaWan_APP.h”

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}

void loop() {
// put your main code here, to run repeatedly:
uint16_t voltage = getBatteryVoltage();
Serial.println(voltage);
delay(1000);
}

What I am getting is:

  1. With USB power --> 3310 (as a flat value)
  2. without UBS --> 2830 (raising slowly over time)

The battery is a brand new 3.6V 1/2 AA so I was wondering, am I missing something? 2830 is definetly wrong…

Filippo


You should set VBAT_ADC_Ctl to high and let battery voltage go through the voltage divider before getBatteryVoltage().

You should measure the voltage on the ADC pin using DMM or CRO to verify.

1 Like