# The LM35 temperature sensor is a lot like the TMP 36 , except that is typically a little less expensive and a tad easier to code for.  It is also a little more accurate.

About the only real drawback is that you have to measure negative voltages if you want to measure below 0 degrees C.

Amazon

AliExpress

BangGood

# Power Requirements

The device is powered anywhere from 4 to 40 Vdc.   When used with your Arduino, you will want to use the 5V output.

# Accuracy

According to the manufacturer, the accuracy is typical with 0.75 degrees C.   The worse case accuracy is stated as +/- 1 degrees C.

# The Range

The device has a range from -55 degrees C to +150 degree C (or -67 to 302 degrees F).

In most applications, you’ll probably want to be using this from zero to 105 degrees C as going below that requires configuring the Arduino to measure a negative voltage.

If you do need to measure below zero C,  I recommend the TMP36.  It’s  a hell of lot easier to implement for lower temperatures.

# The Output (or Scale Factor)

There is no offset for the LM35.   Zero millivolts represents zero degrees C ( or 32 F).

Every degree of change from zero  will either increase or decrease this value by 10 mV (the scale factor).

Therefore  a temperature of 110 degrees C will yield an output of 1100mV.

# The LM35 Pinouts The sketch to the left identifies the pins of the LM35.  Click on it if you need a larger view.

# Tutorial

## Connecting the Arduino

Pretty simple stuff here.  You just connect it as shown below.

NOTE—  It was pointed out that I erred in the picture below.   The then center pin connects to ground and the rightmost pin goes to A0.   :(. ## The Sketch

Just copy and paste this into your Arduino IDE to see it work.

```/*
The simplest LM35 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 * 0.1;
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

### One Comment

1. capnfatz@gmail.com October 3, 2016