title: Precision rectifier
text: # Precision rectifier
  
  The precision rectifier is a configuration obtained with an operational amplifier in order to have a circuit behave like an ideal diode and rectifier. It is very useful for high-precision signal processing. With the help of a precision rectifier the high-precision signal processing can be done very easily.
  
  The op-amp-based precision rectifier should not be confused with the power MOSFET-based active rectification ideal diode.
  
  ## Basic circuit
  
  The basic circuit implementing such a feature is shown on the right, where $R_{\text{L}}$ can be any load. When the input voltage is negative, there is a negative voltage on the diode, so it works like an open circuit, no current flows through the load, and the output voltage is zero. When the input is positive, it is amplified by the operational amplifier, which switches the diode on. Current flows through the load and, because of the feedback, the output voltage is equal to the input voltage.
  
  The actual threshold of the super diode is very close to zero, but is not zero. It equals the actual threshold of the diode, divided by the gain of the operational amplifier.
  
  This basic configuration has a problem, so it is not commonly used. When the input becomes (even slightly) negative, the operational amplifier runs open-loop, as there is no feedback signal through the diode. For a typical operational amplifier with high open-loop gain, the output saturates. If the input then becomes positive again, the op-amp has to get out of the saturated state before positive amplification can take place again. This change generates some ringing and takes some time, greatly reducing the frequency response of the circuit.
  
  ## Improved circuit
  
  An alternative version is given on the right. In this case, when the input is greater than zero, D1 is off, and D2 is on, so the output is zero because the other end of $R_{2}$ is connected to the virtual ground and there is no current through $R_{2}$. When the input is less than zero, D1 is on and D2 is off, so the output is like the input with an amplification of $-R_{2}/R_{1}$. Its input–output relationship is the following:
  
  This circuit has the benefit that the op-amp never goes into saturation, but its output must change by two diode voltage drops (about 1.2 V) each time the input signal crosses zero. Hence, the slew rate of the operational amplifier and its frequency response (gain–bandwidth product) will limit high-frequency performance, especially for low signal levels, although an error of less than 1% at 100 kHz is possible.
  
  Similar circuitry can be used to create a precision full-wave rectifier circuit.
  
  ## Peak detector
  
  With a little modification, the basic precision rectifier can be used for detecting signal level peaks. In the following circuit, a capacitor retains the peak voltage level of the signal, and a switch is used for resetting the detected level. When the input Vin exceeds Vc (voltage across capacitor), the diode is forward-biased and the circuit becomes a voltage follower. Consequently, the output voltage Vo follows Vin as long as Vin exceeds Vc. When Vin drops below Vc, the diode becomes reverse-biased and the capacitor holds the charge until the input voltage again attains a value greater than Vc.
  
  