# ESP32 and monitoring battery voltage

#### Ya’akov

Joined Jan 27, 2019
6,856
Yes, maybe if was to increase it a little, it can reduce further. This way no need for a switch.
Well, you need to work out a power budget and see what you need to make the device work within the constraints of the design goals. It isn't optimization if you don't get any benefit from it.

#### DJ_AA

Joined Aug 6, 2021
206
Yes, there will be large battery about 4000mA, so few mA for battery detection is not an issue, as i will be charging the device once a week or so

#### ericgibbs

Joined Jan 29, 2010
16,806
Hi DJ,
My note about using the Vss as Vref for the ADC, I thought you were planning to monitor the ESP32's voltage supply source, not an external battery, so the Vss will be OK at 3.3V.

E

#### DJ_AA

Joined Aug 6, 2021
206
Ok, but the issue also arise that if battery was to drop very low say for example 3V, it is possible that ESp32 would function at maybe lower voltage, therefore the VCC ref would not be 3.3V. How would this effect the ADC?

#### ericgibbs

Joined Jan 29, 2010
16,806
hi DJ,
As you may know, the 12Bit ADC of the ESP32 powered by Vss= 3.3V, will give a count of 4095 when the ADC Vin is 3.3V.
Also if the Vss falls to 3.0V the ADC count will be 4095 when the ADC Vin is 3.0V.

eg:
say the Vss=3.3V and Vin ADC = Vss/2 [ your resistive divider] = 1.65V, the ADC count would be 4095* (1.65v/3.3v)= 2047.

If Vss falls to say 3.2V , thats 1.6v at the divider, the ADC count will be 4095*(1.6/3.2) = 2047 and so on .... ie: 2047.

Do you follow that OK.?

E