this question comes from this other, trying to implement the folloging circuit to measure a -3V battery pack (2xAA) (I've to measure in that way, cannot swap or move GND):

schematic Digital PIN 6 will be set to OUTPUT and HIGH, thus providing +3.3V there.

I'm trying to implement that divider without burning the SAMD21 3.3V MCU and allowing to disconnect it, so I reached to the following 2 problems:

  1. When MCU is power disconnected, power on digital pin is cut, so the negative voltage reach both analog and digital ports. Can this burn the protections?

  2. I want to switch off the circuit by setting digital pin to INPUT (isolates by about 100Mohm internal impedance). This makes the analog pin receive the negative voltage again, so, I'm afraid to also damaging the MCU.

I tried to do some simulations, enter image description here trying to mimic the internal impedance of analog and digital port to get the voltage in the lines. When powered (digital pin output and high), voltage values are ranging from 1.2V to 2.4V what is safe. When switched off (digital pin input), both ports get the -3V negative voltage. I placed the diode (1N4007) there as I supposed it would avoid current in opposite direction, but it seems not to do anything there (and multimeter says the same...)

Could you get me some other hint in how to implement this? Thanks!

  • 1
    \$\begingroup\$ Remove the diode, and use 910K and 91K resistors, for a 10:1 divider to -0.3 volts. For accuracy, program your ADC acquisition-time to 5 microseconds, so the ADC's internal sample-hold capacitor has plenty of time to charge. Note you need to ensure the ADC has a differential input that can handle (-) input voltages. If the ADC cannot handle (-) inputs, then use TWO equal resistors of 1MegOhm (3uA current draw at all times). \$\endgroup\$ Commented Jul 5, 2019 at 16:06
  • \$\begingroup\$ @analogsystemsrf I think that my ADC cannot handle negative values, as is the internal of the SAMD21. 2 x 1Mohm bridge could be fine, and is which I'm actually using for measuring external +5V. In this case I would have -3.1V in one extreme and +3.3V in the opposite, so the sensor should get values from only a few over 0 to about 1.65V when depleted, so could be fine. But, wouldn't this be dangerous for the SAMD if own 3.3V gets disconnected and -3.1V connected? I l'd have -3.1V directly on the ADC \$\endgroup\$
    – avelo
    Commented Jul 8, 2019 at 20:27

1 Answer 1


I would replace D1 with a 3.3V Zener diode, and flip it around so that the anode connects to the battery and the cathode connects to R1. This will prevent the battery from pulling the microcontroller inputs below about 0.2V, and it won't draw any significant current when the digital pin is floating (or set to 0).

I was trying to draw the schematic for you but the schematic editor is not playing nicely with my browser right now.

  • \$\begingroup\$ Sorry, I've not the skills to fully understand your solution with a zener. AFAIK the zener would let the current to flow to the cathode, and in reverse when zener voltage reached. I've tried to simulate your proposal, but in my tests, it would allow the -3.1V to reach the ADC... probably I missing something \$\endgroup\$
    – avelo
    Commented Jul 8, 2019 at 20:36

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.