User login
Caution Choosing a Thermistor
Temperature Tuning Part 1
Thermistors work very well when measuring temperatures near the middle of the specified range. They operate nearly linear and have a high resolution (large resistance change per degree). These properties make it easy to determine the actual temperature using the RepRap electronics.
There are two parts to this problem. The first part is when you get close to the upper end of the range of the thermistor the resistance changes per degree are very small. Depending on the resolution of the DAC being used, this can allow for more error in measurements and loss of individual degrees (e.g. incrementing the digital value may be 2 - 3 degrees).
The other part is the resolution of the lookup table in the firmware. Since thermistors are nonlinear and ATmegas are relatively slow at float-point calculations, a lookup table is required to convert the output of the DAC measuring the thermistor to an actual temperature. This table approximates the curve of the thermistor’s change in resistance to actual temperature.
With careful thermistor choice you can reduce the effect of this problem. I will attempt to explain below.
Here are some lookup tables generated using the script on the RepRap Wiki Thermistor page. The highlighted row (reading 54) is the turning point for these thermistors. Temperatures above this value will have lower resolution. This low resolution is bad because each incremental value from the DAC is more than one degree; in fact it is quite a lot more. For each of the three thermistors below here is the actual temperature increment for one digital increment:
- 100k 1mm Makerbot Thermistor: ~5C
- 100k EPOCS: ~11C
- 100K RRRF: ~12C
| 100K - 1mm MKRBOT | EPCOS 100K | RRRF 100K | |||
| r0 | 93700 | r0 | 100000 | r0 | 100000 |
| t0 | 24 | t0 | 25 | t0 | 25 |
| r1 | 0 | r1 | 0 | r1 | 0 |
| r2 | 4700 | r2 | 4700 | r2 | 4700 |
| beta | 4881 | beta | 4066 | beta | 3960 |
| Reading | Temp | Reading | Temp | Reading | Temp |
| 1 | 477 | 1 | 841 | 1 | 929 |
| 54 | 189 | 54 | 255 | 54 | 266 |
| 107 | 159 | 107 | 209 | 107 | 217 |
| 160 | 142 | 160 | 184 | 160 | 190 |
| 213 | 130 | 213 | 166 | 213 | 172 |
| 266 | 120 | 266 | 153 | 266 | 158 |
| 319 | 112 | 319 | 142 | 319 | 146 |
| 372 | 106 | 372 | 132 | 372 | 136 |
| 425 | 99 | 425 | 124 | 425 | 127 |
| 478 | 93 | 478 | 116 | 478 | 119 |
| 531 | 88 | 531 | 108 | 531 | 111 |
| 584 | 82 | 584 | 101 | 584 | 103 |
| 637 | 77 | 637 | 93 | 637 | 96 |
| 690 | 71 | 690 | 86 | 690 | 88 |
| 743 | 65 | 743 | 78 | 743 | 80 |
| 796 | 59 | 796 | 70 | 796 | 71 |
| 849 | 51 | 849 | 61 | 849 | 62 |
| 902 | 43 | 902 | 50 | 902 | 50 |
| 955 | 30 | 955 | 34 | 955 | 34 |
| 1008 | 4 | 1008 | 3 | 1008 | 2 |
If you were trying to use the PID to control the temperatures in this range, it would behave very poorly. The PID could never stabilize because the next temperature reading it received could be as much as 12C higher than the previous. Notice the first thermistor's temperature at reading 54 is 189C. Anything above 189C will have a very low precision and cause the PID to operate poorly. As a test, I used this thermistor and set my extruder temperature to 190C. The temperature would ramp up as expected to 189C and then instantly jump to 195C, causing the PID to turn off completely, instead of ramping down the PWM slowly to achieve steady state. With the heater off, the extruder starts cooling, and the temperature would fall to about 186C before turning the heater on again. It takes a few seconds with the heat on before the thermistor starts indicating the temperature rising again, by then the temp had fallen to 179C.
Think of the PID and heater control as you holding a long spring with a weight attached. Your goal is to move the weight to a specific height as quick as possible. Most likely, when you first move the weight up, you will overshoot the target height. When you move your hand down to make up for it, the weight will drop below the target height. Eventually you will find the proper place to hold your hand to keep the weight at the right height, achieving steady state. This height can be related to the PWM output, or power, of the PID control to the heater. The goal is to find the right power to keep the temperature at a steady state.
Now imagine the spring example, but you can't see the weight unless it is just below or far above the mark. We as humans could guess at where to hold the weight to achieve a steady state, but the microcontroller doesn't have that luxury. It needs to know the temperature with as much precision as possible to be able to achieve steady state.
If we selected one of the other thermistors, we could precisely measure temperatures of a much higher value, up to 255C or 266C. This is more than adequate for melting PLA, ABS or most any other thermoplastics the RepRap is capable of extruding. There are other thermistors than these three, some with higher temperature ranges, most with lower. Before purchasing a thermistor take a look at the datasheet, and run the createTemperatureLookup.py and see where the best precision range of that thermistor lies and if it will meet your needs.
If you still don't trust thermistors, you can always try a thermocouple! Next time I'll talk about PID tuning vs thermal mass and heater power.

thanks
Submitted by Anonymous on Tue, 06/29/2010 - 21:43.Very informative, thanks for the post!
- Richard.
More info on better thermistor tables.
Submitted by Anonymous on Tue, 06/29/2010 - 16:00.I posted an article a while ago on how to improve the thermistor tables to improve resolution around the measurement points of interest, but this is just a software fix for a poor component choice. I've now switched to thermocouples as they are cheaper and more robust in my experience.
You can read about it here - http://www.brokentoaster.com/blog/?p=148
Look forward to reading about PID tuning vs thermal mass and heater power as prepare to undergo the same experiments on my mendel.
It looks like we have come to
Submitted by Jeff on Wed, 06/30/2010 - 12:38.It looks like we have come to the same conclusion about thermistors vs thermocouples. I just ordered a spool of thermocouple wire, once I have a chance to hook that up I will use it for the PID experiments. Your temperature prioritized lookup table is actually quite an improvement, as it follows the curve closer at area of the largest differential. Thanks for the info and the comments!