Temperature control

From RepRapWiki
Jump to: navigation, search

A typical RepRap or RepStrap controls the temperature of the Hot End and (if it has one) the heated bed. Typically a temperature control algorithm inside the Arduino reads the temperature from a thermistor, and then drives another pin connected to a MOSFET that connects or disconnects 12 V power to a resistance heater.

If the thermal mass of the ExtruderIO and the Heated Bed is big enough, the temperature changes per unit time are slow, and then simple bang-bang control is adequate to keep the temperature close enough to constant. However, many people people apparently build extruders with very small thermal mass. (Why? To reduce moving mass, to increase temperature response.)

The smaller the thermal mass, the more difficult it is to keep the temperature in a narrow range around the desired temperature.

If a given temperature controller can't hold the temperature to within the desired range of temperatures around the desired temperature, there are a variety of things you can do:

  • increase the thermal mass.
  • add insulation, so it doesn't cool off as quickly and requires less power.
  • reduce power to the heater, so it doesn't heat up as quickly
  • switch to a better sensor that (a) measures (on average) more accurately, so the I term works better, and (b) has less delay between when the temperature changes to when the sensor reports the new temperature, so it's less likely to oscillate, and (c) has less noise, so the "D" term works better.
  • use more than one sensor -- a "prompt" sensor near the heater to drive the "D" term, and a "precise" sensor closer to the molten plastic point to drive the "I" term -- see "What's All This P-I-D Stuff, Anyhow?"
  • switch to a more complicated temperature controller
  • ... any other tips and tricks I'm missing? ...

By a "more complicated temperature controller", I mean the next step on this slippery slope:

  • very large thermal mass -- simple bang-bang control is adequate. The temperature cycles up and down, hopefully the entire range is close enough to the desired temperature.
  • ... ... ... -- the bang-bang temperature range is too wide; perhaps PI control is adequate.
  • ... ... . -- PI control overshoots the desired temperature too much; perhaps PID control with guesstimated tuning is adequate.
  • ... .. -- PID control oscillates; perhaps PID with better tuning and one of the many anti-windup strategies is adequate. Auto-tuning PID parameters has been on our ToDoList for a while, and currently exists in the Marlin firmware (see M303)
  • ... -- The PID tuning for "extruder stopped" and "extruder pushing out plastic" is so different that it becomes impossible to find any compromise tuning that works in both cases. Perhaps some sort of process model and feed-forward controller is adequate, or some sort of continuously-running auto-tuner.
  • very tiny thermal mass -- when the temperature is too cold, the MCU turns on the heater, and -- even if it immediately tries to turn the heater back off again -- the temperature gets far too hot. In this case, it's not possible for any control system to keep the desired temperature in range -- you'll have to try something else, perhaps adding thermal mass.
  • On a related note, if you are having trouble controlling the temperature of the extruder very precisely, you may want to raise the target temperature. This does not help with control but it is sometimes better to fluctuate around a slightly higher temperature. Fluctuating around a lower temperature can cause partial solidification in the extruder when the temperature dips below the target, causing clogging and therefore inconsistent extrusion.
  • many temperature controllers use a Pulse-Width-Modulation (PWM) scheme at a 0.1-100 Hz scale to control power.

Further reading