LM35 isn't giving me correct values

I’ve tried using multiple sketches and they all result in the same error. The temperature is apparently extremely high and it doesn’t change its value easily. It tends to stay around that value without deviating. I bought two of these and confirmed that both of these give the same value. Also i checked the wiring was correct , so i am quite confused on whats wrong.

On the sensor it says LM35DZ by the way. I could do with some help getting it to read the temperature, I would appreciate any help, thanks.

Why do you think it's not working ? Temperature is in most cases a very stable variable, so I'm not surprised to see the same value over and over being read. Have you tried to heat/cool the sensor to see if your reading changes?

I think you just got your calibration wrong. What's the logic behind the 0.488 you use to multiply with the reading?

Regards,

Carlos

You’re right pepe, now that I’ve done the math it should never hit 4,1 V.

Print the value of temp before the multiplication.

EDIT:

What's the logic behind the 0.488 you use to multiply with the reading?

5000 / 1024 / 10 = 0.48828125

Hi, I haven't heated the sensor or soldered it yet. All I have done is opened it out of the packet and started using it with arduino. That's why I'm so confused because I treys using it with another arduino and the same thing happened and I also used the other sensor I bought to see if that was a mistake.

What I meant by it not changing temp was that I tried putting a fan on it and then holding it to see the change. However this never happened and it just stayed at 411 degrees.

Its not a connection issue because i followed the exact circuit diagram, shown below. And i have checked that actual sensor and the label printed on it says LM35DZ. I’m not sure what it could be.

Ok, thanks for the advice, i'll give it a try!

Its not a connection issue because i followed the exact circuit diagram, shown below.

You should never assume that, just because someone has published a diagram, means it is correct.

I've wasted time twice this week by following other peoples' incorrect diagrams.

If you can't get something to work, never automatically rule out any particular reason.

Yes, I agree with you and that's why I did check many other forums and diagrams to confirm that this was correct. Also I tried to minimise any wires and interference and still couldn't get it to work.

You still haven't followed my advice:

Print the value of temp before the multiplication.

Put a 500 ohm resistor to ground from the LM35 signal lead. The LM35 can give all sorts of random signals if the impedance is too high.

Ok I'll give it a try and let you know how it ends up. Jiggy-ninja I did try what you said but that didn't work either as it gave me values of 842-843, but thanks for that option.

Do you have the arduino set up so that the reference voltage is the nominal 5V supply ? That is what you need to be doing, for your sketch to work.

Did you actually try measuring this alleged 4.1 V output with a voltmeter ?

What temperature are you actually trying to measure ?

If you have actually connected it with short wires to your arduino, then transmission line problems should not be an issue. If it isn't connected to anything actually hot, then you should be measuring "room temperature", which would be something in the range 20 to 30 degrees. If you are holding it tightly in your hot little had, as in your photo, then maybe 35 degrees,

This means your analog output voltage from the device should be in the ballpark of 200 to 350 mV.

Try measuring this voltage with a voltmeter.

Things that could be wrong:

The device is broken.
The analog input of your arduino is broken.

Even if you set the reference voltage of your arduino a/d converter to 1.1V, you still should not get an analog count of 840. You should be getting an int analog count around 200 to 400.

Yes, i measured the output voltage and it was a constant 3.89V. I have only tried measuring room temp and my body temp from holding it. I am guessing both of them are faulty and i will get a refund. Thanks for everyones help!

cptdondo:
Put a 500 ohm resistor to ground from the LM35 signal lead. The LM35 can give all sorts of random signals if the impedance is too high.

amazing. worked for me!

Digging up old posts...
500ohm?
Temp sensors shouldn't be loaded that much.
It will heat up the sensor chip, and will give false temp readings.
I have seen values of 47k.
You do ofcourse have a 100n bypass cap across the supply of the sensor.
Leo..