I am trying to use the two temperature sensors TMP36 (from Sparkfun Inventor's kit) and KEYES LM35.
In read TMP36 Sensor and I convert the result to Celsius using the following code:
// TMP36 input sensor -> degrees Celsius calculation
TM36reading = analogRead(TM36sensor);
TM36voltage = (TM36reading/1024.0)*5.0;
//converting from 10mv per degree with 500 mV offset
// (TMP36 voltage - 500mV) times 100)
TM36degreesC = (TM36voltage - 0.5) * 100;
In read LM35 Sensor and I convert the result to Celsius using the following code:
// LM35 input sensor -> degrees Celsius calculation
LM35reading=analogRead(LM35sensor); // reads the LM35 output
LM35voltage = (LM35reading/1024.0)*5.0;
LM35degreesC=LM35voltage*100.0;
I have connected also a LCD display to monitor visually the values of these two sensors. Here is my full code. I use also a serial log. Here is a sample from this serial log (as you can see there is a difference/offset between 0.5 to 0.9 Celsius).
TM36: 17.38, LM35: 16.60 diff -> 0.78
TM36: 16.89, LM35: 16.11 diff -> 0.78
TM36: 16.89, LM35: 16.60 diff -> 0.29
TM36: 16.89, LM35: 16.60 diff -> 0.29
TM36: 16.89, LM35: 16.60 diff -> 0.29
TM36: 17.87, LM35: 16.60 diff -> 1.27
TM36: 16.89, LM35: 16.60 diff -> 0.29
TM36: 16.89, LM35: 16.60 diff -> 0.29
TM36: 16.89, LM35: 17.09 diff -> 0.20
TM36: 17.38, LM35: 17.09 diff -> 0.29
mean difference between sensors: 0.48
TM36: 17.38, LM35: 16.11 diff -> 1.27
TM36: 16.89, LM35: 16.60 diff -> 0.29
TM36: 17.38, LM35: 16.60 diff -> 0.78
TM36: 16.41, LM35: 17.58 diff -> 1.17
TM36: 16.89, LM35: 16.60 diff -> 0.29
TM36: 17.38, LM35: 16.11 diff -> 1.27
TM36: 16.89, LM35: 16.60 diff -> 0.29
TM36: 17.38, LM35: 16.11 diff -> 1.27
TM36: 16.89, LM35: 16.60 diff -> 0.29
TM36: 16.89, LM35: 17.09 diff -> 0.20
mean difference between sensors: 0.71
TM36: 17.38, LM35: 16.60 diff -> 0.78
TM36: 16.89, LM35: 16.60 diff -> 0.29
TM36: 17.38, LM35: 16.11 diff -> 1.27
TM36: 17.38, LM35: 16.11 diff -> 1.27
TM36: 17.38, LM35: 16.11 diff -> 1.27
TM36: 17.38, LM35: 16.60 diff -> 0.78
TM36: 17.38, LM35: 16.11 diff -> 1.27
TM36: 17.38, LM35: 16.11 diff -> 1.27
TM36: 17.38, LM35: 17.09 diff -> 0.29
TM36: 16.89, LM35: 16.11 diff -> 0.78
mean difference between sensors: 0.93
I power the Arduino from the computer using the USB cable. When the computer is ON we have the offset that I already demonstrated above. When the computer is turned off (after computer shutdown), immediately the sensor of TMP36 falls around 1 Celsius.. And then both sensors have similar temperature.
Why there is this temperature difference between TMP36 and LM35 sensors? How can we "fine tune" these sensors to monitor the real temperature?