3D Printer PID Autotune: Hotend and Bed Temperature Stability with Klipper and Marlin — 2026

Your hotend temperature swings ±5°C during a print and you can see it in the surface finish — glossy bands where it ran hot, matte bands where it dropped. A PID autotune takes 3 minutes and eliminates this. Here’s the correct procedure for both major firmware platforms, plus what the numbers actually mean.

Step-by-Step: PID Autotune for Hotend and Bed

Step 1: Know When You Need a PID Tune

Run a PID tune when:
– You change the hotend (different heater cartridge or thermistor type)
– You change the part cooling fan or fan duct (airflow across the hotend changes heat loss)
– You switch to a silicone sock, or remove one
– Your temperature graph in OctoPrint/Mainsail shows oscillations more than ±2°C
– You changed voltage (e.g., 12V to 24V heater cartridge)

If none of these apply and your temperature holds steady within ±1°C, don’t touch PID. A bad tune is worse than no tune.

Klipper’s PID calibration is superior to Marlin’s because it allows finer control over the test parameters and runs from the web interface.

For the hotend:

PID_CALIBRATE HEATER=extruder TARGET=210

This runs 5 heating cycles around 210°C. Use the temperature you most commonly print at — PLA at 210°C, PETG at 240°C, ABS at 250°C. PID values are temperature-dependent: a tune at 210°C won’t be optimal at 250°C.

After the cycles complete, the console displays the new PID values. Save them:

SAVE_CONFIG

For the heated bed:

PID_CALIBRATE HEATER=heater_bed TARGET=60

Bed PID tunes take longer (3–5 minutes per cycle) because the thermal mass is large. Use 60°C for PLA, 80°C for PETG, 100°C for ABS. Save with SAVE_CONFIG when complete.

Step 3: Marlin PID Tune

Marlin requires sending G-code via a terminal (Pronterface, OctoPrint, or the printer’s LCD if it supports terminal input).

Hotend:

M303 E0 S210 C8 U1

This runs 8 cycles (C8) at 210°C (S210) and applies the result (U1). The U1 flag is important — without it, Marlin just reports the values without saving them. After completion, save with:

M500

Heated bed:

M303 E-1 S60 C5 U1
M500

E-1 targets the bed. Beds need fewer cycles (5 is sufficient) because their thermal response is slower and calculations converge faster.

Step 4: Verify the Tune

After saving new PID values, run a test print and watch the temperature graph in your printer’s web interface. The hotend should settle at the target within 10–15 seconds of the print starting and hold within ±0.5°C for the entire print. If you see consistent ±1.5°C or larger swings, re-run the tune with more cycles (C10 or C12).

For the bed, expect ±1°C variation due to the large thermal mass. The bed’s temperature graph should be a slow, damped wave — not a sawtooth.

PID Parameter Reference Table

Parameter What It Controls Too High Too Low
Kp (Proportional) Immediate response to error Overshoot, oscillation Sluggish heating, never reaches target
Ki (Integral) Correction for steady-state error Slow oscillation, windup Persistent offset (e.g., sits at 208°C with 210°C target)
Kd (Derivative) Damping of overshoot Noisy, over-reactive to small changes Overshoot on initial heat-up

Reading your PID values after a tune:
– Kp for hotend: typically 20–40 (higher values mean the heater cartridge is powerful relative to the hotend’s thermal mass)
– Ki for hotend: typically 0.5–2.0
– Kd for hotend: typically 50–120
– Kp for bed (Marlin/Klipper): typically 40–100 (beds have much higher Kp values because they’re slow to respond)
– Ki for bed: typically 0.2–1.0
– Kd for bed: typically 200–600

What Most Makers Get Wrong

Mistake 1: Running PID tune with the part cooling fan off, then printing with it on.
Consequence: The fan blows air across the hotend block, pulling heat away. PID values tuned without fan are too conservative — the hotend struggles to maintain temperature when the fan kicks on at layer 2.
Fix: Set your part cooling fan to the speed you actually use (typically 100% after layer 2 for PLA) and run the PID tune with the fan running. The G-code: M106 S255 (fan 100%) before M303, then M106 S0 after the tune completes.

Mistake 2: Using the auto-saved Klipper values without checking if the graph is stable.
Consequence: Klipper saves whatever the PID algorithm returns — it doesn’t validate that the tune produced good results. A noisy thermistor or a loose heater cartridge connection produces garbage PID values that Klipper saves dutifully.
Fix: After SAVE_CONFIG, run a test heat cycle (set temperature, watch for 3 minutes). If the temperature oscillates more than ±1°C, your wiring has an intermittent connection or the thermistor isn’t seated — fix the hardware before re-tuning.

Mistake 3: Tuning the bed at room temperature without the build surface.
Consequence: A bare aluminum bed with no glass/PEI/spring steel has different thermal characteristics than the same bed with a build plate attached. The PID values are tuned for a thermal mass that doesn’t exist during actual printing.
Fix: Tune with your normal build surface installed. The glass or PEI sheet adds thermal mass and changes the bed’s response time. This is especially important for glass beds, which can add 30+ seconds to the bed’s stabilization time.

Mistake 4: Re-tuning PID every time you change filament type without understanding the values.
Consequence: PID tunes drift slightly between runs due to ambient temperature changes, not filament type. Running 5 separate tunes at 5 different temperatures and saving them all creates value confusion — which tune is currently active?
Fix: Tune once at your most common printing temperature. For everything else, the PID values will be close enough. If you switch between PLA (210°C) and ABS (250°C) regularly, tune at 230°C as a compromise. The ±20°C difference won’t cause oscillation.

For printers running Klipper, the BTT SKR Mini E3 V3 pairs perfectly with a Raspberry Pi Zero 2 W for a compact, affordable Klipper setup. The TMC2209 drivers are silent, and the board supports both sensorless homing and the ADXL345 for input shaping calibration. Available at uavmodel.com with pre-configured Klipper firmware.

⚠️ Safety Notice: PID tuning involves heating elements to high temperatures (200–300°C). Never leave a printer unattended during tuning or operation. Ensure thermal runaway protection is enabled in your firmware (verify with M503 and look for THERMAL_PROTECTION settings). Use only CE/UL-certified power supplies and properly rated wiring. Fire safety: keep a smoke detector in your printing area and have a fire extinguisher rated for electrical fires accessible.


Leave a Comment

Scroll to Top