temperature sensor LM35 not working properly

Hi guys, Im trying to set up LM35DZ temperature sensor from my starter kit with arduino uno, but Im getting temperatures which are 2.5 degrees C off.

I looked for anything on this forum and nobody seems to have this problem. I use simple connection like in here


I have just the sensor connected to ground, 5V source from arduino and A0 for analog reading. I power arduino with USB and measured the output like this as 5.02V. I calculate the temperature as temp = (analogread/1024) * 500

I compare the reading with standard room temperature meter ( I hope these things are not so off).

I read the datasheet of LM35 and they guarantee 3/4 degree accuracy, so Im not in that for sure. What could be wrong?

LM35*D* datasheet : Accuracy = +/-2 °C

You read for LM35*A*, not for LM35D which is the worse version,

Your "standard room temperature meter" is an real "standard thermometer" ? I doubt, what is his accuracy ?

Well my thingy says LM35DZ and datasheet knows this as order number only. So I thought its LM35. My thermometer is weather station KN-WS400. Its my first time to play with temperature sensors, so I dont have idea how much accuracy one can expect.

So now it shows 32 instead of 34, should I expect 27 instead of 25 or will that be unrelated and I can get anything from 23-27? Thanks.

knowing the drift you can "patch the formula"

float temperature = temperature - 2.5; // or + 2.5 ;)

knowing the drift you can “patch the formula”

float temperature = temperature - 2.5; // or + 2.5 :wink:

That is if the temperature difference is constantly 2.5°C or you only want to measure in a range of a few degrees.

If you want to read from lets say -10°C to +35°C you might want to do the following:

Measure your weather station and lm35 in room temp and in the freezer.

You might get something like this:
Room temperature:

  • Weather station 25°C
  • LM35 27.5°C
  • Error = +2.5°C


  • Weather station -5°C
  • LM35 -4°C
  • Error = +1°C

Your correction forumula will be:
LM35Temp -(1+ 1,5/31,5*(LM35Temp + 4)) = corrected result

so a reading of 10°C on the LM35 will become:
10 - (1+1,5/31,5*(10+4)) = 8.33°C (correcting 1.66°C)

You might also want to read this:
and my problem with the LM35: http://forum.arduino.cc/index.php?topic=178408.0

thank you for reply, I read the thread about your problem, still didnt get why it worked out the way it did, but good anyways..

@deleenheir you are completely right (if the drift is linear - if not, one can check multimap() on the playground ;)