skewed image of the PID pid settings within marling. Showing DEFAULT_Kp, DEFAULT_Ki, DEFAULT_Kd

PID Tuning Extruder Calibration

PID Tuning the extruders heating element is essential in improving your 3D printing. A quick an easy process to stabilise your extruders temperature. Proportional Integral Derivative or PID for a nice easy acronym, is a method used in Marlin to calibrate the amount of power and for how long is supplied to your heating elements. Either in the heated bed or in this case the extruders heat block.

For arguments sake, let’s presume you have set a temperature of 210˚C for the extruder. At this time Marlin knows to start heating the element. However when it reaches the target temperature it doesn’t yet know for how long or short it should apply the power for. Nor how much current to supply in order to keep it steady at the target temperature.

Without PID tuning the temperature can fluctuate up and down by 10˚C, nows that a difference that can stop extruding correctly or excessive marks on the print due too high a heat.

What to Enable in Marlin

Search for and double check that //#define PIDTEMP in Configuration.h is enabled. To enable simply remove the forward slashes before #define PIDTEMP.

Below is a good general setup for PID. For the moment leave them as they are as below. Firstly when your setup is up and working then you can choose what else to enable.

screenshot of marlin 2 PIDTEMP settings within marlin 2 firmware

#define PIDTEMP
#define BANG_MAX 255
#define PID_K1 0.95
//#define PID_DEBUG
//#define PID_OPENLOOP 1

PID Tuning The Extruder

In order to calibrate the extruders heated element, we need to use software that can talk to the 3D printer, normally referred to as a terminal.

The good news is you probably already have this as most slicer programs have these built-in to them. However this time around I will be using Simplify3D terminal for tuning of the extruder. Moreover the commands are simple and remain the same regardless of software used, so let’s start tuning your extruders heating element.

Let it begin

screenshot of Simplify3d showing the cog or gear icon for the Machine Control Panel to control and send commands to the 3d printer from the computer via the Simplify3d software

Once Simplify3D has loaded, click on the Machine Control Panel on the Far right at the bottom, the icon looks like a cog or gear.

screenshot of Simplify3d's machine control panels with the port for the usb connection showing and ready to be connected

Ensure that the correct port and baud rate for your print is selected. Similarly the Verbose option at the end of baud rate needs to be enabled, now click on Connect.

screenshot of Simplify3d's temperature graph for monitoring the 3d printers hot end and heated bed temperatures

Once connected the temperature data starts to show and gets confusing. As this isn’t needed, click on the Temperature Plot tab and at the bottom under the graph click on Monitor Temperatures to disable it.

screenshot of Simplify3d's showing the fan speed slight set to the far right putting the fan at 100% power.

Furthermore as the part cooling fan will be on and working when we print, we need to ensure the fan is on full power before we run the PID tuning.

On the right hand side in the Accessory Control is the Set Fan Speed slider. In order to set the fan on full speed, grab the slider and move it all the way to the right.

screenshot of Simplify3d's terminal showing the3d printers PID readings as it calibrates itself using marlin 2 firmware

Now on the tabs on the left, click on Communication and you will see the command terminal at the bottom, with a send button at the end of it.

Marlin Extruder PID SKR V1.3 PID Start Autotune

Type in the command below and hit the return key or click on the send button.

M303 E0 S220 C16

So what does this mean?

M303 is the command for PID tuning. 
E0 is the reference number for the first extruder.
C16 is the number of cycles or times that it carries out a tuning process. 
S220 is the temperature that we would want the tuning to be carried out. In this case 220˚C.

I personally prefer 16 cycles when I do an PID auto tune. The more you have the more accurate it will be. However I personally find that beyond 16 there is not too much to be gained.

You will start to see in the log at the bottom, the information that the 3D printer is sending back to the terminal.

Now lets save

screenshot of Simplify3d's terminal with PID autotune has finished message with the new DEFAULT_Kp, DEFAULT_Ki, DEFAULT_Kd values to be stored in Marlin firmware or and reloaded or via the M301 gcode command

Now that the PID extruder tuning is complete we need to save it. There are two places we can save this and the information that we want to store is only that prefixed #define.

*NOTE* – Your values will differ from mine.

#define DEFAULT_Kp 17.68
#define DEFAULT_Ki 1.38
#define DEFAULT_Kd 56.65

Saving PID results via the command terminal

To quickly save the value into memory of your 3D printer, type in the following command into the terminal followed by the send button.

*NOTE* – Do not forget to change the values to that of your results of the PID tuning.

M301 D056.65 E0 I001.38 P017.68

M301 is the write to EEPROM command for extruder PID tuning values.

You will now see in the log at the bottom something similar to the following.
READ: echo: e:0 p:17.68 i:1.38 d:56.65

Now in the terminal type in the following code followed by the send button.


M500 is the store to EEPROM or store in long term memory for another term.
You will now see in the log at the bottom. echo:Settings Stored (**** bytes; crc *****)

This will now stay in the 3D printer no matter how many times you turn it on and off.

However if you reload the firmware it will revert back to the firmware version. So we need to also save it in our Marlin firmware, so when we next change a firmware setting we will not have to run another PID auto tuning.

Saving PID results via Marlin

Marlin 2 firmware with adjusted DEFAULT_Kp, DEFAULT_Ki, DEFAULT_Kd settings after a completed hot end PID tunning

Open up your Marlin Firmware, in Configuration.h search for #define DEFAULT_Kp ( Search is normally Ctrl + F (PC), or CMD + F (Mac) )

Now change the existing values to the new values from the PID tuning.

For example:
#define DEFAULT_Kp will be the value given in the log for P.
#define DEFAULT_Ki will be the value given in the log for I.
#define DEFAULT_Kd will be the value given in the log for D.

Once updated save your new configuration.

That is it, all done for a single extruder PID tuning. Effortless, a few lines of code and we let the 3D printer do all the work. Now the next time you upload your firmware it will contain the custom PID tuning for your extruders heating element.

DON’T FORGET – If you change your heating element or thermistor you will need to run the PID tuning again, even if the are from the same manufacture.

But how do I run PID tuning on a dual or multiple extruder setup?

Sadly at this point in time we are unable to save PID settings for more than one extruder in Marlin. However we can run a PID tuning for a second extruder and save it in the EEPROM. Additionally this is then also accessible via the Marlin menu on your 3D printer.

M303 E1 S220 C16

As you can see from the code above there is little change in the code except the extruder designation. Because of how Marlin references and stores extruders in arrays, this makes the first extruder designation 0.

Consequentially it can be a little confusing to grapple with if you are not used to dealing with arrays. However arrays always start with 0 as the first point of reference, which is why the second extruder is 1. See below for examples.

E0 // Extruder 1
E1 // Extruder 2
E2 // Extruder 3

We know we cannot save a second extruder PID tuning results directly in the Marlin configuration files, so we need save it via the terminal method.

Just like the first extruder PID tuning we use the same code but just changing the extruder designation, and the new results for the second extruder.

M301 D056.42 E1 I001.39 P017.72

Now if you have not done so already don’t forget to run the PID tuning for the heated bed if applicable. Follow our guide HEATED BED CALIBRATION if you need further guidance.

If you found this guide useful, please consider a donation to help keep the Make ‘N’ Print website running. For further information please have a look at our support us page

Thank You

© 2019-2020 Copyright - All Rights Reserved.