OPAMP limit output voltage for ADC (improving design) - Page 1
Forum section: electronics / projects

author: MaximilianMM
author_rank: Contributor
timestamp: January 17, 2023, 07:29:30 am
content: Hello,In my project I use an Opamp-circuit which boost some signal for an STM32-ADC. To make sure the output can’t get over 3,3V (max.3.6V) and not below 0V, I added two diodes on the output (D2, D3).I already manufactured the PCB and tested the circuit. The Diode D3 works fine to limit the negative voltage, however the Diode D2 doesn’t work as expected. The output can still get to ~4.5V or something and it also pushes the 3.3V Rail to that voltage.Why is that? OPAMPs shouldn’t have that drive strength to elevate my 3.3V Rail right? Or does it interfere with my 3.3V LDO?How can I easily improve my circuit (without remanufacturing it?). I don’t really want to use a Zener, as it makes the output nonlinear.Thanks in advance.

author: iMo
author_rank: Super Contributor
timestamp: January 17, 2023, 08:23:16 am
content: What is your LDO?Also you may add a resistor at the opamp's output..

author: Kleinstein
author_rank: Super Contributor
timestamp: January 17, 2023, 08:25:22 am
content: The cleanest solution would be to use an OP amp with rail to rail output and power it from the some 0 and 3.3 V as the µC. With the inverted configuration as shown this should not be an issue and the common mode voltage is fixed well within the range. One may want larger resistor values at the amplifier anyway. It depnds on the rest of the PCB if this is possible (e.g. change the regulator and lower the 5 V for the whole circuit).The OP-amp may well be powerfull enough to power the whole 3.3. V rail and lift it up. 20 mA is rather common and modern µCs can well get away with less.The diode solution would anyway allow for some 500 mV byound the rails and thus a little on the high side.A zener diode would not make the circuit very nonlinear - to a large part the OP-amps feedback compensates (good enough for a 12 bit ADC) for the extra current. It could be an issue only rather close to the current limit (e.g. the last 5% of the range). The zener diode is probably the cleanest solution.An extra resistor in the positive supply path could also work - instead of rising the 3.3 V one would than lower the 5V for theOP amp. One should still have a decoupling cap at the op-amp.

author: Wolfram
author_rank: Frequent Contributor
timestamp: January 17, 2023, 11:41:45 am
content: Clamping the voltage by trying to divert all the output current that the op-amp can deliver is not a good approach. This will lead to high dissipation and power draw, it modulates the supply current draw significantly on clipping, potentially introducing noise on the supply rails. Also the 100 nF capacitor hanging off the output is likely well in excess of what the op-amp is designed to handle, without impacting stability.

author: iMo
author_rank: Super Contributor
timestamp: January 17, 2023, 12:38:19 pm
content: You have to limit the current when using the clamping diodes.The resistor in front of the diodes is necessary, the max value of the resistor depends on the ADC sampling rate (the ADC requires a certain max input impedance for a specific sampling rate - see the datasheet).The min value of the resistor gives the max opamp's output and Id1/Id2 current.Also the usage of the 100nF input capacitor would not allow for high speed app, if that is your target..

author: Zero999
author_rank: Super Contributor
timestamp: January 17, 2023, 01:42:03 pm
content: Quote from: imo on January 17, 2023, 08:23:16 amTo reduce the effects of loading and keep the output impedance low, the resistor should be within the op-amp's feedback loop.

author: iMo
author_rank: Super Contributor
timestamp: January 17, 2023, 02:23:04 pm
content: Zero999's suggestion below:

author: Wolfram
author_rank: Frequent Contributor
timestamp: January 17, 2023, 08:46:31 pm
content: Quote from: imo on January 17, 2023, 02:23:04 pmR5/C1 inside the op-amp feedback loop is not going to do much good for the phase margin of the system. 90 degrees from the op-amp dominant pole compensation plus 90 degrees from the RC network gives zero phase margin at high frequencies. For stability, feedback should be taken before the resistor. If the DC error due to ADC input bias current needs to be reduced, then the series resistor can likely be lowered to 100 ohms without affecting stability too much. The 100 nF capacitor on the output can likely also be reduced significantly, depending on the accuracy requirement, ADC S/H capacitance and sampling window.

author: iMo
author_rank: Super Contributor
timestamp: January 17, 2023, 09:28:48 pm
content: Wolfram's mod:

author: Zero999
author_rank: Super Contributor
timestamp: January 17, 2023, 11:34:56 pm
content: I have another idea. Since it's just the positive swing which is a problem and the negative is fine. Try a red, orange or yellow, in parallel with R3: anode to the op-amp's output. Don't use a phosphor converted LED. It must have a forward voltage of around 2V to work properly.

author: Kleinstein
author_rank: Super Contributor
timestamp: January 18, 2023, 12:28:06 pm
content: Clamping parallel to R3 (the feedback at the OP-amp) would introduce some nonlinearity. The transistion from conducting to non conducting is not that steep. With only a 0-3.3 V useful range one would loose quite a bit of the range.The advantage of hard clamping the output is that the OP-amp can compensate for the nonlinearity / gradual onset for quite some time and limiting only happens when the current limit is reached.The combination of quite some capacitors at the input and output with a rather fast OP-amp is strange, as the capacitors would limit the speed quite a bit. Most amplifiers also don't like that much of capacitive load. With lower speed, there may be a choice of weaker drive amplifiers that make it easier to clamp the output.

author: RogerThat
author_rank: Regular Contributor
timestamp: January 18, 2023, 02:03:42 pm
content: Easiest way to achieve what you want is to change the op amp power supply to 0-3.3v and adjust the gain so that you signal fits into the 0-3.3v output. ditch all diodes and increase R6 to a 100-1000ohm. BE AWARE that this type of op amp setup also pulls/pushes current from the OS_BOOST node...

author: dobsonr741
author_rank: Frequent Contributor
timestamp: January 18, 2023, 03:25:21 pm
content: Not all opamp can do this. Both inputs and outputs needs to be rail to rail spec’d. The CMRR should be specified and acceptable for this range too. Lifting up the power rail still needs to addressed, as said before. Schottky clamp diodes are preferable, if you can afford the higher leakage compared to the regular PN junction.See this old thread too, including the reference TL7726 or the DIY equvivalent:https://www.eevblog.com/forum/beginners/overvoltage-protection-with-a-twist/

author: Kleinstein
author_rank: Super Contributor
timestamp: January 18, 2023, 08:09:10 pm
content: In the shown circuit of the inverting configuration the common mode voltage is fixed at some 1.2 V. So there is no need for the OP-amp to be rail to rail for the input when using a 0/3.3 V supply. Essentially all OP-amps that can work with a 3.3 V supply should be OK with this.

author: iMo
author_rank: Super Contributor
timestamp: January 18, 2023, 08:38:14 pm
content: Btw the input of the stm32's ADC includes 2 clamping diodes already, the Imax of the diodes is usually 5mA or something like that. Thus a resistor limiting the currents to say 2mA will do the job, imho. Try to remove the diodes and solder in the current limiting resistor in the place of the 0 ohm resistor you have there. And also reconsider the value of the ADC input capacitor, as the usage of the high speed AD8027 with the 1k feedback resistor and that 100nF capacitor at the ADC input does not make sense..