M307
Back to the Gcode Dictionary
M307: Set or report heating process parameters
Parameters
- Hn Heater number (0 is usually the bed heater)
- Rnnn Heating rate in degC/sec at full power when the heater temperature is close to ambient (RRF 3.2 and later)
- Annn (deprecated in RRF 3.2 and later in favour of the R parameter) gAin, expressed as ultimate temperature rise obtained in degC divided by the PWM fraction. For example, if G=180 then at 50% PWM the ultimate temperature rise would be 90C.
- Cnnn or Caaa:bbb (deprecated in RRF 3.4.0beta7 and later in favour of K and E) dominant time Constant of the heating process in seconds. If two values are provided (supported in RRF 3.2 and 3.3), the first value is with the fan off and the second is with the fan on at full PWM.
- Dnnn Dead time in seconds
- Ennn (RRF 3.4.0beta7 and later) Exponent of the cooling rate curve, default 1.35. Used in conjunction with the K parameter.
- Knnn or Knnn:nnn (RRF 3.4.0beta7 and later) Cooling rate when the heater is 100C above ambient. If one value is given then the cooling rate is calculated as K*((Th-Ta)/100)^E where Th is the heater temperature and Ta is the ambient temperature. If two values are given then the cooling rate is calculated as K[0]*((Th-Ta)/100)^E + K[1]*((Th-Ta)/100)*F where F is the fan PWM in the range 0 to 1.
Additional parameters to help control the heating process:
- Bn selects Bang-bang control instead of PID if non-zero. Default at power-up is 0 for extruder heaters, 1 for the bed heater.
- Innn Invert PWM signal (I0 = not inverted, I1 = invert PWM/bang-bang signal for inverted temperature control [e.g. with Peltier elements]
- Snnn maximum PWM to be used used with this heater on a scale of 0 to 1. Default 1.0.
- Vnnn VIN supply voltage at which the A parameter was calibrated (RepRapFirmware 1.20 and later). This allows the PID controller to compensate for changes in supply voltage. A value of zero disables compensation for changes in VIN voltage. Supply voltage compensation is applied to hot end heaters only, not to bed or chamber heaters.
Additional parameter in RepRapFirmware 2.x and in 1.20 and later 1.x
- Fnnn PWM frequency to use
- I2, I3 I2 = full PWM signal inversion, I3 = both I1 and I1
Examples (RRF 3.4.0beta7 and later)
- M307 H0 ; report the process parameters for heater 0
- M307 H1 R2.186 K0.17:0.11 D5.67 S1.00 V24.0 ; set the process parameters for heater 1
Examples (RRF 3.2 and 3.3)
- M307 H0 ; report the process parameters for heater 0
- M307 H1 R2.186 C202.1:155.0 D5.67 S1.00 V24.0 ; set the process parameters for heater 1
Examples (RRF 3.1 and earlier)
- M307 H0 ; report the process parameters for heater 0
- M307 H1 A346.2 C140 D5.3 B0 S0.8 V23.8; set process parameters for heater 1, use PID, and limit heater 1 PWM to 80%
Notes - RepRapFirmware 3
The F parameter is no longer supported. Use M950 to set the frequency in the M950 command that you use to define the heater .
The I2 parameter is no longer supported, and I3 does the same as I1. You can use M950 to invert the output.
You can no longer disable a heater using M307 A-1 C-1 D-1. To use the pin for something else, don't create a heater on that pin.
Example - old code:
M307 H0 F100 ; change heater 0 PWM frequency to 100Hz M307 H2 A-1 C-1 D-1 ; disable heater 2 so we can use its pin to drive a fan
New code:
M950 H0 C"bed_heat" Q100 T0 ; heater 0 uses the bed_heat pin, sensor 0, PWM frequency 100Hz ; No need to disable heater 2 because we didn't define it in the first place
Notes
Each heater and its corresponding load may be approximated as a first order process with dead time, which is characterised by the gain, time constant and dead time parameters. The model can used to calculate optimum PID parameters (including using different values for the heating or cooling phase and the steady state phase), to better detect heater faults, and to calculate feed-forward terms to better respond to changes in the load. Normally these model parameters are found by auto tuning - see M303 and Wiki:Tuning Temperature Control.
For those platforms that provide power voltage monitoring, the calibration voltage setting allows the heating controller to adjust the power automatically in response to changes in the power supply voltage. For example, if a bed or chamber heater is turned on or off, this may cause the power supply voltage to change a little, which if not corrected for would change the extruder heater power.
RepRapFirmware 1.16 and later allow the PID controller for a heater to be disabled by setting the A, C and D parameters to -1. This frees up the corresponding heater control pin for use as a general purpose I/O pin to use with the M42 or M280 command.
0 Comments