miércoles, 10 de febrero de 2010

Operational amplifier as rectifier (Precision Rectifier)

Rectifiers are often called into action to measure signal strength. Rectify an AC signal, pass it through a low-pass filter and the resulting DC level represents some measure of the signal's magnitude. Although the series diode is the classic rectifier, it can't rectify signals smaller that it own forward voltage! But what if your expected amplitude can be as low as 100 mV? Op amps to the rescue! The advantage of op amp circuits lies in their ability to compensate for non-linear devices in the feedback loop. Combining the rectifying action of a diode with the accuracy of an op amp, this circuit creates a precision rectifier.

Half Wave Precision Rectifiers

There are many applications for precision rectifiers, and while most are suitable for use in audio circuits, I thought it best to make this the first ESP Application Note. While some of the existing projects in the audio section have a rather tenuous link to audio, this information is more likely to be used for instrumentation purposes than pure audio applications.

Typically, the precision rectifier is not commonly used to drive analogue meter movements, as there are usually much simpler methods to drive floating loads such as meters. Precision rectifiers are more common where there is some degree of post processing needed, feeding the side chain of compressors and limiters, or to drive digital meters.
There are several different types of precision rectifier, but before we look any further, it is necessary to explain what a precision rectifier actually is. In its simplest form, a half wave precision rectifier is implemented using an opamp, and includes the diode in the feedback loop. This effectively cancels the forward voltage drop of the diode, so very low level signals (well below the diode's forward voltage) can still be rectified with minimal error.
The most basic form is shown in Figure 1, and while it does work, it has some serious limitations. The main one is speed - it will not work well with high frequency signals. To understand the reason, we need to examine the circuit closely. This knowledge applies to all subsequent circuits, and explains the reason for the apparent complexity.
Figure 1
Figure 1 - Basic Precision Half Wave Rectifier
For a low frequency positive input signal, 100% negative feedback is applied when the diode conducts. The forward voltage is effectively removed by the feedback, and the inverting input follows the positive half of the input signal almost perfectly. When the input signal becomes negative, the opamp has no feedback at all, so the output pin of the opamp swings negative as far as it can. Assuming 15V supplies, that means perhaps -14V on the opamp output.
When the input signal becomes positive again, the opamp's output voltage will take a finite time to swing back to zero, then to forward bias the diode and produce an output. This time is determined by the opamp's slew rate, and even a very fast opamp will be limited to low frequencies - especially for low input levels. The test voltage for the waveforms shown was 20mV at 1kHz. Although the circuit does work very well, it is limited to relatively low frequencies (less than 10kHz) and only becomes acceptably linear above 10mV or so (opamp dependent).
Note the oscillation at the rectified output. This is (more or less) real, and was confirmed with an actual (as opposed to simulated) circuit. This is the result of the opamp becoming open-loop with negative inputs. In most cases it is not actually a problem.
Figure 2
Figure 2 - Rectified Output and Opamp Output
Figure 2 shows the output waveform (left) and the waveform at the opamp output (right). The recovery time is obvious on the rectified signal, but the real source of the problem is quite apparent from the huge voltage swing before the diode. While this is of little consequence for high level signals, it causes considerable nonlinearity for low levels, such as the 20mV signal used in these examples.
The circuit is improved by reconfiguration, as shown in Figure 3. The additional diode prevents the opamp's output from swinging to the negative supply rail, and low level linearity is improved dramatically. A 2mV (peak) signal is rectified with reasonably good linearity. Although the opamp still operates open-loop at the point where the input swings from positive to negative or vice versa, the range is limited by the diode and resistor. Recovery is therefore a great deal faster.
Figure 3
Figure 3 - Improved Precision Half Wave Rectifier
This circuit also has its limitations. The input impedance is now determined by the input resistor, and of course it is more complicated than the basic version. It must be driven from a low impedance source. Not quite as apparent, the Figure 3 circuit also has a defined output load resistance (equal to R2), so if this circuit were to be used for charging a capacitor, the cap will discharge through R2. Although it would seem that the same problem exists with the simple version as well, R2 (in Figure 1) can actually be omitted, thus preventing capacitor discharge. Likewise, the input resistor (R1) shown in Figure 1 is also optional, and is needed only if there is no DC path to ground.

Full Wave Precision Rectifiers
Figure 4 shows the standard full wave version of the precision rectifier. This circuit is very common, and is pretty much the textbook version. It has been around for a very long time now, and I would include a reference to it if I knew where it originated. The tolerance of R2, 3, 4 and 5 is critical for good performance, and all four resistors should be 1% or better. Note that the diodes have been reversed to obtain a positive rectified signal. The second stage inverts the signal polarity. To obtain improved high frequency response, the resistor values should be reduced.

Figure 4
Figure 4 - Precision Full Wave Rectifier
This circuit is sensitive to source impedance, so it is important to ensure that it is driven from a low impedance, such as an opamp buffer stage. Input impedance as shown is 6.66k, and any additional series resistance at the input will cause errors in the output signal. The input impedance is linear. As shown, and using TL072 opamps, the circuit of Figure 4 has good linearity down to a couple of mV at low frequencies, but has a limited high frequency response. Use of high speed diodes, lower resistance values and faster opamps is recommended if you need greater sensitivity and/ or higher frequencies.
The Alternative (Analog Devices)
A little known variation of the full wave rectifier was published by Analog Devices, in Application Brief AB-109 [
1]. In the original, a JFET was used as the rectifier for D2, although this is not necessary if a small amount of low level non-linearity is acceptable. The resistors marked with an asterisk (*) should be matched, although for normal use 1% tolerance will be acceptable.

Figure 5
Figure 5 - Original Analog Devices Circuit
It was pointed out in the original application note that the forward voltage drop for D2 (the FET) must be less than that for D1, although no reason was given. As it turns out, this may make a difference for very low level signals, but appears to make little or no difference for sensible levels (above 20mV or so).
Simplified Alternative
For most applications, the circuit shown in Figure 6 will be more than acceptable. Linearity is very good at 20mV, but speed is still limited by the opamp. To obtain the best high frequency performance requires a very fast opamp, and reduce the resistor values.

Figure 6
Figure 6 - Simplified Version of the AD Circuit
It is virtually impossible to make a full wave precision rectifier any simpler, and the circuit shown will satisfy the majority of low frequency applications. Where very low levels are to be rectified, it is recommended that the signal be amplified first. While the use of Schottky (or germanium) diodes will improve low level and/or high frequency performance, it is unreasonable to expect perfect linearity from any rectifier circuit at extremely low levels. Operation up to 100kHz or more is possible by using fast opamps and diodes. R1 is optional, and is only needed if the source is AC coupled, so extremely high input impedance (with no non-linearity) is possible.

Another Precision Rectifier (Intersil)
A simple precision rectifier circuit was published by Intersil [2]. This is an interesting variation, because it uses a single supply opamp but still gives full-wave rectification, with both input and output earth (ground) referenced. Unfortunately, the specified opamp is not especially common, although other devices could be used. The CA3140 is a reasonably fast opamp, having a slew rate of 7V/us. I will leave it to the reader to determine suitable types (other than that suggested below). The essential features are that the two inputs must be able to operate at below zero volts (typically -0.5V), and the output must also include close to zero volts.

Figure 7
Figure 7 - Original Intersil Precision Rectifier Circuit
During the positive cycle of the input, the signal is directly fed through the feedback network to the output. R3 actually consists of R3 itself, plus the set value of VR2. The nominal value of the pair is 15k, and VR2 can be usually be dispensed with if precision resistors are used (R3 and VR2 are replaced by a single 15k resistor).
This gives a transfer function of ...
Gain = 1 / ( 1 + (( R1 + R2 ) / R3 )) ... 0.5 with the values shown above
1V input will therefore give an output voltage of 0.5V. During this positive half-cycle of the input, the diode disconnects the op-amp output, which is at (or near) zero volts. Note that the application note shows a different gain equation which is incorrect. The equation shown above works.
During a negative half-cycle of the input signal, the CA3140 functions as a normal inverting amplifier with a gain equal to -( R2 / R1 ) ... 0.5 as shown. Since the inverting input is a virtual earth point, during a negative input it remains at or very near to zero volts. When the two gain equations are equal, the full wave output is symmetrical. Note that the output is not buffered, so the output should be connected only to high impedance stage, with an impedance much higher than R3.
Figure 8
Figure 8 - Modified Intersil Circuit Using Common Opamp
Where a simple, low output impedance precision rectifier is needed for low frequency signals (up to perhaps 10kHz as an upper limit), the simplified version above will do the job nicely. It does require an input voltage of at least 100mV, because there is no DC offset compensation. Because the LM358 is a dual opamp, the second half can be used as a buffer, providing a low output impedance. Minimum suggested input voltage is around 1V peak (710mV), which will give an average output voltage of 320mV. Higher input voltages will provide greater accuracy, but the maximum is a little under 10V RMS with a 15V DC supply as shown. The LM358 is not especially fast, but is readily available at low cost.
Note that the input impedance of this rectifier topology is non-linear. The impedance presented to the driving circuit is 30k for positive half cycles, but only 10k for negative half-cycles. This means that it must be driven from a low impedance source - typically another opamp. This increases the overall complexity of the final circuit.

[1] Amplificador operacional rectificador
[2] Amplificador operacional rectificador de media onda y onda completa
Gerald Soto, EES.

4 comentarios:

  1. So you've stolen all the content from Rod Elliott. Do you really think it's nice to do that? Even the whole text is stolen from his article in 2005!

  2. http://sound.westhost.com/appnotes/an001.htm

  3. http://sound.westhost.com/appnotes/an001.htm

  4. So you've stolen all the content from Rod Elliott. Do you really think it's nice to do that? Even the whole text is stolen from his article in 2005!