I am trying to measure the voltage level of a battery with a microcontroller and a bit of circuitry (since the voltage level will be above 5V). A simple circuit like this can be constructed to measure the battery voltage with an MCU's ADC capabilities:
However, I want the battery to be loaded by this external circuitry only when measurements are taking place. The circuitry in the schematic above will continuously load the battery with a leakage current flow from the zener diode (which is present to ensure the voltage level never exceeds 5V to safely measure with the MCU ADC).
So, I thought about using a enhancement mosfet as a switch. The design specification would be such that no load on the battery exists unless the mosfet is turned on. The only way I was able to successfully implement a mosfet was after R2 .. but that really defeated the purpose. In this way, without current flow (mosfet off), V1 appears across the zener and the device will significantly conduct current if it's > 5V (in this case it is). So that design is actually worse than not using a mosfet at all. Without the zener diode in place there is no protection from placing a high voltage (higher than 5V) at the terminals of the MCU.
I then tried to place the mosfet before R1, but experienced significant voltage drop across the device that I was not able to explain (I am not that fluent with these devices).
I could replace the zener with an integrated regulator, but they have load currents also and the voltage will be lower than 5V at times which causes non-linear output (compared to the zener which does not alter voltages under its breakdown).