Welcome! Log In Create A New Profile

Advanced

More Accurate Thermistor Lookup Tables with tltgen

Posted by pietr 
More Accurate Thermistor Lookup Tables with tltgen
December 10, 2011 10:21AM
Hello everybody,

I've created an open source utility for generating more accurate thermistor lookup tables for your favorite firmware. The utility is named 'tltgen' and can be downloaded here.

Some information:
The lookup tables generated by tltgen are based on either the beta equation (1/T = 1/T0 + 1/B*ln(R/R0)) or the Steinhart-Hart equation (1/T = A + B*ln(R) + C*(ln(R)^3)). The latter provides more accurate results over a larger temperature range, but some thermistor datasheets do not mention the required A, B and C parameters.

tltgen has the ability to calculate the Steinhart-Hart parameters, when given at least 3 measured data points. These datapoints are either (temperature:adc-value) pairs or (temperature:resistance) pairs. If more than 3 data points are given, tltgen will use the least squares method to calculate the Steinhart-Hart parameters that fit most closely to the given data points.

tltgen outputs a C source file and an accompanying header file. The C file contains an array, mapping adc-values to temperatures. The specific structure of the output array can be customized using command line options.

Currently, tltgen has only been tested to work on Linux, but there is no reason it should not work on other platforms.

Let me know what you think about it...
Re: More Accurate Thermistor Lookup Tables with tltgen
December 12, 2011 08:20AM
Re: More Accurate Thermistor Lookup Tables with tltgen
December 02, 2012 06:36AM
I was just writing a utility to do the same thing, but I think yours is better!

It would be great if it could read temp-resistance data from a file. I have a plain text file for different thermistors, each line containing a temperature and resistance value, for a useful range of the thermistor e.g. from 0 to 300 in steps of 10 or whatever. The file data can be generated from various sources, e.g from data sheet, from measurement, or generated from beta equation etc.

I then calc Steinhard-Hart coefficients from the data, and extrapolate the rest of the range using S-H to generate the C file.

I also added parameters for the range of the ADC, and a scaling factor for temperature values (fixed point) since this is used by Teacup firmware.
Re: More Accurate Thermistor Lookup Tables with tltgen
December 02, 2012 08:16AM
Have you checked out the source from Google code lately? If so, you've probably noticed that I've been working on a new implementation. It uses C++ instead of C, which makes properly structuring the code much easier. It also has a GUI instead of only a command line interface.

If you send me an example text file, I could take a look to see if I could implement an import feature for this type of files. The new version also has parameters for the ADC range and a scaling factor (although I'm not sure if I've already implemented this completely). In one or two weeks I'll probably have some time to continue working on the implementation.

Anyway, thanks a lot for your comments, it's nice to see there is some interest in this tool! If you have more suggestions, I'd be very happy to hear them!


--------
Visit my blog: [blog.agten.net]
Re: More Accurate Thermistor Lookup Tables with tltgen
December 03, 2012 05:17AM
IMHO, ideally, these equitations would become a preprocessor macro somehow. This would make such stuff actually available to mere humans.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: More Accurate Thermistor Lookup Tables with tltgen
December 03, 2012 05:25PM
pietr Wrote:
-------------------------------------------------------
> If you send me an example text file, I could take
> a look to see if I could implement an import
> feature for this type of files.

Sure, sample file attached. The format is temperature in Celcius, and resistance in Ohms. One line per pair, white space includes tabs. Numbers may be decimal but not floating point. Now I think of it, it would be good to have comments prefixed with "#".

This data was taken from an EPCOS data sheet (although I have just realised the data sheet was for an obsolete part winking smiley)
Attachments:
open | download - therm_EPCOS_100k.txt (693 bytes)
Re: More Accurate Thermistor Lookup Tables with tltgen
February 12, 2013 05:44PM
@bobc I just committed a new development version of tltgen that includes a CSV import feature. I don't have any binaries out yet (because the application is still rather unstable), but you can check out the source code from Google Code and compile it yourself, if you're interested. Let me know if you have any problems, I'll try my best to help...


--------
Visit my blog: [blog.agten.net]
Sorry, only registered users may post in this forum.

Click here to login