Dead time temp control stopped working right

The dead time control for my extruder does not seem to be limiting the drive max anymore. It doesn't matter what value I enter there in the eeprom, it always outputs 100%. 

It didn't use to be that way. Now, the only way I can reduce the output is by setting the eeprom value for PID max value to less than 255.

Here's what happened - the pin on my Arduino that TEMP0 on the RAMPS is connected to seemed to quit working as Repetier Host always showed the room temp at over 60 degrees for the extruder. So I moved the extruder thermistor to TEMP2 pin on RAMPS and updated the firmware via Repetier firmware configuration tool to use the TEMP2 pin now instead of TEMP0 for Extruder0, which is my only extruder. That seemed to correct the temperature displaying in Repetier Host when at room temperature.

But, now, when the extruder heater is on the temp curve chart is always showing the output for the extruder as 100% when it is on and has reached the set temperature. It doesn't matter what I change the PID drive max value in the EEPROM to, it doesn't seem to have any effect on the max output. 

The output used to change in the temp curve chart when I changed the extruder PID drive max value in the EEPROM. As mentioned above, the only way I can reduce the output of the extruder heater is by reducing the PID max value from 255 down.

I am using heat manager 3 for the extruder.

Do you know why this is now happening? 


  • A temperature graph would help here to analyse.

    There is avariable to define control range. Outside control range pid max is used, inside the value you set for controlling it.

    What you describe would match a bit bang bang temperature control.
    Curve including output power could show what it is using.
  • Thanks. Here is the screen shot of the temp graph when it won't reduce the power output:


    And here is the eeprom settings for the extruder chart above. Note that PID drive max value is at 50.

    Then I changed the eeprom PID max value from 255 to 140.

    Here is the temperature chart after I did that change:


    And here is the eeprom settings for the above chart:


    Does that help to show what's happening?

  • Yes, it shows exactly that it is not expected behaviour, so I checked the source for dev release. For lower temp range you have

            else if(error > PID_CONTROL_RANGE) // Phase 1: full heating until control range reached
                output = act->pidMax;

    which is PID max value. and in control range you get

                else if(act->heatManager == HTR_DEADTIME)     // dead-time control
                    float raising = 3.333 * (act->currentTemperatureC - act->tempArray[act->tempPointer]); // raising dT/dt, 3.33 = reciprocal of time interval (300 ms)
                    act->tempIState = 0.25 * (3.0 * act->tempIState + raising); // damp raising
                    output = (act->currentTemperatureC + act->tempIState * act->deadTime > act->targetTemperatureC ? 0 : act->pidDriveMax);
    so using pidDriveMax as you expect. So the code and what you expect is ok, result not. Not sure how you managed to get that error. Could you add after last output a log message:


    so you see in log what it sets output to at that point. I guess it is ok there and gets changed to bad value somewhere else.
  • Which file do I add that line to?
  • I found the file - it was extruder.cpp.

    I added the line and the log shows the output at zero until near the set temperature, and then when at the set temperature, the log shows the output as the PID drive max value entered in the EEPROM.

    Something that I discovered when testing was that as long as I set the extruder temp under 165 degrees, the output on the chart matched the PID drive max value. However, when I entered 165 degrees or higher in Repetier Host, the output on the chart went to the maximum. 

    I thought that was the problem, but then I entered down below 165 degrees to 120 degrees and it was back to outputting the drive max value, and then eventually, the output on the chart went down to the PID drive max value. It was inconsistent.

    I'm very confused.
  • Your description is a bit confusing. When you say in 165° part it works or does not work is it the output to log showing correct values and temp. graph shows 100% or do you also see the output to log with wrong value? That is the most important question here since we want to find out if computation is correct and gets overwritten somewhere else or not.

    Just tried at my printer and it still works as expected. So a bit difficult to say what is going on here.
  • The log always shows the correct value.

    Its the temp graph that sometimes shows the correct value and sometimes shows 100%.
  • I think I found out what the problem was!

    The PID_CONTROL_RANGE was at the default value of 1 degree C. I changed it to 15 degrees C and it started working normally.

    Thanks for your help
  • Default is 20°C for control range. But this explains it. As soon as you leave your 1°C range it uses full power.
Sign In or Register to comment.