Monitoring Battery source voltage?

If doesn't fit into any other category ....
Post Reply
Zim
Posts: 282
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 258 times
Been thanked: 128 times

Monitoring Battery source voltage?

Post by Zim »

Hi all
If we use a pin to monitor source voltage, does the CPU reading get skewed by the drop in supply voltage?
How could it give a reading if it has nothing to compare to?

Thanks
Zim?
BeanieBots
Posts: 344
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 182 times
Been thanked: 112 times

Re: Monitoring Battery source voltage?

Post by BeanieBots »

It depends on the board you are using.
The ESP itself has an onboard reference and the input to the adc is 0 - 1v.
Some dev boards have a divider to make the range 0 - 5v but are not well layed out and pick up a lot of noise.

It's quite useful as a random number generator and I've read that by applying a voltage you can bias the randomness up and down.
I've also heard that the linearity is affected by how many stray cats are in your neighbourhood at the time you take the reading :lol:

Other than that, it's actually not too bad as long as you are careful about source impedance and don't mind some non-linearity on the ESP32.
For a bare module to monitor it's own battery supply, all you need is a potential divider to bring it down to a max of 1v from whatever the supply is.
I typically I use 3M3//1M0 to keep current down but that means you must also fit a 1uF (or greater) capacitor DIRECTLY on the adc pin to stop it floating in the breeze. Bare in mind that 3M3//1M0 + 1uF is quite a large time constant so it will take several seconds to register a voltage change.
User avatar
Electroguard
Posts: 856
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 273 times
Been thanked: 321 times

Re: Monitoring Battery source voltage?

Post by Electroguard »

A V1.2 Wemos Battery Shield can be connected to A0 via J2 option link (solder bridge), allowing any wemos footprint device (including ESP32's) to monitor the LIPO battery voltage (can also easily be hardwired to non-wemos footprint devices just by connecting supply pins and A0).
Obviously they will already have the appropriate components included needed to match the A0 analog input to the LIPO battery voltage.
Must be V1.2 Battery Shield though, else doesn't have J2 option for connecting battery to A0.

Edit: Take an analog reading of a lowish battery to be used as the low-warning threshold for sending low-battery warning email or udp msg etc, but everything above that reading signifies the battery is ok.

Almost any single cell LIPO battery can be used, and the shield has built-in LIPO charger to optionally charge it from any dc voltage source such as USB or solar panel.
v1.2.jpg
You do not have the required permissions to view the files attached to this post.
Post Reply