Page 1 of 2

How-to: Thermistor calibration

Posted: Wed Jun 04, 2014 10:10 pm
by Captain Starfish
We need a device which measures temperature so the printer knows when to heat or cool the hot end as it tries to maintain our set point temperature. There are pretty much two choices, thermistors and thermocouples. Thermocouples are much more accurate and stable but they require more complexity in the electronics to read. Thermistors, the device of choice in most printers, are just a resistor whose resistance changes with temperature. The higher the temp, the lower the resistance.

Easy?

Yup. Kinda.

The problem with thermistors is that they are horribly non-linear (half the resistance isn't twice the temperature) and they vary widely from one thermistor to the next and even in themselves over time. I've watched the output of mine compared to a thermocouple reading over the last few months. With a setpoint of 230º the actual temperature has varied from 200º to 260º!

There are two ways to deal with this. First is John Oly’s approach - just change the theta value in the firmware until the measured temperature approaches the actual. This will quickly and easily get you to an approximate hot end temperature around the setpoint where you're measuring but it doesn't allow for the nonlinearity and so even jumping from ABS to PLA you might find the temperature wandering off significantly. If that's good enough for you, then have a look here

Otherwise, we're going to do it a little more first principally from two measurements, one hot and one cold.

Start by downloading the Repetier firmware - note this link is for v0.91, there maybe newer versions out, grab the latest. Also grab the Arduino development environment. You'll be using the Arduino software to change and upload the firmware to your Rambo board.

You're going to need a multimeter and a thermocouple meter. Sorry, the reflective nature of the hot end means the infra red contactless type thermometers are useless. A combination meter/thermocouple can be had for thirty bucks from eBay and is worth having in your printer toolkit - you'll be wanting to check the accuracy of the thermistor occasionally as part of your routine tighten-up / recalibration routine.

How does it all work?

To get the temperature, the firmware reads the resistance of the thermistor via the cable and connector on the Rambo. It now needs to convert this resistance to a temperature. Each of the two extruders and the bed have a setting in configuration.h which tell the firmware what type of sensor to use. For example, the first extruder might be set with the following

Code: Select all

#define EXT0_TEMPSENSOR_TYPE 1
This tells the firmware that EXT0 (extruder 0 or the first extruder) should use sensor type 1 - the 100k thermistor from Epcos. You can see a description of the sensor type values above this line. We are particularly interested in the Generic tables and are going to use the first table (ie type 97) for the extruder and the second table (type 98) for the bed. If you had a second extruder you could use the third generic table type 99 for it or, if you were feeling lazy, you might re-use 97 and hope the thermistors were close enough to act the same. If.

Anyway. Now the firmware has its resistor and it knows what method to use to convert that resistance to a temperature. The generic method creates a curve based on some parameters we need to define in configuration.h and then calculates the thermistor temperature based on the resistance and that curve.


Enough chit chat. On to the "doing" bit.

Re: Thermistor calibration

Posted: Wed Jun 04, 2014 10:11 pm
by Captain Starfish
First, loosen off the nozzle on your hot end and put the thermocouple end between the back of the nozzle nut and the heater block. Tighten the nozzle until it just holds the thermistor in place - you don't want to crush or short out the thermistor! Turn on your thermocouple meter and make sure it's reading about room temperature.

Now, set your multimeter to 200kΩ range. Pull the thermistor connector (remember to press the release catch) out of the RAMBO. Wrap bit of wire around each multimeter probe and push it into the plug so it contacts inside. You should be reading something between 90 and 150kΩ depending on the room temperature.

Write down both the room temperature and the resistance at that temperature as T0 and R0, respectively.

Now plug the thermistor connector back into the Rambo and power the printer up. Preheat the hot-end to ABS (around 230º). Waiting, waiting for it to get there :)

Once it's arrived, you want to do the following as smartly as you can:
- turn the printer off (the temperature is now falling fast)
- remove the thermistor connector and measure the resistance
- measure the thermocouple temperature.

You want to grab the resistance and temperature readings as close in time to each other and as soon as possible. Two meters helps, or just switch leads on one meter as fast as you can - otherwise you get the resistance at one point and the temperature at another, different, point as the temp drops.

These values can be written down as T1 and R1.

Put your thermistor plug back into the rambo, coz measurin' time is done.

Enough playing with machines. Now it’s maths time.

Re: Thermistor calibration

Posted: Wed Jun 04, 2014 10:11 pm
by Captain Starfish
We are going to take those four values and calculate our Beta and R2 values for the generic table.

Per the link in the configuration.h file:
Beta = ln(R1/R0) / ((1/(T1 + 273.15)) - (1/(T0 + 273.15)))

Ignore R2 or RZ, we don't care.

The maths is a lot better laid out and they even have a calculator script you can save as an HTML file and open in your browser here: http://reprap.org/wiki/MeasuringThermistorBeta" onclick="window.open(this.href);return false;

Maths class is over. Time for some programming!

First thing to do is update that configuration file. If you’re working with the firmware for the first time be warned - things may be a little different than what’s on your machine and you might need to tweak some stuff. The SeeMeCNC forum has plenty of advice on changes to the Repetier 0.91 firmware to get things behaving again if it’s happened but we have grabbed the SeeMe version of the firmware so it should be ready to go.

In your download of the firmware, find and open the repetier.ino file - it should fire up the Arduino environment for you. Find the tab for Configuration.h, this is our playground for today.

First thing to do is find the line that tells us which sensor type to use for ext0:
#define EXT0_TEMPSENSOR_TYPE

and set it to 97:

Code: Select all

#define EXT0_TEMPSENSOR_TYPE 97
Now we need to set that generic table up. Find the line that contains:
#define USE_GENERIC_THERMISTORTABLE_1

Make sure that it’s un-commented, ie the line STARTS with that # and not a // or /*

Next, set your GENERIC_THERM1 parameters. T0, R0 you measured. BETA you’ve calculated, MIN_TEMP and MAX_TEMP can stay where they are. R1 and R2 are not what we measured or calculated - they are what's hardwired onto the RAMBO board. Leave them at 0 and 4700, respectively.

All done? Good. Time to get it to the printer.

Re: Thermistor calibration

Posted: Wed Jun 04, 2014 10:12 pm
by Captain Starfish
First thing first, just in case, take a snapshot of your EEPROM settings. You should be ok but if it all gets lost you don’t want to have to re-configure it all yourself. If your repetier version on the printer is older than the one you’ve downloaded and modified, you should clear the EEPROM first up anyway to avoid hassles down the road.

Make sure your printer is powered up and plugged in via USB and that either no host software is running or the printer is disconnected from all of them.

In the tools menu of the Arduino app, change the board to Arduino Mega 2560 and the port to whatever serial port you use to talk to your printer. Mac guys, happy days, no driver required and it should all just be sweet. Windows guys, yeah, sucks to be you. Either way it all uses the same connection and driver stuff as the host software setup.

Ready? Upload it.

Once the printer comes back to life, run the ABS pre-heat again and hopefully the temp on the LCD should be within a whisker of the temp on the thermocouple. If not, either repeat the process until it is or tweak that beta value per John’s instructions.

Hope this helps someone.

Re: How-to: Thermistor calibration

Posted: Thu Jun 05, 2014 9:49 am
by geneb
Stickied!

Thanks Cap!

g.

Re: How-to: Thermistor calibration

Posted: Thu Jun 05, 2014 9:54 am
by Captain Starfish
Apologies for a lack of gratuitous pictures :)

Oh, and to re-calibrate the bed you pretty much go through the same process with the 2nd generic table and type 98. Just rest the thermocouple under the glass, on top of the Onyx bed.

Re: How-to: Thermistor calibration

Posted: Thu Jun 05, 2014 1:33 pm
by Polygonhell
I find it easier just to set the thermistor type to 97, measure the actual vs reported temperature at say 220.
If the thermistor is reporting high, increase the Beta value, if it's low decrease it, re download the firmware, rinse/repeat until it's close enough to call it accurate, I usually aim for <5C difference.

The Beta values listed in the firmware for various thermistor type can be miles off because they are the manufacturer provided values, usually designed to be accurate at 50C, which is really of little use to us.

Re: How-to: Thermistor calibration

Posted: Thu Jun 05, 2014 6:47 pm
by Captain Starfish
^^ This is what I reference as John's method. Yeah it works kinda but it's a rough guess. I have doubts as to its accuracy if you calibrate at 235 for ABS, say, and then switch to 190 for PLA etc. For me, measuring the points that define the generic curve and doing it "properly" leaves me with a unit that tracks temperature to within a couple of degrees from room up to 250º. I like that.

Re: How-to: Thermistor calibration

Posted: Thu Jun 05, 2014 9:24 pm
by Polygonhell
Your fitting a curve through two points, you'll be close at whatever temperatures you pick and further off when you are away from them, whether you measure the resistance or just tweak the beta value until it works. All your method does is calculate the beta value for the point you measure T1 at, rather than determining it experimentally.

As I say in my post above the problem with the manufacturers beta values is they are picked to give maximum accuracy for in the 20-100C range.

And FWIW I actually check my hotend against a thermocouple reasonably regularly, usually whenever I change filament, and just getting inside a few degrees at 220 or so will give good results at least from 150 to 280 or so.

Re: How-to: Thermistor calibration

Posted: Thu Jun 05, 2014 10:22 pm
by Captain Starfish
Not just calculating the beta, also measuring out the R0:T0 values which I believe affect the curve too.

If I wasn't about to chuck the thermistor for a thermocouple interface anyway, I would be seriously looking at adding a tuning page to the Repetier 0.91 page which would let you tweak at room and operating temperatures based to change these curves without needing recompilation.

Re: How-to: Thermistor calibration

Posted: Thu Aug 14, 2014 10:22 pm
by PhoenixNZ
Captain Starfish wrote:The problem with thermocouples is that they are horribly non-linear (half the resistance isn't twice the temperature) and they vary widely from one thermistor to the next and even in themselves over time. I've watched the output of mine compared to a thermocouple reading over the last few months. With a setpoint of 230º the actual temperature has varied from 200º to 260º!
Wait, so are thermocouples or thermistors non-linear and have issues over time?

I is confuzzled

Re: How-to: Thermistor calibration

Posted: Fri Aug 15, 2014 12:45 am
by 1ggy
Thermistors are non linear. Thermocouples are (nearly) linear.

Re: How-to: Thermistor calibration

Posted: Fri Aug 15, 2014 12:58 am
by Captain Starfish
Sorry, had a brain fart halfway through the type-a-thon. Thanks for picking it up.

Edited to preserve sanity of any other readers.

Re: How-to: Thermistor calibration

Posted: Sun Aug 24, 2014 12:54 am
by Delta Zee Solutions
Captain Starfish,
How does the process or table differ when working with the E3d thermistor (type 8)? Am I just substituting the 97 for an 8?

I'm measuring the gap between the nozzle and heat block with a certified calibrated type J thermocouple.... the thermocouple is reading right at 200c with the target setpoint of 240C.

Thanks,
Mark

Re: How-to: Thermistor calibration

Posted: Sun Aug 24, 2014 3:00 am
by Captain Starfish
Dunno, haven't done it. But 97 is telling the RAMBo "Forget everything, this is a mystery thermistor from Mars and I WILL TELL YOU the mapping instead of letting you guess based on a manufacturer table of your own lookups". So it will work (when you go through the measuring process) with any thermistor as 97.

Or you forget the whole thing, throw in the type of thermistor you have and hope that the model accurately reflects the physical thing you have plugged into your hot end.

Re: How-to: Thermistor calibration

Posted: Tue May 05, 2015 11:34 am
by DITAmech01
This is great work. When I first measured our new Max v2, the thermistor-reported temp and the actual temp were 20+ deg C apart... which I think explains why my first ABS prints came out bubbly. After following the procedure, the reported temp is now within 2.5 deg C of the actual temp at the high end (235). Totally worth the effort and we'll see how well she prints this evening!

Re: How-to: Thermistor calibration

Posted: Tue May 05, 2015 11:10 pm
by Jimustanguitar
After you've got this dialed in correctly, folks should do the PID autotune procedure. I like to run mine at the exact temperature that I will be printing. Same thing with the bed.

http://makerhive.proboards.com/thread/7 ... emperature" onclick="window.open(this.href);return false;

Having your temp readout calibrated, and your PID settings dialed in will do a lot for your print quality and repeatability.

Re: How-to: Thermistor calibration

Posted: Thu May 07, 2015 1:14 pm
by Eaglezsoar
Thanks Captain and Jim!

Re: How-to: Thermistor calibration

Posted: Fri Sep 04, 2015 5:51 pm
by joseph
Polygonhell wrote:I find it easier just to set the thermistor type to 97, measure the actual vs reported temperature at say 220.
If the thermistor is reporting high, increase the Beta value, if it's low decrease it, re download the firmware, rinse/repeat until it's close enough to call it accurate, I usually aim for <5C difference.

The Beta values listed in the firmware for various thermistor type can be miles off because they are the manufacturer provided values, usually designed to be accurate at 50C, which is really of little use to us.
Where, exactly, do I go to "tweak" the beta setting? I can see the thermister setting, but cannot see a way to fine tune within it.

Re: How-to: Thermistor calibration

Posted: Sun Feb 21, 2016 4:05 pm
by The Rigger
Odd...

Stock MAX v2 hot end... Successfully printed ABS as assembled.

Measured the temp as directed, did the maths, calculated the Beta, updated the firmware.... And lost the abolity to get the hot end up hot enough to print ABS. I set it to 228°C and the temp got up to around 224°... And stopped climbing. 45 minutes and the machine never got hot enough to trigger MatterControl to initiate the print.

Went back in and changed the numbers back to OEM (thank whomever for screen snapshots), and ABS prints just finely; the nozzle gets right on up there to 230° and beyond.

v0.91 of the firmware... Wha'd I screw up?

Re: How-to: Thermistor calibration

Posted: Sun Feb 21, 2016 5:14 pm
by Captain Starfish
What was the thermocouple measured temperature when the machine was sitting at 224º ??

Re: How-to: Thermistor calibration

Posted: Tue Feb 23, 2016 11:45 pm
by The Rigger
Captain Starfish wrote:What was the thermocouple measured temperature when the machine was sitting at 224º ??
I set the machine to 228°C. With the updated beta, the thermocouple was measuring ±228° - within a degree or two, no wider a swing than usual - but MatterControl sensed it as 224° and never initiated the print.

Re: How-to: Thermistor calibration

Posted: Tue Feb 23, 2016 11:57 pm
by IMBoring25
Thermistors are not an exact science. For whatever reason, the theoretically-correct 25C resistance and beta values are giving you a thermistor that reads low, so there is more heat loss to the ambient environment than there would be if the thermistor were correctly reading that temperature. Either your PID settings are not commanding enough heat for that set of circumstances or your PSU and/or heater don't have the punch to get the hot end beyond an actual 228 (the PWM record will tell the tale). With the other thermistor settings you're not actually getting the hot end as hot but the electronics think they are reaching the setpoint.

Re: How-to: Thermistor calibration

Posted: Sun May 22, 2016 10:59 am
by DeltaCon
This is great info! My thermistor guest about 20 degrees to low at a target temp of 230. After the first calculation that got back to a difference of 18 degrees, a second try got me to 15 degrees. I think the drop in temp an the reading of the ohms is so far off that a accurate measurment is almost impossible. So I decided to go the John Oly way ;-) and withing 3 guesses of the Beta value I am within a half to a whole degree in difference between the themistor and thermoucouple readings. So... Off to the bed temp calibration ;-) and thinks for this info!

Re: How-to: Thermistor calibration

Posted: Sun May 22, 2016 1:21 pm
by DeltaCon
Also the bed temp calibration went well, but still two questions if I may:

.1. The guide above tells me to stick the thermocouple between the glas and the bed. I did that, but would it not make more sense to measure the upper surface of the bed instead? Now I know the Onyx is at temp, but my prints have to stick to the glas, not the Onyx ;-) I am measuring a difference of about 4 degrees.

.2. It did not strike me that much earlier, but the Rambo is making some StarTrek-ish music while powering the bed, that varies obviously with reaching or overshooting the set temp. It is pretty good audible. Should I be concerned?