user7271: // Tells the Arduino to read A2 and stores the value in “Vin”    
Vin = analogRead (tempSensor); 

// Converts the voltage value to temperature and stores it into the “TC” variable (in °C)
TC = 500.0 * (Vin / 1024.0); 

The temperature shown is about 50.25°C, sometimes it is showing 36-38°C   degrees, but the actual temperature is about 25-26°C.
Why this is happening?
Code:
Vin = analogRead (tempSensor);
TC=(500.0*Vin)/1023.0;
TF = ((9.0*TC)/5.0)+32.0;
lcd.setCursor(0, 1);
lcd.print(TF);
lcd.print((char)223);
lcd.print("F ");
lcd.print (TC);
lcd.print((char)223);
lcd.print("C");
delay(1000); 


user881: I gave up on using a LM335, which is quite similar to your LM35. The problem is these devices self-heat due to the quiescent power they draw. The LM35 data sheet suggests you correct for this in software (footnote 5), and the LM335 datasheet dodges the bullet by quoting accuracy figures that can be achieved in an oil bath rather than free air.
But the figures you are quoting suggest you have a bigger problem, as I am talking of a few degrees inaccuracy, not tens of degrees.
I changed to a DS18B20 and never looked back - simple interface and self-heating is compensated for by the device.

user7292: Any chance you're printing Vin, and not TC? 
500*(50.25/1024) = ~24.5
If not, please post as much of your program as possible

7271: <pre><code>// Tells the Arduino to read A2 and stores the value in “Vin”    
Vin = analogRead (tempSensor); 

// Converts the voltage value to temperature and stores it into the “TC” variable (in °C)
TC = 500.0 * (Vin / 1024.0); 
</code></pre>

<p>The temperature shown is about 50.25°C, sometimes it is showing 36-38°C   degrees, but the actual temperature is about 25-26°C.</p>

<p>Why this is happening?</p>

<p>Code:</p>

<pre><code>Vin = analogRead (tempSensor);
TC=(500.0*Vin)/1023.0;
TF = ((9.0*TC)/5.0)+32.0;
lcd.setCursor(0, 1);
lcd.print(TF);
lcd.print((char)223);
lcd.print("F ");
lcd.print (TC);
lcd.print((char)223);
lcd.print("C");
delay(1000); 
</code></pre>
 881: <p>I gave up on using a LM335, which is quite similar to your LM35. The problem is these devices self-heat due to the quiescent power they draw. The LM35 data sheet suggests you correct for this in software (footnote 5), and the LM335 datasheet dodges the bullet by quoting accuracy figures that can be achieved in an oil bath rather than free air.</p>

<p>But the figures you are quoting suggest you have a bigger problem, as I am talking of a few degrees inaccuracy, not tens of degrees.</p>

<p>I changed to a DS18B20 and never looked back - simple interface and self-heating is compensated for by the device.</p>
 7292: <p>Any chance you're printing Vin, and not TC? </p>

<p>500*(50.25/1024) = ~24.5</p>

<p>If not, please post as much of your program as possible</p>
