Welcome! Log In Create A New Profile

Advanced

Thermistor Lookup Tables

Posted by dazed.dnc 
Thermistor Lookup Tables
February 13, 2011 03:53PM
This is an alternative to the python script, since some users (myself included) had trouble running it.

I blended some of the features/tactics in thermistors_rev1.xls with the Python script and added my own two cents as well.

If your firmware supports two different thermistors (one for the extruder and another for the heated build plate), it will export two tables for you. If it doesn't just disable the heated build plate table and you will only get one table. If you can run Excel VBA macros, it will create a back up of your table (if it already exists) then export everything at the click of a button. If you can't run macros, then you have to do a bit of manual copy/paste work.

You can narrow the temperature range of your table to a specific range of interest by changing the min/max adc values. I thought it might improve accuracy over the tempurature range that we really care about without having to use bigger tables, but I haven't done any testing to see if it really helps or not.

Here is an example of the output:
// Thermistor lookup table for RepRap Temperature Sensor Boards (http://make.rrrf.org/ts)
//Made with createTemperatureLookup.xls (no link yet)

//-----------EXTRUDER SETTINGS-----------//
//--Thermistor model #:  EPOCS B57560G104F
//--r0:  100000
//--t0:  25
//--beta:  4066
//--r1:  0
//--r2:  4700
//--num-temps:  20
//--vcc voltage:  5
//--vadc voltage:  5
//--min ADC:  25
//--max ADC:  600

//-----------HEATED BUILD PLATE SETTINGS-----------//
//--Thermistor model #:  Honeywell 135-104LAG-J01
//--r0:  100000
//--t0:  25
//--beta:  3974
//--r1:  0
//--r2:  4700
//--num-temps:  20
//--vcc voltage:  5
//--vadc voltage:  5
//--min ADC:  200
//--max ADC:  800

//Extruder Table:
#define NUMTEMPS 20
short temptable[NUMTEMPS][2] = {
  { 25, 317 },
  { 55, 254 },
  { 86, 223 },
  { 116, 204 },
  { 146, 190 },
  { 176, 178 },
  { 207, 168 },
  { 237, 160 },
  { 267, 153 },
  { 297, 147 },
  { 328, 141 },
  { 358, 135 },
  { 388, 130 },
  { 418, 125 },
  { 449, 120 },
  { 479, 116 },
  { 509, 112 },
  { 539, 107 },
  { 570, 103 },
  { 600, 99 }
};

//Heated Build Plate Table:
#define BEDNUMTEMPS 20
short bedtemptable[BEDNUMTEMPS][2] = {
  { 200, 176 },
  { 232, 166 },
  { 263, 158 },
  { 295, 151 },
  { 326, 145 },
  { 358, 139 },
  { 389, 133 },
  { 421, 128 },
  { 453, 123 },
  { 484, 118 },
  { 516, 113 },
  { 547, 109 },
  { 579, 104 },
  { 611, 100 },
  { 642, 95 },
  { 674, 91 },
  { 705, 86 },
  { 737, 81 },
  { 768, 76 },
  { 800, 71 }
};

Edited 1 time(s). Last edit at 02/13/2011 03:56PM by dazed.dnc.
Attachments:
open | download - createTemperatureLookup.xls (173 KB)
Re: Thermistor Lookup Tables
February 13, 2011 04:23PM
I thought that the "cannonical" way do adjust a temp table for more accuracy in the range you're interested in was to generate a table with many more entries than you really need (say, 50) and then delete most of them. You can delete the almost all of the ones that are low (say, <150C) and keep all of the entries in the region that you print in. You have to make sure and adjust the value of NUMTEMPS to the number of entries actually in the table, of course.

This gives you accurate results in important ranges while still having some idea what the temperature is elsewhere.

I recently adjusted the original createThermistorTable.py program to generate entries in in 1/4 degree increments (i.e. tempuratures are listed as temp*4, rounded to nearest integer) for the 5DoA firmware, which uses 14.2 fixed point notation (same thing as above) for temps. Python is a pleasure to work with.

I don't know how much difference it makes (too lazy to actually work through the math) but the R1 resistor that's part of the voltage divider (the other part is the thermistor) is only rated to 5% accuracy. I redid my table with the measure resistance instead of using the 4.7KΩ. It's an easy thing to do, presuming that you have a ohm-meter and a way of regenerating the thermistor table.


--
I'm building it with Baling Wire
Re: Thermistor Lookup Tables
February 13, 2011 08:18PM
jgilmore Wrote:
-------------------------------------------------------
> I thought that the "cannonical" way do adjust a
> temp table for more accuracy in the range you're
> interested in was to generate a table with many
> more entries than you really need (say, 50) and
> then delete most of them. You can delete the
> almost all of the ones that are low (say, <150C)
> and keep all of the entries in the region that you
> print in. You have to make sure and adjust the
> value of NUMTEMPS to the number of entries
> actually in the table, of course.
Makes sense. Instead of using a linear change in adc values, I guess it should fit some sort of curve. However, is the best "curve" for this going to depend on some property of the thermistor or should it be relatively universal?

> I recently adjusted the original
> createThermistorTable.py program to generate
> entries in in 1/4 degree increments (i.e.
> tempuratures are listed as temp*4, rounded to
> nearest integer) for the 5DoA firmware, which uses
> 14.2 fixed point notation (same thing as above)
> for temps. Python is a pleasure to work with.
I'm not trying to be rude or anything, but I don't understand what you are getting at here. Are you saying this was the table you chopped values out of or did you use the whole table? I thought using huge tables would cause excessive memory consumption and/or processing delays. Besides that, I noticed while using 200 entries that a significant range of adc values actually correlated to the same temperature once it was rounded to the nearest whole number in order to fit within an array of type "short" - at least, this was my understanding of why it had to use whole numbers only.

> I don't know how much difference it makes (too
> lazy to actually work through the math) but the R1
> resistor that's part of the voltage divider (the
> other part is the thermistor) is only rated to 5%
> accuracy. I redid my table with the measure
> resistance instead of using the 4.7KΩ. It's an
> easy thing to do, presuming that you have a
> ohm-meter and a way of regenerating the thermistor
> table.
I measured my resistors to be 4460 and 4440 ohm (extruder and thermistor respectively). I plugged these into my spreadsheet and it only noticeably affects the higher end temperatures. At around the 313C mark, using the actual values added another 5C. Unless I have done something wrong, It makes just over 0.1% difference. If you are talking about comparing one machine to another, the 5C temperature difference might account for how settings that work well on one machine would not work as well on another. Otherwise, I don't think that really matters since people just guess-and-check until they find a working temperature regardless of of whether or not it is actually the true temperature.
Re: Thermistor Lookup Tables
February 13, 2011 08:53PM
dazed.dnc Wrote:
-------------------------------------------------------
> jgilmore Wrote:
> --------------------------------------------------
> -----
> > I thought that the "cannonical" way do adjust a
> > temp table for more accuracy in the range
> you're
> > interested in was to generate a table with many
> > more entries than you really need (say, 50) and
> > then delete most of them. You can delete the
> > almost all of the ones that are low (say,
> <150C)
> Makes sense. Instead of using a linear change in
> adc values, I guess it should fit some sort of
> curve. However, is the best "curve" for this going
> to depend on some property of the thermistor or
> should it be relatively universal?

They way I was doing it depends on if your printing with ABS or PLA smiling smiley What matters is the range of temperatures you're interested in. Having said that, towards the higher end the response curve does look less like a straight line and more like a curve. Which means that if you want to average out your inaccuracy over the whole range of temperatures, you should have your table values closer together on the higher end.

> > I recently adjusted the original
> > createThermistorTable.py program to generate
> > entries in in 1/4 degree increments (i.e.
> > tempuratures are listed as temp*4, rounded to
> > nearest integer) for the 5DoA firmware, which
> uses
> > 14.2 fixed point notation (same thing as above)
> > for temps. Python is a pleasure to work with.
> I'm not trying to be rude or anything, but I don't
> understand what you are getting at here. Are you
> saying this was the table you chopped values out
> of or did you use the whole table? I thought using
> huge tables would cause excessive memory
> consumption and/or processing delays. Besides
> that, I noticed while using 200 entries that a
> significant range of adc values actually
> correlated to the same temperature once it was
> rounded to the nearest whole number in order to
> fit within an array of type "short" - at least,
> this was my understanding of why it had to use
> whole numbers only.

The table still has only twenty values in it, but the values look like "{21, 1329}, // 332.48 C" instead of "{21,332}". I.E. there aren't more numbers, but the numbers that are there are more accurate. It's storing 332.5 instead of 332. Doesn't make much difference (1/4°? who cares?) the point is that the table is now storing the values in the same format that the firmware is using them, a great improvement for the 5DoA firmware.

The reason it has to use whole numbers only (for the ADC side) is that the ADC unit in the chip measures voltage and converts it to a number between 0 (0V) and 1023(5V). The point of the thermistor table is to take this number and convert it to a temperature via the relatively simple linear interpolation, rather than trying to make the poor overloaded 8-bit processor try to calculate logarithmic functions.

For the temp side of the table, it's because the standard firmware uses an integer to hold the value anyway. Given that, there's no point in a more accurate number b/c it would just be truncated anyway.

I mention in mainly because I have a swollen ego to say that I've struggled with it recently. Staring at the stupid thing and trying to figure out why it's not working gives plenty of time for thinking about irrelevant aspects of it as well. That's really the only reason that I regenerated my table with the actual resistance reading. i.e. it will improve accuracy right? It won't compensate for the calculations being off by 200°, but since I don't yet know why that's happening, I'll do what I can while I think about it.


> > I don't know how much difference it makes (too
> > lazy to actually work through the math) but the
> R1
> > resistor that's part of the voltage divider
> (the
> > other part is the thermistor) is only rated to
> 5%
> > accuracy. I redid my table with the measure
> > resistance instead of using the 4.7KΩ. It's an
> > easy thing to do, presuming that you have a
> > ohm-meter and a way of regenerating the
> thermistor
> > table.
> I measured my resistors to be 4460 and 4440 ohm
> (extruder and thermistor respectively). I plugged
> these into my spreadsheet and it only noticeably
> affects the higher end temperatures. At around the
> 313C mark, using the actual values added another
> 5C. Unless I have done something wrong, It makes
> just over 0.1% difference. If you are talking
> about comparing one machine to another, the 5C
> temperature difference might account for how
> settings that work well on one machine would not
> work as well on another. Otherwise, I don't think
> that really matters since people just
> guess-and-check until they find a working
> temperature regardless of of whether or not it is
> actually the true temperature.

I think you slipped a digit there, 5.0/313.0=0.015, or 1.5% difference. Which is still rather small. It does mean that in our systems the accuracy depends on the resistor (±5%) rather than the thermistor (±1%) at high temperatures, but that the inaccuracy of the resistor doesn't make any difference at lower temperatures. Presumably that's because at low temps, the relatively higher resistance of the thermistor drowns out the inaccuracy in the resistor. Good to know, thanks.

You're correct that it would only matter when moving settings between different machines. Even a different batch of plastic would probably make enough difference to swallow 5C.


--
I'm building it with Baling Wire
Sorry, only registered users may post in this forum.

Click here to login