Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Thermistor config with negative C parameter

    Scheduled Pinned Locked Moved
    Config Tool
    2
    3
    237
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • achrnundefined
      achrn
      last edited by

      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:
      8c316f7e-ec12-4c0a-ac6c-cc320066593f-image.png

      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]

      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @achrn
        last edited by

        @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.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        achrnundefined 1 Reply Last reply Reply Quote 0
        • achrnundefined
          achrn @dc42
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA