Hi all,
i've tried to use a lm335a themperature sensor with my arduino uno board. But i'm not sure if i'm doing everything correctly. (I'm very new to arduino and electronics).
I connected the sensor to arduino as shown in figure:
And the code that i used is that:
int pin = 0; // analog pin
void setup()
{
Serial.begin(9600); // start serial communication
pinMode(12, OUTPUT);
}
void loop()
{
digitalWrite(12,HIGH);
float valRead = analogRead(pin) * 0.004882814;
float k = ((100*valRead)-273.15);
Serial.println(k);
delay(1000);
}
Now i'm not sure about the results (i did not checked the temperature in my room) are here: http://pastebin.com/uMCEFvGQ As you can see the temperature seems to be abbout 16-17 degrees. The fact that i don't understand are why the values change so many times (and sometimes it have very strange values, like 5.66 degrees) Notice that in after the 50th value i put my fingers on the sensors.
My questions are: 1. The sensor is wired correctly? 2. These values can be ok? 3. THere are some errors in my code?
Thanks a Lot! Ivan