The TMP36 (and TMP35 and TMP37) is a low-cost, precision temperature sensor that can be used to measure the temperature of a wide range of objects or environments. They output an analog voltage signal that is proportional to the temperature (in Celsius) being measured. This makes them very easy to work with.
Connect one to an analog input pin (see: Analog input, and the value (between 0 and 1024) read from the pin can be converted to Celcius by this formula:
( ( sensor_value / 1024 * Vcc_in_millivolts) - offset_value_in_millivolts ) / scaling_factor
Take the offset_value_in_millivolts and scaling_factor from the table below.
Sensor | Offset voltage (mV) | Scaling (mV/C) | Output at 25C (mV) |
---|---|---|---|
TMP35 | 0 | 10 | 250 |
TMP36 | 500 | 10 | 750 |
TMP37 | 0 | 20 | 500 |
For example, for a TMP36, 5V Vcc it would be as follows:
( ( sensor_value / 1024 * 5000) - 500 ) / 10
Which can be simplified as:
( sensor_value * 500 / 1024 ) - 50
Or even:
( sensor_value * 49 - 5026 ) / 100
You can check the math using the reference mV at 25C.