I am designing a PCB with a PIC 16 microcontroller. The purpose of the PCB is to measure the voltage of a button cell battery, before the battery is placed in its device (assume this battery testing is involved in a mass production line, so its used very much, and very quick). Now I am using a sort of clothspin to clamp the battery on the top and bottom side (anode and cathode). But the mistake to reverse the polarity of the battery is very easy to make. For that reason I want to include a reverse polarity protection, so that if the battery is placed wrong (negative voltage on the analog input) it doesn't fry my microcontroller. What is the best option I can use? A diode won't do the trick in my opinion since that makes the voltage that I want to read drop, but I also don't want to make a very difficult circuit for this RPP.

This is the circuit. The Battery wire is going to the analog INPUT. The resistor values are not right yet. They will be something like 100, 1000, 1000 ohm.

enter image description here

  • 1
    \$\begingroup\$ A diode wont do the trick in my opinion since that makes the voltage that i want to read drop... Okay then what other device can you think of that prevents this? I contend that you can still use a diode and then design something the minimize this voltage drop. Also, can you explain why a voltage drop would be considered detrimental? \$\endgroup\$
    – user103380
    Commented May 14, 2020 at 15:49
  • \$\begingroup\$ Im sorry, you are right. What i meant is: Just a series diode wont do the trick, because the voltage drop will be to big., so what kind of circuit can i use, with RPP, and minimal voltage drop. I am going to active test the battery 3 times, with 3 different resistors for very short periods of times. The current (and voltage drop of the battery) will be different each time. When the voltage drops, the analog signal will no be the same voltage as the voltage on the battery. And you might say, well, you know the voltage drop over the diode, but i got the feeling that this is not accurate enough. \$\endgroup\$ Commented May 14, 2020 at 16:03

1 Answer 1


The pin has built in protection diodes to its supplies. So the usual method is to use a resistance between what your measuring and the micro to limit the current. Ideally look up what the adc input impedance needs to be. Pick something slightly less than that and check if less than say 1mA can flow through those protection diodes to keep thing safe over hundreds of encounters.

The other method would be a p-mosfet in series with your positive battery terminal. If the polarity is wrong it open circuits the battery so your circuit only sees the negative spike for a moment. You still need to protect against it like above. But it means leaving it in backwards will not strain your circuit for a longer period of time.

  • \$\begingroup\$ So you are saying that i can reverse the polarity without the microcontroller getting damaged, IF i just place an resistor in between the microcontroller and the batteryPin. \$\endgroup\$ Commented May 14, 2020 at 20:43
  • \$\begingroup\$ And if the current the resistor limits it to is small. Yes. The current will end up on your devices supply rails so you will want to make sure your circuit draws more current than what can flow through that pin. E.g. a power led \$\endgroup\$
    – Reroute
    Commented May 14, 2020 at 21:11

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.