# interfacing with a temperature sensor

I have absolutely no experience with temperature sensors. I am interfacing with a STLM20 temperature sensor, the datasheet can be found here: http://www.st.com/web/catalog/sense_power/FM89/SC294/PF129199

anyway the connection is quite simple, I have a question regarding the transfer function.....what is it and how can I use it to measure temperature?

That type of sensor generates a voltage that is proportional to the temperature so that you would have to connect this to one of the arduino's ADC inputs. The transfer function is just an equation which shows how to calculate the temperature from the voltage (or vice versa). Reorganizing the linear equation on page 6 slightly, the output voltage V at a temperature T (Celsius) is given by:

``````V = 1.8663 - .01169*T
``````

A simple example is that when the temperature is zero degrees C, the output voltage will be 1.8663V. For use with the Arduino, you will be measuring a voltage on the ADC and then calculating the temperature from that. Reworking the equation to solve for T gives:

``````T = 85.543*(1.8663 - V)
``````

so, for example, if V=0 then T=159.65C The problem with this device, as is evident from the tables on pages 6 and 7, is that its accuracy varies depending upon the range of temperatures you wish to measure and the chip's supply voltage. The parabolic equation given on page 6 will give more accuracy but it is still dependent upon the operating temperature range and supply voltage.

Pete