Resistance divider for measuring battery voltage 3.7V

I have ESP32 and I would like to measure the battery voltage of 3.7V (max 4.2V) on the analog pin. What resistors to choose? To have the full measurement range.

Thank you very much.

Probably a 100k to 330k should work. You need big resistances to avoid too much leak current for the measurement, as you have to keep in mind that over that voltage divider a constant current is flowing (which isn't a good thing for battery driven devices).

That sounds great. It is recommended to put a capacitor between the resistor and the output analog pin there as well. For example, 100nF?

Output analog pin? I don't see an output pin involved there.

Have a read of this article about measuring battery voltage using a potential divider and capacitor.

This site is useful for working out resistor values too.

Hi @cevepe
espressif recommends calibrating the ADC.

read this link at: ADC Calibration

" The esp_adc_cal/include/esp_adc_cal.h API provides functions to correct for differences in measured voltages caused by variation of ADC reference voltages (Vref) between chips."

RV mineirin

1 Like