3D Printer PID Tuning: Step-by-Step Guide (Marlin Firmware)

Photo of author

Written by Marcello De Lio

Last Updated

6 min read
A close up of the heat block on an Ender 3 V3 SE with the plastic shroud removed while PID tuning the hot end on a 3D printer with marlin firmware
KEY TAKEAWAYS
  • Proper PID tuning minimizes temperature fluctuations in the hot end and heated bed to enhance print quality.
  • The PID control system consists of Proportional (P), Integral (I), and Derivative (D) components, which control temperature to achieve stability.
  • PID tuning involves using terminal software like OctoPrint to send G-code commands and adjust the PID parameters.

PID tuning is an often overlooked component of 3D printer calibration. Proportional-integral-derivative (PID) tuning allows you to calibrate the heating of your hot end and heated bed for more consistent heating.

More consistent heating results in fewer temperature fluctuations, significantly enhancing the print quality.

This process involves adjusting specific parameters to maintain a stable temperature, crucial for producing smooth and precise prints. Inconsistent heating or high-temperature variations result in inconsistent layer lines across your print.

3D printer PID tuning is an advanced technique that improves print quality noticeably. We’ll walk you through the process step by step to fine-tune the PID settings.

What is PID?

PID Tuning is a process used to control the temperature of your 3D printer. PID stands for Proportional-Integral-Derivative, which is one of three types of controls that work together.

Temperature changes happen when you heat your printer’s hot end or heat bed.

P (Proportional) controls the power applied to the heater. It reacts to the current error, which is the difference between the desired and actual temperature.

I (Integral) examines errors and makes adjustments to reduce the total error over time. This helps correct any residual error that P alone can’t fix.

D (Derivative) predicts future errors based on the rate of change. It dampens the effect of sudden temperature fluctuations and brings stability.

Without proper PID tuning, your 3D printer may face issues like temperature instability. This can lead to poor print quality.

You can achieve a stable temperature in the hot end and heat bed by carefully tuning the PID settings.

You may use software that sends G-Code commands to your printer to tune your PID settings. Examples of such software include Pronterface and OctoPrint. You can also use firmware like Marlin or Klipper, which often provide built-in tools for this process.

Tuning your PID settings ensures that the temperature remains stable during printing. This helps achieve the best possible print quality.

How It Works

A screenshot of Octoprint graph showing the temperature fluctuations of the hot end and print bed during PID tuning

PID stands for Proportional, Integral, and Derivative. These three parts help control the temperature of your 3D printer.

  1. Proportional (P): This is the proportion of the actual temperature to the requested temperature. If the temperature is too low, it will heat up faster. If it’s too high, it will cool down. A high P value can overshoot the requested temperature, while a low P value takes longer to heat up.
  2. Integral (I): A measurement of historical errors used to fix small mistakes over time. If the temperature has been a little bit off for a long time, the integral part will help correct it and keep the temperature steady.
  3. Derivative (D): This part examines how fast the temperature changes above and below the requested temperature. It helps slow down the changes so the temperature doesn’t go too high or too low quickly, making the temperature changes smoother.

When these three parts work together, they keep the printer’s temperature just consistent.

PID vs. Bang-Bang

Bang Bang is an alternative heating method that acts like a simple on/off switch. It is used in ovens and furnaces by activating when the temperature drops below a specified value. When the oven gets too cold, the heater turns on. When it gets too hot, the heater turns off. This method causes the temperature to go up and down around the set point.

While this works fine for baking cookies, it’s not great for 3D printers.

Bang Bang heating results in larger temperature swings and is slower to respond to changes in temperature. 3D printing requires consistent temperatures on the hot end and the build plate, and the wild temperature swings caused by Bang Bang heating would significantly degrade print quality.

When To Perform PID Tuning

You should perform PID tuning when you first set up your 3D printer or install a new hot end or heated build plate. New components may have different thermal properties and need adjustment.

It’s also a good idea to perform PID tuning after significant ambient temperature changes. For instance, moving your printer from a cool basement to a warm garage affects temperature stability.

If you notice inconsistent print quality, such as warping or layer shifts, it might be a sign that PID tuning is needed. Temperature fluctuations often cause these issues.

Before You Begin

A rapsberry pi in a clear case with OctoPi loaded on the SD card. The micro computer is connected to a Creality 3D printer in the background

Before diving into PID tuning for your 3D printer, you need to make sure your printer is ready. This involves a few simple steps to ensure accurate tuning.

  1. Start by checking your printer’s firmware version. This guide covers how to perform 3D printer PID tuning on Marlin firmware. If your printer is running on Marlin, check if your printer’s firmware is based on Marlin 1.x or Marlin 2.x.
  2. Next, you’ll need a way to send G-code commands to your printer. Pronterface and OctoPrint are popular choices. Open the software and ensure it recognizes your printer. I recommend using a Raspberry Pi with OctoPrint, but Pronterface or any other methods that allow you to send G-code to your printer work fine.
  3. Temporarily disable any active cooling features, including fans that might affect the temperature readings of your hot end and heat bed.

3D Printer PID Tuning Hot End (Marlin)

A screenshot of OctoPi while sending the PID autotuning commands to a 3D printer with Marlin firmware

To perform PID tuning on a hot end running on Marlin firmware, follow these steps:

  1. Connect your 3D printer to your computer using a USB cable. Open your preferred terminal software (like Pronterface or OctoPrint) to send commands to your printer.
  2. Preheat your hot end to your usual printing temperature. For example, if you often print with PLA, set the temperature to 200°C. Let the hot end reach this temperature and stay there for a few minutes to stabilize.
  3. If your printer has multiple extruders choose which hot end you want to tune. E0 is the primary hot end. If you choose a hot end other than E0, replace the E0 commands with the commands for your selected hot end.
  4. Decide how many heating cycles you want to run. The more heating cycles you choose, the longer the process takes, but the more accurate the results. In this example, we will run 8 heating cycles, as noted by the command C8.
  5. In the terminal window, enter the following command by filling in the values “M303 E{hot end number} S{target print head temperature} C{number of cycles}” and send the G-Code to your printer. In our example, we’ll send the code M303 E0 S200 C8. This command tells the printer to start the PID tuning process. The E0 specifies the hot end, S200 is the target temperature, and C8 means the printer will cycle the heating process eight times to gather data.
  6. Wait for the PID tuning process to complete. This can take a few minutes. Your printer will heat up and cool down several times. Once it’s done, the terminal will display the results, showing the new PID values (Kp, Ki, Kd).
  7. Write down the new PID values from the terminal. They will look something like this: Kp: 22.25, Ki: 1.08, Kd: 114.00.
  8. To save these new PID values to your printer’s firmware, type the command M301 P22.25 I1.08 D114.00 (replace the numbers with your specific values) and send it to your 3D printer.
  9. Next, type M500 and send the command to your printer. This command saves the new settings to the printer’s EEPROM, which will be used every time you print. Alternatively, you can use your printer’s LCD interface to select “Save Settings.”
  10. To verify that the new PID settings are saved, you can type M503 and press Enter. This command will display your printer’s current settings. Check to see if the new PID values are listed.
  11. Finally, test your printer by starting a print to ensure the temperature remains stable. If you notice any issues, you can repeat the PID tuning process or adjust the values manually.

3D Printing PID Tuning Heated Bed (Marlin)

Close up of a textured PEI spring steel print bed on an Ender 3 V3 SE during a 3D printing PID tuning

To perform PID tuning on the heated bed of a 3D printer running Marlin firmware, follow these steps:

  1. Connect your 3D printer to your computer using a USB cable. Open your preferred terminal software (like Pronterface or OctoPrint) to send commands to your printer.
  2. Preheat your heated bed to your usual printing temperature. For example, if you often print with PLA, set the bed temperature to 60°C. Let the bed reach this temperature and stay there for a few minutes to stabilize.
  3. Identify the version of Marlin firmware you are using:
    • For Marlin 1.X, use the heating element E-1.
    • For Marlin 2.X, use EBED. (Note: I’ve found a few people who report that E-1 also works for Marlin 2.X. However, I prefer to use the correct EBED code.)
  4. In the terminal window, type the command M303 E-1 S60 C8 (for Marlin 1.X) or M303 EBED S60 C8 (for Marlin 2.X) and press Enter. This command tells the printer to start the PID tuning process for the heated bed. The E-1 or EBED specifies the heated bed, S60 is the target temperature, and C8 means the printer will cycle the heating process eight times to gather data. You can replace the S60 command with your preferred bed temperature and the C8 command with the number of cycles you want to run.
  5. Wait for the PID tuning process to complete. This can take several minutes. Your printer will heat up and cool down the bed multiple times. Once it’s done, the terminal will display the results, showing the new PID values (Kp, Ki, Kd).
  6. Write down the new PID values from the terminal. They will look something like this: kP: 65.47, kI: 11.23, kD: 342.00.
  7. To save these new PID values to your printer’s firmware, send the command M304 P65.47 I11.23 D342.00 (replace the numbers with your specific values).
  8. Next, type M500 and press Enter to save the new settings to the printer’s EEPROM, which will be used every time you print. Alternatively, you can use your printer’s LCD interface to select “Save Settings.”
  9. To verify that the new PID settings are saved, you can type M503 and press Enter. This command displays your printer’s current settings. Check if the heated bed’s new PID values are listed.
  10. Finally, test your printer by starting a print to ensure the bed temperature remains stable. If you notice any issues, you can repeat the PID tuning process or adjust the values manually.
Photo of author
Written by

Marcello co-founded 3D Print Mentor to share his love of 3D printing. Marcello used to own an online 3D printing company, where he sold unique designs and customized novelty gifts. After closing the business, Marcello’s new passion is 3D printing replica movie props and cosplay items.

Related Articles

3D printed engine block model. Technology, industry

14 Crazy 3D Printing Facts

Close up of a hand holding an SD card with an out of focus Ender 3 V3 SE 3d printer in the background

How to Convert STL Files to G-code

Bambu Lap P1P Upgrades with a green PLA printed side panels and a purge bucket

Bambu Lab P1P Upgrades and Modifications