Battery Level Indicator
setting the GPIO high turns on Q1 and Q2 presenting half the battery voltage to the analog input.

setting the GPIO it low turns off Q1 and Q2 avoiding unneeded drain on the battery.







simulate this circuit &ndash; Schematic created using CircuitLab