OpAmp Buffer configuration with max allowed output
Here's my solution:







simulate this circuit &ndash; Schematic created using CircuitLab

How it works is that the 3rd opamp will compare Vlim against a 5 V reference voltage. As soon as the voltage rises above the 5 V reference, the output of OA3 will go low this basically works as an ideal 5 V zener diode. As soon as Vlim goes below 5 V, OA3's output will become high and the diode will be in reverse mode.

So the diode is to prevent OA3 interfering when Vlim &lt; 5 V

The accuracy of the 5 V clamping level is mainly determined by that level itself and the DC offsets of the OA3. The diode is in OA3's feedback loop so the voltage drop across it does not matter.