How to measure a battery.

jenya7
Posts: 19
Joined: Mon Feb 24, 2020 9:14 am

How to measure a battery.

Postby jenya7 » Thu Aug 13, 2020 7:16 am

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?
Last edited by jenya7 on Thu Aug 13, 2020 11:55 am, edited 3 times in total.

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: How to measure a battery.

Postby tommeyers » Thu Aug 13, 2020 1:55 pm

Use a ruler if you want to measure its size. Use google if you want to measure its charge.
IT Professional, Maker
Santiago, Dominican Republic

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: How to measure a battery.

Postby jgustavoam » Wed Aug 26, 2020 3:07 am

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).
Retired IBM Brasil
Electronic hobbyist since 1976.

dynek=
Posts: 7
Joined: Thu Aug 27, 2020 11:28 am

Re: How to measure a battery.

Postby dynek= » Thu Aug 27, 2020 11:34 am

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

Who is online

Users browsing this forum: No registered users and 68 guests