Obtaining better accuracy for LMT87 Temperature Sensor by using polynomial regression
LMT87 is one of the cheapest as well as relatively well-performing general-purpose temperature sensors. One of the most considerable disadvantages of this sensor family is its negligible nonlinear transfer function between voltage and temperature. This nonlinearity can be easily seen by plotting the transfer table data which is provided in the datasheet of the sensor.

To address this issue, the datasheet offers an equation to get a better voltage-temperature relationship which should be implemented in the firmware side.

However, this equation requires high computational power which can be an issue when working with low-power implementations.
The good news is we can get rid of this complex equation by applying polynomial regression to the extracted data from the datasheet. The python library, numpy, provides a conducive function polyfit to deal with such type of problems.
After implementing polynomial regression, we got the equation below to convert output voltage to the temperature which requires less computational power and perfectly fits the derived data.

To view the full project code, please, visit the GitHub repo. If you think it is helpful please, don’t forget to clap.

