I was considering using the circuit shown below to measure the battery voltage without having to drain the battery (see original post here). The MCU is an ESP32 and uses 3.3V and needs to measure the battery voltage using a voltage divider to step the voltage down from the 4.2V.


The BATT_SENS_EN pin of the MCU turns the mosfet on and the BATT_SENS pin can read half the voltage applied at B_OUT+. My question is particularly around the BATT_SENS_EN pin — this seems like it is pulled up to 4.2V and will most certainly damage the MCU. Are there any techniques to address this issue?

Thanks for any pointers.

  • 2
    \$\begingroup\$ your microcontroller has an allowed current that a pin is allowed to sink when its voltage is above VCC, typically in a datasheet table under "absolute maximum ratings". You'd choose R21 much larger, usually, and especially large enough to keep that current small enough. Apropos: Making resistors larger, why are R19 and R20 10 kΩ? that feels very strong. \$\endgroup\$ – Marcus Müller Jun 24 at 18:06
  • \$\begingroup\$ The original circuit has a capacitor between the enable GPIO pin and P-MOS gate. A simplistic simulation shows that the cap will buffer the voltage difference between the battery voltage and the MCU's supply voltage. \$\endgroup\$ – ErikR Jun 24 at 18:57
  • \$\begingroup\$ @MarcusMüller OP has not specified electrical characteristics of the MCU ADC, but it's typical for these things to need an apparent impedance of at most ~10k. Might be able to weaken it, but not by much or else the ADC cap will be too slow to charge. \$\endgroup\$ – Reinderien Jun 24 at 23:04

Since you don't have a MCU that tolerates more than 3.3V on IO pins, you can add another transistor to pull the FET gate low.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.