Looking to learn more about temperature control

Couple of questions:
1. When does the heat manager ignore the PID Drive Min setting?
2. How can I force the heat manager to take the PID Drive Min setting into account?

Reason for asking:
For some reason yet to be discovered, when heating my extruder to any temperature, as soon as the temperature reaches its target, the heater turns off (PWM 0) and the temperature shoots up by 30 degrees or so. I can only hazzard a guess as to less electrical load due to no heater running, in turn altering the nominal 5v on the temperature sensing circuit.

Except, in my printer, heaters are powered by an external ATX power supply. The temp sensors operate off the arduino's 5v as are the heater MOSFETs. So I'm not sure how electrical load as it relates to the heater could possibly be affecting or offsetting the temperature reading. Turning on my bed heater however, has no affect on the temperature readings. However this is beside the point.

Yesterday, I had the temperatures working well as I set the PID Drive Min to 127 (50% PWM) and when the heater reached its target, instead of turning off, it went to half power and PID control was nice and smooth as a result. PWM varied between 50% and maximum as required. It never switch off completely.

Today, I ran a new PID autotune and now it is completely ignoring the PID Drive Min setting and just turning the heater off. As soon as the heater is off, temperatures shoot upwards by about 30 degrees. I cannot for the life of me remember or repeat what I was able to achieve yesterday as the printer is now simply ignoring the PID Drive Min figure.

Comments

  • When you say 30°C jump you mean immediately at a speed that is physical not possible?

    There is only one function using pid drive min:
    void TemperatureController::updateTempControlVars() {
    if (heatManager == HTR_PID && pidIGain != 0) { // prevent division by zero
    tempIStateLimitMax = (float)pidDriveMax * 10.0f / pidIGain;
    tempIStateLimitMin = (float)pidDriveMin * 10.0f / pidIGain;
    }
    }

    You see it is not really min/max but it limits the I part of the PID computation. Not sure you know how PID works, so I is integral part that builds over time. When you hold the temperature exact you would only need this part, so you can think of it as the range required to hold all the temperatures you want.

    P is proportional part. It adds temperature difference * P to drive value. So if I is 127 and P=10 with bing 30°C too hot it will subtract 10*30 = 300 from your min value 127 becoming negative so resulting in 0. D is damping of that move and would reduce it.

    So having a min I is of no help if you get the jump and otherwise works good. The problem is there should be no jump and normally there is none. Also if 5V is changing it would also change the 5V reference voltage I'd guess so no jump from this.

    Have you already tried a different thermistor pin instead to see if that behaves the same?
  • edited July 2022
    Yeah I put the heater onto it's own dedicated power supply to workaround this, but they still share a common ground, so I'm guessing interference at this point. As soon as the heater turns off, it's an instant shoot up by 30 or so degrees, then when the temperature lowers to PID control range, the heater is turned on and temperatures plummet by 20 or so degrees, resulting in lower than desired printing temperatures.

    I've worked around the issue for now, by expanding the PID control range to 50 degrees above and below the target temperature.  Temperatures are much smoother going no more than 10 degrees above or below target. Since the heater is always "on" to some extent, the surges are now non existent.

    PID Drive MIN and MAX are both now being considered when calculating output. Resulting in better prints and a far better temperature graph

    Also, yes, I have moved thermistor pins, built whole new temperature circuits (cap, resistor, etc). 
Sign In or Register to comment.