Electronic – Use GPIO to disable voltage divider

adcbatteriesgpiolow-powervoltage divider

I'm using a voltage divider to read the battery level of a wireless sensor platform using STM32L151. I'm shooting to use 20k for R1 and 10k for R2, to be under the 50k limit of the MCU's ADC peripheral.

How do I calculate the current wasted by the divider?

Originally, I was planning on using a P-channel MOSFET to enable the divider when taking measurements to reduce power consumption, but I see that MOSFETs have leakage current and raise the part count.

Can I just set the GPIO to push-pull as the ground for the divider and set it low when I want to measure and high when I don't?

Best Answer

First thing - if the ADC is okay with 50K you can use 150K and 75.0K (the source impedance will be exactly 50K).

The current used by the divider will be 4.3V/225K = 19.1uA.

Unlike most micros, I think you can actually lift the lower end of the divider and reduce the current, if you pick a 5V-tolerant input that is shared with the ADC and use another 5V-tolerant pin for the divider control. At least that is what it looks like to me. You would set the control pin to low/output for divider operation and have the ADC input active. To disable set both pins to digital inputs.