# Accurate Temperature Control Of Your 3D Printer Extruder

[Tim] is working on building a 3D printer and using it as an excuse to learn as much as he can. The first big issue he tackled was accurate temperature control, so he made an interesting write-up on how to characterize the thermal properties of an QU-BD extruder’s hot end and use that information to create a control algorithm for the heater.

The article starts with a basic thermal model and its corresponding formula. [Tim] then runs several tests where he measures the heater and extruder tip temperatures while switching on and off the heater. This allows him to figure out the several model parameters required to design his control algorithm. Finally, he tweaked his formula in order to predict the short term future so he can know when he should activate the heating element. As a result, his temperature is now accurately controlled in the 200°c +/-1°c window that he was shooting for.

## 16 thoughts on “Accurate Temperature Control Of Your 3D Printer Extruder”

1. gajio says:

1. learn to PID
2. tune it
3. problem solved

1. Tony says:

1. Buy \$15 PID off Ebay or DX.
2. Run autotune.
3. Profit.

2. zumax wollo says:

Ugh. It’s one of those sites which come up blank if you haven’t Javascript enabled.

Here’s a sane URL for those of us sensible enough:

And yes, it’s definitely worth a read. Pity that those gems get buried in the “Web 2.0 Experiance”

3. Trav says:

Without reading the article, Does he take into account the effects the filament will play in the temprature curve?

1. no but he does acknowledge that there is some extra loss somewhere due to the simplicity of his model. Perhaps this is part of it.

4. Fallen says:

Yeah should probably throw the thermal mass of the filament into his model.

5. If your thermal mass is big enough, the change in temperature due to
filament can be ignored in the thermal model. An alternative to actual
modeling is to implement a PID controller.

My overly simplified summary: (You can google the math).
P: (Proportional) Amount of error
I: (Integral) Accumulated error – used to “zero” the errors and small drifts
D: (Derivative) slope of previous change – “predict future”
used to reduce overshoots/oscillations

Take the weighted sum of these to control your device and you got a
PID controller. Play with the weight values to “tune” the control loop.

Aren’t they already using PID for temperature control?
(I am not “into” 3D printing articles.)

1. Regulus says:

[Tim] is not using one of the existing & available firmware packages, he is implementing it himself, and in this project write up describes writing the logic in assembly for the PIC16F1937.

1. Trui says:

So ? You don’t need an existing firmware package to implement a PID controller. They are pretty simple, less work than the model based solution, and more robust. And the PIC16F1937 is big enough to hold the code (and if not, simply replace the PIC)

1. The point of saying it’s not an existing firmware package is a response to tekkineet’s comment. The RepRap (and I’m assuming closed-source) firmwares do use PID. The article author is starting from scratch, and apparently doesn’t know what PID is.

1. ChemistryDude says:

Most firmwares for RepRap machines is open source. The whole idea of RepRap is open source. Even the electronics are open source.

2. I’ve written my own firmware and I just used PI control. The derivative term in this case doesnt help that much because of how relatively slow the heaters thermal response time is. My controller is also just roughly tuned by experimenting with the gain values, but it is pretty easily able to keep it within 1-2C of the target temperature which is good enough for most 3D printing.

The nice thing with PI(D) control is that the integral term is adaptive, meaning that I can switch on/off my cooling fan which drastically changes the the parameters of the system but this is just automatically corrected for by integral gain.

The only thing that bugs me a bit with my current PI control is that when I extrude a lot of filament (such as on long infills), the temperature can drop slightly because the rapid extrusion (like the cooling) changes the thermal properties of the system and takes a bit of time to correct. It would be neat to add a term to the control that adds a gain multiplied by the current rate of extrusion.

6. gannon says:

I haven’t read into the article too much, but I wonder how accurate his cooling curve is compared to Newton’s cooling equations.

7. The author says he is using a mechanical relay to control the heater. This means he can’t use a PID loop to control the plant.

Even if he could implement a PID controller he would still have to tune it. In that case, it still makes sense to develop a model of the system behavior. Computers can tune a PID controller much faster than manually tuning, especially given that his system has a step response of over 10 minutes.

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.