What is window comparator

What is window comparator

Fig. 1 Window Comparator using LM339
click picture for full size.

by Lewis Loflin

A window comparator will output a voltage between two selected voltage points and be off outside that range. In Fig. 1 we have used 2 of 4 comparators in a LM339. The outputs of the each comparator in the LM339 is a open collector transistors tied together and connected to a LED and resistor. This open collector arrangement allows one to use a separate power supply form the rest of the circuit.

Note that U1b is connected as an inverting comparator while U1c is connected as a non-inverting comparator.

See Voltage Comparator Circuits

The rule for open collector comparator is both comparators must be turned OFF at the same time to output a HIGH. in Fig. 1 we use three 10,000 ohm resistors in series that produces 2/3s Vcc at Vref HIGH and 1/3 Vcc at Vref LOW.

On an inverting comparator if the MINUS input is greater than the PLUS input the internal open collector transistor is turned on. On a non-inverting comparator if the PLUS input is greater than the MINUS input the internal open collector transistor is turn on.

Thus the LED in Fig. 1 is on between these two voltages of 4V and 8V.

What is window comparator

Fig. 2 Window comparator using LM358 dual Op-Amp at 3 volts.

What is window comparator

Fig. 3 Window comparator using LM358 dual Op-Amp at 6 volts.

What is window comparator

Fig. 4 Window comparator using LM358 dual Op-Amp at 9 volts.

Because each LM339 comparator is nothing more than an operational amplifier we can use a LM358 and do the same thing as Fig. 1 other than the output is 12-volts fed into two transistors Q1 and Q2. We use both a non-inverting and inverting comparators together. Vin is TP1.

What is window comparator

Above is the logic table for the window comparator circuit at different voltages at Vin. Output transistor Q3 is turned on by the 10K pull up resistor when both Q1 and Q2 are turned off at the same time.

A Hall sensor in its most basic form is an analog integrated circuit. It consists of a Hall plate that outputs a "transverse" voltage based on the intensity of a magnetic field - polarity is dependant on magnetic polarity.

It also consists of a high gain differential amplifier because the generated voltage is small. The output voltage is analog usually centered around half the power supply voltage.

The addition of a Schmitt trigger with a properly set hysteresis will create a Hall switch or Hall latch. They often have an open collector output transistor.

The Schmitt triggers used here are based on an analog comparator. These can be built from operational amplifiers (op-amps) like the LM358 or LM741.

Or one can use the LM311 or LM339 quad comparator. The have open collector outputs unlike the LM311/LM741.

Often considered "digital" at this point we have in reality a one-bit analog-to-digital converter.

Web site Copyright Lewis Loflin, All rights reserved.
If using this material on another site, please provide a link back to my site.

Definition
A device, usually consisting of a pair of voltage comparators, in which output indicates whether the measured signal is within the voltage range bounded by two different thresholds (an "upper" threshold and a "lower" threshold). Synonyms
Find a term alphabetically:

0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ

This version (03 Jan 2021 22:24) was approved by Robin Getz.The Previously approved version (23 Aug 2019 14:14) is available.

What is window comparator

The objective of this lab activity is to use two high speed voltage comparators as a Window-Comparator and program the TMP01 Low Power Programmable Temperature Controller using this approach.

A Window-Comparator is a circuit configuration, usually consisting of a pair of voltage comparators (inverting and non-inverting), in which the output indicates whether an input signal is within the voltage range bounded by two different thresholds. One which triggers an op-amp comparator on detection of some upper voltage threshold, VREF(HIGH) and one which triggers an op-amp comparator on detection of a lower voltage threshold level, VREF(LOW). The voltage levels between these two upper and lower reference voltages is called the “window”.

ADALM2000 Active Learning Module Solder-less breadboard, and jumper wire kit 2 – AD8561 Comparators 1 – 2N3904 NPN transistor 2 – 1N914 small signal diodes 1 – LED ( any color ) 3 – 10KΩ resistor 1 – 20KΩ resistor 1 – 470Ω resistor

Consider the circuit presented in Figure 1.

What is window comparator

Figure 1 Window Comparator

The circuit uses a voltage divider network, formed of three equal value resistors R1 = R2 = R3. The voltage drops across each resistor will also be equal at one-third of the reference voltage (VREF). Therefore, the upper reference (VREF(HIGH)) is set to 2/3VREF and the lower reference to 1/3VREF.

Considering that we use the When VIN is below the lower voltage level, (VREF(LOW)) which equates to 1/3VREF, the output will be HIGH and D2 will be forward biased. Due to the positive voltage at base the npn transistor, Q1 moves into the saturation. Thus, the output voltage is zero, and the supply voltage will drop on R5 and D3, turning the LED on.

When VIN exceeds this 1/3VREF lower voltage level and it is below 2/3VREF (VREF(HIGH)), both comparators' outputs will be LOW and the diodes reverse-biased. No voltage is applied to the base of Q1,the transistor is in cut-off and no collector current flows through R6 or R5, D3. The output voltage is the supply voltage V+.

When VIN is above the upper voltage level, (VREF(HIGH)) which equates to 2/3VREF, the output will be HIGH and D1 will be forward biased. Due to the positive voltage at base the npn transistor, Q1 moves into the saturation. Thus, the output voltage is zero, and the supply voltage will drop on R5 and D3, turning the LED on.

Build the following breadboard circuit for the window comparator circuit.

What is window comparator

Figure 2. Window Comparator breadboard circuit

Use the first waveform generator (W1) as source to provide a Triangular signal with 5V amplitude peak-to-peak, 100Hz frequency and 2.5V offset.

Use the second waveform generator (W2) as 5V constant reference voltage.

Supply the circuit using the 5V power supply.

Configure the scope so that output signal is displayed on channel 2 and the input signal is displayed on channel 1.

A plot example is presented in Figure 3.

What is window comparator

Figure 3. Window Comparator waveforms

On the plot the “windows” can be noticed when the input voltage is between the upper and the lower voltage references.

An example of a window comparator application is a simple temperature controller circuit (Figure 2). The temperature sensor, TMP01, has the dual comparator configuration of figure 1 built in. By choosing the proper values for R1, R2 and R3 the circuit monitors if the temperature holds in the required range (25 ± ~10 °C).

The TMP01 is a linear voltage-output temperature sensor, with a window comparator that can be programmed by the user to activate one of two open-collector outputs when a predetermined temperature set point voltage has been exceeded. A low drift voltage reference is available for set point programming. By connecting the two open collector outputs together as a single wire OR output we can obtain a signal which is at a logic high when the ambient temperature is within the target window.

What is window comparator

Figure 4 Temperature sensor window comparator

In the basic fixed set point application utilizing a simple resistor ladder voltage divider, the desired temperature set points are programmed in the following sequence:

1. Select the desired hysteresis temperature.

2. Calculate the hysteresis current IVREF.

3. Select the desired set point temperatures.

4. Calculate the individual resistor divider ladder values needed to develop the desired comparator set point voltages at SET HIGH and SET LOW.

The hysteresis current is readily calculated. For example, for 2 degrees of hysteresis, IVREF = 17 μA. Next, the set point voltages, VSETHIGH and VSETLOW, are determined using the VPTAT scale factor of 5 mV/K = 5 mV/(°C + 273.15), which is 1.49 V for 25°C. Then, calculate the divider resistors, based on those set points. The equations used to calculate the resistors are:

VSETHIGH = (TSETHIGH+ 273.15) (5 mV/°C)

VSETLOW = (TSETLOW + 273.15) (5 mV/°C)

R1 (in kΩ) = (VVREF−VSETHIGH)/IVREF= (2.5 V −VSETHIGH)/IVREF

R2 (in kΩ) = (VSETHIGH−VSETLOW)/IVREF

R3 (in kΩ) = VSETLOW/IVREF

The total R1 + R2 + R3 is equal to the load resistance needed to draw the desired hysteresis current from the reference, or IVREF.

IVREF = 2.5V/( R1 + R2 + R3)

Since VREF = 2.5 V, with a reference load resistance of 357 kΩ or greater (output current 7 μA or less), the temperature setpoint hysteresis is zero degrees. Larger values of load resistance only decrease the output current below 7 μA and have no effect on the operation of the device. The amount of hysteresis is determined by selecting a value of load resistance for VREF.

1. Build the following circuit:

What is window comparator

Figure 5 Temperature Measurement

Measure VPTAT output value and compute the actual measured temperature in degrees Kelvin and degrees Celsius.

2. Build the following circuit:

What is window comparator

Figure 6 Temperature Control

2.a. Identify the components and try to draw the circuit schematic.

2.b. Using the information provided by the breadboard circuit, compute the following parameters:

  • IVREF

  • VSETHIGH

  • VSETLOW

  • TSETHIGH

  • TSETLOW

2.c. How many degrees is the temperature setpoint hysteresis? How can you change this value?

2.d. How does the circuit work? When will LED1 (red) and LED2 (blue) turn on? Explain your answer.

university/courses/electronics/electronics-lab-window-comp-tmp01.txt · Last modified: 03 Jan 2021 22:21 by Robin Getz