Home/Analog Electronics/Op-amp applications/Comparator with reference

Comparator with reference using Op-Amp (IC 741) – Virtual Lab

A comparator compares the input with a reference voltage and gives a high or low output depending on which is larger. Here the reference is set by a potentiometer connected across the +12 V supply.

Aim

To use IC 741 as a voltage comparator with an adjustable reference and study how the reference changes the output pulse width.

Circuit components

ComponentValuePurpose
IC 741OA1Open loop
VR10 kΩ potReference voltage at − input
Function generator—Input at + input

Supply: ±12 V dual power supply. Instruments: function generator and two-channel digital storage oscilloscope, all on the virtual bench.

Theory

The input is applied to the + terminal and the reference to the − terminal, so the output is high only while the input is above Vref (non-inverting comparator). Interchanging the two inputs gives an inverting comparator.

For a sine input of peak Vp the output is a rectangular wave of the same frequency. Its high time is the part of each cycle during which the sine is above Vref, so moving the reference changes the duty cycle. This is how a comparator works as a level detector or a simple pulse-width modulator.

If the input peak is smaller than Vref the output never switches and stays at −Vsat. With Vref = 0 the circuit becomes a zero-crossing detector with a 50 % duty cycle.

Vref = 12 V × pot setting = 12 × 0.25 = 3 V
Vin > Vref → Vo = +Vsat, Vin < Vref → Vo = −Vsat
Duty cycle = cos⁻¹(Vref / Vp) / π = cos⁻¹(3/5)/π ≈ 30 %

Procedure

  1. Open the Op-Amp Trainer Kit simulator; it starts with the Comparator with reference application selected.
  2. In Guided mode follow the highlighted connections to place the components from the parts bank and wire the circuit on the kit, or wire it yourself in Free mode.
  3. Set the dual power supply to ±12 V and switch it on.
  4. Switch on the function generator and set: Sine, 10 Vpp, 100 Hz.
  5. Connect CH1 and CH2 of the oscilloscope as shown and set: CH1 2 V/div, CH2 5 V/div, 2 ms/div.
  6. Keep the pot at 25 % (Vref = 3 V) and note the instants where the output switches.
  7. Read CH1 at those instants: it should be about 3 V.
  8. Turn the pot and record the duty cycle for several reference voltages.
  9. Capture the oscilloscope screen and compare it with the expected result below.
Function generatorSine, 10 Vpp, 100 HzOscilloscopeCH1 2 V/div, CH2 5 V/div, 2 ms/divSupply±12 V, ON

Expected result

The output switches when the sine crosses about 3 V and is high for about 30 % of each cycle, matching cos⁻¹(3/5)/π.

Viva questions

What is the difference between an inverting and a non-inverting comparator?
In a non-inverting comparator the input goes to the + terminal and the output is high when Vin > Vref; in an inverting comparator the input goes to the − terminal and the output is high when Vin < Vref.
Why does the output stay low for a small input?
If the input peak never exceeds the reference voltage, the + input is always below the − input and the output remains at −Vsat.
Give applications of a comparator.
Level detectors, window detectors, pulse-width modulators, and analog-to-digital converters.

Other op-amp applications