I built a custom hotend with a powerful heater cartridge and a small thermal mass in the heater block. This combination created significant temperature oscillations during printing:
Standard PID tuning at 280°C: When printing at 250°C, temperature fluctuations exceeded ±10°C
I tried to implement an adaptive PID that:
Calibrates PID parameters at multiple temperature points (e.g., 210°C, 220°C, 230°C… 280°C)
Stores a lookup table of temperature → (Kp, Ki, Kd) mappings
Dynamically selects PID parameters based on the current target temperature during operation
After calibrating 8 temperature points (210-280°C with 10°C steps) temperature fluctuations reduced from ±10°C to <±3°C across the entire temperature range
The adaptive PID controller uses a “nearest neighbor” approach:
Even what you described requires changing the original code too… And don’t you think that tuning the PID in the slicer, rather than in the firmware, is illogical?
A linear interpolation is - however within the limits of accuracy (ambient temperature, material, print speed, etc) - an approximation.
But I think it is accurate enough.
I’m hoping it’s not just interpolation but actually running multiple PID tuning steps.
I realize that makes the PID turning operation much longer to run but, if it means accurate PID values for different temperatures, then I think it’s worth it.
You’re right - linear interpolation is an approximation, and factors like ambient temperature, airflow, and print speed do affect the optimal PID values. However, for my use case (custom hotend with high power/low thermal mass), even the approximation through linear interpolation showed significant improvement over single-point tuning. The main benefit is that the controller adapts to the drastically different thermal dynamics at 210°C vs 280°C, rather than using parameters optimized for only one temperature.
It seems to me, that adding another pid complicate the code more than it is required. You would have better chances (I think so) if it is incorporated within current one.
The only difference is the allowance to set several value triplets. So simple backward compatible assumption that current triplet is (for example) always at zero temp (or simply min/max), could be enough.
Same for the calibration, if there is only one pid and so the calibration code, you can simply modify it to append/replace 1 value at a time if it is required.
I would not put it that way. From a generic perspective, PID has limitations.
One of the limitations is that tuning is done in specific circumstances, and basically speaking, with specific gain/loss circumstances.
Your approach is completely valid, to make PID fit in a wider temperature range, if it is necessary.
Basically, I would say this is the only solution within the pid loop, I think. Another one can be to increase PID frequency/decrease command lag, for example, but it should not directly influence your case, I think.
From my updated understanding, we want the average power to be provided by the Ki, and oscillations dumped by the Kd.
It is hard to guess what is happening without log,
my pure guess is that you can reduce Ki a little, and try to reduce the Kd, and that can help.
So, for example: Kp: 30, Ki: 7, Kd: 15
So, Ki would be laggy, but should still provide average value, where Kd will be less aggressive and should dump itself, I guess.