Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Annoying nonlinear voltage divider

  1. Aug 11, 2011 #1
    Hello All,

    I'm working with a microcontroller and want to take analog measurements using its built-in ADC. However, I want to be able to measure voltages much higher than just 0-5V. My *seemingly* simple solution to this was to grab a 500k 25-turn potentiometer which I could connect up as a simple, adjustable, voltage divider to connect to the input of the controller. I then put a 5.1V Zener diode in parallel with the voltage divider output to ensure that the input voltage would not ever exceed the 5V limit for the IC's input. I also added a series resistor of about 1k or so on the HV side to limit the current through the zener if the POT was ever adjusted to the top of the scale when the zener breaks down (schematic attached below).

    At first, this solution seemed to work well, until it came time to calibrate the divider circuit. I first wanted to set it so that it could handle up to 20V on the input. So, I set a digital power supply to 20V, and adjusted the POT to output 5V on the low voltage side. But if I scaled the voltage down to 10V, the output voltage did not scale linearly.

    My initial thought was that the zener I was using was causing the problem since I was adjusting it to closely to the breakdown voltage. So I then set the power supply to 10V and re calibrated the output to read 2.5V. This worked slightly better but the setup would still go nonlinear if I went 5V above or below the value. I'm wondering if it's the zener diode that is the root cause, or if the POT itself is not linear over a range of voltage inputs?

    Assuming that the diode is at fault, I could just remove it but I've already had other *accidents* without having some sort of protection circuit. Ultimately I would like to be able to safely measure up to about 50V but are there any more eloquent solutions to the problem besides my current situation?

    Jason O

    Attached Files:

  2. jcsd
  3. Aug 11, 2011 #2
    You use resistance too high, it your pot is 500K, the R1 must be in mega ohm range. Zener diode do draw current close to breakdown voltage or even not close to. That will mess up your divider. Only take a few nano amps to mess you up.
  4. Aug 11, 2011 #3
    Also... your ADC input has a finite impedance, it may be spec'ed in the man page or you may need to measure it. That impedance will appear in parallel to the grounded leg of your pot and change the actual voltage divider ratios.
  5. Aug 11, 2011 #4
    It's the zener leakage. They leak a lot as they approach breakdown voltage. Might work okay with lower resistance values, but you'll still get some error from leakage. Also, most ADCs can not tolerate a whole lot of source impedance since they need to charge a small capacitor to take a measurement. Unless you're using a very long sample period, you'll probably need to keep it under ~5kΩ.

    I came across a similar situation myself when I wanted to use high side current sensing. My final solution was to give up on the idea and use low side sensing. About the only thing I could think of was to use a voltage detector driving an analog switch to disconnect the input in the event of over-voltage.
  6. Aug 13, 2011 #5


    User Avatar
    Science Advisor

    You can avoid using a Zener by using a diode like this:

    [PLAIN]http://dl.dropbox.com/u/4222062/voltage%20divider%202.PNG [Broken]

    This stops the output going above 5.6 volts if the diode is a silicon one, or you could use a Schottky diode for a maximum voltage of 5.2 volts.

    Outputs up to 5 volts should be unaffected by the diode.

    Note that the 5 V source must have some load on it (like a microprocessor) as 5 V regulators may not allow current to flow into them from the output.

    The maximum voltage input will be determined by the power rating of the 33 K resistor. A ¼ watt 33 K resistor should not have more than 90 volts across it. A ½ watt 33 K resistor can have up to 128 volts across it.
    Last edited by a moderator: May 5, 2017
  7. Aug 13, 2011 #6
    Better put a put a 1k or so pull down resistor from +5V to ground to make sure you draw enough current to maintain +5V. ALL power supply drive only one direction. It can source many amps but it cannot sink anything. just one mA can make it flow up beyond 5V. Putting a 1K ensure it has a sinking capability of 5mA before it start to flow up. If need more, you can put smaller resistor.
    Last edited by a moderator: May 5, 2017
  8. Aug 13, 2011 #7


    User Avatar
    Science Advisor

    Yes, but not in this case.

    There is already a microprocessor being supplied by 5 volts, so this supply is sufficiently loaded to sink a couple of milliamps. The warning was there to alert the poster that he should take care that the 5 V source was suitable.

    ALL power supply drive only one direction. It can source many amps but it cannot sink anything.

    This is a little reckless.
    An unloaded LM7805 can sink 5 mA before the output voltage starts to rise. I tried it a few minutes ago.
    Batteries have no problem sinking a few mA, even if they are not rechargeable.
    Shunt regulators can sink plenty of current.
  9. Aug 14, 2011 #8
    That's a beautifully simple solution. Thanks for posting. Perfect for high side current sensing with voltages higher than MCU supply. I'll probably still use low side sensing for my application since it solves some other problems for me, but if I ever need to go with a high side sensor, I'll use that method if I need to put a clamp on the ADC input.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook