comparators are used in | comparators are used in circuits such as | comparator definition meaning in digital electronics ?

**Comparators**

An analog comparator has two inputs one is usually a constant reference voltage V_{R} and other is a time varing signal V_{I} and one output V_{0}. the basic circuit of a comparator is shown in fig. 54.

When the non-inverting voltage is large than the inverting voltage, the comparator produces a high output voltage (+V_{sat}). When the non-inverting output is less than the inverting input, the output is low (-V_{sat}).Fig. 54 (b) also shows the output of a comparator for a sinusoidal.

V_{0} = – V_{sat,} if V_{i} > V_{R}

= + V_{sat} if V_{I} < V_{R}

If V_{R} = 0, then slightest input voltage (in mV) is enough to saturate the op-amp and the circuit acts as zero crossing detector as shown in fig. 54 (c). if the supply voltages are + 15 V, then the output compliance is from approximate -13 V to + 13 V. the more the open-loop gain of op-amp, the smaller the voltage requires to saturate the output. if V_{d} required is very small then the characteristic is a vertical line as shown in fig. 54(d) and (e).

If we want to limit the output voltage of the comparator two voltage (one positive and other negative) then a resistor R and two zener diodes are added to clamp the output of the comparator. the circuit of such comparator is shown in fig. 67(f) the transfer characteristics of the circuit is also shown in fig. 54(g).

The resistance is chosen, so that the zener operates in zener region when V_{R} = 0, then output changes rapidly from one state to other very rapidly every time that the input passes through zero as shown in fig. 54(h) and (i).

Such a configuration is called zero crossing detector. if we want pulses at zero crossing then a differentiator and a series diode is connected at the output. it produces single pulses at the zero crossing point in every cycle.

If the input to a comparator contains noise, the output may be erractive when V_{in} is near a trip point. for instance, with a zero crossing, the output is low, when V_{in} instance, with a zero crossing, the output is low, when V_{IN} is positive and high when V_{IN} is negative. if the input contains a noise voltage with a peak of 1 mV or more, then the comparator will detect the zero crossing produced by the noise. fig. 55(a) shown the output of zero crossing detection, if the input contains noise.

This can be avoided by using a schmitt trigger, circuit which is basically a comparator with positive feedback.

Fig. 55(b) shows an inverting schmitt trigger circuit using op-amp.

Because of the voltage divider circuit, there is a positive feedback voltage. when op-amp is positively saturated a positive voltage is feedback to the non-inverting input, this positive voltage holds the output in high stage (V_{IN} < V_{F}). When the output voltage is negatively saturated, a negative voltage feedback to the inverting input, holding the output in low state.

When the output is +V_{sat}, then reference V_{ref} is given by

V_{ref} = R_{1} / (R_{1} + R_{2}) * V_{sat} = (+BV_{sat})

If V_{in} is less than V_{ref} output will remain +V_{sat.}

When input V_{in} exceeds V_{ref} = +V_{sat}, the output switches from + V_{sat} to -V_{sat}. Then, the reference voltage is given by

V_{ref} = -R_{2} / (R_{1} + R_{2}) * V_{sat} = (-BV_{sat})

The output will remain -V_{sat} as long as V_{in} > V_{ref.}

If V_{in} < V_{ref, }i.e,. V_{in} becomes more negative than -V_{sat}, then again output switches to +V_{sat} and so on. the transfer characteristic of schmitt trigger circuit is shown in fig. 55(c). the output is also shown in fig. 55(d) for a sinusoidal wave. if the input is different than sine even then the output will be determined in a same way.

Positive feedback has an unusual effect on the circuit. if forces the reference voltage to have the same polarity as the output voltage. the reference voltage is positive when the output voltage is high (+V_{sat}) and negative when the output is low (-V_{sat}).

In a schmitt trigger, the voltage at which the output switches from +V_{sat} to -V_{sat} or vice-versa are called upper trigger point (UTP) and lower trigger point (LTP). the difference between the two trip points is called hysteresis.

UTP = R_{2} / R_{1} + R_{2} = V_{set}

LTP = R_{2} / R_{1} + R_{2} = (-V_{sat)}

_{ }V_{hys} = UTP – LTP

= R_{2} / R_{1} + R_{2} = V_{sat} – R_{2} / R_{1} + R_{2} = (-V_{sat})

= 2 (R_{2} / R_{1} + R_{2}) V_{sat}

= 2BV_{sat}

The hysteresis loop can be shifted to either side of zero point by connecting a voltage source as shown in fig. 55(e) and (f).

When V_{0} = +V_{sat}, the refernce voltage (UTP) is given by,

UTP = (V_{sat }-V_{R})R_{2 }/ R_{1} + R_{2} + V_{R}

BV_{sat} + R_{1}V_{R} / R_{1} + R_{2}

When V_{0} = – V_{sat}, the reference voltage (UTP) is given by,

LTP = (-V_{sat} – V_{R}) R_{2} / R_{1} + R_{2} = V_{R}

= – BV_{sat} + R_{1}V_{R} / R_{1} + R_{2}

If V_{R} is positive, the loop is shifted to right side; if V_{R} is negative, the loop is shifted to left side. the hysteresis voltage V_{hys} remains the same.

**Non-Inverting Schmitt Trigger**

In this case, again the feedback is given at non-inverting termilnal. the inverting terminal is grounded and the input voltage is connected to non-inverting input. fig. 56 shows an non-inverting schmitt trigger circuit.

To analyze the circuit behaviour, let us assume the output is negatively saturated. then, the feedback voltage is also negative (-V_{sat}). This feedback voltage will hold the output in negative saturation untill the input voltage becomes positive enough to make voltage positive.

V_{+} = (-V_{sat} – V_{in}) /R_{1} + R_{2} = R_{2} + V_{IN}

= -V_{sat}R_{2} / R_{1 + }R_{2} + V_{IN}R_{1} /R_{1} + R_{2}

= R_{1} / R_{1} + R_{2} (-R_{2}V_{sat} + R_{1}V_{IN})

= R_{1} /R_{1} + R_{2} (R_{2}V_{sat} / R_{1} = V_{in})

When V_{IN} becomes positive and its magnitude is greater than (R_{2} / R_{1})V_{sat}, then the output switches to +V_{sat}. therefore, the UTP at which the output switches to +V_{sat} is given by.

UTP = (R_{2}V_{sat} /R_{1})

Similarly, when the output is in positive saturation, feedback voltage is positive. to switch output state, the input voltage has to become negative enough to make. when it happens the output changes to the negative state from positive saturation to negative saturation voltage negative.

V_{+} = (V_{sat} – V_{IN})/ R_{1} + R_{2} = R_{2} + V_{in}

= V_{sat }R_{2} / R_{1} + R_{2} + V_{in} R_{1} / R_{1} + R_{2}

= R_{1} / R_{1} + R_{2} (R_{2}V_{sat} + R_{1}V_{in})

= R_{1} / R_{1} + R_{2} (R_{2} V_{sat} / R_{1} + V_{in})

When, V_{in} becomes negative and its magnitude is greater than R_{2}/R_{1} V_{sat}, then the output switches to -V_{sat}.

Therefore,

LTP = (-R_{2}V_{sat} / R_{1})

The difference of UTP and LTP given the hystersesis of the schmitt trigger.

V_{bys} = UTP – LTP

= 2 (R_{2}/R_{1}) V_{sat}

= 2BV_{sat}

In non-inverting schmitt trigger circuit, the B is defined as

B = R_{2}/R_{1}

**Example 14. **Design a voltage level detector with noise immunity that indicates when an input signal crosses the nominal threshold of -2.5 V. the output is to switch from high to low, when the signal crosses the threshold in the positive direction and vice-versa. noise level expected is 0.2 V_{PP} maximum assume the output levels are V_{H} = 10 V and V_{L} = 0 V.

**Sol. **for the triggering action required an inverting configuration is required. let the hysteresis voltage be 20% larger than the maximum pp noise voltage that is V_{hys} = 0.24 v.

Thus, the upper and lower trigger voltages are – 2.5 + 0.12 or UTP = 2.39 V and LTP = – 2.62 V

Since, the output levels are V_{H} and V_{L} instead of + V_{sat} and -V_{sat}, therefore, hysteresis voltage is given by

V_{hys} = R_{2} / R_{1} + R_{2} (V_{H} – V_{L})

Or V_{H} – V_{L} / V_{hys} = 1 + R_{1} / R_{2}

and R_{1}/R_{2} = 10 – 0/0.24 – 1 = 40.7

The reference voltage V_{ref} can be obtained from the expression of LTP.

LTP = BV_{L} + R_{1}V_{ref} / R_{1} + R_{2}

Given that V_{L} = 0 and LTP = – 262, we obtain

V_{R} = (1 + R_{2}/R_{1}) LTP = (1 + 1/40.7) (-2.62) = – 2.68 V

We can select any values for R_{2} and R_{1} that satisfy the ratio of 40.7. it is a good practice to have more than 100 k for the sum of R_{1} and R_{2} and 1 k to 3 k for the pull-up resistor on the output. the circuit shown in figure above shows a possible final design. the potentiometer serves as a fine adjustment for V_{R} while the voltage follower makes V_{R} to appear as an almost ideal voltage source.

**Relaxation Oscillator**

With positive feedback, it is also possible to build relaxation oscillator which produces rectangular wave.

The circuit is shown in fig. 57(a).

In this circuit a fraction R_{2}/(R_{1} + R_{2}) = B to the output is feedback to the non-inverting input terminal. the operation of the circuit can be explained as follows:

Assume that the output voltage is +V_{sat}. the capacitor will charge exponentially toward +V_{sat}. the feedback voltage is +bV_{sat}. when capacitor voltage exceeds + bV_{sat} the output switches from + V_{sat} to -V_{sat}. then feedback voltage becomes -V_{sat} and the output will remain -V_{sat}. now, the capacitor charges in the reverse direction. when capacitor voltage decreases below – bV_{sat} (more negative than -bV_{sat}) the output again switches to +V_{sat}. this process continues and it produces a square wave. under steady state conditions, the output voltage and capacitor voltage are shown in fig. 57 (b). the frequency of the output can be obtained as follows.

The capacitor charges from -BV_{sat} to +BV_{sat} during time period T/2. the capacitor charging voltage expression is given by

V_{C} (t) = {V_{sat} – (-BV_{sat})} (1 – e^{-t/RC}) -BV_{sat}

At T = t/2, V_{C} (t) = +BV_{sat}

BV_{sat} = (1 + B) V_{sat} (1- e^{-t/2RC}) – BV_{sat}

2B = (1 + B) (1 – e^{-t/2RC})

Or 1 – e^{-t/2RC} = 1B/1 + B

Or e^{-t/1RC} = 1 – B/1 + B

Or e^{-t/RC} = 1 + B/1 – B

Or t/2RC = 1n 1 + B/1 – B

Or t = 2RC 1n (1 + B / 1 – B)

The frequency of the output is given by f = 1 / t

f = 1 / t = 1 / 2RC 1n (1 + B /1 – B)

This square wave generator is useful in the frequency range of 10 Hz to 10 KHz. at higher frequencies, the slew rate of the op-amp limits the slope of the output square wave.

The duty cycle of the output wave can be changed replacing the resistance R by another circuit consisting of variable resistance and two diodes D_{1} and D_{2} as shown in fig. 57 (c).

When the output is positive then D_{2} conducts and D_{1} is off. the total feedback resistance becomes R_{b} + R and charging voltage is reduced by V_{D}. During the interval when the output is negative than D_{1} conducts and D_{2} is off. the charging resistance becomes R + R_{A}. the total charging and reverse charging period is decided by total resistance (2R + R_{A} + R_{B}) = constant. therefore, frequency will remain constant but duty cycle changes. the capacitor voltage and output valtage of the oscillator are shown in fig. 57 (d).

t_{1} = (R + R_{B}) C 1n (1 + B/1 – B)

t_{2} = (R + R_{A}) C 1n (1 + B/1 – B)

t = t_{1} + t_{2} = (2R + R_{A} + R_{B}) C 1n (1 + B/1 – B)

The duty cycle is given by D = t_{1} / t = R + R_{B} / 2R + R_{A} + R_{B}

BY varying R_{A} and R_{B} the duty cycle can be charged keeping frequency constant.

**Triangular Wave Generator**

In the relaxation oscillator, capacitor voltage V_{C }has a near triangular wave shape but the sides of the triangles are exponential rather than straight line. to linear size the triangles, if is required that C be charged with a constant current rather that the exponential current through R. the improved circuit is shown in fig. 58(a).

In this circuit an op-amp integrator is used to supply a constant current to C, so that the output is linear. because of inversion through the integrator, this voltage is feedback to the non-inverting terminal of the comparator rather than to the inverting terminal. the inverter behaves as a non-inverting schmitt trigger. the voltage V_{R} is used to shift the DC level of the triangular wave and voltage V_{S} is used to change the slopes of triangular wave form is shown in fig. 58(b).

To find the maximum value of the triangular waveform assume that the square wave voltage V_{o} is at its negative value = – V_{sat}. with a negative input, the output V_{(t) }of the integrator is an increasing ramp. the voltage at the non-inverting comparator input V_{1} is given by.

V_{1} = (-V_{sat} – V_{out} / R_{1} + R_{2}) R_{2} + V_{out}

Or V_{1} = R_{1} / R_{1 }+ R_{2} = V_{out} – R_{2} / R_{1} + R_{2} = V_{out}

When V_{1} rises to V_{R}, the comparator changes state from -V_{sat} to +V_{sat} and V_{(t)} starts decreasing linearly similarly,when V_{1} falls below V_{R}, the comparator output changes from +V_{sat} to -V_{sat}.

Hence, the minimum value of triangular V_{min} occurs for V_{1} = V_{R.} hence, the pecak value V_{max} of the triangular waveform occurs for V_{1} = V_{R}.

Therefore, V_{max} = R_{1} + R_{2} / R_{1} = V_{R} + R_{2} / R_{1} = V_{sat}

And V_{min} = R_{1} + R_{2} / R_{1} = V_{R} – R_{2}/ R_{1} = V_{sat}

The peak to peak swing is given by

V_{max} – V_{min} = 2V_{sat} R_{2}/R_{1}

The average output voltage is given by V_{R} (R_{1} + R_{2} / R_{1}).

If V_{R} = 0, the waveform extends between -V_{sat} (R_{2}/R_{1}) and +V_{sat} (R_{2}/R_{1}).

The sweep times t_{1} and t_{2} for V_{S} = 0 can be calculated as follows :

The capacitor charging current is given by

I = C dV_{C} / dt = – C dV_{out} / dt

Where, V_{C} = – V_{out} is the capacitor voltage.

For V_{out} = – V_{sat}, I = – V_{sat} / R

Therefore, -V_{sat} / R = – C dV_{out} / dt

dV_{out} / dt = V_{sat} / RC

Or V_{max – }V_{min} / t_{1} = V_{sat} / RC

Therefore, t_{1} = V_{max} – V_{min} / V_{sat} / RC

When the output voltage of first op-amp is +V_{sat, }then the voltage V_{1} is given by

V_{1} = (-V_{sat} – V_{out} / R_{1} + R_{2} = R_{2} + V_{out}

As triangular voltage increases, the voltage V_{1} also increases. At t = t_{1}, when the voltage V_{out} become V_{max} the voltage V_{1} becomes equal to V_{R} and switching takes place. Therefore,

V_{R} = -V_{sat}R_{2} / R_{1} + R_{2} + R_{1} / R_{1} + R_{2} = V_{max}

Or V_{max} = R_{1} + R_{2} / R_{1} = V_{R} + R_{2} / R_{1} = V_{sat}

Similarly, when output voltage is +V_{sat,} then voltage V_{1} is given by

V_{1} = (V_{sat} – v_{out} ) / R_{1} + R_{2} = R_{2} + V_{out}

As triangular voltage decreases, the voltage V_{1} also decreases. At t = t_{2}, when the voltage V_{out} becomes V_{min}, the voltage V_{1} becomes equal to V_{g} and switching takes place. therefore,

V_{R} = V_{sat} R_{2} / R_{1} + R_{2} + R_{1} / R_{1} + R_{2} = V_{max}

Or V_{max} = R_{1} + R_{2} / R_{1} V_{R} – R_{2} / R_{1} V_{sat}

Therefore, V_{max} – V_{min} = 2R_{2} / R_{1} V_{sat}

and V_{av} = R_{1} + R_{2} / R_{1} = V_{R}

Solving the above equations, we get

t_{1} = 2R_{2}RC / R_{1} = V_{sat}

t_{2} = t_{1} = 1/2f

f = R_{1} / 4R_{2}RC

The frequnency f is independent of V_{O,} maximum frequency is limited either by slew rate or its maximum output current which determines the charging rate of C. slowest speed is limited by the bias current of op-amp.

If unequal sweep intervals t_{1} = t_{2} are desried, then V_{S} can be changed. the positive sweep speed is given by (V_{sat} + V_{S} )/ RC and the negative sweep speed is given by (V_{sat} – V_{S}) / RC . the peak to peak triangular amplitude is unaffeeted by the voltage V_{S}.

When V_{S} = 0, I = C dV_{C} / dt

-V_{sat} – V_{S} /R = – C dV_{Out} /dt = – C. (V_{max – }V_{min}) /t_{1}

Therefore, t_{1} = V_{max} – V_{min} / (V_{sat} + V_{S} ) / RC

Or t_{1} = 2V_{sat}R_{2}/R_{2 }/ (V_{sat} + V_{S}) / RC

Similarly, when the output voltage of first op-amp -V_{sat}, then

V_{sat} – V_{S} / R = – C (V_{max} – V_{min} / t_{2}

Therefore, t_{2} = V_{max} – V_{min} / (V_{sat} – V_{S}) / RC

Or t_{2} = 2V_{sat}R_{2}/R_{1} / (V_{sat} – V_{S}) / RC

Therefore, t_{1 / }t_{2} = V_{sat} – V_{S} / V_{sat} + V_{S}

and t = t_{1} + t_{2}

2V_{sat} R_{2}RC / R_{1} [2V_{sat} / V^{2}_{sat} -V^{2}_{S}]

The oscillation frequency is given by

f = 1 / t = R_{1} / 4R_{2}RC [1 – (V_{S} / V_{sat})^{2}]

and the duty cycle is given by

Duty cycle t_{1}/t = V^{2}_{sat} – V^{2}_{S} / 2V_{sat} (V_{sat} + V_{S})

= V_{sat} – V_{S} / 2V_{sat} = 1/2 (1 – V_{S} / V_{sat})

**Example 15. **(a) Consideer the pulse generator shown in figure below. in the quiescent state (before a trigger pulse is applied), find V_{2} , V_{0} and V_{1}.

(b) At t = 0, a narrow, positive trggering pulse V, whose magnitude exceeds V_{R} is applied. At t = 0 +, find V_{0} and V_{1}.

(c) Verify that the pulse width t = RC in (2V_{0})/ V_{R}.

**Sol.** (a) Before a trigger pulse is applied, the circuit is in stable state with the output at V_{0} = + V_{0} (~V_{z} + 0.7). the capacitor C is charged with the polarity shown in figure below.

Thus, V_{1} ~ 0.7 V

And V_{2} = – V_{R}

(b) At t = 0, a narrow positive triggering pulse of higher magnitude is applied. the capacitor C voltage can not charge instantaneously. therefore, V_{2} becomes positiven and greater than V_{1} (~ 0.7 V) the comparator output changes.

Thus, V_{O} = – (V_{Z} + 0.7 V) = – V_{0}

Since, capacitor C voltage cannot change instantaneously, therefore,

V_{1} = 2V_{0}

(c) The input trigger pulse in of very short duration therefore, after the short duration pulse the voltage V_{2} returns to (-V_{R}). But the output remains -V_{0} because V_{1} is – 2V_{0}.

The capacitor now starts charging exponentially with a time constant t = RC through R towards V_{0}, because diode is reverse biased.

V_{C} = (-V_{0} – V_{0}) (1 – e^{-1/RC}) – V_{0}

The voltage at point V_{1} is given by,

V_{1} = – V_{0} – V_{C}

= – V_{0} + 2V_{0}(1 -e^{-1 / RC}) – V_{0}

= 2V_{0e}^{-1 / RC} – t /RC

When V_{1} voltage becomes more than V_{R}. the comparator output switches back to + V_{O} let at t = T. the voltage V_{1} becomes – V_{R}

– V_{R} = – 2V_{0} e^{-T/RC}

T = RC In 2V_{O} / V_{R}

The capacitor now starts charging towards +V_{0} through R untill V_{C} reaches +V_{0} and V_{1} becomes 0.7 V.The waveform at different points are shown in figure above.

**Voltage Regulators**

An ideal power supply maintains a constant voltage at is output terminals under all operating condititons. the output voltage of a practical power supply changes with load generally dropping as load current increase as shown in fig. 59(a).

The terminal voltage when full load current is drawn is called full load voltage (V_{FL}) The no load voltage is the terminal voltage when zero current is drawn from the supply, that is the open circuit terminal voltage.

Power supply performance is measured in terms of per cent voltage regulation, which indicates its ability to maintain a constant voltage it is defined as

V_{R} = V_{NL} – V_{FL} / V_{FL} x 100%

The thevenin’s equivalent of a power supply is shown in fig. 59 (b). the thevenin voltage is the no load voltage V_{NL} and the thevenin resistance is called the output resistance R_{0} let the full load current be I_{fl}. therefore, the full load resistance R_{fl} is given by,

R_{fl} = V_{fl} / I_{fl}

From the equivalent circuit, we have

V_{fl} = (R_{fl} / R_{fl} + R_{0}) V_{nl}

and the voltage regulation is given by

V_{nl} – (R_{fl} / R_{fl} + R_{0}) V_{nl}

V_{R} = (R_{fl} / R_{fl} + R_{0}) V_{nl} x 100%

V_{R} = R_{0} / R_{fl} x 100%

or V_{R} = R_{0} (I_{fl} / V_{fl}) x 100%

it is clear that the ideal power supply has zero output resistance.

**Example 16. **A power supply having output resistance 1.5 supplies a full load current of 500 mA to a 50 load determine,

(a) Percentage voltage regulation of the supply

(b) no load output voltage.

**Sol. **(a) full load output voltage

V_{FL} = (500mA) (50) = 25 V

Therefore, V_{R} = R_{0} (I_{FL}/V_{FL}) x 100%

= 1. 5 (0.5 /25)x 100%

= 3.0%

(b) the no load voltage V_{nl} = (R_{fl} + R_{0} / R_{fl}) = V_{fl}

= 25 (50 + 1.5) / 50 = 25.75 V