So we bought five LM35DZ, in the previous days, when we use the mutlimeter to measure the voltage betewen Vout and GND, the results were correct and logic, and when we exposed LM35 to a heat source, the voltage increased, But the problem was with arduino, the results wer unstable and ilogical! We checked internet, and We found some possible reasons!
- Sharing the GND was one of them, but we only use the LM35, so we don't share the GND with any other device!
- Another possible reason is due to the unstable source, because we're feedig the arduino from the USB and this can lead to wrong results, because of the ADC converter, there are some ways to eliminate such problem, we chose to read the 3.3volt pin of arduino and use it as a reference!
unsigned int temp = 0;
unsigned long temptot = 0;
unsigned int REFtemp = 0;
unsigned long REFtemptot = 0;
int x;
int REFSensor= A1,
LMSensor=A0;
void setup() {
pinMode(REFSensor,INPUT);
pinMode(LMSensor,INPUT);
Serial.begin(9600);
}
void loop() {
temptot = 0;
REFtemptot = 0;
for(x = 0; x < 64; x++) { analogRead(REFSensor);}
for(x = 0; x < 64; x++) {REFtemptot += analogRead(REFSensor);}
for(x = 0; x < 64; x++) {analogRead(LMSensor);}
for(x = 0; x < 64; x++) {temptot += analogRead(LMSensor);}
temp = temptot >> 6;
REFtemp = REFtemptot >> 6;
float y= (float(REFtemp)*3.3)/676.;
Serial.print("Vcc: " ); Serial.print(y*1023./676.); Serial.print("v ");
Serial.print("REF: " ); Serial.print(y); Serial.print("v ");
float volt= (float(temp)*3.3)/float(REFtemp);
// Serial.print("V.LM: " ); Serial.print(volt*1000.); Serial.print("mv ");
Serial.print("T.LM: " ); Serial.print(volt*100); Serial.println("C " );
}
- Another problem is the noise and many propse to add a 100nF capasitor between Vcc and GND, we don't have 100nF
so we used 10nF; - Also to smoth the results we add another capacitor (1pF to 10pF) between Vout and arduino pin( A0 in our case)!
So today and after making all these changes, what happen is that the results were stabl but ilogical; in room temprature we read 10C to 12C! and when we removed one or both capacitors the results go crazy (between 100C to 10C!) and the most stange event is that when we expose the LM35 to heat, the temprature decreeases
We checked the LM35 using the multimeter and here the surprise! the voltage between Vout and GND was between 1000mv to 3000mv! and when we expose the LM35 to heat it decreases to 200mv, I'm saying it is a surprise because all the five LM35 start acting in the same way! is it possible that we burn all of them at once? if this is the case! so how and when this happened! I remember we switched between the Vcc and GND of one of the LM35 which can cause damage, but as I said just one! not all of them!
So anyone can help! we decided to buy another LM35 and check it! who knows!