# SIGNAL CHAIN BASICS #63: Using SPICE to design the PID control for a TEC temperature loop

(Editor's note : Signal Chain Basics is an ongoing and popular series; click here for a complete, linked list of all installments.)

(Editor's additional note : if you are not familiar with the principles and analysis of PID control: you should be; It is the most important, studied, understandable, and applied closed-loop control algorithms ever devised. There are many very good tutorials available at all levels and lengths.)

Temperature control using an analog proportional-integral-derivative (PID) controller can be a very simple, effective means of ensuring that the desired set point in a thermoelectric cooler (TEC) can regulate the temperature of a laser. The proportional-integral term works in tandem to accurately servo the current through the TEC, in an attempt to maintain the temperature set point of the controller.

At the same time, the derivative term regulates the rate at which this is achieved, thereby optimizing the overall system response. If the overall system response, H(s), can be characterized, then one of the most convenient and effective ways to design the PID controller, G(s), for this application is through simulation using SPICE.

Step 1: Determine the thermal impedance of the TEC/Temp Sensor for SPICE Model

To effectively employ SPICE as a design tool for a PID loop, it is important to capture the temperature loop’s thermal response to obtain the actual thermal resistance, capacitance, and transfer function of the PCB:TEC:laser diode:temp sensor connection.

Keep in mind that since the actual thermal characteristics can vary as much as 50 percent, it is best to inject and measure a thermal-step input into the actual system (with all devices soldered down) to obtain the best thermal model for a SPICE simulation.

Once the thermal connection is characterized, use an “outer loop, inner loop” procedure to determine both the overall loop response and stability of the controlling amplifier in the G(s) function. In each case, the outer and inner loop will be broken using a very large inductor and the loop excited via a large capacitor and AC source.

Step 2: Break the outer loop between G(s) and H(s)

The outer loop is defined as the path around the G(s) and the H(s) functions. The objective of the simulation using Figure 1 is to break the outer loop to obtain H(s), G(s), and the overall loop gain to verify thermal loop stability.

Figure 1: Simulation circuit obtains loop gain and phase.

In this case, Figure 2 shows that the phase dips below zero degrees where the loop gain goes to zero dB, indicating that the entire loop is unstable. Therefore, modifying G(s) should both impose PID control and add stability to the temperature loop.

Figure 2: Loop gain and phase plot for Figure 1.

The modified G(s) block in Figure 3 includes the PID elements. The corner frequency for the differentiator is set by R7 and C3; R3 sets the proportional gain; and C2 and R6 set the integrator corner.

Figure 3: Simulation circuit with compensated G(s).

Step 3: Break the “Inner Loop” of G(s) to determine the local amplifier stability

The final step in creating the complete PID element is to check the stability of the local amplifier (OPA2314) by breaking the inner loop to ensure its stability separate from the overall loop gain. In this case the amplifier requires a 50 pF capacitor (Figure 4 ) to keep the local loop stable.

Figure 4: Final circuit with compensated local G(s) loop.

References

•Green, Timothy, “Operational Amplifier Stability, Part 2 of 15: Op Amp Networks, SPICE Analysis” En-Genius (formerly AnalogZone), 2006.

•Simon Lenvkin, Sam Ben-Yaakov. “ PSPICE-Compatible Equivalent Circuit of Thermoelectric Coolers,” Power Electronics Specialists Conference, 2005. PESC ’05. IEEE 36th

•Chavez, J.A., Salazar, J, Ortega, J.A., and Garcia, M.J., “ SPICE Model of Thermoelectric Elements Including Thermal Effects,” Instrumentation and Measurement Technology Conference, 2000. IMTC 2000. Proceedings of the 17th IEEE

Please join us next month when we will discuss how a poorly designed 20W amplifier can destroy 100W speakers.

Matthew William Hann , SAR ADC Product Line Manager at TI, has more than a decade of analog product and applications expertise which includes ADC’s, temperature sensors, operational amplifiers, difference amplifiers, instrumentation amplifiers, programmable gain amplifiers, power amplifiers, and TI’s line of ECG AFE devices. Through his previous role as an applications engineer, Matt developed a focused expertise on the design of analog front ends for medical applications such as ECG, EEG, EMG, blood glucose monitoring, and pulse oximetry. Matt received his BSEE from the University of Arizona, Tucson. He can be reached at .

Editor's note : Liked this? Want more?

If you are interested in “analog” issues such as signal input/output (sensors and transducer, real-world I/O); interfacing (level shifting, drivers/receivers); the signal chain; signal processing (op amps, filters, ADCs and DACs); and signal integrity, then go to the Planet Analoghome page for the latest in design, technology, trends, products, and news.

## 3 comments on “SIGNAL CHAIN BASICS #63: Using SPICE to design the PID control for a TEC temperature loop”

1. JackGrat2
July 2, 2013

In my view of the article, none of the links to the content functioned (404 errors). Just temporary?

2. hooman.hashemi
July 3, 2013

It does seem like the image links are broken.