Convert Marlin Thermistor Table To M305

  • I bought a Chinese V6 clone and it says I should use Marlin thermistor #13 (100k Hisens B25/50 3950). I was looking around a lot but I could not find any datasheet for this kind of thermistor that also includes a temperature table.

    But Marlin already does have a working configuration so someone must have measured the correct values for this kind of thermistor already (I don't have any means to measure high temperatures e.g. a thermocouple).

    Did anyone already convert Marlin thermistor tables to the values required for M305? I have a hard time to understand their code regarding thermistor tables otherwise I would do that myself. They have a two dimensional short array with an (to me) unknown value mapping to what seems to be a temperature.

    // Hisens thermistor B25/50 =3950 +/-1%
    const short temptable_13[][2] PROGMEM = {
      { OV( 20.04), 300 },
      { OV( 23.19), 290 },
      { OV( 26.71), 280 },
      { OV( 31.23), 270 },
      { OV( 36.52), 260 },
      { OV( 42.75), 250 },
      { OV( 50.68), 240 },
      { OV( 60.22), 230 },
      { OV( 72.03), 220 },
      { OV( 86.84), 210 },
      { OV(102.79), 200 },
      { OV(124.46), 190 },
      { OV(151.02), 180 },
      { OV(182.86), 170 },
      { OV(220.72), 160 },
      { OV(316.96), 140 },
      { OV(447.17), 120 },
      { OV(590.61), 100 },
      { OV(737.31),  80 },
      { OV(857.77),  60 },
      { OV(939.52),  40 },
      { OV(986.03),  20 },
      { OV(1008.7),   0 }


    #define OVERSAMPLENR 16
    #define OV(N) int16_t((N)*(OVERSAMPLENR))

    I cannot make any sense of the first value. Any ideas?

  • you don't need to RRF doesn't use thermistor tables and you need to supply the correct values and then do a pid tune and the Duet will take care of it

    use something like

    M305 P1 T100000 R4700 B3950

    This will set the Duet thermistor params for you then do a PID autotune using M303 and follow the guide at Duet Temp Tuning

  • If you want to determine the Beta value (or verify it) you can use this spreadsheet. Choose two temperatures that are either side of the range you typically want to use i.e. 180-250 for hotends then you get a better approximation of the actual temperature. I've used it with unknown brand thermistors.

    But as Doug said if the Beta value is known then you just enter it and then autotune.!Apv79JfGbPIwgv9DIbujMxNtMwHQpg

  • I know that RRF does not make use of thermistor tables. But after all I read just setting this thermistor with

    M305 P1 T100000 B3950

    will not give me a good precision at higher temperatures - but as a hotend thermistor this is of course what it is all about. And PID autotune is no help here because this would only set hotend heater power based on the imprecise readings of the thermistor.
    This beta value of 3950 is being given for 25/50°, so I will probably have to raise this. I found a temperature-resistance-table for another 100K 3950 thermistor and plugged its values into the calculator at and it gave me a B value of something above 5000.

    The thermistor tables of Marlin must have the temperature-resistance-relation somehow encoded in the given code snippet (or maybe some code that depends on this) so it is mainly a question how to get this information out of there to plug these values into the above linked calculator for RRF.

  • My main issue is that I have nothing to externally confirm the real temperature. So if I set the hotend to e.g. 190°C then of course RRF will heat up until the thermistor reports 190°C.
    But I cannot confirm if that is accurate or if this is rather 175°C or 210°C in reality. Then there is no use in measuring the resistance at these temperatures because I could not tell what exact temperature that reading is at.

    I own neither a thermocouple nor an IR thermometer.

    EDIT: Best thing I have is a DHT22 - I could strap one with kapton tape to the hotend and slowly heat it up. Just kidding - worst case I melt the DHT22 to the heatblock. 😂

  • @wilriker You can put the thermistor to a boiling water and measure the resistance. 100C will give you at least one accurate point.

  • @nuffe said in Convert Marlin Thermistor Table To M305:

    @wilriker You can put the thermistor to a boiling water and measure the resistance. 100C will give you at least one accurate point.

    @nuffe Why didn't I come up with this? 🤦

    I just remembered that I bought an overly expensive BBQ thermometer a couple of years ago that a basically used once. I have to check if I can poke this somehow into the hotend. That should give me another reading at least around 200°C (don't remember what its top temp was but it probably should go a lot higher).

  • administrators

    I suggest you use configtool at Go to the Heaters page, click on Calculate thermistor coefficients, then enter 3 temperatures and the corresponding resistances from the resistance vs. temperature table. I suggest you choose 25C, a value at the bottom end of the extrusion temperature range you use (e.g. 180C), and a value at the top end of that temperature range (e.g. 250C). It will calculate the B and C values for you. Then go to the final page, click Finish, view the config.g file, and extract the M305 line from it.

  • @dc42 I know, I even referenced the calculator in my first post. My issue was that I would have had no means to measure the real temperature - until I remembered my BBQ thermometer. I can not use the thermistor reading if I want to calibrate this exact thermistor. 😁

  • administrators

    With reference to your original question, in the Marlin temperature table I think the first value is the theoretical 10-bit ADC reading and the second value is the temperature that gives that reading. If we call the ADC reading A and the thermistor resistance R, then A = 1024 * R / (R + 4700). From that, R = 4700 * A / (1024 - A).

  • @dc42 Thanks!

    One question regarding the procedure of measuring resistance at various temperatures: can I measure this resistance while the thermistor is plugged into the Duet? I would need to use the heater cartridge to heat it up but that will only work if a thermistor is plugged in as well (even if the temperature is off). And I don't see how I could fit the thermistor in my current MK8 hotend to the V6 heaterblock while at the same time having the new thermistor in the block... oh, wait... I could insert the existing thermistor into the filament path, couldn't I?

  • administrators

    No you can't measure the thermistor resistance with the Duet operating and the thermistor connected to the Duet. You could unplug the thermistor when the temperature is stable, and measure the resistance quickly before the temperature drops very much.

Log in to reply