Getting started with the LM335 Temperature sensor can be a bit tricky. I ran into some problems when I started getting incorrect data. I googled around for the problem, and all of the schematics and drawings at the top of google were incorrect. They either had a static resistor on the data pin, or they show the data pin on the arduino directly connected to the LM335 Temperature sensor’s data pin.
The trick to correctly calibrating the temperature sensor is to connect a 10k potentiometer to the data pin. Once the potentiometer is wired in place, you can calibrate the LM335 to read the correct temperature. The correct wiring of the LM335 can be seen below:


Once everything is wired up, I simply used the lm335a.h library written by greenrobotics.net. This is a nice library, a quick test sketch can be seen below here:
// Example using the LM335A library for reading temperatures
// Created by Jonathan Merrill, February 20, 2010.
// http://www.greenrobotics.net
// Released into the public domain.
#include
LM335A InsideTemp(0); //pass the analog input pin number
void setup() {
Serial.begin(57600);
Serial.println("starting");
}
void loop() {
delay(3000);
//user must call ReadTemp before any valid temp data is available
InsideTemp.ReadTemp();
Serial.print("Fahrenheit: ");
//functions to get the temperature in various unitsfs
Serial.println(InsideTemp.Fahrenheit());
Serial.print("Celsius: ");
Serial.println(InsideTemp.Celsius());
Serial.print("Kelvin: ");
Serial.println(InsideTemp.Kelvin());
}
Once I get motived, I’ll be sending this temperature data from my home to my blog, here. I’ll be sure to post more updates as they come.