The facilities described here are available in RepRepFirmware-dc42 and DuetWiFiFirmware version 1.15 and later.
For some reason, it seems that PID tuning doesn't change the way that my heated print bed heats up. I started by doing a PID autotune issues with M303 E-1 S75 C10, and then I put those values in my 'before print starts' gcode as well as 'when printer connects' gcode in octoprint with M304 Pxxx.x Ixx.x Dxxx.x but it doesn't seem to affect the way the bed heats (still does a full cycle of about. May 05, 2019 Get the current PID settings using the M503command. Your printer will return the current PID settings. Run the M106 S255 command in order to set your cooling fan to 100%; Run the M303 E0 S215 C8 command and wait for the process to finish. The message “PID Autotune start” will appear in. Jan 16, 2018 PID or Proportional-Integral-Derivative is used in 3D printers to control how the way it heats up to temperature. In this video, I will show you how to do a heated bed PID calibration, to.
Each heating controller in RepRapFirmware 1.15 and later can work either in bang-bang mode or in PID mode. When operating in PID mode, it can get its PID parameters in either of two ways:
After power up or reset, the bed heater controller is in bang-bang mode and the extruder heaters use the model-derived PID parameters. If you use the M301 command to set the legacy PID parameters, the controller for that heater switches over to use them. If you run a successful auto tune or you set the model parameters manually using the M307, the controller switches back to using model-derived PID parameters.
To see which set of parameters is being used, run M307 H# where H is the heater number, and that will tell you either that the model is in use (so model-based PID parameters are being used for that heater), or not in use (so legacy PID parameters are being used).
Each heating controller performs temperature monitoring to try to detect fault conditions such as a heater of thermistor falling out of an extruder heating block. The temperature monitor relies on the model parameters to decide what is reasonable behaviour. Therefore, even if you decide to use legacy PID parameters or bang-bang control, you should still define an approximate model of the heater to provide good heater monitoring without false alarms.
Auto tuning is initiated by the M303 command:
The S parameter is the temperature to heat up to. The default value depends on which heater you are tuning. During auto tuning, the heater will be run at the specified power until this temperature is reached and then it will be switched off; so the temperature will overshoot the target somewhat
There is also an optional P parameter, which is the PWM value to use. Unless your heater is greatly over-powered, use the default PWM value of 1.0.
The S parameter is the maximum allowed temperature. Auto tuning will be abandoned if the temperature exceeds this value.
The P parameter is the PWM fraction to use. You should choose it such that when the heater is run at this PWM for an extended period, a typical printing temperature will be reached but the maximum specified by the S parameter will not be exceeded. The default value of 0.5 is satisfactory for a heater of modest power. If you have a particularly powerful hot end heater, reduce it as necessary to avoid excessive temperature rise. Conversely, when tuning a weak bed heater that can barely reach 100C, increase it.
Only one heater may be auto tuned at a time. Before commencing auto tuning, the heater to be tuned must be at or near room temperature and its temperature reading should be stable.
Send M303 with an H parameter (and optionally P and S parameters) to start the auto tune process. A message will be generated when auto tuning is completed or abandoned. You can also run M303 with no parameters to see the current status of auto tuning.
Warning! During auto tuning there is minimal protection against heating faults. Therefore you should not leave the printer unattended during auto tuning.
If auto tuning is successful, new model parameters are set and the PID parameters computed from them are used. You can see these parameters by running the M307 H# command, where # is the heater number M307 will also indicate that the model is in use, meaning that the PID parameters displayed by M307 are used, not the PID parameters displayed by M301.
Tuning a hot end heater typically takes between five and ten minutes. Tuning a bed heater may take more than half an hour, depending on the thermal capacity of the bed. You can cancel tuning by sending M0.
After you have run auto tuning and checked that the heater control is working well, run M500 to save the heater parameters in config-override.g (this is supported in firmware 1.17 and later). Alternatively, construct a M307 command with the model parameters and add it to config.g. For example, if after tuning you run M307 H0 and see this:
then you should add the following to config.g to preserve this model:
The B0 parameter tells the system to use PID (the default on power up is bang-bang for the bed heater). If you need to limit the maximum PWM of the heater, add an S parameter to the M307 command, for example S0.8 will limit the PWM to 80%.
Make sure there is no M301 command for the same heater after the M307 command, otherwise the model will not be used.
Model parameters can be changed and reported using the M307 command. Examples:
The H parameter specifies the heater.
The A parameter is the model gain, which is the ultimate temperature rise divided by the PWM fraction. For example, a gain of 350 means that at a constant 50% PWM, the temperature would eventually reach ambient temperature plus 350 * 0.5 degC.
The D parameter is the dead time, which is the delay between a change in PWM and an appreciable effect on the rate of temperature change.
The C parameter is the model time constant. This may be thought of as the time taken for the temperature rise to reach 63.2% of its ultimate value after the heater is switched on from cold at constant PWM, less the dead time.
You can limit the PWM by adding a suitable S parameter, for example S0.8 will limit the PWM to 80%.
To use bang-bang mode instead of PID, change B0 to B1. In bang-bang mode, the S parameter is still used to limit the PWM when the heater is turned on.
If necessary you can make manual adjustments to the M307 model parameters, as follows:
This mode is intended as a backup, for use if model-based tuning is not working well enough. The parameters are configured using the M301 command. Example:
The H parameter is the heater number. Usually, 0 is the bed heater, 1 is the extruder 0 heater, and so on.
P, I and D are the standard proportional. integral and differential coefficients, scaled by 255 for compatibility with older firmware. A negative P value means use bang-bang control.
Previous firmwares also had B, S, T and W parameters in the M301 command. These are no longer used.
If the firmware detects a temperature anomaly, it will turn off the corresponding heater and put it in the Fault state. This can be seen in DuetWebControl, which will show the status of that heater as 'fault' instead of 'active', 'standby' or 'off'.
You can reset a heater that is in the fault state using the command M562 P# where # is the heater number.
When a heater goes into the fault state, an error message is generated giving the reason. You can view the message in the Console page of DuetWebControl or PanelDue. The most common reasons are:
English • العربية • български • català • čeština • Deutsch • Ελληνικά • español • فارسی • français • hrvatski • magyar • italiano • română • 日本語 • 한국어 • lietuvių • Nederlands • norsk • polski • português • русский • Türkçe • українська • 中文(中国大陆) • 中文(台灣) • עברית • azərbaycanca • |
PID tuning refers to the parameters adjustment of a proportional-integral-derivative control algorithm used in most repraps for hot ends and heated beds.
PID needs to have a P, I and D value defined to control the nozzle temperature. If the temperature ramps up quickly and slows as it approaches the target temperature, or if it swings by a few degrees either side of the target temperature, then the values are incorrect.
To run PID Autotune in Marlin and other firmwares, run the following G-code with the nozzle cold:
This will heat the first nozzle (E0), and cycle around the target temperature 8 times (C8) at the given temperature (S200) and return values for P I and D. An example from http://www.soliwiki.com/PID_tuning is:
For Marlin, these values indicate the counts of the soft-PWM power control (0 to PID_MAX) for each element of the control equation. The softPWM value regulates the duty cycle of the f=(FCPU/16/64/256/2) control signal for the associated heater. The proportional (P) constant Kp is in counts/C, representing the change in the softPWM output per each degree of error. The integral (I) constant Ki in counts/(C*s) represents the change per each unit of time-integrated error. The derivative (D) constant Kd in counts/(C/s) represents the change in output expected due to the current rate of change of the temperature. In the above example, the autotune routine has determined that to control for a temperature of 200C, the soft PWM should be biased to 92 + 19.56*error + 0.71 * (sum of errors*time) -134.26 * dError/dT. The 'sum of errors*time' value is limited to the range +/-PID_INTEGRAL_DRIVE_MAX as set in Configuration.h. Commercial PID controllers typically use time-based parameters, Ti=Kp/Ki and Td=Kd/Kp, to specify the integral and derivative parameters. In the example above: Ti=19.56/0.71=27.54s, meaning an adjustment to compensate for integrated error over about 28 seconds; Td=134.26/19.56=6.86s, meaning an adjustment to compensate for the projected temperature about 7 seconds in the future.
The Kp, Ki, and Kd values can be entered with:
In the case of multiple extruders (E0, E1, E2) these PID values are shared between the extruders, although the extruders may be controlled separately. If the EEPROM is enabled, save with M500. If it is not enabled, save these settings in Configuration.h.
For the bed, use:
and save bed settings with:
For manual adjustments:
See also Wikipedia's PID_controller and Zeigler-Nichols tuning method. Marlin autotuning (2014-01-20, https://github.com/ErikZalm/Marlin/blob/Marlin_v1/Marlin/temperature.cpp#L250 ) uses the Ziegler-Nichols 'Classic' method, which first finds a gain which maximizes the oscillations around the setpoint, and uses the amplitude and period of these oscillations to set the proportional, integral, and derivative terms.
You will need to commit your changes to EEPROM or your configuration.h file for them to be permanent.
To save to EEPROM use:M500
The default Marlin M303 calculates a set of Ziegler-Nichols 'Classic' parameters based on the Ku (Ultimate Gain) and the Pu (Ultimate Period), where the Ku and Pu are determined by searching for a biased BANG-BANG oscillation around an average power level that produces oscillations centered on the setpoint. (See https://github.com/ErikZalm/Marlin/blob/Marlin_v1/Marlin/temperature.cpp#L238 )
You can transform these 'Classic' parameters into the Zeigler-Nichols 'Some Overshoot' set with:
Or the Z-N 'No Overshoot' set:
Note that the multipliers for the autotuning parameters each have only one significant digit (implying 10% maximum precision), and that the other schemes differ by factors of 2 or 3. PID autotuning and tuning isn't terribly precise, and changes in the parameters by factors of 5 to 50% are perfectly reasonable.
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.
If you have access to a PID controller unit and a compatible thermal probe that fits down into your hotend, you can use them to tune your PID and calibrate your thermistor.
Connection of the output of the PID to your heater varies depending on your electronics. (I used a 1K2:4K7 voltage divider to drop the 22V output of the PID to 5V for my bread-boarded VNP4904)
After the PID is connected you can use it to measure the nozzle temperature and correlate it with the thermistor readings and resistances.
Conversion from the commercial PID values of kP in %fullscale, Ti in seconds, and Td in seconds is as follows:
As an example, a $30 MYPIN TD4-SNR 1/16 DIN PID temperature controller and $10 type-K probe can hold a particular Wildseyed hotend with a 6.8ohm resistor at 185.0C+/-0.1C using 12V with about a 43.7% duty cycle, or 0.437*12*12/6.8=9.25W. Invoking the autotuning on the controller produces these parameters: P=0.8%/C, I=27s, D=6.7s. Converting these to Marlin PID values:
Differences between the results can be caused by physical differences in the systems, (e.g: the thermocouple is closer to the heater than the thermistor,) or by different choices of autotuning parameters (e.g.: the MYPIN TD4 autotuning process is a proprietary black box, while Marlin uses Zeigler-Nichols 'Classic' method.)
The Temperature/resistance table below was developed by using the PID+thermocouple system to set temperatures on a sample hotend by controlling the heater while measuring the thermistor resistance. These values can be used with Nophead's http://hydraraptor.blogspot.com/2012/11/more-accurate-thermistor-tables.html or Marlin's https://github.com/ErikZalm/Marlin/blob/Marlin_v1/Marlin/createTemperatureLookupMarlin.py to create calibrated thermistor tables. The PID column collects the autotuning values produced by the PID controller for the indicated temperature. The kP,Ki,Kd lists the converted parameters.
Temp | DutyCycle | Thermistor R | Commercial PID | Kp,Ki,Kd |
---|---|---|---|---|
60.0 | 6.0 | 31630 | ||
100.0 | 15.7 | 10108 | 1.1%/C, 35.5s, 8.8s | 2.81, 0.08, 3.13 |
120.0 | 22.5 | 5802 | 1.0%/C, 32.0s, 8.0s | 2.55, 0.08, 3.14 |
135.0 | 26.5 | 3967 | ||
150.0 | 28.5 | 2840 | 1.2%/C, 29.0s, 7.2s | 3.06, 0.10, 2.35 |
170.0 | 34.0 | 1829 | ||
185.0 | 43.7 | 1347 | 0.8%/C, 27s, 6.7s | 2.04, 0.08, 3.28 |
190.0 | 45.9 | 1200 | 0.8%/C, 26s, 6.5s | 2.04, 0.08, 3.18 |
200.0 | 51.0 | 977 |
댓글 영역