I am working on a project where I need a microcontroller ADC (3.3V range) to detect the voltage being put out by a 24V variable power supply. This is the circuit I came up with to accomplish this: The circuit creates a variable voltage divider using RV1 which is set to trim the max voltage 24V down to 3.3V. A 3.3V zener diode ensures unexpected peaks above this do not reach the op-amp input, and a MCP6002 rail-to-rail op-amp powered at 3.3V is used for additional protection. VREAD connects to the micro ADC pin.

Does this circuit look like it should work as I am expecting it to?

After have the parts populated on a test PCB by JLCPCB I am seeing some odd behavior with the voltage at VREAD not scaling linearly with input VDD values. Is there anything that could account for this in the circuit design?

You've put a non-linear device across the voltage you want to read.

A Zener is not a hard limiter, their reverse characteristic can be rather soft, so while it may be a 3.3 V Zener, it will start to conduct before it reaches 3.3 V.

Try it without the Zener and see if it's still not linear.

• would a better approach then be to use a regular diode to 3.3V and GND for overvoltage protection? Sep 29 at 14:40
• @EmmettPalaima Possibly. You'd have to do some prototyping, maybe try some different diodes. On the other hand, you could just take the non-linearity into account in the calibration, and maybe increase the number of calibration points in the range where the most error occurs. Sep 29 at 16:42

If you read the data sheet for the MCP6002 you will see that the analogue inputs can take a maximum of 2 mA and, this is something you can rely on to protect the inputs by using a value of series resistance that is appropriate.

So, let's say that the 100 kΩ pot was set to deliver (maybe) 4.0 volts when the true input was 24 volts. Given that you have a 1 kΩ resistor in series with the input, the maximum current into the input would be: -

$$\dfrac{4.0 - 3.6}{1000}\text{ amps} = 0.4 \text{ mA}$$

• 3.6 volts is a nominal value for the clamping voltage of a typical op-amp powered from 3.3 volts
• If you read the data sheet you can find out what it actually is

Of course, it's a better scenario if you made R6 10 kΩ. This won't be an additional accuracy problem because the input bias currents are 1.1 nA over the full temperature range and, with a 10 kΩ resistor that would produce an input error voltage of 10 μV. Compare this with the natural input offset voltage error of +/- 4.5 mV and you see that it isn't as a problem.

But the clever part of this is that the potentiometer's effective Thevenin output resistance is easily going to be in the order of 10 kΩ (however, I would use a potential divider instead). This means that you don't need R6 or a usually crappy (and accuracy killing) Zener diode.

And, if you realized that the analogue inputs on this op-amp can be as high as 1 volt above their power rail voltage, you might not need to use anything if you are careful in setting up the pot. Of course, the most careful thing you could do is not use a potentiometer but used a fixed potential divider made from two resistors instead. Note that Zener diodes are not the right approach if you want accuracy.

• So I want to use a trimpot to set the voltage scaling since I am potentially using this with a variety of power supplies, which might have slightly different specs or variations in actually output from their rating. I need to set the potentiometer to the correct value using a voltage meter, so the circuit needs to be able to tolerate values above 3.3V while it is being calibrated, hence the diode. Sep 29 at 14:37
• @Andy_aka If I replace the zener with a regular diode to 3.3V and GND for overvoltage protection, and the 2 1k resistors with a single 10k in place of R6, does that seem like it would work well? Sep 29 at 14:42
• @EmmettPalaima find a Zener that you think might suit and, look in its data sheet to see what likely current it will be taking when the required input signal is in the normal range. I think you'll be disappointed still. Sep 29 at 15:12