# Easy to Use Temperature Sensor

It really doesn’t get much easier to measure temperature with an Arduino than with Analog Device’s TMP36 temperature sensor.  Supply it 5 volts and ground from your Arduino, connect it’s output to an analog pin, add a little code and you’re measuring temperature.

Want another option like this? Try the LM35

Amazon

AliExpress

# Power Requirements

The TMP 36 needs power that is between 2.7 and 5.5 volts.  On your Arduino, you have two pins that supply voltages in this range.  The first is the 3.3V output and the other is the 5V output.  In my test, I used the 5 volt output.

# Accuracy

The manufacturer’s data sheet indicates that the typical accuracy is plus or minus one degree C.   The worse case accuracy is stated as +/- 2 degrees C.

# The Range

This sensor is suppose to have a range from -40 degrees C to +125 degree C.   For my American brothers (who are going metric inch by inch), that’s from -40 to 257 degrees F.

# The Output (or Scale Factor)

Zero degrees Celsius (ice point) is 500 mV.  This is often referred to as the offset.

Every degree of change from that point will either increase or decrease this value by 10 mV (the scale factor).   So at five degrees Celsius, the device would output 550 mV.  At a negative 10 degrees Celsius, the output will be 400 mV.

# The TMP36 Pin outs

The TMP36 pinouts  are identified in the diagram on the left.  You can click on it to get a larger view.

# TMP 36 Connections

As I mentioned before, you need just three connections and a USB cable to your computer.  See below.

• I wanted to see the measurement in millivolts, so I mutliplied my input value by 5000.
• I wanted to see my measurement in degrees F, so I converted the degrees C to F.  Its really simple.  All you have to do is multiply the measurement in C by 1.8 and then add 32.

# The Code

```/*
The simplest TMP 36 Thermometer
*/

int RawValue= 0;
double Voltage = 0;
double tempC = 0;
double tempF = 0;

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

void loop(){

Voltage = (RawValue / 1023.0) * 5000; // 5000 to get millivots.
tempC = (Voltage-500) * 0.1; // 500 is the offset
tempF = (tempC * 1.8) + 32; // conver to F
Serial.print("Raw Value = " );  // shows pre-scaled value
Serial.print(RawValue);
Serial.print("\t milli volts = "); // shows the voltage measured
Serial.print(Voltage,0); //
Serial.print("\t Temperature in C = ");
Serial.print(tempC,1);
Serial.print("\t Temperature in F = ");
Serial.println(tempF,1);
delay(500);
}```

# Related Documents

Below you will find some PDF files that you can view or print