ADALM2000 Activity: Temperature Control Using a Window Comparator

Objective

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 noninverting), in which the output indicates whether an input signal is within the voltage range bounded by two different thresholds: one that triggers an op amp comparator on detection of some upper voltage threshold, VREF(HIGH), and one that 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 are called the window.

Materials

  • ADALM2000 Active Learning Module
  • Solderless breadboard and jumper wire kit
  • Two AD8561 comparators
  • One 2N3904 NPN transistor
  • Two 1N914 small signal diodes
  • One LED (any color)
  • Three 10 kΩ resistor
  • One 20 kΩ resistor
  • One 470 Ω resistor

Window Comparator

Background

Consider the circuit presented in Figure 1.

Figure 1. A 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 to one-third of the reference voltage (VREF). Therefore, the upper reference (VREF(HIGH)) is set to 2/3 VREF and the lower reference to 1/3 VREF.

Considering that the VIN is below the lower voltage level—that is, (VREF(LOW)) equals 1/3 VREF—the output will be HIGH and D2 will be forward biased. Due to the positive voltage at the base of 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/3 VREF lower voltage level and it is below 2/3 VREF (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—that is, VREF(HIGH) equals 2/3 VREF—equates to 2/3 VREF, the output will be HIGH and D1 will be forward biased. Due to the positive voltage at the base of 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.

Hardware Setup

Build the following breadboard circuit for the window comparator circuit.

Figure 2. A window comparator breadboard circuit.

Procedure

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

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

Supply the circuit using the 5 V power supply.

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

A plot example is presented in Figure 3.

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.

Temperature Control

Background

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 (15°C to 35°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 that is at a logic high when the ambient temperature is within the target window.

Figure 4. A temperature sensor window comparator.

Programming TMP01

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:

  • Select the desired hysteresis temperature.
  • Calculate the hysteresis current IVREF.
  • Select the desired set point temperatures.
  • 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.

Figure 5. Temperature measurement.

IVREF = 2.5 V/(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.

Tasks

1. Build the following circuit:

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

2. Build the following circuit:

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

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

  • IVREF
  • VSETHIGH
  • VSETLOW
  • TSETHIGH
  • TSETLOW
Figure 6. Temperature control.

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

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

Question:

1. For the circuit presented in Figure 1, express VREF(LOW) and VREF(HIGH) as equations depending on R1, R2, R3, and W2. What is the ratio between VREF(HIGH) and VREF(LOW) if all resistances are equal?

You can find the answers at the StudentZone blog.

Authors

Doug Mercer

Doug Mercer

Doug Mercer received his B.S.E.E. degree from Rensselaer Polytechnic Institute (RPI) in 1977. Since joining Analog Devices in 1977, he has contributed directly or indirectly to more than 30 data converter products and holds 13 patents. He was appointed to the position of ADI Fellow in 1995. In 2009, he transitioned from full-time work and has continued consulting at ADI as a fellow emeritus contributing to the Active Learning Program. In 2016, he was named engineer in residence within the ECSE department at RPI.

Antoniu Miclaus

Antoniu Miclaus

Antoniu Miclaus is a software engineer at Analog Devices, where he works on embedded software for Linux and no-OS drivers, as well as ADI academic programs, QA automation, and process management. He started working at ADI in February 2017 in Cluj-Napoca, Romania. He holds an M.Sc. degree in software engineering from the Babes-Bolyai University and a B.Eng. degree in electronics and telecommunications from the Technical University of Cluj-Napoca.