1
\$\begingroup\$

I'm using a simple voltage divider to measure the voltage of my battery. The battery will be in the neighborhood of 12V, and the uC runs at 3.3V. I don't need to read it often, and don't mind a few extra components to turn it off when not needed. I went down the high-side switch path on a tip from the interwebs, but now I'm thinking why not just put a low-side N-MOSFET instead? Given the voltage difference I need a driver transistor to run the high-side switch, and wouldn't for a low-side one. Any reason not to? Here's the current circuit:

enter image description here

EDIT So - I remembered why it's not ideal, but I'll continue the question anyway. If I disconnect the circuit between R11 and ground, there's still a current through R5 and into the uC. However, the question then is how much current is flowing through in that scenario? The uC is an ATMega2560, which has an input pin impedance of 10 MOhm, implying a negligible amount of current (on the order of a few nA). Am I going about this the right way?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ With a 10MΩ input impedance in your µC I'll bet you'd have a lot easier time if you just increased the divider to 250kΩ for R5 and 68kΩ for R11. Your µC won't load the divider much and you'll have far less current flowing in that branch, about 40µA. \$\endgroup\$
    – Samuel
    Commented Sep 10, 2014 at 3:11
  • 1
    \$\begingroup\$ I've run into a similar thing where I'm using an N-ch to turn off a P-ch. It works fine but I can't sample down to 0V because of not enough difference between Vg and GND, which sounds like what you're experiencing too at 3.3V. I ended up using a (pwm generated) negative voltage to sort that out. \$\endgroup\$
    – captcha
    Commented Sep 10, 2014 at 3:13

1 Answer 1

2
\$\begingroup\$

No, you shouldn't do that. The pin will rise to about 4V and then more than 3mA will flow continuously. This is outside the normal operating mode of the micro. There's effectively a diode from the input to Vdd.

It could cause the 3.3V line to rise as well, possibly damaging something.

\$\endgroup\$
3
  • \$\begingroup\$ Can you explain why the pin would rise? I thought that the high input impedance would mean that this wouldn't happen? \$\endgroup\$
    – kolosy
    Commented Sep 10, 2014 at 3:12
  • \$\begingroup\$ It's only high-Z until the ESD protection diode becomes forward biased. Absolute maximum input voltage is Vdd + 0.5V. You've got R5 to 12V pulling it up. \$\endgroup\$ Commented Sep 10, 2014 at 3:13
  • \$\begingroup\$ Ah! That's the part I was missing (the fact that R5 becomes a pull-up). Cool. \$\endgroup\$
    – kolosy
    Commented Sep 10, 2014 at 3:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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