Skip to content

LM35 and the Arduino

Very simple linear temperature sensor.

The sensor outputs 10mV/Deg. C. linear from -55 to +150 C in full range mode.
You can even use the sensor without any supplementary ciruit. Just connect the +5V, GND and one analog input line. In this mode the sensor will work from +2 to +150 C.
As the analogRead() function has a default resolution of 5V/1024 = 4.9mV we multiply the sensor input with that value to get the correct sensor data.


#define vPin 0
void setup() {
Serial.begin(9600);
Serial.println("Setup...");
pinMode(vPin,INPUT);
}

void loop() {
Serial.print(analogRead(vPin)*4.9/10);
Serial.println(" C");
delay(500);
}

Post a Comment

You must be logged in to post a comment.