Thursday, August 9, 2012

The M303 command – use it!


I just discovered a great feature in the Marlin firmware: PID autotune.
PID is a method of controlling the heater in the hotend to more precisely control temperatures. The algorithm needs to be tuned for your type of hotend and individual variation can make a big difference.  Without precise temperature control, you may have big variations in plastic performance across your prints.  I certainly did.
Marlin now has a command that can make tuning PID trivial.
From Pronterface, connect to your printer (best to start this procedure cold), and type M303 into the direct command box (lower right next to the “send” button).  It will proceed to heat the hotend up to 150 and cycle it a little.  At the end it will give you a set of numbers.
Do this 4 or 5 times, it will refine the numbers each time.  At the end, your status window will have something like this:
bias: 36 d: 36 min: 148.52 max: 151.66
Ku: 29.26 Tu: 34.08
Clasic PID
Kp: 17.93
Ki: 1.07
Kd: 75.22
PID Autotune finished !
You have two choices in how to use this info.  The simplest is to put a command into your startup custom GCODE in Slic3r like this:
M301 P17.93 I1.07 D75.22
Alternatively, go into your firmware configuration.h and find this section:
// PID settings:
Comment out whatever’s uncommented there now for the following values and put in your own:
// J-Head III-B
#define  DEFAULT_Kp 17.93
#define  DEFAULT_Ki 1.07
#define  DEFAULT_Kd 75.22
Compile and download to the printer.
Before doing this, I was seeing temperature swings on my hotend as much as +/- 12 degrees, and I think it contributed significantly to my uneven print results.  After doing this, my hotend temp is controlled to +/- 0.5 degrees at 200*C.  Usually it’s within 0.2 degrees, only swinging far away (0.5 degrees) during long/fast extrudes.

No comments:

New printer: JGAurora A3

This week I decided I'd had it with all the other printers in my stable.  The CTC is stable and decent but it just bugs me (can't st...