I would like to track the battery that supplies my microcontroller.
I was thinking at a simple voltage divider bridge wired to an ADC input.
As my divider bridge will be permanently connected, I suppose the resistors will consume current all the time.
I wonder if there is not a more energy-efficient way to measure it.
EDIT 1 :
- My microcontroller is an STM32L422. I know I could use the ADC of the VBAT pin of the uC to measure this voltage (p38 of the datasheet) but I read p73 of the datasheet that the VBAT max was of 4V. Problem, my battery can go high as 4.2V, so I can't use it directly.
- I will probably run my uC at 8MHz for HSE and at 32KHz for LSE.
- I'm using standard li-ion battery like this one for instance (4.2V max)
- My charge management IC is the MCP73831, here is the datasheet
- My LDO voltage regulator is the XC6220
EDIT 2 :
There is the the power section schematic :
- Vbat being the battery voltage, the one that I'm trying to monitor
- +5VDC_(24V) = a possible 5V input from a 24VDC to 5V regulator.
- +5VDC_(USB) = a possible 5V input from an USB power source.
- +3VDC = The voltage used for the uC and all the other components.