Modelling the LM35 Temperature Sensor in SPICE

The LM35 is a common semiconductor temperature sensor. It produces an output voltage between -0.55 to 1.5 Volts, proportional to its temperature. This article shows how the LM35 can be simulated using a SPICE model, which can be configured for a fixed temperature, or swept over a range of temperatures.

The LM35 is an integrated circuit that provides a linear output proportional to temperature, with a sensitivity of 10mV per degree Celsius. It does not require any external calibration or trimming and provides typical accuracies of +/- 0.25 degrees at room temperature, and +/- 0.75 degrees over a full -55 to +150 degrees C temperature range. It is available in a number of different packages, e.g. TO-46, TO-92, 8-lead surface mount SO, and TO-220.

To simulate this device in SPICE, such that it produces the normally expected voltage output at any given temperature, we require a linear temperature controlled element. There is an option for the resistor model to specify a temperature coefficient, or a polynomial series of temperature coefficients. For a linear dependence, we only need one coefficient and the others may be omitted (defaulting to zero).

A current source and a resistor can be used to create a voltage source that has a linear temperature coefficient. The resistor has a value:

R = R0 * (1. + dt * tc1)

where R0 is the resistance at the nominal temperature (TNOM),
dt is the difference between the resistor's temperature and the nominal temperature, and tc1 is the temperature coefficient in ohms per degree.

We need an output voltage that goes to zero at the temperature that the TC35 is calibrated to give zero output for, so a second current source and resistor are used to generate a voltage corresponding to a fixed temperature at zero C.

A voltage-controlled current source G1 is used to subtract the reference voltage from the temperature dependent voltage to obtain a temperature dependent output that is zero at the reference temperature for the LM35. The gain of G1 and its shunt resistor are chosen to give a voltage gain of 1 and an output impedance of 0.1 ohms to match the dynamic impedance of the LM35 for a 1mA load.

Circuit of LM35 simulation Circuit Scribe schematic of LM35 Model

This simulation uses the built-in global temperature value of SPICE that is typically used to either specify the operating temperature of a circuit, or is swept to measure circuit characteristics over a temperature range.

To demonstrate the model, which is given below as a SPICE netlist, the LM35 model is packaged as a subcircuit, and invoked as "X1 1 LM35" which simply gives us one node where the output voltage appears. Note that there is no simulation of the LM35 power supply, or any detail of the internal circuit; this is purely a behavioural model. Also note that for the full sub-zero temperature range to be covered, a pull-down resistor is required; for details please consult the manufacturer's data sheet.

Here is the SPICE model (suitable for Linear Technology Corporation SwitcherCAD):


*SPICE Simulation of National Semiconductor LM35 Precision Centigrade Temperature Sensor
*
*
X1 1 LM35
*
.subckt LM35 Out
* Simulation of National Semiconductor LM35 Precision Centigrade Temperature Sensor
* By C J Seymour http://colinjs.com/
*
* Spec for LM35 connected as Full-Range Centigrade Temperature Sensor:
* Vout = +1500 mV at +150°C
*      = +250 mV at +25°C
*      = -550 mV at -55°C
*
* Current source I1 and resistor R0 create a voltage source
* with a lineartemperature coefficient tc1
* controlled by the SPICE temperature
* R = R0 * (1. + dt * tc1)
* where R0 is the resistance at the nominal temperature
* dt is the difference between the resistor's temperature
* and the nominal temperature TNOM
* LM35 tempco = 0.01 V per degree C
I1 0 N001 1
R0 N001 0 1 tc1=0.01
*
* Current source I2 and resistor R1 create a similar voltage source
* with the same linear temperature coefficient, but the temperature
* is fixed at zero C, which is the reference temperature
* for the LM35
I2 0 N002 1
R1 N002 0 1 tc1=0.01 TEMP=0
*
* G1 and R2 subtract the reference voltage from the 
* temperature dependent voltage to obtain a temperature
* dependent output with zero at the reference temperature
* for the LM35.
* The output impedance is set to 0.1 ohms to match the
* dynamic impedance of the LM35 for a 1mA load
G1 0 Out N001 N002 10
R2 Out 0 0.1
.ends

* Simulation commands to plot the operating point
* over a temperature range
.step temp -55 150 5
.OP
.print V(1)

.end

Here is a plot of the output, swept by temperature, which is pretty much as expected:

LM35 Temperature sensor output voltage versus temperature Linear Technology Corporation SwitcherCAD plot for LM35 Model Netlist

If you need to simulate the thermal time-constant of the device, there doesn't seem to be a way for SPICE to set an operating temperature and follow a time-dependent response simultaneously, so this would not work in the model I have given. As an alternative, you could simulate the output of a sensor as a transient model, using a stepped voltage source to switch between the voltages at the temperatures of interest, followed by an RC network with the appropriate time constant.

For example, for a thermal time constant of 15 seconds, which you would get with a TO-92 package in still air, you could use a 0.1 ohm resistor in series with a 150 Farad capacitor, which will give you the time constant with the dynamic output resistance of the LM35.

If using a 150 Farad value for simulation (which is hardly practical) does not appeal to you, or perhaps the shunt capacitance could be a problem being connected to subsequent circuitry, you could use a time constant stage with say a 1Meg resistor and a 15 uF capacitor, followed by a voltage-controlled current source with a gain of 10 and a shunt resistor of 0.1 ohms to model the dynamic output resistance of the LM35.

Info

Zip file containing a Circuit Scribe schematic file as used for the circuit shown above, a matching SPICE schematic file for LTC SwitcherCad, and a SPICE netlist file corresponding to the one quoted above:

tempsens.zip [6KB]

Data for LM35:
LM35 Precision Centigrade Temperature Sensors - Texas Instruments

Linear Technology Corporation's LTSpice (formerly SwitcherCAD 3) software:
Linear Technology - Home Page

For Circuit Scribe software, see: Software