Problem with absolute value circuit

Discussion in 'Analog & Mixed-Signal Design' started by ronsoy2, Apr 3, 2018.

  1. ronsoy2

    Thread Starter Member

    Sep 25, 2013
    67
    19
    The goal is to convert positive and negative DC input levels from 1 millivolt to 4 volts to an absolute positive level from 1 millivolt to 4 volts. The first circuit tried was the dual diode type but it was found that the diodes MUST be carefully matched to get an equal positive and negative response at millivolt levels.(contrary to what the books say! LTspice also confirms this as well. see LT1001 spice demo and fool with one of the diodes parameters.)
    So the circuit below with one diode was tried. There is still a serious discrepancy between the positive and negative values, over 100% error at millivolt inputs.
    The OP amps came from a large batch I happened to have on hand, and were selected to have less than 1/10 millivolt offset. The resistors match to much better than 1%. When the input is grounded, the output is below 200 microvolts, well below a millivolt. Quite satisfactory I think.
    Photo 1 shows the output with a 500 millivolt peak-peak input. (100hz) Photo 2 shows the output with 50mv p-p input. Note that the error is severe.
    Tweaking the resistor values to equalize the response doesn't work. It was found that it takes different resistor values at different input levels, so equalizing at 10 mv doesn't hold at a half volt, etc.
    The signal generator has an offset adjustment and it was found that if some offset (50mv or so) was added to the signal the output had equal response to the peaks. But at zero offset there is that difference in peaks. Using a large capacitor coupling on the input had no effect. LTspice doesn't show any difference in the peaks. It only happens in the real circuit. Any ideas?
    500mvinput.jpg 50mvinput.jpg absolute.jpg
     
  2. ebeowulf17

    Well-Known Member

    Aug 12, 2014
    2,465
    444
    I'm woefully unqualified to say anything definitive, but here are some thoughts for brainstorming until someone more experienced comes along...

    The noise vaguely reminds me of some oscillation issues I ran into when I first dabbled into trans-impedance amplifiers. With those a capacitor in parallel with the feedback resistor would often shunt high frequencies and kill the oscillation. Maybe something similar would help here.

    I'd tell you which resistor I'd try first, but there are no reference designators on the schematic. For future reference, it's a LOT easier to discuss circuits when the schematic has reference designators for every component.

    Beyond that, I'm personally feeling dumb right now, but I'm having a hard time wrapping my head around the interaction of the two op amp stages to the right. It seems unnecessarily complicated, but I can't say that with any certainty. Here's the "ideal rectifier" portion of a circuit I built recently. I believe it does the same thing you're trying to accomplish:
    IMG_5061.PNG
     
  3. ronsoy2

    Thread Starter Member

    Sep 25, 2013
    67
    19
    Sorry about the reference designator oversight. The amp on the left is only to buffer the input to the rectifier circuit, which has different impedance to positive and negative signals, and also to provide gain and impedance matching to the external circuitry. Your circuit is even simpler. I will give it a try. Thanks!
     
  4. ebeowulf17

    Well-Known Member

    Aug 12, 2014
    2,465
    444
    An input buffer may well be a good idea with the circuit I shared as well. I cropped that portion out of what I shared only because, in the referenced circuit, I've got a weird double op-amp input stage that has nothing to do with the rectification.

    Mostly it was the connections between the two amps on the right of your circuit that I wasn't following (just to be clear, I'm not saying they're wrong - just that, with my limited op amp experience, I didn't understand their configuration.)
     
  5. crutschow

    Expert

    Mar 14, 2008
    20,044
    5,639
    What is the output voltage when you ground the input?

    You output looks kind of ratty.
    Try placing a capacitor (100pF or so) across the 47kΩ feedback capacitor between the second and third op amps.
     
    ebeowulf17 likes this.
  6. MrChips

    Moderator

    Oct 2, 2009
    17,078
    5,282
    Are you wanting to roll your own or would an off-the-shelf solution such as ZXCT1041 do?
     
  7. ebeowulf17

    Well-Known Member

    Aug 12, 2014
    2,465
    444
    Yay, the experts are here!

    (@crutschow is the one who first showed me trans impedance amps and ideal rectifiers.)
     
  8. danadak

    Well-Known Member

    Mar 10, 2018
    1,737
    354
  9. ebp

    Well-Known Member

    Feb 8, 2018
    2,044
    720
    You words suggest you are using the FET input op amps as shown. Confirm?

    Do you have good high and low frequency decoupling caps in place?

    Glass diodes are all light sensitive to some degree and this can cause some very odd behavior sometimes.

    Base-emitter (fast, but low reverse breakdown) or base-collector (slower, higher voltage) junctions of small signal transistors can be considerably superior to general purpose switching diodes for some applications, notably where low leakage is required. It might be worth trying.

    I agree with the comments about the ratty looking signal. I'd try some capacitance across the feedback resistor of the input amp in addition or as an alternative to crutschow's suggestion. Besides being furry, the input signal looks distorted to me - the negative peak looks more rounded than the positive, but it may just be artifact from the camera angle.
     
  10. MisterBill2

    Well-Known Member

    Jan 23, 2018
    1,529
    269
    At low voltages the turn on characteristics are not as linear as at higher voltages. That may be contributing to some problems.In fact, at low voltages and small currents a lot of diodes are not terribly linear.
     
  11. crutschow

    Expert

    Mar 14, 2008
    20,044
    5,639
    Diodes are inherently not linear except at high currents where there intrinsic parasitic resistance comes into play, and they become somewhat linear.
    Otherwise they have a logarithmic relation between voltage and current over a very wide current range.

    But the purpose of having the diode in the feedback loop in these ideal rectifier (absolute value) circuits is so the diode forward voltage drop and nonlinearity is basically reduced by a factor equal to the open-loop gain of the op amp and thus becomes negligible for most purposes.
     
    ebeowulf17 likes this.
  12. Hymie

    Active Member

    Mar 30, 2018
    530
    123
    My op-amp cookbook (first published back in the 1970s) mentions within the first few pages the importance of the op-amp input bias currents and how to minimise their effects. This appears to have been lost/ignored by today’s circuit designers.

    Although the currents will be of the order of nano amps and the effects normally small – for your circuit at the milli-volt levels, the effects may be significant.

    The effect of the input bias currents can be minimised by making the impedance at the inverting and non-inverting inputs equal. So rather than tying the two non-inverting op-amp inputs to 0V, they should be connected to 0V via resistors of value 4.3k ohm.

    The calculation for this resistance value (for an inverting op-amp configuration) is the sum of the input and feedback resistance divided by the product of the two resistor values.
     
  13. Hymie

    Active Member

    Mar 30, 2018
    530
    123
    Ebeowulf17’s circuit (at U1.2) is only rectifying a negative voltage (with ref to GND). With a positive input voltage, the op-amp output will saturate at the negative rail.
     
  14. ebeowulf17

    Well-Known Member

    Aug 12, 2014
    2,465
    444
    Positive voltage passes through R5 to U1.3, which buffers the output. D3 prevents the U1.2 saturation from pulling the output down. The result is pretty convincing full wave rectification.

    I'm sure in theory having the op amp saturate for half of every AC cycle is less than ideal, but in practice the result was good enough for me (using it primarily at 60Hz input.) Accuracy in my application was better than my ability to measure accuracy (within a few mV.) It should certainly do better than the 20mV errors in the original post.

    I haven't tried it on steady state DC sources, but I don't see why it wouldn't work.
     
  15. Hymie

    Active Member

    Mar 30, 2018
    530
    123

    For what it’s worth, here is the precision full wave rectification circuit from my trusty op-amp cookbook.

    You mentioned that you had tried dual diode types (so might be referring to this circuit or similar), however the diode D2 only serves to prevent IC1 saturating to the positive rail when the input goes negative. So only the behaviour of D1 is critical, and should be minimal as it is within the feedback circuit of IC1.

    In simple terms, the circuit operation is such that the output of IC1 (Va) is only the positive portion of the input signal (inverted) and IC2 is configured as an inverting adder; its output adding 2xVa + Vin to give full wave rectification of the input.

    Against this, the circuit requires precision value resistors as denoted by the ‘*’ but this should not be a problem with 1% values being common these days. However at very low voltage inputs, even 1% tolerance resistors might not give precisely the gain required by each op-amp for the circuit to operate as you want.
    Precision Full Wave Rectifier.jpg
     
  16. MrChips

    Moderator

    Oct 2, 2009
    17,078
    5,282
    Here is a circuit for a precision rectifier that I have used.
    All resistors are 1% precision.

    Precision Rectifier.jpg
     
  17. Hymie

    Active Member

    Mar 30, 2018
    530
    123
    This is likely to be the type of 2 diode circuit that the original poster had reported problems with, in that the characteristics of both diodes is affecting the output.

    Although on the plus side, the fully rectified output is not so critically dependent on the gain of IC1 (as shown in my cookbook circuit).

    One thought on the original poster’s problem – maybe the solution is to amplify the input signal by 10, then apply full wave rectification and attenuate the final output by 10. With op-amps operating with supply rails up to +/- 48V available, such a solution is possible.
     
Loading...