Limiting lower and upper limits of a control voltage - Page 1
Forum section: electronics / beginners

author: Phil Smith
author_rank: Regular Contributor
timestamp: August 12, 2025, 11:40:36 am
content: Hey guys,Just curious, is it possible to implement the following input/output voltage response utilizing analogue circuitry only?V_IN V_OUT0.0 3.51.0 3.52.0 3.53.0 3.53.5 3.54.0 4.05.0 5.06.0 5.07.0 5.0So, basically, input control voltage (V_IN) can be in the range of 0-7 VDCMin output control voltage (V_OUT) - 3.5VDC, even when V_IN is lower.Max V_OUT - 5VDC, even when V_IN is higher.If V_IN is >=3.5 and <5.0 VDC - V_OUT is following the input.Regarding the max limit, I can clamp it with a Zener diode, but what about the lower limit?Appreciate any ideas.

author: MrAl
author_rank: Super Contributor
timestamp: August 12, 2025, 11:50:15 am
content: Quote from: Phil Smith on August 12, 2025, 11:40:36 amHi,What you are suggesting is like a wave shaper circuit. It takes an input range and shapes it into a different range where some of the outputs may be similar for different inputs.The typical way to do this using pure analog circuitry would be to use diode break points. That's where diodes are used to change the current level as the input is increased and thus produce a different output level. It depends on the exact levels you need though.This usually means you have to have an input that is always higher than the output, but if you can use op amps you may be able to get higher values from lower values also.You could start by just trying to get two distinct levels from a ramp input. It will still be hard to get the exact levels you require you'll have to compromise a little. For example, if you want 3.5v 3.5v 3.5v from a slowly rising input, you might actually get 3.4v, 3.5v, 3.6v so you'll have to determine if that is acceptable. You may even be able to get better than that, like 3.45v, 3.50v, 3.55v which is a little closer.You could also look at diode sine wave shaper circuits, and transistor sine wave shaper circuits to get an idea how this is done. It also depends partly on how complex you want to allow the circuit to become as to how many components are allowed.I don't know if you consider comparator circuits to be analog but if you do you can do a lot better.In any case you'd have to specify your input/output relationship a lot better. For example, if you go from 3.5v to 4.0v, what do you want to happen beween those two, if anything. Do you want a ramp between those two or just a step from 3.5 up to 4.0v or something else.So far you have pairs 3.5, 3.5, then 4.0, 4.0, but what about an input of 3.6, 3.7, 3.8v, etc.

author: Phil Smith
author_rank: Regular Contributor
timestamp: August 12, 2025, 12:16:10 pm
content: Quote from: MrAl on August 12, 2025, 11:50:15 amThank youMrAl, I'll take a look at those circuits.Regarding input/output relationship - from 3.5 to 5.0 v the output should follow the input as a linear ramp (see the pic attached, pardon my chicken scratches)BTW, op-amps and comparators are allowedis there a way to limit lower value with a comparator as well?

author: ledtester
author_rank: Super Contributor
timestamp: August 12, 2025, 12:26:34 pm
content: A formula for your output is: Vout = min(5.0, max(Vin, 3.5)).This stackexchange discussion mentions a couple of ideas for computing the max of two voltages:https://electronics.stackexchange.com/questions/218496/passing-greater-of-2-voltages-using-5v-signaland one of the ideas is a detector using op-amps:For computing the min you can use a Zener as you mentioned, but if you need the limit to be an arbitrary value I found this other stackexchange discussion:https://electronics.stackexchange.com/questions/316848/how-would-i-make-a-circuit-that-takes-a-voltage-v-as-input-and-outputs-minvIt has a couple of interesting ideas including the analog of the op-amp max circuit above (instead of a pull-down to GND R1 is a pull-up to the positive rail and the direction of the diodes are reversed.)

author: Zero999
author_rank: Super Contributor
timestamp: August 12, 2025, 12:45:02 pm
content: Is it just DC/low frequencies?Assuming you're not bothered about distortion, just put a couple of MOSFETs on the output of an op-amp, which doesn't have to be anything special. The LM358 will do.Note I've not done any stability analysis. An RC frequency compensation network might be required to avoid ringing and oscillation.

author: Phil Smith
author_rank: Regular Contributor
timestamp: August 12, 2025, 02:56:38 pm
content: wow, that's brilliant, thank youledtester&Zero999!These are nice building blocks

author: Zero999
author_rank: Super Contributor
timestamp: August 12, 2025, 05:35:45 pm
content: One thing I forgot to say was that V2 and V3 supply all of the current to whatever is connected to the output. If you need to use high impedance sources (say a potential divider) then you'll need to add op-amp unity gain buffers to reduce the impedance.https://en.wikipedia.org/wiki/Buffer_amplifier?useskin=vector#Op-amp_implementationFor completeness, here's a plot of the output voltage (Y-axis) vs the input voltage (X-axis).

author: TimFox
author_rank: Super Contributor
timestamp: August 12, 2025, 05:36:09 pm
content: You might apply the approach in this article:https://www.electronicdesign.com/technologies/analog/article/21801600/op-amps-make-precision-clipper-protect-adcThe example circuit shown uses "precision clamps" to prevent the output from going out of the range defined by the two reference voltages (0 and +4.096 V in the example), but the output follows the input in between those values.The lower voltage (0 in the example) could be a positive voltage less than the higher voltage (+4.096 V in the example).The voltages can come from a resistor voltage divider, since the current drawn by the two op-amp inputs is very low.Note that the article discusses the requirement that the op amps not have diodes between the two inputs, and can tolerate a high differential voltage.

author: MrAl
author_rank: Super Contributor
timestamp: August 13, 2025, 10:15:13 am
content: Quote from: Phil Smith on August 12, 2025, 12:16:10 pmHello again,There are a lot of ways to do this but the complexity goes up with the desired accuracy and the exact shape required. This leads to a couple more questions.For one, do you need the transition points (3.5v and 5.0v) to be smooth curves like you actually drew, or can they be abrupt changes from perfectly flat to a ramp then to perfectly flat again, which would create sharp corners.Secondly, what is the overall accuracy required for the 3.5v and 5.0v and the ramp?For example, if instead of 3.5v we had 3.6v would that be ok, or should we have 3.55v or 3.10v or even 3.02v ?I would not use a zener diode for anything they are too variable for applications like this.

author: Phil Smith
author_rank: Regular Contributor
timestamp: August 14, 2025, 12:29:02 pm
content: Thank youZero999,TimFox &MrAl,much appreciated you helpCurrently I've implemented the circuit (see attached) which initially was proposed byledtestersimply because I wanted to modify the existing PCB and had x2 spare opamps anyway. It is not very accurate nor very stable (due to zener diode nature) by it works.Next step is to revise the PCB design and for that I plan to useZero999solution with x1 opamp and x2 mosfets.All reference voltages are supplied via 10V voltage reference IC, then a trimmer pot following by a buffer amp.Desirable tolerance for control voltages is +/- 0.1V

author: MrAl
author_rank: Super Contributor
timestamp: August 14, 2025, 12:56:24 pm
content: Quote from: Phil Smith on August 14, 2025, 12:29:02 pmHi,That's a relatively simple design and if it works that's great.There is one caution here. That is the functionality related to the input Vin frequency.For low frequency like 10Hz, it may be just fine, but for higher frequency like 100Hz or higher, there may be some delay in the way the output changes. That's because many op amps have a 'recovery' specification that is a sort of delay time for the op amp to recover from a saturated state.This is rarely shown on the data sheet so it may be hard to understand at first, but it's actually really simple. It's due to the internal compensation capacitor which has to charge or discharge after the output has been in a saturated state. A saturated state occurs when the feedback no longer can keep the op amp in the linear operation mode. Unfortunately, when there is a diode in the feedback path and nothing else, the op amp can go into the saturated state when the diode stops conducting.This will occur in this circuit when the input Vin goes higher than 3.5 volts, because the lower diode will stop conducting. This will cause the output of that op amp section to go to the supply voltage connected to the minus power supply terminal of that op amp. Now if the input Vin suddenly goes lower than 3.5v, the output of the circuit will follow Vin lower than 3.5v while the lower op amp section starts to recover. It could be a full 100ms or longer before the output goes back up to 3.5 volts. How low it actually gets before that and how long it takes to recover depends on the power supply voltages, the level of Vin, and the specs of the op amp itself.If a delay like this is not a problem, then it's good to go. If the frequency can be over 10Hz or so then it deserves at least a quick test. Note that a simulation may or may not show this problem because it depends on how the manufacturer modeled the op amp. It's also possible that a simulation will show this condition in a lesser degree than in real life. This means making a real life test a good idea.

author: Zero999
author_rank: Super Contributor
timestamp: August 14, 2025, 09:28:12 pm
content: Quote from: Phil Smith on August 14, 2025, 12:29:02 pmDid you not look at the article TimFox linked to?It looks pretty good to me. I've simulated it and it will work. More later.Quote from: MrAl on August 14, 2025, 12:56:24 pmYes the op-amp's output hits the rail, once the voltage exceeds the limit. That's not a problem at low frequencies, but can lead to glitches as the slew rate of the input goes up.Here's a simulation.The horizontal scale is the input voltage (V3) which is swept from 0V to 7V. The vertical traces are voltages at different parts of the circuit. The yellow is the output voltage, the red, the output of U1, green, the output of U2 and cyan, the input current flowing though V3.The large voltage changes on U1 and U2's outputs can be seen, as the output voltage exceeds the limits, when the input current increases, as it's being diverted into U1 and U2, as they clamp the voltage. I reduced the positive supply voltage from 12V to 9V, just to make the plot more clear.op-amp limits.asc(2.25 kB - downloaded 1 times.)Adding extra diodes and resistors can alleviate this issue. The diode connected between the inverting input and output (D4 and D6), thus closing the loop, when the op-amp is clamping. R3 and R4 are required to prevent the current though the diodes from clamping the input. U3 is a buffer. R1, D1 and D2 limit the input before it goes into the buffer. The shunt resistor (R2) can now be lower because the voltage is already clamped by R1, D1 and D2.The voltage swing on the op-amp outputs is now smaller. Note the scale of the vertical axis has changed from 0V to 9.9V to 3.2V to 5.4Vop-amp limits improved.asc(3.84 kB - downloaded 5 times.)

author: Phil Smith
author_rank: Regular Contributor
timestamp: August 16, 2025, 05:56:46 pm
content: Quote from: Zero999 on August 14, 2025, 09:28:12 pmWOW! That's awesome, thank youZero999for a such in-depth reply.I think I like this solution the most, as it's utilizing the same component I already have in the design - opamps, 1n4148 diodes and couple of resistors, so no additional BOM items needed comparing to the MOSFET solution. Plus there are no active circuitry between input and output.

author: Zero999
author_rank: Super Contributor
timestamp: August 16, 2025, 06:05:15 pm
content: Quote from: Phil Smith on August 16, 2025, 05:56:46 pmIf its just low frequency/DC and you're happy with the output impedance of 1k, then I recommend the first one.

author: radiolistener
author_rank: Super Contributor
timestamp: August 16, 2025, 06:21:54 pm
content: you can use 3 voltage regulators and MOSFET's controlled with voltage detectors to connect appropriate voltage regulator output to the load.

author: Phil Smith
author_rank: Regular Contributor
timestamp: August 16, 2025, 06:55:42 pm
content: Quote from: Zero999 on August 16, 2025, 06:05:15 pmYep, it is just DC control voltage, input is taken from photodiode amp (x3 stages, ranges from 1v (dark) and 12V - bright sunlight) and output is driving x3 mosfet gates in parallel, which are current sink for 100W COB LED, which in itself is a backlight for a 4" square LCD.3.1v is min voltage requred for those mosfets to start conducting and 3.5V produces enough backlight for image to be visible in the dark, hence I dont want it go below this figure.PS. it is a Head-up display for flight sim. Some pics are enclosed. Pardon the cracked combiner glass, it is all I could find on the ebay for nowIt is from tornado GR4 aircraft.Quote from: radiolistener on August 16, 2025, 06:21:54 pmSo, as far as I understand, it is pretty much whatZero999suggested initially

author: Zero999
author_rank: Super Contributor
timestamp: August 17, 2025, 04:30:20 pm
content: Quote from: Phil Smith on August 16, 2025, 06:55:42 pmYes, it sounds similar to my original idea.Note that it also has the issue with the op-amp's output saturating. For completeness, here's a plot of the op-amp's output.