<p>Besides the <code>P</code>, <code>I</code> and <code>D</code> values, you may also have to tune <code>PID_FUNCTIONAL_RANGE</code> and <code>PID_INTEGRAL_DRIVE_MAX</code>.</p>

<p>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.</p>

<p><a href="https://reprap.org/wiki/PID_Tuning" rel="nofollow noreferrer">The RepRap wiki</a> notes: <em>(note this wiki is dated! some options might not be available)</em></p>

<blockquote>
  <p>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.</p>
</blockquote>

<p>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.</p>

CC BY-SA 4.0
2020-04-13T09:26:39.450Z
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
CC BY-SA 4.0
2020-04-14T13:59:08.967Z
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
CC BY-SA 4.0
2020-04-14T18:40:54.257Z
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
CC BY-SA 4.0
2020-04-13T09:10:10.693Z
2020-05-18T07:18:54.040Z
2020-05-18T07:18:54.040Z
Tom van der Zanden
<p>Recently I decided to upgrade my Geeetech A10 (GT2560 v3.0 board) with E3D Chimera, Marlin 2.0.3 and more powerful 50&nbsp;W heater cartridge. I wired everything up and tried to PID tune the hot end, but I got a problem. </p>

<p>When the tuning ends and I use the values with <code>M301</code>, the values are too agressive and the hot end initially overshoots more than 15&nbsp;&deg;C. After that the temperature is rock steady.</p>

<p><a href="https://i.sstatic.net/KKZgl.png" rel="nofollow noreferrer" title="Overshooting the temperature"><img src="https://i.sstatic.net/KKZgl.png" alt="Overshooting the temperature" title="Overshooting the temperature"></a></p>

<p>The tuned values are <code>P=9.4 I=0.47</code> and <code>D=46.4</code>. </p>

<p>I tried to change the values according the <a href="https://en.wikipedia.org/wiki/Ziegler%E2%80%93Nichols_method" rel="nofollow noreferrer">wikipedia table</a> to no overshoot (<code>P=3,13 I=0.47</code> and <code>D=123.7</code>), but it just made the temperature unstable. </p>

<p>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 &plusmn;10&nbsp;&deg;C and still overshot.</p>

<p>My guess is that the cartridge is too powerful for the Marlin PID tuning.</p>

<p>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 <code>M301 E1 P0.25 S200 C10</code> but it seems that it didnt use the <code>P</code> parameter.</p>

<p>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?</p>

CC BY-SA 4.0
2020-04-12T22:22:16.000Z
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
CC BY-SA 4.0
2020-04-12T22:30:00.127Z
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
CC BY-SA 4.0
2020-04-12T22:36:33.840Z
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](/a/13314).
0scar
CC BY-SA 4.0
2020-04-13T00:08:06.263Z
You can de-turne the classic PID values to eliminate overshoot. See this RepRap Wiki article: https://reprap.org/wiki/PID_Tuning
Mick
CC BY-SA 4.0
2020-04-13T07:57:21.293Z
@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
CC BY-SA 4.0
2020-04-13T08:06:43.077Z
@Mick Yes, I tried that. I checked the RepRap wiki and it is the same modification I did. Now I noticed that I wrote incorrect D gain into stack exchange after it. The correct Values after were `P=3.13 I=0.47 D=123.7`
Honza535
CC BY-SA 4.0
2020-05-18T12:29:57.713Z
Instead of one car bulb, put 2x21W in series, which are easy to find because it's what the combined position+brakes bulb use, and usually only the position light burns out.
FarO
<marlin><hotend><heat-management><pid>
PID tuning 50 W cartridge in Marlin
Honza535
# PID tuning 50 W cartridge in Marlin

(Asked by: username_0 on 2020-04-12)

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.

[![Overshooting the temperature](https://i.sstatic.net/KKZgl.png "Overshooting the temperature")](https://i.sstatic.net/KKZgl.png "Overshooting the temperature")

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

I tried to change the values according the [wikipedia table](https://en.wikipedia.org/wiki/Ziegler%E2%80%93Nichols_method) 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?

**Tags:** marlin, hotend, heat-management, pid
> **Comments:**
> **username_1**: 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.  
> **username_0**: 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).  
> **username_2**: 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](/a/13314).  
> **username_3**: You can de-turne the classic PID values to eliminate overshoot. See this RepRap Wiki article: https://reprap.org/wiki/PID_Tuning  
> **username_0**: @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.  
> **username_0**: @Mick Yes, I tried that. I checked the RepRap wiki and it is the same modification I did. Now I noticed that I wrote incorrect D gain into stack exchange after it. The correct Values after were `P=3.13 I=0.47 D=123.7`  
> **username_4**: Instead of one car bulb, put 2x21W in series, which are easy to find because it's what the combined position+brakes bulb use, and usually only the position light burns out.  

---

## 1 answers

### Answer by username_5 on 2020-04-13. Score: 3 | Accepted answer

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](https://reprap.org/wiki/PID_Tuning) 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.

> **Comments:**
> **username_0**: 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.  
> **username_2**: 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.  
> **username_5**: 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.  

---

