Auto tuning the bed heater

  • I thought I would change the bed heating from bang-bang to PID. It took me a while working through the documentation and the G code wiki to sort out what M code to send. After a couple of false starts I got a result. Actually I got 2 results so I am wondering which one to send with M304.
    M307 H0
    Heater 0 model: gain 361.6, time constant 647.2, dead time 9.3, max PWM 1.00, mode: PID
    Setpoint change: P34.3, I0.053, D223.6
    Load change: P34.3, I1.119, D223.6

    Warning: Heater 0 appears to be over-powered and a fire risk! If left on at full power, its temperature is predicted to reach 381C.
    Auto tune heater 0 with PWM=0.25 completed in 1797 sec, maximum temperature reached 103.5C
    Use M307 H0 to see the result

    M303 H0 P0.25 S120
    Auto tuning heater 0 - do not leave printer unattended

  • administrators

    You don't need to use M304 at all. Just put the M307 command with the specified gain, time constant and dead time parameters in config.g. Or, if you are running firmware 1.17 then after running auto tuning you can run M500 to write the M307 command to config-override.g.

  • Thanks for that dc42. I used M500 and here is my config-override file.

    ; This is a system-generated file - do not edit
    ; Heater model parameters
    M307 H0 A350.2 C637.4 D6.0 S1.00 B0
    M307 H1 A340.0 C140.0 D5.5 S1.00 B0
    M307 H2 A340.0 C140.0 D5.5 S1.00 B0
    M307 H3 A340.0 C140.0 D5.5 S1.00 B0
    M307 H4 A340.0 C140.0 D5.5 S1.00 B0
    M307 H5 A340.0 C140.0 D5.5 S1.00 B0
    M307 H6 A340.0 C140.0 D5.5 S1.00 B0
    M307 H7 A340.0 C140.0 D5.5 S1.00 B0
    ; Z probe parameters
    G31 T1 P500 X0.0 Y0.0 Z2.25
    G31 T3 P500 X0.0 Y0.0 Z0.70
    G31 T4 P500 X0.0 Y0.0 Z0.00

    If I do a M307 H0 I still get the bang-bang values.

    M307 H0
    Heater 0 model: gain 90.0, time constant 700.0, dead time 10.0, max PWM 1.00, mode: bang-bang

    I assume config-override overrides config.g. Is there any way of telling?

  • administrators

    Config-override.g should be invoked by putting a M501 command near the end of config.g. See

  • Great thanks dc42 that's done the trick.

Log in to reply