# PID tuning 50 W cartridge in Marlin

Recently I decided to upgrade my Geeetech A10 (GT2560 v3.0 board) with E3D Chimera, Marlin 2.0.3 and more powerful 50 W heater cartridge. I wired everything up and tried to PID tune the hot end, but I got a problem.

When the tuning ends and I use the values with M301, the values are too agressive and the hot end initially overshoots more than 15 °C. After that the temperature is rock steady.

The tuned values are P=9.4 I=0.47 and D=46.4.

I tried to change the values according the wikipedia table to no overshoot (P=3,13 I=0.47 and D=123.7), but it just made the temperature unstable.

I also tried to tune the values manually but with no succes. I even tried to use zeros for all three gains but it just oscilated ±10 °C and still overshot.

My guess is that the cartridge is too powerful for the Marlin PID tuning.

Is there a setting in the firmware where I can set the PWM value for the PID tuning? To slow the heating down? I tried to use M301 E1 P0.25 S200 C10 but it seems that it didnt use the P parameter.

Or is there a way to manually tune the values without the printer? I've got an Arduin Uno and RPi Zero availible. Or do I have to buy another less powerful cartridge?

• Just a thought, but if it's a 12 V heater then adding a 55 W car headlamp bulb in series with it would halve the voltage, quarter the power and give a visual indication of heater on. (Actual values will differ a bit due to the lower cold resistance of the lamp.) I did notice the power limiting setting in configuration.h while setting mine up recently but have little experience and didn't have a need to adjust it. – Transistor Apr 12 '20 at 22:22
• The whole system is running on 24V so I can't add typical car lightbulb. Btw I also checked the heater with multimeter and it has corresponding resistance (its not one for 12V). – Honza535 Apr 12 '20 at 22:30
• In Marlin firmware the power to the heater cartridge can be limited by PID_MAX and/or BANG_MAX. What is the resistance of the heater cartridge? Sure it is not for 12 V, I recently experienced exactly the same problem. – 0scar Apr 12 '20 at 22:36
• You can de-turne the classic PID values to eliminate overshoot. See this RepRap Wiki article: reprap.org/wiki/PID_Tuning – Mick Apr 13 '20 at 0:08
• @oscar I am sure that the cartridge is not 12V. The resistance of it when cold is 11,4 ohms and when hot 11,5 ohms. I found the PID_MAX setting asi you said, but I think it just limits the overall output of the cartridge, doesnt it? I might use it later, but right now I vould prefer to tune the PID values correctly, so I can use full potential. – Honza535 Apr 13 '20 at 7:57

Besides the P, I and D values, you may also have to tune PID_FUNCTIONAL_RANGE and PID_INTEGRAL_DRIVE_MAX.

Basically, the functional range disables PID control when more than the set number of degrees away from the target temperature and just puts the heater to zero/maximum power. The integral drive max parameter limits the value of the integral term of the PID controller.

The RepRap wiki notes: (note this wiki is dated! some options might not be available)

In Marlin, the parameters that control and limit the PID controller can have more significant effects than the popular PID parameters. For example, PID_MAX and PID_FUNCTIONAL_RANGE, and PID_INTEGRAL_DRIVE_MAX can each have dramatic, unexpected effects on PID behavior. For instance, a too-large PID_MAX on a high-power heater can make autotuning impossible; a too-small PID_FUNCTIONAL_RANGE can cause odd reset behavior; a too large PID_FUNCTIONAL_RANGE can guarantee overshoot; and a too-small PID_INTEGRAL_DRIVE_MAX can cause droop.

My hunch is that the functional range may be too small; the PID doesn't kick in until close to the desired temperature at which point you will already have overshot the target (due to the high power heater and delay in the measurements). Once you've overshot the target temperature the integral term starts growing (negative) which causes the massive undershoot.

• Yes, that was the problem. I changed the functional range from 10°C to 25°C (original + what it overshot), retuned the hot end and it just came to the desired temperature +-0,5°C. – Honza535 Apr 13 '20 at 9:26
• @Honza535, you should accept this answer to indicate that your question is answered. You can upvote too. – Transistor Apr 13 '20 at 10:57
• I cannot find PID_INTEGRAL_DRIVE_MAX; has this parameter changed name or is it obsolete? It looks like the reprap wiki is not up to date. – 0scar Apr 14 '20 at 13:59
• Yes, apparently so. The current version of Marlin limits the Iterm so that it never becomes larger than necessary to achieve maximum output power, but there is no configuration option to adjust this. – Tom van der Zanden Apr 14 '20 at 18:40