Archive for May 14th, 2013

Makergear M2: Thermistor Tables

The Marlin firmware used by the M2 has these thermistor selections in Configuration.h:

//// Temperature sensor settings:
// -2 is thermocouple with MAX6675 (only for sensor 0)
// -1 is thermocouple with AD595
// 0 is not used
// 1 is 100k thermistor
// 2 is 200k thermistor
// 3 is mendel-parts thermistor
// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
// 5 is ParCan supplied 104GT-2 100K
// 6 is EPCOS 100k
// 7 is 100k Honeywell thermistor 135-104LAG-J01

#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 1
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_BED 1

The first table in thermistortables.h looks like this:

#define OVERSAMPLENR 16

#if (THERMISTORHEATER_0 == 1) || (THERMISTORHEATER_1 == 1)  || (THERMISTORHEATER_2 == 1) || (THERMISTORBED == 1) //100k bed thermistor

const short temptable_1[][2] PROGMEM = {
{       23*OVERSAMPLENR ,       300     },
{       25*OVERSAMPLENR ,       295     },
{       27*OVERSAMPLENR ,       290     },
{       28*OVERSAMPLENR ,       285     },
{       31*OVERSAMPLENR ,       280     },
{       33*OVERSAMPLENR ,       275     },
{       35*OVERSAMPLENR ,       270     },
{       38*OVERSAMPLENR ,       265     },
{       41*OVERSAMPLENR ,       260     },
{       44*OVERSAMPLENR ,       255     },
{       48*OVERSAMPLENR ,       250     },
{       52*OVERSAMPLENR ,       245     },
{       56*OVERSAMPLENR ,       240     },
{       61*OVERSAMPLENR ,       235     },
{       66*OVERSAMPLENR ,       230     },
{       71*OVERSAMPLENR ,       225     },
{       78*OVERSAMPLENR ,       220     },
{       84*OVERSAMPLENR ,       215     },
{       92*OVERSAMPLENR ,       210     },
{       100*OVERSAMPLENR        ,       205     },
{       109*OVERSAMPLENR        ,       200     },
{       120*OVERSAMPLENR        ,       195     },
{       131*OVERSAMPLENR        ,       190     },
{       143*OVERSAMPLENR        ,       185     },
{       156*OVERSAMPLENR        ,       180     },
{       171*OVERSAMPLENR        ,       175     },
{       187*OVERSAMPLENR        ,       170     },
{       205*OVERSAMPLENR        ,       165     },
{       224*OVERSAMPLENR        ,       160     },
{       245*OVERSAMPLENR        ,       155     },
{       268*OVERSAMPLENR        ,       150     },
{       293*OVERSAMPLENR        ,       145     },
{       320*OVERSAMPLENR        ,       140     },
{       348*OVERSAMPLENR        ,       135     },
{       379*OVERSAMPLENR        ,       130     },
{       411*OVERSAMPLENR        ,       125     },
{       445*OVERSAMPLENR        ,       120     },
{       480*OVERSAMPLENR        ,       115     },
{       516*OVERSAMPLENR        ,       110     },
{       553*OVERSAMPLENR        ,       105     },
{       591*OVERSAMPLENR        ,       100     },
{       628*OVERSAMPLENR        ,       95      },
{       665*OVERSAMPLENR        ,       90      },
{       702*OVERSAMPLENR        ,       85      },
{       737*OVERSAMPLENR        ,       80      },
{       770*OVERSAMPLENR        ,       75      },
{       801*OVERSAMPLENR        ,       70      },
{       830*OVERSAMPLENR        ,       65      },
{       857*OVERSAMPLENR        ,       60      },
{       881*OVERSAMPLENR        ,       55      },
{       903*OVERSAMPLENR        ,       50      },
{       922*OVERSAMPLENR        ,       45      },
{       939*OVERSAMPLENR        ,       40      },
{       954*OVERSAMPLENR        ,       35      },
{       966*OVERSAMPLENR        ,       30      },
{       977*OVERSAMPLENR        ,       25      },
{       985*OVERSAMPLENR        ,       20      },
{       993*OVERSAMPLENR        ,       15      },
{       999*OVERSAMPLENR        ,       10      },
{       1004*OVERSAMPLENR       ,       5       },
{       1008*OVERSAMPLENR       ,       0       } //safety
};
#endif

The OVERSAMPLENR constant determines the number of successive ADC samples added together into a single value, which is then used to search the table for the corresponding entry. The table entries are pairs of:
{nominal ADC value * number of samples, temperature in C}
which means that if we know the temperature, we can work backwards to find the ADC value and then compute the actual thermistor resistance.

However, before doing that, I created a modified version of the thermistor table that simply scales the temperatures down by 0.878:

#if (THERMISTORHEATER_0 == 8) || (THERMISTORHEATER_1 == 8) || (THERMISTORHEATER_2 == 8) || (THERMISTORBED == 8) // M2 thermistors on RAMBO
const short temptable_8[][2] PROGMEM = {
	{23*OVERSAMPLENR, 263.51},
	{25*OVERSAMPLENR, 259.12},
	{27*OVERSAMPLENR, 254.73},
	{28*OVERSAMPLENR, 250.34},
	{31*OVERSAMPLENR, 245.94},
	{33*OVERSAMPLENR, 241.55},
	{35*OVERSAMPLENR, 237.16},
	{38*OVERSAMPLENR, 232.77},
	{41*OVERSAMPLENR, 228.38},
	{44*OVERSAMPLENR, 223.98},
	{48*OVERSAMPLENR, 219.59},
	{52*OVERSAMPLENR, 215.2},
	{56*OVERSAMPLENR, 210.81},
	{61*OVERSAMPLENR, 206.42},
	{66*OVERSAMPLENR, 202.03},
	{71*OVERSAMPLENR, 197.63},
	{78*OVERSAMPLENR, 193.24},
	{84*OVERSAMPLENR, 188.85},
	{92*OVERSAMPLENR, 184.46},
	{100*OVERSAMPLENR, 180.07},
	{109*OVERSAMPLENR, 175.67},
	{120*OVERSAMPLENR, 171.28},
	{131*OVERSAMPLENR, 166.89},
	{143*OVERSAMPLENR, 162.5},
	{156*OVERSAMPLENR, 158.11},
	{171*OVERSAMPLENR, 153.71},
	{187*OVERSAMPLENR, 149.32},
	{205*OVERSAMPLENR, 144.93},
	{224*OVERSAMPLENR, 140.54},
	{245*OVERSAMPLENR, 136.15},
	{268*OVERSAMPLENR, 131.76},
	{293*OVERSAMPLENR, 127.36},
	{320*OVERSAMPLENR, 122.97},
	{348*OVERSAMPLENR, 118.58},
	{379*OVERSAMPLENR, 114.19},
	{411*OVERSAMPLENR, 109.8},
	{445*OVERSAMPLENR, 105.4},
	{480*OVERSAMPLENR, 101.01},
	{516*OVERSAMPLENR, 96.62},
	{553*OVERSAMPLENR, 92.23},
	{591*OVERSAMPLENR, 87.84},
	{628*OVERSAMPLENR, 83.45},
	{665*OVERSAMPLENR, 79.05},
	{702*OVERSAMPLENR, 74.66},
	{737*OVERSAMPLENR, 70.27},
	{770*OVERSAMPLENR, 65.88},
	{801*OVERSAMPLENR, 61.49},
	{830*OVERSAMPLENR, 57.09},
	{857*OVERSAMPLENR, 52.7},
	{881*OVERSAMPLENR, 48.31},
	{903*OVERSAMPLENR, 43.92},
	{922*OVERSAMPLENR, 39.53},
	{939*OVERSAMPLENR, 35.13},
	{954*OVERSAMPLENR, 30.74},
	{966*OVERSAMPLENR, 26.35},
	{977*OVERSAMPLENR, 21.96},
	{985*OVERSAMPLENR, 17.57},
	{993*OVERSAMPLENR, 13.18},
	{999*OVERSAMPLENR, 8.78},
	{1004*OVERSAMPLENR, 4.39},
	{1008*OVERSAMPLENR, 0}
};
#endif

I inserted that table, changed the thermistor selection, reloaded the firmware, and ran the same test as before, which produced this result:

Rescaled extruder thermocouple

Rescaled extruder thermocouple

The stock thermistor and the thermocouple now report essentially the same values, which is entirely due to the new table. The two additional lines come from two more thermocouples taped to the nozzle and dangling downward toward the platform:

M2 - Hot end with additional thermocouples

M2 – Hot end with additional thermocouples

Given that I simply taped those thermistors in place, they don’t contact the nozzle nearly as well as the epoxied sensors. The fact that one reads a bit higher and the other much lower could be explained by handwaving, but one possibility is that the various thermocouples don’t quite agree with each other.

Time for some calibration along those lines, methinks…

1 Comment