• 0 Posts
  • 2 Comments
Joined 1 year ago
cake
Cake day: July 4th, 2023

help-circle
  • Not sure I understand this point. Which resistor would you replace with a diode?

    Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).

    Not sure it'll work with just a P-FET actually. You'll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn't really best practice).

    The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.

    I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.


  • Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?

    Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You'll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).

    Switch it with an NFET

    The micro will see 0V or divided/clamped battery voltage on the measurement pin.