PID Tuning - Marlin Firmware

PID Tuning 3D Printer Marlin

PID stands for Proportional, Integral, and Derivative. It controls how your printer handles temperature adjustments to your hotend and heated bed. Having these parameters calibrated will ensure you have more consistent temperatures at your hotend and heated bed which can help improve print quality. Marlin no longer controls heat by simply turning the heater on and off to make adjustments. It now uses a variable power approach which allows for fine adjustments and smarter, more accurate output. In this article, you will learn how to calibrate these settings to allow your machine to run its best.

Tuning Your Hotend

Finding Hotend PID Values

While the topic of PID is actually somewhat complex, tuning it with Marlin is very straight forward. Marlin has a built-in tool to allow users to easily come up with the correct PID values for their printers. This command is M303 followed by the hotend number (E0, E1, etc.), S (temperature), and C (number of iterations to run).


*Please make sure your part cooling fan is set to 100% (M106 S255) before continuing for best results


Example 1:

M303 E0 S205 C10 ; This will run autotune for extruder 1 (Extruder 1 is E0) at 205°C for a total of 10 iterations.


Example 2:

M303 E1 S250 C15 ; This will run autotune for extruder 2 (Extruder 2 is E1) at 250°C for a total of 15 iterations.


It is important to pick a temperature that is close to what you typically print at. If you print at a wide range of temperatures you should pick a value somewhere in the middle of them. This will prevent you from having to rerun autotune each time you switch filament types. Also, because PID tuning is a fairly quick process I would start by running at least 10 iterations to get accurate results.


After completing the final iteration your machine will send the values it determines is the best for your machine. You will want to write these down so that you can enter them into your printer in the next step. Here is a screenshot of example values of autotune results. Please note these are different from the values you will come up with.


3D Printer PID Tuning Marlin

Saving Hotend PID Values

By default, Marlin will not add the optimized value to your machine automatically. You will need to take those values and manually change your machine using the M301 command


Example:

M301 P21.21 I2.31 D48.64 ; Sets hotend PID parameter to new values (yours will be different values)


Finally, Save these results permanently by sending M500 to your machine

Tuning Your Heated Bed

Finding PID Values

This process is almost the same as hotend tuning with the exception of using E-1. As with the hotend, try to pick a temperature that matches what you print with or somewhere in the middle if you print at a wide range of temperatures.


Example 1:

M303 E-1 S60 C10 ; This will run autotune for the heated bed at 60°C for a total of 10 iterations.


Example 2:

M303 E-1 S100 C15 ; This will run autotune for the heated bed at 100°C for a total of 15 iterations.

3D Printer PID Tuning Marlin

Saving Bed PID Values

The only difference between saving the hotend and heated bed values is that you will want to use M304 instead of M301.


Example:

M304 P30.93 I2.13 D299.02 ; Sets heated bed PID parameter to new values


Finally, Save these results permanently by sending M500 to your machine

Summary

After completing the steps in this guide you will have the optimized PID values for your hotend and heated bed. You will find that your print layers will be more consistent and your bed adhesion will be better throughout your prints due to reduced temperature fluctuations. It is also a great idea to write down your factory PID values before making any changes in case you need to revert to the original settings.


-3DMaker Engineering


Recommended Products:

4 comments

  • This is the best documentation of PID for desk top 3D “printing” i would love to share this but the credits only state -3DMaker Engineering and normally there is an name attached. Our company policy is to give 100% credit in all documentation

    Andrey Factor
  • Hot end tuning went very well. Heated bed tuning seems to result in widely varying results as the K values from the previous run are entered and the test re run. One question I have is how much variation is to be accepted? Second question is whether I should repeat the test multiple times while updating the K values until satisfied?

    Todd Duffett
  • Thanks for this a bunch!! One thing I ran into in recent Marlin builds is that the heated bed pid autotune is disabled out of the box.

    Line 531
    #define PIDTEMPBED

    Thanks again for this guide!

    Jordan
  • I enter command as stated. Machine heats to temp. Hovers up and down then cools. I get no feedback. Sent using both Cura 4.4 and Easy Print.
    Thank you

    Donald Bolden

Leave a comment

Please note, comments must be approved before they are published