PID Tuning Procedure
-
Dose anyone have a procedure for auto tuning he extruder? I am using a Pt-100 Expansion board and Pt-100 for control. I would also like to tune the bed. Thanks in advance.
Carl
Firmware Name: RepRapFirmware for Duet 2 WiFi/Ethernet
Firmware Electronics: Duet WiFi 1.02 or later
Firmware Version: 2.05.1 (2020-02-09b1)
WiFi Server Version: 1.21
Web Interface Version: 1.22.6
Web Interface by Christian Hammacher
Licensed under the terms of the GPL v3 -
@CarlBosson See https://docs.duet3d.com/en/How_to_guides/Commissioning
Specifically this section, but the whole guide is useful: https://docs.duet3d.com/en/How_to_guides/Commissioning#h-7-tune-heaters
Ian
-
Not sure if this is useful for your situation, but here are two (related) macros that I put together. Basically, together, they create additional macro files that look something like this:
M307 H1 R2.673 K0.258:0.127 D9.248 E1.350 S0.80 B0 V24.16 M143 H1 S250
I then invoke the applicable macro depending on which tool I select as well as a separate macro for the bed,
; ; Macro to select PID target and parameters ; ;Invoke a PID tuning ;parameters A, B and C are mandatory ; A = "hot" if autotune hotend, A = "bed" if autotune Bed ; B = heater number (typically 0 for Bed) ; C = Target Tune Temp ; D = Tool number > 0 ; ; Optional Parameters ; E = Pwm - default is 0.8 ; F = Bed temp during hotend tuning - default is 20 deg C ; M291 R"Auto Pid Tuning" P"What to tune?" K{"Hotend","Bed","Cancel"} S4 if input = 0 var tool = state.currentTool if var.tool < 0 ; no tool selected M291 R"Auto Pid Tuning" P"What hotend?" K{"Direct(T0)","Bowden(T1)","Cancel"} S4 if input = 0 T0 elif input = 1 T1 else var msg = "Cannot run if no tool is selected" M117 {var.msg} abort {var.msg} if state.currentTool = 0 ; Tune Tool 0 to 250 deg using heater 1 with bed temp = 50 deg M98 P"0:/macros/PID_Tuning/PID_Tune.g" A"hot" B1 C240 D0 F50 elif state.currentTool = 1 ; Tune Tool 1 to 250 deg using heater 1 with bed temp = 50 deg M98 P"0:/macros/PID_Tuning/PID_Tune.g" A"hot" B1 C240 D1 F50 else abort "Invalid tool selected. Tool number "^state.currentTool elif input = 1 ; Tune Bed to 85 deg using heater 0 M98 P"0:/macros/PID_Tuning/PID_Tune.g" A"bed" B0 C85 D1 E1 else abort "Selection cancelled"
; ;Macro to perform the actual tuning and save results to another macro file ; ;Autotune heater and save the M307 settings to a macro file ; ;parameters A, B , C and D are mandatory ; A = "hot" if autotune hotend, A = "bed" if autotune Bed ; B = heater number (typically 0 for Bed) ; C = Target Tune Temp ; D = Tool number > 0 ; ; Optional Parameters ; E = Pwm - default is 0.8 ; F = Bed temp during hotend tuning - default is off ; G = ambient temp at start of autotune - default is 20 deg C ; ;Filename templates var hotfile = "0:/macros/PID_Tuning/PID_T" var bedfile = "0:/macros/PID_Tuning/PID_Bed.g" var file = "" ; Set some safe defaults var hotEnd = "hot" var tool = 0 var heater = 1 var tuneTemp = 0 var pwm = 0.8 ; optional var bedTemp = 0 ; optional - only used for Autotune Hotend var ambientTemp = 20 ; if exists(param.A) & exists(param.B) & exists(param.C) & exists(param.D) if param.A = "hot" | param.A = "bed" set var.hotEnd = param.A else abort "Invalid value for A parameter" set var.heater = param.B set var.tuneTemp = param.C set var.tool = param.D else abort "PID_Tune.g is missing mandatory parameters" if exists(param.E) set var.pwm = param.E if exists(param.F) set var.bedTemp = param.F if exists(param.H) set var.ambientTemp = param.H ; T{var.tool} ; reset temps and turn heaters off M568 S0 R0 A0 ; Reset temps and turn off hotend M140 S0 R0 ; Reset bed temps M140 S-273 ; Turn of bed heater ; G28 ; Home all - best if homing leaves the Hotend near the center of the bed ; if var.hotEnd = "hot" ; Performing Autotune on Hotend G0 Z1.5 ; Move Hotend close to bed echo "Heating bed to "^var.bedTemp^" deg" M190 S{var.bedTemp} ; wait for bed temp to stabilize M303 T{var.tool} P{var.pwm} A{var.ambientTemp} S{var.tuneTemp} else G0 Z25 ; give some clearance from the Hotend during Bed autotune. M303 H{var.heater} P{var.pwm} A{var.ambientTemp} S{var.tuneTemp} ; ; Wait until autotune complete while heat.heaters[{var.heater}].state = "tuning" G4 S10 ; ; Capture the tuned results var myR = heat.heaters[{var.heater}].model.heatingRate+0.001-0.001 var myK = heat.heaters[{var.heater}].model.coolingRate+0.001-0.001 var myF = heat.heaters[{var.heater}].model.fanCoolingRate+0.001-0.001 var myD = heat.heaters[{var.heater}].model.deadTime+0.001-0.001 var myE = heat.heaters[{var.heater}].model.coolingExp+0.001-0.001 var myS = heat.heaters[{var.heater}].model.maxPwm+0.01-0.01 var myB = 0 if !heat.heaters[{var.heater}].model.enabled set var.myB = 1 var myV = heat.heaters[{var.heater}].model.standardVoltage+0.01-0.01 ; ; Assemble the results var myPid = "M307 H"^var.heater^" R"^var.myR^" K"^var.myK^":"^var.myF^" D"^var.myD^" E"^var.myE^" S"^var.myS^" B"^var.myB^" V"^var.myV echo "New PID settings = "^var.myPid ;write out to file var maxTemp = "" if var.hotEnd = "hot" set var.file = var.hotfile^var.tool^".g" set var.maxTemp = "M143 H"^var.heater^" S"^{var.tuneTemp+10} ;Set max hotend temp else set var.file = var.bedfile set var.maxTemp = "M143 H"^var.heater^" S"^{var.tuneTemp+5} ;Set max bed temp echo "Saving to file "^var.file echo > var.file {var.myPid} echo >> var.file {var.maxTemp} ; ; reset temps and turn heaters off M568 S0 R0 A0 ; Reset temps and turn off hotend M140 S0 R0 ; Reset bed temps M140 S-273 ; Turn of bed heater ; G0 Z50
-
@droftarts ,
Thank you for the help. Please forgive my ignorance. As I look over the document you refered me to"Result
If successful, the firmware will report the parameters to use, and an M307 GCcode command e.g.:
M307 H1 R7.046 K1.519:0.006 D3.58 E1.35 S1.00 B0 V23.9 (RRF 3.4 and later)
M307 H1 B0 R1.839 C270.7:170.1 D8.10 S1.00 V12.1 (RRF 3.3 and earlier)Then, either:
Copy this into your config.g, replacing the existing one for the heater, or
If your config.g has M501 at the end, you can save the current heater settings by sending M500. This will save the current parameters to the sys/config-override.g on the SD card. M501 in config.g will load them at each reboot."I do not see a line of code in my config.g that looks like this to copy the info to? see config.g below. Do I need to create it? If so where?
I also do not have a M501 in my config.g? again same as above, do I add it? where?Config.g
SENDING:M503
; Configuration file for Duet WiFi (firmware version 1.21)
; executed by the firmware on start-up
;
; generated by RepRapFirmware Configuration Tool v2 on Sun Jun 16 2019 12:25:24 GMT-0400 (Eastern Daylight Time)
; General preferences
G90 ; Send absolute coordinates...
M83 ; ...but relative extruder moves
; Network
M550 P"My Printer" ; 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 S1 ; Physical drive 0 goes forwards
M569 P1 S1 ; Physical drive 1 goes forwards
M569 P2 S0 ; Physical drive 2 goes forwards
M569 P3 S0 ; Physical drive 3 goes forwards
M350 X16 Y16 Z16 E16 I1 ; Configure microstepping with interpolation
M92 X80.58 Y80.58 Z400.00 E799.53 ; Set steps per mm
M566 X900.00 Y900.00 Z12.00 E120.00 ; Set maximum instantaneous speed changes (mm/min)
M203 X6000.00 Y6000.00 Z180.00 E1200.00 ; Set maximum speeds (mm/min)
M201 X500.00 Y500.00 Z20.00 E250.00 ; Set accelerations (mm/s^2)
M906 X1450.00 Y1450.00 Z1450.00 E1450.00 I30 ; Set motor currents (mA) and motor idle factor in per cent
M84 S30 ; Set idle timeout
; Axis Limits
M208 X0 Y0 Z0 S1 ; Set axis minima
M208 X300 Y300 Z400 S0 ; Set axis maxima
; Endstops
M574 X1 Y1 Z1 S0 ; Set active low and disabled endstops
; Z-Probe
M558 P1 H5 F120 T6000 ; Set Z probe type to unmodulated and the dive height + speeds
G31 P500 X0 Y0 Z2.5 ; Set Z probe trigger value, offset and trigger height
M557 X15:6 Y15:195 S20 ; Define mesh grid
; Heaters
M305 P0 T100000 B4138 R4700 ; Set thermistor + ADC parameters for heater 0
M143 H0 S200 ; Set temperature limit for heater 0 to 200C
M305 P1 X200 ; Set to Pt-100 sensor
M143 H1 S475 ; Set temperature limit for heater 1 to 475C
M305 P2 X200 ;Set to Pt-100 sensor
M143 H2 S200 ;Set temperature limit to 200c
; Fans
M106 P0 S1 I0 F500 H-1 ; Set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned off
M106 P1 S1 I0 F500 H1 T45 ; Set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned on
; 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 Power Saving
M911 S21.0 R23 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" ;Set voltage threasholds and actions to run on power loss
; Custom settings are not configured
ok T0:23.6 /0.0 B:20.5 /0.0 -
@stuartofmt
This looks great! But I do not know how to use it. I am a little over my head but trying to leaarn.Carl
-
@droftarts
I tried the M300 T0 S200 command but nothing happened. See what was returned below.M303 T0 S200
SENDING:M303 T0 S200
No heater has been tuned yet -
@stuartofmt
Do I just copy and past the code
into a new Macro in the User interface? -
@CarlBosson said in PID Tuning Procedure:
@stuartofmt
Do I just copy and past the code
into a new Macro in the User interface?No, that would be a bad idea as the PID tuning parameters (in the first macro) depend a lot on your printer.
I offered up the macro as a way of assisting in understanding some of the parameters, assuming you may have been familiar with running macros.Can you descibe your machine ? From the config file it looks to have two different hotend heaters (H1 and H2) and a bed heater (H0) ? If so, how do you switch between the two different hotends?
Also - it looks like you may be running old versions of the firmware and DWC - can you comfirm by posting the output of M122
-
@stuartofmt said in PID Tuning Procedure:
Can you descibe your machine ? From the config file it looks to have two different hotend heaters (H1 and H2) and a bed heater (H0) ? If so, how do you switch between the two different hotends?
Also - it looks like you may be running old versions of the firmware and DWC - can you comfirm by posting the output of M122
This is a custom Machine. It used to be a Folger Tech FT-5 large volume printer 300mm X 300mm X 300mm. The only thing original now is a few stepper motors and the frame. We are running the Duet E3D mother board and E3D Titan Aqua extruder. There is a 110Vac heated bed controlled by the use of an SSR. This also has a custom built enclosure and heaters controlled by an externally mounted din rail Watlow controller. Early on I tried to use the Duet to control the chamber heaters but I ran out of time. I may come back to this.
There should only be two heaters. The hot end and the heated bed. If there are more, then this might be a hold over from the chamber heating attempt.
I am sure I have not upgraded the firmware since the original install so I am sure it is old.
I had never seen a 3D Printer when I was tasked too build this one, and now have a few Enders at home to learn on. I could use some help making this printer what I know it can be.
I will get you the M122 next.
Carl
-
SENDING:M122
=== Diagnostics ===
RepRapFirmware for Duet 2 WiFi/Ethernet version 2.05.1 running on Duet WiFi 1.02 or later
Board ID: 08DGM-917DA-G4MSD-6J1FA-3SJ6N-T8T39
Used output buffers: 1 of 24 (13 max)
=== RTOS ===
Static ram: 25712
Dynamic ram: 93344 of which 484 recycled
Exception stack ram used: 496
Never used ram: 11036
Tasks: NETWORK(ready,628) HEAT(blocked,720) MAIN(running,3760) IDLE(ready,160)
Owned mutexes:
=== Platform ===
Last reset 05:04:57 ago, cause: power up
Last software reset at 2023-06-16 10:27, reason: User, spinning module GCodes, available RAM 11592 bytes (slot 2)
Software reset code 0x0003 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0441f000 BFAR 0xe000ed38 SP 0xffffffff Task 0x4e49414d
Error status: 10
[ERROR] Error status: 10Free file entries: 10
SD card 0 detected, interface speed: 20.0MBytes/sec
SD card longest block write time: 504.0ms, max retries 0
MCU temperature: min 26.7, current 44.1, max 48.3
Supply voltage: min 0.9, current 24.6, max 24.8, under voltage events: 2, over voltage events: 0, power good: yes
Driver 0: standstill, SG min/max 0/361
Driver 1: standstill, SG min/max 0/232
Driver 2: standstill, SG min/max not available
Driver 3: standstill, SG min/max 0/1023
Driver 4: standstill, SG min/max not available
Date/time: 2024-02-20 15:37:13
Cache data hit count 4294967295
Slowest loop: 47.05ms; fastest: 0.05ms
I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0, resets 0
=== Move ===
Hiccups: 0, FreeDm: 160, MinFreeDm: 140, MaxWait: 12289133ms
Bed compensation in use: none, comp offset 0.000
=== DDARing ===
Scheduled moves: 0, completed moves: 0, StepErrors: 0, LaErrors: 0, Underruns: 0, 0
=== Heat ===
Bed heaters = 0 -1 -1 -1, chamberHeaters = -1 -1
Heater 0 is on, I-accum = 0.1
Heater 1 is on, I-accum = 0.9
=== GCodes ===
Segments left: 0
Stack records: 4 allocated, 0 in use
Movement lock held by null
http is idle in state(s) 0
telnet is idle in state(s) 0
file is idle in state(s) 0
serial is ready with "M122" in state(s) 0
aux is idle in state(s) 0
daemon is idle in state(s) 0
queue is idle in state(s) 0
autopause is idle in state(s) 0
Code queue is empty.
=== Network ===
Slowest loop: 505.69ms; fastest: 0.00ms
Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0) Telnet(0)
HTTP sessions: 0 of 8- WiFi -
Network state is running
WiFi module is connected to access point
Failed messages: pending 0, notready 0, noresp 0
WiFi firmware version 1.21
WiFi MAC address cc:50:e3:0d:29:ce
WiFi Vcc 3.40, reset reason Turned on by main processor
WiFi flash size 4194304, free heap 17096
WiFi IP address 192.168.1.151
WiFi signal strength -61dBm, reconnections 0, sleep mode modem
Socket states: 0 0 0 0 0 0 0 0
- WiFi -
-
@CarlBosson said in PID Tuning Procedure:
Firmware Version: 2.05.1 (2020-02-09b1)
WiFi Server Version: 1.21
Web Interface Version: 1.22.6Your firmware versions are very out of date. Most of the code suggestions you will get here likely won't work as expected.
I suggest you update your firmware. You'll need to generate a fresh config set for RRF3. https://configtool.reprapfirmware.org/
If you still have access to DWC. Upload these zip files, one at a time in the system tab. Don't extract them first. Reboot after each. Use M115 in the gcode console to verify the firmware has been applied.
https://github.com/Duet3D/RepRapFirmware/releases/download/2.05.1/Duet2Firmware-2.05.1.zip
https://github.com/Duet3D/RepRapFirmware/releases/download/3.0/Duet2and3Firmware-3.0.zip
https://github.com/Duet3D/RepRapFirmware/releases/download/3.3/Duet2and3Firmware-3.3.zip
https://github.com/Duet3D/RepRapFirmware/releases/download/3.4.5/Duet2and3Firmware-3.4.6.zip -
@CarlBosson If you don't want to update the firmware, you can still tune the heaters. You just can't tune them as a tool. Use
M303 H1 S200
instead.Ian
-
This post is deleted! -
Thank you for all your help. Sorry for the late response, I have been out sick. Things are a little busy now and I have playing catch up, I may have to take this machine home to work on it. I am sure I will have questions as I go. Thanks and have a great day.
Carl
-
@droftarts said in PID Tuning Procedure:
Thank you for your input and the option that you offer. I think I will try to fix it once and for all. "I know that is a fantasy".
Carl
-
@Phaedrux I have updated to firmware Ver 3.3.
But the kink you sent to Ver 3.4.6 says file not found? -
-
@Phaedrux Ok I have that done.
I need to be honest. I am in way over my head! Thank you for all the help.
Yesterday I connected to my home network and had access to the DWC but now it will not connect to the same IP address. When I enter M587 via YAT I get the following message?
M587
Failed to retrieve network list: another SPI transfer is pending
ok -
@Phaedrux Current M122
M122
=== Diagnostics ===
RepRapFirmware for Duet 2 WiFi/Ethernet version 3.3 (2021-06-15 21:44:54) running on Duet WiFi 1.02 or later
Board ID: 08DGM-917DA-G4MSD-6J1FA-3SJ6N-T8T39
Used output buffers: 1 of 24 (4 max)
=== RTOS ===
Static ram: 23876
Dynamic ram: 73796 of which 84 recycled
Never used RAM 16660, free system stack 170 words
Tasks: NETWORK(ready,7.7%,521) HEAT(delaying,0.0%,386) Move(notifyWait,0.1%,364) MAIN(running,92.1%,461) IDLE(ready,0.1%,29), total 100.0%
Owned mutexes: USB(MAIN)
=== Platform ===
Last reset 00:21:12 ago, cause: power up
Last software reset details not available
Error status: 0x00
Step timer max interval 0
MCU temperature: min 37.0, current 40.3, max 40.8
Supply voltage: min 0.3, current 24.6, max 24.7, under voltage events: 1, over voltage events: 0, power good: yes
Heap OK, handles allocated/used 0/0, heap memory allocated/used/recyclable 0/0/0, gc cycles 0
Driver 0: position 0, standstill, SG min/max not available
Driver 1: position 0, standstill, SG min/max not available
Driver 2: position 0, standstill, SG min/max not available
Driver 3: position 0, standstill, SG min/max not available
Driver 4: position 0, standstill, SG min/max not available
Driver 5: position 0
Driver 6: position 0
Driver 7: position 0
Driver 8: position 0
Driver 9: position 0
Driver 10: position 0
Driver 11: position 0
Date/time: 1970-01-01 00:00:00
Cache data hit count 4294967295
Slowest loop: 101.25ms; fastest: 0.13ms
I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0, resets 0
=== Storage ===
Free file entries: 10
SD card 0 detected, interface speed: 20.0MBytes/sec
SD card longest read time 0.9ms, write time 0.0ms, max retries 0
=== Move ===
DMs created 83, maxWait 0ms, bed compensation in use: none, comp offset 0.000
=== MainDDARing ===
Scheduled moves 0, completed moves 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
=== AuxDDARing ===
Scheduled moves 0, completed moves 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1
=== Heat ===
Bed heaters = -1 -1 -1 -1, chamberHeaters = -1 -1 -1 -1
=== GCodes ===
Segments left: 0
Movement lock held by null
HTTP is idle in state(s) 0
Telnet is idle in state(s) 0
File is idle in state(s) 0
USB is ready with "M122" in state(s) 0
Aux is idle in state(s) 0
Trigger is idle in state(s) 0
Queue is idle in state(s) 0
LCD is idle in state(s) 0
Daemon is idle in state(s) 0
Autopause is idle in state(s) 0
Code queue is empty.
=== Network ===
Slowest loop: 0.33ms; fastest: 0.00ms
Responder states: HTTP(0) HTTP(0) HTTP(0) HTTP(0) FTP(0) Telnet(0), 0 sessions
HTTP sessions: 0 of 8- WiFi -
Network state is starting2
WiFi module is disabled
Failed messages: pending 0, notready 1, noresp 0
Socket states: 0 0 0 0 0 0 0 0
ok
- WiFi -
-
@Phaedrux Here are my attempts to restart the wifi below
- WiFi -
Network state is starting2
WiFi module is disabled
Failed messages: pending 0, notready 1, noresp 0
Socket states: 0 0 0 0 0 0 0 0
ok
M552
WiFi module is being started
ok
M552
WiFi module is being started
ok
M552
WiFi module is being started
ok
M552 S-1
WiFi module stopped
ok
M552
WiFi module is disabled
ok
M552 S0
ok
M552
WiFi module is being started
ok
M587
Failed to retrieve network list: another SPI transfer is pending
ok
- WiFi -