Thermistor config with negative C parameter
-
This is mainly just idle curiosity:
I note that the online config tool custom thermistor functionality cannot cope with negative C values - if the input data implies a negative C it produces 'NaN' for the T parameter:
I assume this is because in solving the Steinhart and Hart equation for resistance given a value of temperature it is using Vieta's substitution on the cubic, and C being negative makes p and q (using notation as per https://mathworld.wolfram.com/VietasSubstitution.html) negative, and thus when solving the resulting quadratic you (in most cases) find a need to obtain the square root of a negative number.
However, doing Steinhart and Hart 'forwards' (i.e. given resistance determine temperature) will in principle work entirely happily with a negative C parameter, and with some trial and error coupled with interpolation the R25 that fits that data is, I believe, 101495 ohms.
Thus, the config for that data is
M308 ... T101495 B4134 C-3.44E-08
Will the firmware work correctly with a negative C value in the M308? I feel it probably should, since it is only doing S&H 'forwards', and the ln() implemented is probably happy with negative input. I've tried it and it seems to behave (though actually it's only on a bed and I can't detect the difference if I didn't have a C term at all [*]), which is why it's just curiosity.
[*
M308 ... T101427 B4326
differs from the three factor config above by no more than 0.2C over the 20C to 100C range] -
@achrn the code in RRF computes this:
// Else it's a thermistor const float logResistance = logf(resistance); const float recipT = shA + shB * logResistance + shC * logResistance * logResistance * logResistance; const float temp = (recipT > 0.0) ? (1.0/recipT) + ABS_ZERO : BadErrorTemperature;
which should work even if C is negative. However, I don't think it's usual t have a negative C value.
-
@dc42 Thanks. Yes, I agree a negative C value is unusual, however when measuring my bed temperature I do find that the best fit Steinhart-Hart figures have a (small) -ve C value.
I speculate that this is due to more than just the characteristic of the thermistor - on my printer the heating element is on the top of the bed structure, the thermistor is on the bottom (Prusa i3 printbed), the printbed is PCB board so not terrifically high thermal conductance - I can believe the bottom of the bed is a little different temperature to the top, and that the difference is itself a function of the temperature, and consequently throws the bed response a little off from a pure thermistor response.