Today I’m talking about measuring temperatures using thermistors. In particular, this will

This blog topic is an old one, and I did all the hard work some time ago, but I decided to document it in order to meet my self-imposed Quota of one blog post per week.

Your basic thermistor circuit is a voltage divider, as shown below:

Rs is a known pull-up resistor, and Rt is a thermistor (in this case, a Negative Temperature Coefficient thermistor or NTC). A known voltage is applied (Vin), the voltage measured (Vout) varies with changes in the resistance of Rt.

Vout=Vin*Rt/(Rs+Rt)

For Marlin, there is a standard “Oversampling” factor n. I haven’t researched this in depth, but common sense suggests that the firmware will measure the voltage from the thermistor n times. It will then add these numbers up and divide by n. This avoids the temperature bouncing up and down as the voltage fluctuates slightly.

Now you have to calculate the temperature based on the resistance of the thermistor. Unfortunately, the maths is a bit of a pain (unless you’re into that kind of thing, which I kind of am), if you want to go from Voltage to Resistance, then from Resistance to Temperature. And the last thing you want is to slow down your 3D printer by making it do unnecessary calculations multiple times per second. It’s much easier to go Temperature -> Resistance -> Voltage. 3D printer firmware like Marlin uses thermistor tables, which are pre-generated arrays of voltage readings and associated temperatures. The firmware then simply interpolates between these data points for measured voltages. Simple enough?

Now, how do you generate these data tables? (One question I have seen a fair bit on forums is “which thermistor table should I use in Marlin?”) Well, here’s what you do:

- Gather as much information on your thermistor as possible:
- Some thermistors will be supplied with a table of R/T values: simply do a voltage divider calculation to convert the R values to measured voltages, taking into account oversampling.
- Some thermistors will just have a Beta value, which gives an approximation of the R/T curve.
- Sometimes you just won’t have any data, so you can measure three datapoints, and use these to generate a curve.

- Download my Thermistor Table Generator spreadsheet ( http://www.thingiverse.com/thing:103668/ ), as this will simplify the calculations. For more information, you can refer to the corresponding links below:
- [Refer to calculation in the above linked spreadsheet]
- http://en.wikipedia.org/wiki/Thermistor
- http://assets.newport.com/webDocuments-EN/images/AN04_Thermistor_Calibration_IX.PDF

- Once you have generated the table, paste it into your Temperature.h in Marlin (below is an example of where to paste it)

#if (THERMISTORHEATER_0 == 8) || (THERMISTORHEATER_1 == 8) || (THERMISTORHEATER_2 == 8) || (THERMISTORBED == 8)

const short temptable_8[][2] = {

//INSERT TABLE HERE!!!!!! each row is in the format {V,T},

};

#endif

Now, any of the three techniques used to generate a thermistor table can be used, with varying levels of accuracy, but one point I’d like to stress is this…

IT DOESN’T MATTER.

Obviously it’s ideal for your thermistor to be reading perfectly accurately, but that’s not going to happen. It’s good if your thermistor is giving you reasonably accurate readings, which is what the above linked spreadsheet will achieve. But at the end of the day, you mainly need your temperature measurement to be REPEATABLE. The temperature readings need to be accurate enough to get a ballpark number, but due to the many different extruder designs, thermistor types, PLA/ABS manufacturers, and other parameters that influence extrusion from a RepRap 3D printer, the nominal printing temperatures recommended by manufacturers will always be different to the ideal *measured* printing temperature, which should be checked and fine-tuned for each printer and printing filament (in order to achieve maximum print quality and strength).

Your thermistor could be reading 17°C when printing in PLA, if you test the temperature and figure out that’s the temperature that you print at… you just need to adjust your printer firmware and slicing software settings to suit, then just print at 17°C.

Hope this helps a bit, read the instructions in my thermistor calculator, and the comments on the Thingiverse page.

Good luck, and happy printing.