>
section 4 of 134 min read

4. Op-Amp Non-Linear Applications

When you remove negative feedback, or replace it with positive feedback, the op-amp stops being a linear amplifier and becomes a one-bit decision-maker. These circuits are surprisingly useful.

4.1 Comparators

An op-amp without feedback. The output saturates at the positive rail when V+>VV_+ > V_- and at the negative rail when V+<VV_+ < V_-. The transition is fast: limited only by the slew rate. Output is always railed.

Used everywhere a binary "is A bigger than B?" answer is needed:

  • Threshold detection (battery low, intrusion alarm).
  • Building block of every flash and SAR ADC.
  • PWM generators (compare a triangle wave to the duty-cycle command).
  • Zero-crossing detectors (compare to ground).
  • Window detectors (compare to two thresholds).

Note: dedicated comparator chips like the LM393, LM339, LMV393, TLV3501, ADCMP600 are much faster than general-purpose op-amps and have open-drain or push-pull rail-to-rail outputs designed for digital fan-out. Use a dedicated comparator chip for any application that requires fast response or clean digital edges.

4.2 Schmitt trigger

Add positive feedback to a comparator and you create a circuit with two thresholds (hysteresis). The output flips high when the input crosses one threshold and flips low at a different threshold lower than the first.

plaintext
   V_in ─────│-\
             │  \
             │   ●─────────●── V_out
             │  /          │
        ┌────│+/           │
        │    │/            │
        ●─────[R_2]────────●

       [R_1]

       GND

Why the hysteresis matters: a noisy signal crossing a single threshold produces multiple bounces (ringing). With hysteresis, the input must overshoot one threshold to flip; once flipped, only a return through the lower threshold flips back. Clean digital edges from noisy analog inputs, no debouncing required.

The two thresholds are:

VTH+=Vout,highR1R1+R2,VTH=Vout,lowR1R1+R2V_{TH+} = V_{out,high}\frac{R_1}{R_1+R_2}, \quad V_{TH-} = V_{out,low}\frac{R_1}{R_1+R_2}

The hysteresis width is Vout,highVout,lowV_{out,high} - V_{out,low} scaled by the divider.

Built into most discrete digital input ICs, GPIO pins on microcontrollers, and CMOS gates marked "ST" (e.g., 74HC14 hex Schmitt inverter). Used in mechanical-switch debouncing, optical sensor thresholding, infrared receivers, and the front end of many digital communications systems.

4.3 Zero-crossing detectors

A comparator with one input grounded. The output flips state every time the input crosses zero. Used to detect the phase of a 50/60 Hz mains voltage (for triac control), to find the timing of a sine signal (for PLL phase detectors), or to convert a sine wave to a square wave.

4.4 Precision rectifiers

A diode in an op-amp's feedback loop. The op-amp's high gain compensates for the diode's 0.6 V forward drop, so rectification works even down to millivolts.

Half-wave precision rectifier:

plaintext
                      D
                   ──▷│──
                   │      │
   V_in ─[R]──●── V- ─────●─── V_out
              │   │\│
              │   │ \
              │   │ /
            GND ──│+/
                  │/

When Vin>0V_{in} > 0, the op-amp drives down to forward-bias the diode and pull VV_- to virtual ground. VoutV_{out} tracks the input through RR and the diode. When Vin<0V_{in} < 0, the diode reverse-biases, the op-amp's output saturates negative trying to keep the loop closed, and VoutV_{out} is held by another path (often a second resistor) at zero.

Full-wave precision rectifier: two op-amps and a few diodes producing a continuous Vin|V_{in}| output. A practical example is the AD736 RMS-to-DC converter chip (which uses an op-amp-and-diode network internally) for true-RMS digital multimeters.

Used in: AC voltmeters that read down to mV (cheap rectifier diodes alone cannot, because of the 0.6 V drop), audio level meters, AGC detection, peak detectors, RF envelope detectors.

4.5 Peak detector

A diode plus a hold capacitor: the input charges the cap through the diode but cannot discharge it (diode reverses). The cap holds the highest voltage seen at the input.

plaintext
                     D
   V_in ──── ▷│ ─────●── V_out (held on C)

                    [C]

                    GND

For accuracy, the diode is wrapped in op-amp feedback (precision rectifier topology). Used in pulse-height analyzers (radiation detectors), peak-program meters (audio), and spectrum analyzers (RF peak detection).

4.6 Sample-and-hold

An analog switch in series with a hold capacitor. On a "sample" command, the switch closes and the cap charges to the input voltage; on "hold," the switch opens and the cap maintains that voltage for the rest of the conversion cycle.

plaintext
   V_in ──── /  ────●── V_buffer ─── V_out
              SW    │
                   [C]

                   GND

Always present at the front of every ADC, because the input must not change while the conversion is happening (a moving target gives wrong digital codes). The internal sample-and-hold of a SAR ADC is what determines its analog input bandwidth: even with a 1 MSPS conversion rate, you can sample a 10 MHz sine cleanly because the S/H takes a snapshot in nanoseconds.

The classic discrete S/H chips were the LF398 and the AD585. Modern ADCs include S/H on-die, integrated with the comparator and switching logic.