I am having serious trouble with temp measurement using lm 35 dz sensor , the code was written correctly and the connections are also correct with Arduino Uno , what i got was randomly changing values and many times I obtain 0 degrees C , it sometimes start with 44 deg C in serial monitor and the readings are then decreasing gradually till reaching zero . So i tried to check if the values got by the analogReference function are correct and also the voltage readings and they are both wrong , when I was measuring the vout voltage to gnd with digital MM i was getting a fixed value of 0.1 V , while values at serial monitor were changing and far away from that value .
so i changed the sensor with other new sensor and i got the same results. i am really so confused about that. I have no idea where the problem is . should i buy another sensor from other store ? or the is something i can do to solve this problem. please i need your help.
here is my code
float val = 0 ;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(0);
float volt = val*0.004888 ; // also tried (val*5) /1023 and didn't work
float cel = val * 0.4888 ;
Serial.print(val);
Serial.print(" ");
Serial.print(volt);
Serial.print(" V ");
Serial.print(cel);
Serial.println(" C");
delay(500);
}
I checked them many times , connections are correct , i wonder why the measured voltage by the digital MM much different from that got by the sensor , could the problem solved by adding caps and resistors in a certain way ?
that was because i ordered another lm35 from the same store , and i gave up about the old one , i was shocked when it gave the same bad results . does it mean i should order one from other store ? or there is something i can do about it ?
I was really confused weather the problem was from my arduino or from the LM 35 sensors i got from a Chinese store , I checked the arduino analogRead function in a cds photocell and it worked fine and gave very closed voltage readings to my digital multimeter , so should I conclude that the problem is in the LM sensors i bought from that store and i should buy from other one ?
(BTW : all other sensors I bought from there worked perfectly except the LM 35 sensors , and all these sensors including LM 35 were included in the arduino kit)
knut_ny:
loo[k] for a TMP36 when buying the next one (or a digital one?)
You will understand why when you see the datasheet fig. 6 here
Why?
They both are 10mV/degreeC.
The only difference is a 500mV offset, so you can measure lower temps easier with the TMP36.
You might or might not need that.
Leo..