PID Tuning Number of Cycles



  • @t3p3tony I'm not home currently. Will redo tomorrow.



  • @T3P3Tony Ok, I'm back at it again. It looks like things have gotten confusing so I would like to step back and iterate what my setup is.

    My printer is a BLV Cube build ala https://www.thingiverse.com/thing:3382718

    Equipment is:
    24v power supply
    Duet 2 WiFi
    Zesty Nimble extruder
    Genuine E3D V6 All Metal Hotend with 24v heater (measures 14.4 on resistance)

    Tests conducted with silicone sock on and parts fan on.

    First test with PWM at 1

    8:07:05 AMM307 H1
    Heater 1 model: gain 549.0, time constant 262.4, dead time 8.0, max PWM 1.00, calibration voltage 23.7, mode PID, inverted no, frequency default
    Computed PID parameters for setpoint change: P10.7, I0.234, D59.7
    Computed PID parameters for load change: P10.
    8:04:31 AMWarning: Heater 1 appears to be over-powered. If left on at full power, its temperature is predicted to reach 573C.
    Auto tune heater 1 completed in 395 sec
    Use M307 H1 to see the result, or M500 to save the result in config-override.g
    8:00:29 AMAuto tune phase 3, peak temperature was 259.6
    8:00:21 AMAuto tune phase 2, heater off
    7:58:01 AMAuto tune phase 1, heater on
    7:57:55 AMM303 H1 S250 P1

    Second test with PWM at .8

    Heater 1 model: gain 285.7, time constant 172.4, dead time 3.9, max PWM 0.80, calibration voltage 23.8, mode PID, inverted no, frequency default
    Computed PID parameters for setpoint change: P27.6, I1.066, D75.4
    Computed PID parameters for load change: P27.
    8:44:00 AMAuto tune heater 1 completed in 447 sec
    Use M307 H1 to see the result, or M500 to save the result in config-override.g
    8:41:22 AMAuto tune phase 3, peak temperature was 252.6
    8:41:18 AMAuto tune phase 2, heater off
    8:36:38 AMAuto tune phase 1, heater on
    8:36:33 AMM303 H1 S250 P0.8
    Auto tuning heater 1 using target temperature 250.0°C and PWM 0.80 - do not leave printer unattended

    Third test with PWM at .7

    eater 1 model: gain 234.7, time constant 160.1, dead time 6.4, max PWM 0.70, calibration voltage 23.7, mode PID, inverted no, frequency default
    Computed PID parameters for setpoint change: P19.0, I0.595, D85.2
    Computed PID parameters for load change: P19.
    9:01:38 AMM307
    9:01:12 AMM307
    8:59:27 AMAuto tune heater 1 completed in 573 sec
    Use M307 H1 to see the result, or M500 to save the result in config-override.g
    8:56:59 AMAuto tune phase 3, peak temperature was 251.0
    8:56:55 AMAuto tune phase 2, heater off
    8:49:59 AMAuto tune phase 1, heater on
    8:49:53 AMM303 H1 S250 P0.7
    Auto tuning heater 1 using target temperature 250.0°C and PWM 0.70 - do not leave printer unattended

    Only after running with the results of PWM 0.7 was the temperature stable. Others showed continuous fluctuations.

    Results of each test were saved with M500.
    Results are saved in config-override.g
    Nothing is saved in config.g
    M501 is called out at end of config.g

    Here is config.g

    ; Configuration file for Duet WiFi (firmware version 1.21)
    ; executed by the firmware on start-up
    ;
    ; generated by RepRapFirmware Configuration Tool v2 on Wed Aug 14 2019 07:35:06 GMT-0600 (Mountain Daylight Time)

    ; General preferences
    G90 ; Send absolute coordinates...
    M83 ; ...but relative extruder moves

    M667 S1 ; Select CoreXY mode

    ; Network
    M550 P"BLV Cube" ; Set machine name
    M552 S1 ; Enable network
    M586 P0 S1 ; Enable HTTP
    M586 P1 S0 ; Disable FTP
    M586 P2 S0 ; Disable Telnet

    ; Drives
    M569 P0 S0 ; Drive 0 X goes backwards
    M569 P1 S0 ; Drive 1 Y goes backwards
    M569 P2 S0 ; Drive 2 Z goes backwards
    M569 P3 S1 ; Drive 3 E1 goes forward
    M569 P4 S0 ; Drive 4 U goes backward
    M92 X100.54 Y100.54 Z400.21 U400.21 E2892.00 ; Set steps per mm
    M350 X16 Y16 Z16 I1 ; Configure microstepping with interpolation
    M350 E16 I0 ; Configure microstepping witout inerpolation
    M566 X400.00 Y400.00 Z100.00 U100 E80.00 ; Set maximum instantaneous speed changes (mm/min) was 480 for x and y
    M203 X10000.00 Y10000.00 Z6000.00 U6000.00 E8000.00 ; Set maximum speeds (mm/min)
    M201 X600.00 Y600.00 Z30.00 U30.00 E100.00 ; Set accelerations (mm/s^2) was 800 for x and y
    M906 X1200.00 Y1200.00 Z800.00 U800.00 E500.00 I30 ; Set motor currents (mA) and motor idle factor in per cent
    M584 X0 Y1 Z2:4 ; two Z motors connected to driver outputs Z and E1
    M671 X-20:310 Y0:0 S2 ; leadscrews at left (connected to Z) and right (connected to E1) of X axis
    M208 X-5:305 Y0:300 ; X carriage moves from -5 to 305, Y bed goes from 0 to 300
    M84 S30 ; Set idle timeout

    ; Axis Limits
    M208 X-25 Y-30 Z0 S1 ; Set axis minima
    M208 X300 Y300 Z300 S0 ; Set axis maxima

    ; Endstops
    M574 X1 Y1 S1 ; Set active high endstops

    ; Z-Probe
    M574 Z1 S2 ; Set endstops controlled by probe
    M307 H3 A-1 C-1 D-1 ; Disable heater on PWM channel for BLTouch
    M558 P9 H5 F120 S.02 T7000 ; Set Z probe type to bltouch and the dive height + speeds
    ;M558 P9 H5 F120 T7000
    G31 P500 X30 Y-10 Z1.5 ; Set Z probe trigger value, offset and trigger height
    M557 X15:285 Y10:275 P4 ; Define mesh grid

    ; Heaters
    M305 P0 T100000 B4138 R4700 ; set thermistor + ADC parameters for heater 0
    M143 H0 S120 ; Set temperature limit for heater 0 to 120C
    M305 P1 T100000 B4725 C7.06e-8 ; Set thermistor + ADC parameters for heater 1
    M143 H1 S280 ; Set temperature limit for heater 1 to 280C

    ; Fans
    M106 P0 S0 I0 F500 H-1 ; Set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned off
    M106 P1 S0 I0 F500 H1 T45 ; Set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned off

    ; Tools
    M563 P0 D0 H1 ; Define tool 0
    G10 P0 X0 Y0 Z0 ; Set tool 0 axis offsets
    G10 P0 R0 S0 ; Set initial tool 0 active and standby temperatures to 0C

    ; Automatic saving after power loss is not enabled

    ; Custom settings are not configured

    ; Miscellaneous
    M501 ; Load saved parameters from non-volatile memory

    Here is config-override.g

    ; config-override.g file generated in response to M500 at 2019-09-09 09:02
    ; This is a system-generated file - do not edit
    ; Heater model parameters
    M307 H0 A90.0 C700.0 D10.0 S1.00 V0.0 B0
    M307 H1 A234.7 C160.1 D6.4 S0.70 V23.7 B0
    M307 H2 A340.0 C140.0 D5.5 S1.00 V0.0 B0
    M307 H4 A340.0 C140.0 D5.5 S1.00 V0.0 B0
    M307 H5 A340.0 C140.0 D5.5 S1.00 V0.0 B0
    M307 H6 A340.0 C140.0 D5.5 S1.00 V0.0 B0
    M307 H7 A340.0 C140.0 D5.5 S1.00 V0.0 B0
    G10 L2 P1 X0.00 Y0.00 Z0.00
    G10 L2 P2 X0.00 Y0.00 Z0.00
    G10 L2 P3 X0.00 Y0.00 Z0.00
    G10 L2 P4 X0.00 Y0.00 Z0.00
    G10 L2 P5 X0.00 Y0.00 Z0.00
    G10 L2 P6 X0.00 Y0.00 Z0.00
    G10 L2 P7 X0.00 Y0.00 Z0.00
    G10 L2 P8 X0.00 Y0.00 Z0.00
    G10 L2 P9 X0.00 Y0.00 Z0.00


  • administrators

    @GeorgeM thanks - that setup should work without reducing PWM. When @dc42 gets a chance maybe he can add to this.

    BTW -its not related but you should not have M587 in your config.g



  • @T3P3Tony Thanks, I missed that.


  • administrators

    @t3p3tony said in PID Tuning Number of Cycles:

    @GeorgeM thanks - that setup should work without reducing PWM. When @dc42 gets a chance maybe he can add to this.

    Yes, that should work. If you send M307 H0 from the GCode console, it should show that it is using the heater 0 parameters that were saved to config-override.g. Similarly for M307 H1.


  • administrators

    @dc42 that part is working. the issue is the oscillation with the results from M303 with a PWM value of >0.7

    @GeorgeM it would be helpful if you could post some images of the temperature graph to show this oscillation at PWM 1 and 0.7


  • administrators

    If the temperature oscillates, that normally means that tuning has under-measured the M307 D parameter. It can be fixed by increasing the D parameter. Try a 50% increase.



  • Well, just like going to the auto mechanic, today I disasembled the hotend, cleaned it up, put it back together and redid the PID with PWM of 1. I still got the error of overheating but in doing my first test print the temp seams stable. Only oscillating about .5d.



  • @GeorgeM The overheating warning won't go away. It's meant to inform you of the predicted possible max temps reachable in a fail on situation. In other words, keep an eye on your printer.



  • @Phaedrux Second day and it's still holding pretty steady so good to go.
    Thanks for all you input.


Log in to reply