-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
Battery Voltage Measurement Issue on Heltec CubeCell HTCC-AB01
Hardware
- Heltec CubeCell HTCC-AB01 v2
- EC5 Soil Moisture Sensor (connected to GPIO1)
Issue Description
I'm developing a low cost soil moisture sensor using the Heltec CubeCell. While the soil moisture readings from my EC5 sensor are working properly, I'm experiencing issues with the battery voltage measurement functionality.
Code
#include "Arduino.h"
#include "LoRaWan_APP.h"
#define ADC_PIN GPIO1
float voltage=0;
void setup() {
Serial.begin(115200);
pinMode(VBAT_ADC_CTL,OUTPUT);
digitalWrite(VBAT_ADC_CTL,HIGH);
voltage=analogRead(ADC)*2;
pinMode(VBAT_ADC_CTL,OUTPUT);
}
void loop() {
Serial.println(voltage);
delay(3000);
int adcRaw = analogReadmV(ADC_PIN);
Serial.print("ADC RAW: ");
Serial.println(adcRaw);
delay(1000);
}
Output/Results
When running the corrected code that properly attempts to read the battery voltage:
Battery Voltage: 0.00 V
Soil Moisture ADC RAW: 676 mV
Battery Voltage: 0.00 V
Soil Moisture ADC RAW: 676 mV
Battery Voltage: 0.00 V
Soil Moisture ADC RAW: 676 mV
Battery Voltage: 0.00 V
Soil Moisture ADC RAW: 250 mV
Battery Voltage: 0.00 V
Soil Moisture ADC RAW: 11 mV
Battery Voltage: 0.00 V
Soil Moisture ADC RAW: 2399 mV
Battery Voltage: 0.00 V
Soil Moisture ADC RAW: 2399 mV
Expected Behavior
The battery voltage should reflect the actual voltage of the connected battery (typically between 3.3V-4.2V for a LiPo battery).
Attempted Solutions
I've tried various approaches:
- Using the
VBAT_ADC_CTL
pin to enable/disable the battery measurement circuit - Trying both
analogRead(ADC)
andanalogReadmV(ADC)
methods - Trying different calculation methods to convert raw ADC readings to voltage
None of these approaches produce a correct battery voltage value. The battery voltage consistently reads as either 0.00V or an incorrect value (424.00 mV in initial tests), while manual measurements of the battery show the correct voltage.
Questions
- Is there a specific procedure for reading battery voltage on the HTCC-AB01 v2?
- Could there be a hardware issue with the battery voltage measurement circuit?
- Are there any known bugs with battery measurement in the current firmware?
Any assistance would be greatly appreciated!
Metadata
Metadata
Assignees
Labels
No labels