TMP36 – Temperature sensor

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

I picked the TMP36 (datasheet) to measure temperature. It’s a cheap and easy to use sensor with a broad range of temperatures it can measure. Several websites describe how to use it in combination with an Arduino, so it is easy to test it. In this post I use the information of several sources to describe how to use the TMP36. At the bottom I give the links to all sources.

The TMP36 can be used with voltages between 2.7V and 5.5V. The analog output lays between approx. 0V (ground) to 1.75V.

There are two formulas to calculate the voltages at the input pins,
one if you use 5V:

Voltage at pin in milliVolts = (reading from ADC) * (5000/1024)
This formula converts the number 0-1023 from the ADC into 0-5000mV (= 5V)

And one to use with  3.3V:

Voltage at pin in milliVolts = (reading from ADC) * (3300/1024)
This formula converts the number 0-1023 from the ADC into 0-3300mV (= 3.3V)

To convert the milliVolts to Centigrade use the formula:

Centigrade temperature = [(analog voltage in mV) – 500] / 10

Below is a code snippet that will ‘read’ the temperature in Centigrade.

/*  
*  Sample sketch to measure the temperature using a TMP36
*  The TMP36 is connected to 5V and analog pin 0
*/

// The Arduino pin the TMP36 signal pin is connected to
int tempPin = 0;    

void setup()
{
  Serial.begin(9600);  
}

void loop()
{
      //  Get the value from the sensor
      int readvalue = analogRead(tempPin);       
      float voltage = readvalue * 5.0;                     
      voltage = voltage / 1024.0;                    
      float centigrade = (voltage - 0.5) * 100 ;
      Serial.print(centigrade);
      delay(5000);
}

Ladyada.net descibes the sensor in this page.
Oomlout describes an example on its page.
Tronixstuff has also a description of how to use it.

To use the TMP36 with a JeeNode you can connect it:
TMP36 V+ (pin1) to JeeNode (+)
TMP36 Vout (pin2) to JeeNode Analog (A)
TMP36 GND (pin3) to JeeNode GND (G)

Leave a Reply