Temperature sensor LM60 wrong value


I just got my Fez Panda II with some sensors. One of them is the temperature sensor LM60.
The value i get is about 30 degrees celcius but i expecting a value about 17 degrees celcius(bases on an weatherstation).

I used the code from http://code.tinyclr.com/project/98/national-semiconductor-lm60-temperature-sensor/

What can i do wrong?

You need to calibrate your own gain values. Take away the “- 424” in GetTemperatureInc() and measure the temp of ice water. That should give you the correct gain value for your sensor.

Welcome !

My first question is how do you have the electonics connected?

Second: Does the temperature vary if you make it warmer/cooler (warmer is usually easier, using hot air from your breath for instance).

Third, have you sampled just the AnalogIn and seen the values, and then manually done the calculations?


@ ianlee74: thats something i can do just adjusting the value untill i’ve got he right temperature.
But is that the right way?

@ Brett:
1: The sensor is connected on a breadboard to ground, 3.3V and analog4 (no resistor in use).
2: Yes, i’ve used my breath and a blow-dryer and the temperature change.
3: Yes, but this will give me the same values because if i make the calculations manually i use the same formula.

Did you try another analog pin ? I recall that someone else had problems with an4 some time ago. Not sure if it will help, but it may be worth a try.

I had connected an light sensor(tept5700) on a3. When i disconnect this the temperature drops with 7 degrees celcius(Strange how is this possible?). Butt stil about 7 degrees celcius to high.

There’s another thread or seven about analog input and tieing all unused ports back to GND to improve reliability so you could try that. Remember that the Analog In on these devices are multiplexed, and this action might help make sure there’s no other influence from the unconnected mux pins.

Edit: if you check the spec sheet for the LM60, the 424mv output is meant to be 0 degrees C, and there is a 6.25mv/degree, so unless your specific device is out of spec I can’t see a specific code related issue, another reason to consider external factors like grounding of the other devices


Tried it but haven’t got any effect.