Designing the Embedded Temperature Circuit to Meet the System's Requirements

Perfect temperature measurement can be an elusive, expensive, and unnecessary goal for many applications. Relax your requirements a bit, and you'll find many cost-effective solutions: diodes, thermistors, RTDs, thermocouples, and silicon thermometers are the most commonly used.

Which temperature sensing circuit is best suited for your system? Often a sensor's cost and ease of implementation determine the answer more than its temperature range, ruggedness, or accuracy. As you will see, three of the most economical ways of implementing a temperature signal conditioning circuit are to use thermocouples, diodes, and thermistors.

A Thermocouple Circuit

Figure 1 shows a signal-conditioning signal path for a thermocouple circuit. Its basic elements are the:

• Thermocouple network

• Analog filter/gain cell

• A/D converter

• Microcontroller

Looking at the thermocouple network, TC1 is the thermocouple at the physical temperature measurement site. TC2 is a second thermocouple of the same type as TC1. In this circuit, both are E-type. Thermocouples TC3 and TC4 are byproducts of the hardware implementation where the wires from TC1 and TC2 connect to the copper traces of the PCB.

Three of the four thermocouples are placed on the isothermal block to maintain them at a given temperature. The equivalent output voltage of all four thermocouples is gained and filtered by the analog gain cell. The gain cell has a single-supply CMOS amplifier (MCP601) configured as a second order, low-pass Chebyshev filter. The output signal from the amplifier is digitized by the 12 bit, A/D converter (MCP3201). The code from the MCP3201 is serially passed to a microcontroller (PIC12C508), where the voltage from the thermocouple network is translated to a temperature representation in Celsius or Fahrenheit.

Figure 1. A simple thermocouple temperature measurement circuit can be constructed using two like thermocouples (TC1 and TC2), an amplifier, an A/D converter, and a microcontroller. This circuit provides an economic solution for the reference temperature measurement system that all thermocouple circuits require.

Thermocouples are constructed of two dissimilar metals. In the case of the E-type thermocouples in Figure 1, the two metals are chromel and constantan. The two metals are bonded together on one end of both wires with a solder bead that is exposed to the thermal environment to be tested. A temperature differential between the bead and the other end of the thermocouple wires causes a voltage between the two wires at the open end. This voltage, commonly called the thermocouple's EMF (electromotive force) voltage, represents the temperature differential between the two ends of the thermocouple. It changes with temperature, without any current or voltage excitation, and with it changes the EMF voltage as well.

Thermocouple EMF voltages are easily definable when referenced to 0°C. With the sensing circuit shown in Figure 1, the voltages of TC2 and TC3 are subtracted from TC1 and TC4. Because the material and temperatures of TC3 and TC4 are the same, the measurement error contributed by these junctions is zero. TC2 is used to subtract out the isothermal block temperature error from the measurement site thermocouple (TC1), leaving the EMF voltage of TC1 as it is, referenced to 0°C. Every thermocouple temperature sensing circuit requires a second one to eliminate the errors introduced by unwanted thermocouples on the PCB. This circuit design conveniently simplifies the second temperature circuit by adding one thermistor rather than another temperature sensor along with its signal conditioning path.

Thermocouples produce an EMF voltage that ranges from nanovolts to tens of millivolts. This voltage is repeatable, but nonlinear; a look-up table can be used to easily calibrate this nonlinearity out of the system (see Table 1). The signal conditioning portion of the electronics requires an analog gain stage. If the temperature range at the measurement site is from 25°C to 600°C, the appropriate gain setting for the MCP601 amplifier filter/gain stage is 104 V/V.

Using a Poor Man's ΔS Converter

A fundamental classical ΔS A/Δ converter can be constructed with two circuit segments—a modulator and a digital filter. This circuit concept has been used to generate a large variety of converters that provide high resolution at a relatively low cost. The next logical step is to move this type of A/D converter into the controller.

A few additional peripherals allow a basic controller to execute this function (see Figure 2). The input signal, which originates at the anode of the IN4148 (Fairchild) diode, is first acquired by the modulator section. Diodes are useful, inexpensive temperature-sensing devices for applications that do not require high precision. If a constant current is used to excite the element, the voltage change of standard diodes, such as the IN4148, with temperature is ~5 mV/°C. With a current excitation, diodes have fairly linear voltage vs. temperature performance.

In Figure 2, the diode used as a temperature sensor has a voltage excitation. A large ratio of voltage excitation (VDIODE) to the changes of the voltage drop across the diode with temperature, however, minimizes linearity errors. Of the three voltage references in Table 2, 10 V provides the most linear results. Also note that changes in the reference voltage change the current through the diode. A precision voltage reference is therefore recommended for higher accuracy application requirements.

The modulator section of the ΔS function is constructed with the MCP601, a single-supply amplifier, and an R/C network. The design equations for the resistors in the ΔS portion of this circuit are:

VR3 – VIN (CM) = VRA0 (1 + R1/R3) (1)

Figure 2. The PIC16C622 firmware and an internal comparator measure temperature changes from the diode, which is excited by a voltage source in series with a bias resistor.

VIN(p-p) = VRA3(p-p) (R1/R2) (2)


VIN (CM) = [VIN (max.) – VIN (min.)] / 2

+ VIN (min.)

= [625 mV (@ –40°C) – 425 mV

(@ 85°C)]/2 + 425 mV

= 525 mV (3)

VRA0 = voltage applied to the comparator's noninverting input

= VDD / 2

= 2.5 V (4)

VIN(p-p) = [(VIN (max.) – VIN (min.)]

= 625 mV (@ –40°C) – 425 mV (@ 85°C)

= 200 mV (5)

VRA3(p-p) = VRA3 (max.) – VRA3 (min.)

= 5 V – 0 V

= 5 V (6)

The integrator function is implemented with an external capacitor (CINT). The absolute accuracy of this capacitor is not critical, but rather only its stability from integration to integration, which occurs in a relatively short period of time. The integrated output of this circuit is compared to the system reference (RA2).

The microcontroller's internal comparator acts like a 1 bit quantizer, providing data to a digital filter program in the microcontroller. The microcontroller also provides a feedback mechanism to the R/C network. When RA3 of the PIC16C622 is set high, the voltage at RA0 increases until the output of the comparator (CMCON<6>) is triggered low. At this point the driver to the RA3 output is switched from high to low, and RA0 decreases until the comparator is tripped high. RA3 is then set high, and the cycle repeats. While the modulator section of this circuit is cycling, two counters keep track of the time and of the number of ones vs. zeros that occur at the comparator's output. With time, the output of the accumulating digital filter provides a multibit conversion result.

Appropriate resistor values vs. the diode reference voltage to achieve a nominal 0.1 mA current through the IN4148 diode.
VDIODE (V) R4 ()
4.096 9.76 k
5.0 121 k
10.0 27 k

Each integration result is taken at a consistent, predetermined time interval. A 10 bit conversion would require 210 1 bit samples, or 1024 samples. Given the linearity errors in the system, a 210 conversion result from this circuit is actually 8 bit accurate. If the microcontroller requires 20 ms to collect all 1024 samples, one complete conversion would take 20.48 ms. (The 0.48 ms are dedicated to program overhead at the end of the conversion.)

Keep It Simple with a Thermistor

In the spirit of simplicity, the easiest solution would be to bring the temperature sensor as close to the microcontroller as possible (see Figure 3). Here, a thermistor placed in parallel with a standard thin film resistor is used as the temperature-sensing element. This parallel combination provides linear performance over a 50°C range that falls within an error band of ±1.5°C. Although the microcontroller selected for the circuit does not have an internal A/D converter, the input threshold voltages of the gates are used in combination with the microcontroller's clock, which counts the rise time of the thermistor and the external capacitor.

Thermistors come in two basic types, negative temperature coefficient (NTC) and positive temperature coefficient (PTC). The NTC thermistor is best suited for precision temperature measurement and the PTC thermistor for switching applications.

The NTC thermistor is used in three different modes of operation, catering to a wide variety of applications. One mode uses the resistance vs. temperature characteristics of the sensing element. The other two take advantage of the voltage vs. current and current-over-time characteristics of the thermistor.

The resistance vs. temperature NTC thermistor configurations, by far the most prevalent, perform precision temperature meas urement, control, and compensation. Unlike applications based on the thermistor's voltage vs. current and current-over-time characteristics, the resistance vs. temperature circuits depend on the thermistor's being operated in a zero-power condition. This condition implies that there is no self-heating of the thermistor as a consequence of current or voltage excitation.

The resistance across the thermistor is relatively high in comparison to the RTD element, which is usually in the hundreds of ohms range. The 25°C rating for thermistors is typically from 1 kΩ to 10 MΩ. The NTC thermistor's nonlinearity can be calibrated out with software or hardware techniques or a combination of the two. Hardware linearization can be simply implemented with a standard resistor, as shown in Figure 3. In this circuit implementation, the thermistor is placed in parallel with an equivalent resistor.

The A/D conversion is performed by using the PIC12C508 to set GP1 and GP2 as high-impedance inputs. GP0 is set low and as an output, thereby discharging the capacitor (CINT). Once CINT is fully discharged, the code in the PIC12C508 changes GP0 to a high-impedance input and GP1 to high as an output port. In this configuration, GP1 conducts current to charge the R/C combination of CINT and the parallel resistance of RNTC||RPAR. During charging, the microcontroller counts the number of clock cycles before GP0 changes to a high state. In this manner, the rise time (tNTC) of the thermistor network is measured.

Figure 3. The ratio of the rise time of the R/C combination of RNTC||RPAR and CINT and the rise time of the R/C combination of RREF and CINT give a measured resistive value for RNTC.

With this count (tNTC) in memory, once again GP1 and GP2 are set as inputs, and GP0 is set low and as an output port. This configuration discharges CINT. When the capacitor is fully discharged, GP0 is again changed to an input, but this time GP2 is set high and as an output. With this configuration, the microcontroller counts the number of clock cycles until the input of GP0 changes to a high state. The new count quantifies the rise time of the RREF/CINT circuit.

The rise time of the R/C networks shown in Figure 3 is:

t = – RC ln (1 – VTH / VDD) (7)


VTH = threshold voltage of the controller input gate, GP0

VDD = power supply voltage of the microcontroller

R = resistor in the circuit

C = capacitor in the circuit

Assuming that the ratio of (VTH) of the gate GP0 and the power supply voltage to the microcontroller (VDD) is constant, the relationship between the rise time of the circuit containing RREF and the circuit containing RNTC||RPAR is:




– tNTC RREF) (9)

The value of RPAR should be equal to the value of the thermistor at the midpoint of a 50°C temperature range. For example, if the application has a temperature range from 25°C to 75°C, a 10 kΩ thermistor is equal to ~3.6 kΩ at 50°C. To linearize the thermistor across this temperature range, the parallel resistor (RPAR) should equal 3.6 kΩ. Once the parallel resistance has been determined, RREF can easily be selected. For optimum performance, the reference resistor is selected to be equivalent to the resistance of the NTC thermistor in parallel at the nominal temperature (RREF = 1.8 kΩ).

In this circuit, the conversion accuracy is independent of VDD and the threshold of the input gate on GP0. In addition, comparing the time constants of these two similar networks minimizes errors due to capacitor leakage and nonlinearity. The value of the capacitor is then dependent on the controller's processor time. For best results, a stable, low-leakage capacitor such as one made of polypropylene or NPO ceramic, should be used. Even the best of capacitors exhibits the phenomenon of memory; the combination of the dielectric absorption and the capacitor discharge voltage determine the magnitude of this remnant charge. A technique that can minimize this effect is to discharge the capacitor to the same trip point (VTH) every time.

Economical and Accurate

In many applications the characteristics of the temperature sensing element are critical. In others, however, the requirements on the sensor element are relaxed, enabling a wider selection of sensors for the job. With these applications, the electronic circuit design becomes the most important factor in system design. Given this change in constraints, you can use a microcontroller, along with a few simple analog functions, to design an economical, relatively accurate temperature sensing system.

For Further Reading

Baker, Bonnie, et al. 1998. "Make a Delta-Sigma Converter with a Microcontroller," AN700, Microchip Technology Inc.

Cox, Doug. 1997. "Implementing an Ohmmeter/ Temperature Sensor," AN512, Microchip Technology Inc.

Suggested Articles

One forecast from Cameron Chell: the best AI designers of the future won’t come from top universities

Survey of 30 chipmakers offers a good sign for research and development of self-driving vehicles, analyst says

Research dollars for AV are expected to remain, if slowed, especially for companies that see self-driving as a key to their success