This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Interfacing LMT87 to a uC

Other Parts Discussed in Thread: LMT87

Hello all,

I am in the process of interfacing the LMT87 with a uC and thus going through the datasheet I have found that the transfer function for converting the analog output of the sensor to temperature is derived using linear approximation using two points of interest from the table 1 of the data sheet. What I would like to ask is that the data sheet mentions the typical accuracy of LMT87 as +-0.3 Deg C, if the transfer function is derived using the linear approximation does it affect the accuracy? If yes, how much will the accuracy be affected?

Secondly, I am planning to implement the C code for the calculation of Temperature from Voltage and therefore would like to make the conversion as fast as possible avoiding the need for a lookup table and float variables how can this be done? One method I have already thought of is scaling the terms in equation 6 of datasheet first with a factor of 10 to convert the -13.6 to -136 and then the answer with 100 to get the temperature up to 2 decimal points without using floats so for example 2450 -> 24.50 Deg C.

Thank you for your time and I appreciate any help in this regard.

  • Hi Owais,

    I think there may be some confusion. Basically the output voltage of the LMT87 is converted to temperature by either using the look up table or using Equation 2. The actual temperature is within +/-0.3C of the LMT87 temperature reading.

    The fastest way to convert from voltage to temperature would be to use a linear interpolation on the lookup table. The linear interpolation equation is much easier to compute and uses less resources on the the microcontroller compared to Equation 2 (no need to compute square roots, etc). An alternative is to use scaling like you mentioned. The method to do this is to shift the ADC data bits over left by n bits, compute the voltage to temperature and then shift the bits right by n bits to receive the final answer. This method will avoid performing floating point math but of course the final temperature value will be a floating point value since you want decimal answers (24 vs 24.50).

    -Michael Wong