In this lab, you will construct a temperature control circuit, which will keep an aluminum block at a nearly fixed voltage by controlling a cooling device.

A block diagram of the full temperature controller circuit.

Figure 1 shows a block diagram of a simplified version of a temperature control circuit taken from [1].  The original circuit was designed to allow the user to maintain the temperature of a diode laser at a stable value, either above or below the ambient temperature.

[1] K. B. MacAdam, A. Steinbach, and C. Wieman , “A narrow‐band tunable diode laser system with grating feedback, and a saturated absorption spectrometer for Cs and Rb”, American Journal of Physics 60, 1098-1111 (1992) https://doi.org/10.1119/1.16955

Circuit Functionality

The 5 key parts of the circuit can be broken down as follows:

  • Temperature Sensor: Allows user to monitor the output of a voltage divider that includes a thermistor, which in turn is proportional to the temperature of the aluminum block.
    • The sensors use buffers (op-amp followers) to prevent any possible loading that would alter their outputs. Remember back in lab 4 (Transistors 1) when your sensor couldn't directly power an LED? That was a loading issue.
  • Temperature Setpoint:  Allows user to control the the temperature that they'd like to coolthe block to by setting a voltage via potentiometer.
    • The difference between the Sensor and Setpoint Monitor voltages is called the Error Signal.
  • Feedback Control: The circuit essentially compares the voltage drop across the thermistor (Temperature Sensor) to the voltage drop across the set point resistance (Temperature Setpoint) and generates an output voltage proportional to the difference between the two. This output voltage is used to control the behavior of the next stage of the circuit by switching a cooling element on or off via transistor.  How this output voltage scales with the changing difference between the Sensor and Set Point voltages is determined by the circuit's gain.
  • Peltier Control: This circuit controls the current passing through the TEC(Thermo Electric Cooler) using a Field Effect Transistor(FET), based on the signal from the feedback control portion. Note that the TEC is a peltier device, and can be used for both heating or cooling depending on configuration.
  • Lighting Indicator: This part of the circuit gives the user visual information about what the circuit is doing. This could be as simple as turning an LED on whenever the heater is on, and if you were building this to be an independent circuit you'd probably want an 'on' indicator when it's powered. This can be quite helpful when using such a circuit in a research environment, where you don't want to have to pull out a thermometer or oscilloscope to tell if the heater is working or not.

This lab will involve quite a few op-amp circuits, which is why you'll be using a TL074CN chip, which contains four op-amps in a single part.

A pin-out diagram for the TL074CN. Notice that the half-moon shape indicates the top of the chip; the circle seems to be an artifact of manufacturing.

Note that the power is connected along the middle pins instead of opposite corners here.

Temperature Sensing

thermistor (temperature-dependent resistor) has been embedded in the aluminum block to allow its temperature to be monitored. This particular thermistor has a nominal resistance of 150k$\Omega$ at 25°C (or 298.15 K). A first order approximation of the relationship between thermistor resistance and temperature is called the $\beta$ equation, given by Eq. 1

$R = R_0 e^{\beta\left(\frac{1}{T} - \frac{1}{T_0} \right)}$  (1)

Here T is temperature in Kelvin and R is resistance in kΩ. $R_0$ is the 150 k$\Omega$ value, $T_0$ = 298.15 K, and $\beta$ is 3892K for this model.

This can be solved for the temperature T to get Eq. 2:

$T =\dfrac{\beta}{ln(R/R_\infty)} $ (2)

where $R_\infty = R_0 e^{-\beta / T_0} \approx 0.32 \Omega $

Higher order accuracy can be gained with appropriate calibration measurements and the use of the Steinhart-Hart Equation or its higher-order cousins for mK level precision.

tecblock.jpg
The circuit symbol for a thermistor. Note that it includes labeling for what the expected resistance is around room temperature. A photo of our heating & cooling element. The purple wires are connected to the embedded thermistor.

Design a voltage divider circuit using the thermistor and a fixed resistor that produces an output that increases with temperature. You can use eq. 2 to estimate what the thermistor's resistance will be at various temperatures. For this experiment, we have the constraint that one of the power supply's variable voltages will be set to $+10 V$ for the op-amps.

What would you expect $V_{out,sen}$ to be when the thermistor is at room temperature ($20^\circ$)?
What would you expect $V_{out,sen}$ to be when the thermistor is cooled to $15^\circ$?

Build the temperature sensing circuit. Record what the actual value of $V_{out,sen}$ is at room temperature. You may also want to verify that the resistance of the thermistor decreases as temperature increases by heating the sensor slightly (e.g., by holding the aluminum block).

Keep this circuit (and all subsequent circuits) built! You'll be using it again later.


Temperature Setpoint

Now that you have an idea of what sensor voltage corresponds to room temperature, you can create a circuit that will generate a target (setpoint) voltage.

Design a voltage divider that will let you produce a range of setpoint voltages, using a potentiometer.

An example temperature setpoint circuit template. Note that by adjusting the resistors X and Y you can narrow the output range to allow for finer control. For instance, if X = 0 and Y = 0, one turn of the pot would sweep from 0 to 10 V.
For the circuit you choose, what range of $V_{out,set}$ values do you expect to be able to achieve?

Construct your circuit, and record what range of values of $V_{out,set}$ can be generated.  

Before you continue, you should build a pair of op-amp follower circuits for the setpoint and sensor circuits and connect them for later use. From here on out, $V_{out,sen}$ and $V_{out,set}$ will refer to the output of the op-amp circuits.

A template for buffered temperature measurement/setpoint circuits. You can use any of the four op-amps in your chip to construct the buffer circuits, it shouldn't make a significant difference in anything.

Thermo Electric Cooler Control

The temperature control circuit will be used to control the current flowing through a Thermo Electric Cooler (TEC) so as to maintain the temperature of an Al block at about 15°C. The TEC uses the Peltier effect to transfer heat from the cold side to the hot side. The rate of heat transfer is governed by the magnitude of the current passing through the TEC. The TEC is a semiconductor device (distantly related to diodes), so polarity of the current flow through the device is important. Reversing the current switches which side is cooled or heated.

As shown below, the hot side of the TEC is attached with thermal paste to a heat sink while the cold side is attached to the Al block we wish to cool.

The thermo electric cooler, shown in place with aluminum block and heat skink. The image on the right is from an old setup, but hopefully it gets the point across.

To start, we'll connect just the TEC and a resistor to the power supply. In this instance the resistor is used to limit the maximum current to the TEC, as otherwise it will happily try to draw more than 3A from the power supply.

A circuit for testing the TEC

Construct the circuit, and verify that the TEC gets hotter on one side and cooler on the other. If the side with the heat sink is getting cold, reverse the connections. Note that you'll probably have to turn up the current limit on your power supply here, and that the resistor will become quite hot.

Controlling the TEC

To control the current through the TEC, we will be using a Field Effect Transistor (FET), depicted below.  We haven't used FETs yet in this course, but essentially the resistance between the Source (S) and Drain (D) may vary between infinite and a few ohms, depending on the Gate (G) voltage.  They're fundamentally controlled by voltages, rather than a BJT's current control.

Our Field Effect Transistor (FET). Note that the Source is named for being the “source” of electrons into the FET and the “drain” is the terminal electrons exit the FET from. Thus, conventional current will be from the drain to the source. The circuit symbol for a FET. Specifically, an N-type JFET. There are many, many types of FETS with differing useful behaviors to learn about if you need to.

To use the FET as a switch, we'll just pop it into our circuit as follows:

A heater control circuit, which will cause the TEC to cool down when $V_{in}$ is sufficiently high. If you place your FET in the board such that the metal heatsink faces towards your right, then the top pin (1) is the Gate, the middle (2) the Drain, and the bottom (3) is the Source.

Modify your circuit with the addition of the FET. Test that, at the very least, the TEC cools when $V_{in}$ is +10 V and that it doesn't when $V_{in}$ is 0V.

The FET, its heatsink, and the power resistor will get hot while you are doing this lab. Take care to not touch other wires to them or brush against either when working. If you aren't sure if the part is cool, you can hold your hand near it or very gingerly touch it with the back side of your finger.

Also, the FET's heat sink is connected to the drain pin. If you touch it with other wires, you may find some very odd behavior popping up.

Testing the controller

To test your circuit, you should try a variety of input voltages $V_{in}$ between 0V and 10V. This can be done a variety of ways; you can use a DC signal from your function generator, the other side of your power supply, or you might be able to use your setpoint circuit depending on the design.  

Test the behavior of your cooling circuit, making a note of your choice of inputs voltages and the current through the device for each value.

At what input voltage does the FET (S)ource voltage begin to change?
What is the maximum current through the positive power supply as you test different inputs? You don't need to be precise, you can just read off the value from the LCD screen. Don't worry if you see 100s of mA; we'll need substantial power to make significant temperature changes.
Hey, my setpoint & sensor voltage are changing when the cooler kicks on. What gives?

It may be that you observe both your setpoint and sensor voltages drop whenever the TEC starts drawing much current. Some of this behavior can be explained by the fact that, when we start moving over an amp of current through our wires, their small resistances may still result in measurable voltage changes. Consider that if a wire has even $0.01\Omega$ resistance, we'd get a 10mV drop across it when passing an amp of current through it. A more sophisticated circuit would take care to stabilize the voltage divider circuits, using a diode clamp or a voltage regulator.

Basic Feedback Control

To begin with, consider a control circuit without any negative feedback at all, shown below.

A control circuit with no feedback whatsoever.
What do you predict $V_{out,fb}$ will be when $V_{in,1} > V_{in,2}$? What about when $V_{in,1} < V_{in,2}$?
What would happen if you switched the setpoint and sensor connections?

Build the comparator circuit shown below and test your predictions. In this instance it may be useful to use a function generator as a dc voltage for $V_{in,1}$ and then use ground $V_{in,2}$.

Initial Testing

Now that you know how to control the cooler and you have the sensors and a basic feedback circuit constructed, it's time to put things together.

  • Turn off your power supply to make sure you aren't affecting your block's temperature to start with.
  • Connect your various circuits together, as shown in the first block diagram.
    • For the feedback stage, $V_{out,set}$ should connect to $V_{in,1}$. If you swap the connections, the device will do nothing to a warm block and cool a cold block indefinitely.
  • Briefly power on your circuit to confirm that it will begin to cool at room temperature.

Adding Lighting Indicators

You should probably be able to tell if the cooler is actively working or not somehow other than by touching it. To start, you might use the output of your feedback circuit to light up an LED when the cooler is on.

Add an LED indicator to your circuit, however you wish. It can be as simple as one LED and a resistor, or you can use a transistor driver if you need things to be brighter. If you really wanted to be fancy you could pass the temperature sensor's output to a chain of resistors in series, then use comparators to light up more LEDs the higher the temperature of the block.

Temperature Logging

In order to log voltages from your circuit as a function of time, you'll have to do a little bit of setup first.

  • Make sure that channel 1 is connected to the temperature sensor output $V_{out,sen}$
  • Make sure that channel 2 is connected to the temperature setpoint output $V_{out,set}$
  • Set the horizontal scale to a short enough time that the scope is continuously updating (i.e. you aren't watching a line crawl across the screen)
  • Start up Jupyter notebook using the icon on the desktop, or through the start menu
  • Download a new copy of the temperature logging notebook here: temperature_logger_2025.ipynb
  • In Jupyter, navigate to the directory the notebook is in and open it
  • Run the two notebook cells (there's a run all button shaped like two arrows in the menu bar ⏩ )

This will connect to the oscilloscope using Python, set it to make measurements of the mean values of channel 1 and channel 2, and then save values once per second. The default runtime is 240 seconds, but you can change the value after the runtime variable to however long you want.

To keep a copy of a plot after it runs, click the power icon in the top right corner of the plot and then right-click the image to save.

If you get an error message about parameter conflicts, hit the default setup button on your scope, turn on channel 2 again, and then re-run the software.

Start the software and turn on your power supply.

Save a copy of the error signal voltage vs. time. Note any relevant information such as the starting and ending voltages and times.

It should be noted that this is not a very precise way of doing this; the scope is not a great tool for measuring small, instantaneous dc voltages. You may see some quantization of values occur that will distort your readings. A better option would be to use a dedicated benchtop voltmeter, but for instructional purposes we decided to keep the same instruments you've been using.


We are still doing some apparatus construction to make the purpose of the advanced feedback controls more apparent. Stop here if this is your first day.

Choose Your Own Lab Adventure

Now that you've got a functioning circuit, it is time to alter the way in which it controls the temperature; this can be done by modifying the control circuitry. Right now, with the op-amp acting as a comparator, the cooler is either fully off or fully on. This works reasonably well for our setup, which has a small aluminum block with the thermistor close to our very powerful cooling unit. However, in many systems the feedback is more delayed and thus this method would oscillate above / below the setpoint temperature by a wider margin.

There are two options at this point.

  • If you would rather not work extensively with building new circuitry, just continue onward.
  • If you would be interested in building a more sophisticated feedback network with a combination of Proportional, Integral, and Differential (PID) control, jump ahead using the link below.

Your choice of option will not affect your grade for the lab.

Advanced Feedback Control

Consider the circuit below, which is a modified inverting amplifier:

A control circuit with only proportional feedback, which will output a voltage $V_{feedback}$ that depends on differences in the setpoint and sensor voltages.
What do you predict $V_{feedback}$ will be in terms of $V_{sensor}$, $V_{setpoint}$, $R_1$, and $R_2$?
Why is this called proportional control?  What is the thing that is proportional to what?

Modify your control circuit as shown in the figure above.  We suggest starting with a 100:1 ratio of $R_2$ to $R_1$. 

You may want to disconnect the sensor, setpoint, and feedback connections in order to test this circuit with a known signal; otherwise it may be difficult to tell if the modified circuit is behaving as intended. After you are satisfied that your control circuit is functioning, re-connect it to the other sub-circuits.  Once again, prepare to record both $V_{sensor}$ and $V_{setpoint}$ with the computer.  

After turning off your circuit for a bit and letting the Al block come to equilibrium, start the data collection on the computer and then turn on the power supply.

Observe how the temperature of the block approaches the setpoint temperature.

Does the Al block reach the set point temperature?
What is the characteristic time with which the block reaches equilibrium?

Repeat the measurement for different values of the proportional gain.

How does the characteristic response time of the TEC change as a function of gain?

Very Advanced Feedback Option

This section is experimental! It has yet to be thoroughly tested by students; on the flip side what you do can inform future offerings of this course. We also do not know how long it will take, so don't be worried if you run out of time. If for some reason you want to play with the circuit past this week, then a few folks leaving their circuits built on breadboards won't cause any issues.

What we'll do from here out is take the difference between our sensor and setpoint voltages, also called an error signal, and manipulate it in various ways.

To start, we'll construct an op-amp circuit called a difference amplifier. As the name suggests, it has an output that is proportional to the difference between the inputs. We'll start with the simple version, which has direct proportionality.

Consider the circuit below:

An op-amp circuit to measure the difference in voltage between two signals. How does it work? Well, the voltage at the non-inverting input will be $\frac{1}{2}V_{set}$ (Golden Rule 1). Negative feedback will then force the output to do whatever is needed for the inverting input to match the non-inverting input (Golden Rule 2). This means that the current at the resistor between $V_{sen}$ and $V_{-}$ is $\frac{V_{sen} - \frac{1}{2}V_{set}}{15k\Omega}$. That same current must pass through the 15k resistor between $V_{-}$ and $V_{out}$, resulting in a voltage drop of $V_{sen} - \frac{1}{2}V_{set}$ between it and $V_{out}$. Thus, $V_{err} = \frac{1}{2}V_{set} -(V_{sen} - \frac{1}{2}V_{set}) = V_{set} - V_{sen}$
Will this circuit be able to directly control your heater? Why or why not?

Replace your existing feedback stage with the difference amplifier shown above.

You may want to use your function generator in place of the sensor and setpoint voltages when testing; otherwise it may be difficult to tell if the modified circuit is behaving as intended.

After you are satisfied that your control circuit is functioning, re-connect it to the other sub-circuits. You can hook it up to your cooler if you want, but unless the lab is on fire it probably won't do anything.  

Back to our diagram

Everything we're doing today is going to be in service of expanding out the feedback portion of our circuit. So, let's start filling it in with our new circuits. The difference amplifier will be the first thing to process inputs, but we won't use it directly as an output.

The beginnings of a feedback network

Proportional Feedback

Now let's do something with this error signal to actually control our heater! We'll start with the most straightforward approach, which is to make the signal driving our FET proportional to (but larger than) our error signal.

An inverting amplifier for creating a proportional feedback signal. Here, $V_{P} = -V_{err}\frac{R_{P2}}{R_{P1}}$. A 100:1 ratio is a good place to start in this lab.

Using the fourth op-amp in your chip, make the proportional amplifier shown above. Test that the output works as expected, but don't connect it to the peltier controller just yet.

Adding proportional feedback

You may have noticed an issue here: the sign of our feedback is backwards! This was intentional, for reasons that will become clearer later on. For now we need a means of flipping the sign, and we'll accomplish this with yet another op-amp circuit: an inverting amplifier with a gain of 1!

An inverting amplifier with a gain of 1. The resistor values aren't special; I just chose something you probably weren't already using.

Wire up another TL074 op-amp chip, and build the proportional amplifier shown above using the difference amplifier as the input.

Inverting the output again

We're ready to try controlling temperature again! Hook up the peltier again and collect some data.

Observe how the temperature of the block approaches the setpoint temperature, and what happens after reaching the setpoint.

Does the Al block reach the set point temperature?

This is the end of what's been reasonably well tested in the past. You can stop here, or you can continue to experiment with using integral and differential feedback. Stopping here will not impact your grade.

Integral Feedback

A problem with just having proportional feedback is that it will naturally slow down as your sensor and setpoint voltages get closer together. To address that, we can add some 'momentum' to our feedback in the form of the integral of our error voltage over time. This means that the longer the error signal persists, the stronger the feedback drive signal becomes. On its own this would overshoot the setpoint every time and result in oscillations for a while, but combined with proportional feedback it can speed up how quickly a system comes to equilibrium.

Consider the control circuit shown below:

A control circuit for producing integral feedback, which will output a voltage $V_{feedback}$ that depends on a time constant defined by $R_{I1}$ and $C_{I1}$. $R_{I2}$ serves to discharge the capacitor over time, letting the circuit “forget” the integrand it has built up. $R_{I2}$ and $C_{I1}$ determine the characteristic time constant of the forgetting.

The integrator made with an op-amp is essentially a better version of the kind made with only a resistor and capacitor. A voltage at the input is translated to a current through $R_{I1}$, which charges up the capacitor $C_{I1}$. For a constant input voltage, the output will grow at a constant rate. The one caveat is that the sign of the integral is flipped; a positive voltage at the input will result in an increasingly negative output.

It also turns out that we lied when we stated the second Golden Rule of op-amps (that the voltage at the inverting and non-inverting teminals of an op-amp will be the same when there's negative feedback). There will be a slight difference, on the order of microvolts or less, but that would add up over time with a perfect integrator. Thus, we add in $R_{I2}$ to keep that effect from building up.

Assuming you want your integrator to act over the course of a second or so, what values of $R_{I1}$ and $C_{I1}$ might be appropriate? Note that the largest capacitor you have access to that isn't polarized is about 3.3 $\mu$F.

Construct the circuit shown above, but do not connect it to the rest of the feedback network yet.

Try testing the integrator's behavior with a known signal from the function generator before you continue on.

Adding the integral feedback

To add the integral feedback to your network, we need only connect it to our inverting amplifier with the same resistor value as the proportional feedback circuit, shown below.

Feedback using both proportional and integral feedback

Try testing the temperature controller again, with the proportional feedback included.

Differential Feedback

In contrast to integral feedback, differential feedback acts as a damping force on our system. If there's ever a sudden change in the error signal it acts to mitigate its output by opposing the proportional feedback. Our temperature controller isn't a system where this is likely to be extremely relevant, but if we for instance had a much more capable cooler, we might not want it to suddenly turn on full blast if there's a glitch in the sensor. A much more relevant situation would be in controlling motors, where sudden changes in drive can come with unwanted side effects (e.g. sudden torques on your motor's mountings).

Consider the circuit below:

A circuit for producing a derivative signal. Yes, the typo in the diagram is intentional. I thought it was funny.

In the circuit above, if $V_{err}$ is constant, the capacitor will eventually charge up and thus there will be no current through any components, resulting in the output $V_D = 0$. If the input is changing, then the current through $R_{D1}$ and $C_{D1}$ will also be shared by $R_{2D2}$, resulting in an output signal. The time constant for this only depends on $R_{D1}$ and $C_{D1}$ as the virtual ground at $V_-$ keeps the feedback resistor from affecting the capacitor's charging/discharging.

Construct the circuit shown above, but do not connect it to the rest of the feedback network yet.

Try testing the differentiator's behavior with a known signal from the function generator before you continue on.

Adding the differential feedback

We're ready to complete our feedback network now by adding the differential component the same way we did the integral component, shown below:

Our completed PID network. Tuning the behavior of such networks for a given task is a science in and of itself, and usually falls into the purview of engineers. For a brief overview, see the following website.

Try testing the temperature controller one more time, with the derivative feedback included. Depending on your parameters, it may or may not make much difference in how well the output settles.

Future Possibilities

There're no new instructions here, feel free to skip.

There are a few possible directions modifying this circuit could take. One would be to add derivative-based feedback, which could increase the feedback voltage (and thus current in the cooler) if it isn't changing quickly/ or reduce it if the signal is changing too much to prevent overshooting. This makes sense if you're working with a more open, unknown system than a particular block of aluminum. The other would be to add integral-based feedback, which can help drive the system closer to the desired setpoint if it has a tendency to be consistently high or low.

A circuit utilizing all three types of feedback is know as a PID controller, which you could spend an entire quarter or two learning the theory of operation. Thankfully, it is possible to construct a control circuit that works well enough by observing the effect of altering the strengths of the different feedback signals.

While we chose to cool a block with a peltier, this technique is ubiquitous and used for things like: