Go Down

Topic: LM35 - value starts out right (Read 93 times) previous topic - next topic


I have a LM35 temp.-sensor.
I tried a lot of the code out there and the different codes mostly behaves the same way.
They START right. Then the value starts drifting. I'd guess it drifts at about half a centigrade per minute.

I reckon this has absolutely nothing to do with the code, but perhaps the sensor most likely the board. I imagine it builds up some sort of excess current caused by false grounding.

Does any of you guys reckognize the problem and/or have a solution?


Code attached.

Code: [Select]
float tempC;
int reading;
int tempPin = 0;

void setup()

void loop()
reading = analogRead(tempPin);
tempC = reading / 9.31;


Try this code:


This code will take an average out of 10 readings.

Also make sure there is nothing else connected to the same ground as the one you are using for the LM35.


Sounds like it may be miswired and self heating from excess current, can you post a wiring diagram?


Nov 28, 2016, 03:01 pm Last Edit: Nov 28, 2016, 03:02 pm by MarkT
Are you sure the temperature isn't changing?  Black epoxy packaged can pick up heat
radiation from your body so just standing near to it will be quite detectable if its an epoxy package.
Metal cans reflect radiated heat efficiently and are much better at measuring the air temperature

I imagine it builds up some sort of excess current caused by false grounding.
No, that's not plausible.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Thanks for your replies.

I will try em ouy when I have more time, for now I just get readings of 110 or 109.88 and no reponse on heating the sensor with my fingers.

Tried three different boards (2x UNO and 1xDUE).

Will keep you posted when I had the time to try again.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131