Page 1 of 1
How to measure a battery.
Posted: Thu Aug 13, 2020 7:16 am
by jenya7
I'm planning to power my ESP32 board directly from a battery. How can I measure the state of the battery to alert a user on low battery?
May I apply VCC directly to an analog input to measure the battery voltage?
Re: How to measure a battery.
Posted: Thu Aug 13, 2020 1:55 pm
by tommeyers
Use a ruler if you want to measure its size. Use google if you want to measure its charge.
Re: How to measure a battery.
Posted: Wed Aug 26, 2020 3:07 am
by jgustavoam
Tommeyers se não quer ajudar, não atrapalha.
Hi Jenya,
If you are using the lithium ion battery to power the ESP32, you can measure the voltage at the battery poles.
But don't connect directly! The input of the ADC pin is limited to 3.3 Volts.
And the lithium-ion battery voltage can be up to 4.2 V in the fully charged state.
Therefore, use a voltage divider with two resistors. (for exemple, two 10 K ohms resistors).
Re: How to measure a battery.
Posted: Thu Aug 27, 2020 11:34 am
by dynek=
Jenya,
To stabilize voltage, you may also want to add a capacitor and a resistor "just in case of":
https://github.com/esp8266/Arduino/issu ... -222891420
I've done so yesterday evening to mesure a backup battery for my home automation device (to ensure it doesn't go below 12V, otherwise that means the battery is dying and must be replaced) and it works perfectly.
Edit: that being said the value returned by the ADC and its stability differ when WiFi is turned on
Cheers