CR2032 Battery Monitoring using ESP32
Posted: Tue Feb 13, 2024 6:05 pm
I have the following circuit which seems to work. My question is whats the resistive load/drain on the battery, if any, that I should consider using mofsets and resistors so they battery lasts a long time.
+BAT -> A0 of ESP32. Common Grounds.
My multimeter (I don't have high end sophisticated ones) shows 0uA consumption possibly because the consumption is in nA. The ESP32 is USB 5v powered. The battery, I would like to last a couple of years (non-voltage-measuring usage of battery will make it approximately last 2 years); and I want to make sure the drain, if any, when not measuring the voltage does not reduce the battery life to mere months.
Any thoughts?
+BAT -> A0 of ESP32. Common Grounds.
Code: Select all
const int analogPin = A0;
void setup() {
Serial.begin(115200);
//only measure during bootup, works for our use case
int batteryValue = analogRead(analogPin);
float batteryVoltage = batteryValue * (3.3 / 4095.0); // Convert ADC value to voltage
Serial.print("Battery Voltage: ");
Serial.println(batteryVoltage);
// Configure analog pin as input with no pull-up or pull-down -- will this do it to essentially disconnect the battery from ESP32?
pinMode(analogPin, INPUT);
}
void loop() {
// Additional code here...
delay(30000); // Just for demonstration, adjust as needed
}
Any thoughts?