Part

Temperature sensor, TMP36

Half a volt at zero degrees and 10 mV a degree. Drag the slider to change the weather.

See every part
  • 3 pins
  • 2 settings
  • In 3 projects
  • In 2 lessons
Drawn live by the editor's own code, at the size you see it.
At a glance

The Temperature sensor, TMP36 in brief

What it is, and every setting the properties panel gives it.

The TMP36 is Analog Devices’ three-legged temperature sensor in a TO-92 package, sold bare in nearly every starter kit. Flat face toward you, legs down, the pins are VS, VOUT and GND; it runs from 2.7 to 5.5 volts, so VS goes to 5 V on an Uno or 3.3 V on an ESP32, and VOUT to any analog input, A0 on an Uno or an ADC1 pin such as GPIO 34 on an ESP32. VOUT is 500 mV at 0 °C plus 10 mV per degree, so 25 °C is 750 mV and -10 °C is 400 mV, which is how it reads below freezing on one supply. Mokxi models exactly that line, with offset and slope as properties (set offset to 0 and it behaves as an LM35), a slider from -40 to 125 °C that starts at 22.5, a 100 ohm output, and an output that goes high impedance below 2.7 volts of supply. The classic mistake is converting it LM35-style, with no offset, which reads 50 degrees too hot. Self-heating, settling time, noise and the real part’s ±2 °C error are not modeled.

Family
Sensors
Pins
3
offset
500
500 mV by default (a TMP36). Setting it to 0 gives an LM35's output, but for an LM35 use the LM35 part, which also has its 4 V minimum supply.
slope
10
10 mV per degree by default.
Pins

3 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
VS
Supply, 2.7 V or more.
VOUT
offset + slope x temperature.
GND
Ground.
How to use it

How to use the TMP36 with an Arduino

Hold it flat face toward you, legs down: left is VS to 5 V, the middle is VOUT to A0, and right is GND. In the love meter the TMP36 stands in the breadboard that way, with VS and GND on the top rails and VOUT on A0 beside a bar of ten WS2812B LEDs.

The sketch turns the count into millivolts with analogRead(A0) * 5000L / 1024 and takes 500 off, because the TMP36 is 500 mV at 0 °C and 10 mV a degree after that, so what is left is tenths of a degree. It averages the room for two seconds first and lights one LED for every half degree above it. Drag the sensor’s slider up as if you were holding it.

Forget the 500 mV offset and you read 50 degrees too hot: that is the LM35’s formula, and the two parts are not interchangeable in code.

Part pin
Board pin
VS
5 V
VOUT
A0
GND
GND

It runs from 2.7 V, so on an ESP32 power VS from 3.3 V, read VOUT on an ADC1 pin such as GPIO 34, and convert with 3300 and 4096 in place of 5000 and 1024.

Arduino Uno: TMP36 love meterlive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
Tenths of a degree from a TMP36
long tenths() {
  long mv = analogRead(A0) * 5000L / 1024;
  return mv - 500;   // 10 mV a degree is 1 mV a tenth
}
void setup() {
  Serial.begin(9600);
}
void loop() {
  Serial.println(tenths());
  delay(500);
}
How it is modeled

What is true about the Temperature sensor, TMP36, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

Below 2.7 V across VS and GND the part is not running and VOUT is high impedance, exactly what an unpowered sensor does. The output is a low-impedance source clamped to the rails, so a sensor on a 3.3 V board cannot read above 3.3 V; the datasheet's 125 degree top of range simply is not reachable there, which is true of the real part too.

Not modeled

No self-heating, no settling time, no noise, and no datasheet accuracy error. The temperature you set is the temperature that comes back, which makes a demo a demo rather than a calibration exercise. A real TMP36 is ±1 °C at 25 °C and ±2 °C over its range, and the straight line here has none of that.

VOUT drives through 100 ohms, which is a stand-in rather than a datasheet figure: a real TMP36 has a much lower output impedance but can only source about 50 µA, and neither the impedance nor the current limit is what the number represents. It is there so a load on the output is not free. There is no supply-current draw, no supply rejection, and no way to overload the output. It simply behaves as a 100 ohm source however much current is taken from it.

From TMP36 temperature sensor, in full.

Projects

See the Temperature sensor, TMP36 in a project

3 built-in projects use it. Each opens in the editor, already wired.

Lessons

Where it turns up in a lesson

2 lessons place it in their own circuits.

Boards

The boards it is shown on

This board has a built-in project with the Temperature sensor, TMP36 in it.

Wire up the Temperature sensor, TMP36

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.