# PID Controller Tuning

Calibrating a PID Controller can be tricky, so here are some tools to help folks get the job done.

### Extruder Heater PID Settings

In the v2.x firmware release, Adam rewrote and made the heater's control system proportional, integral and derivative (PID) parameters changeable from ReplicatorG. If your Plastruder MK4 extruder's heater has difficulty reaching and/or maintaining a target 220C temperature, check and set them to the following new set of Adam default values:

- Launch ReplicatorG
- Select menu item
**Machine - Onboard Preferences - Set Extruder Parameters** - Set
**P**roportional to**7.0** - Set
**I**ntegral to**0.35** - Set
**D**ifferential to**36.0**

#### Relay-Driven Gen3 Electronics Driven Plastruder MK5 PID Settings

**Note:** These settings were gathered for Cupcakes with relay-driven MK5 extruders and Gen3 firmware support. See the next section for Thing-O-Matic/Gen4 recommended settings.

From the "MK5 PID tuning?" discussion, the following PID settings may be a better starting point:

- Set
**P**roportional to**5.143** - Set
**I**ntegral to**0.0612** - Set
**D**ifferential to**108.0**

I'm using these settings with my MK5: (Bre)

- Set
**P**roportional to**5.1367*** **Set **I**ntegral to**0.055**- Set
**D**ifferential to**108.0**

I'm using these settings with my MK5: (Isaac)

- Set
**P**roportional to**5.00*** **Set **I**ntegral to**0.0078125**- Set
**D**ifferential to**35.00**

#### Gen4 Electronics Driven Plastruder MK5 PID Settings

The recommended defaults for a Thing-O-Matic or similar machine using a Mk5 extruder driven directly by Gen4 electronics are listed below:

- Set
**P**roportional to**6.25** - Set
**I**ntegral to**0.4140625** - Set
**D**ifferential to**100.0**

# The Ziegler-Nichols Tuning Method

Pulled from Wikipedia's PID Controller Page, where T is the **Time Constant** and L is the **Delay Time**:

- Proportional Term: K
_{P}= 1.2*T/L - Integral Term: K
_{I}= 0.6*T/L^2 - Derivative Term: K
_{D}= 0.6*T

# Wolfram Alpha Widgets

For a Plastruder MK4, the seed values of T=60 and L=10.286 produce approximately K_{P}=7.0, K_{I}=0.34, K_{D}=36.

For a Plastruder MK5, the seed values of T=180 and L=42 produce K_{P}=5.143, K_{I}=0.0612, K_{D}=108

jmil says:

For a Plastruder MK5 for PLA printing, the seed values of T=34 and L=8 produce K_{P}=5.1, K_{I}=0.31875, K_{D}=20.4

From the Manual Tuning page, **decreasing** both K_{P} and K_{I} should improve system stability. From the above Ziegler-Nichols Tuning equations, **decreasing** the **Time Constant** and **increasing** the **Delay Time** will have this effect on the PID values.

Depending on your tuning goals (improved performance versus improved stability), use the following Wolfram-Alpha Widgets to determine appropriate sets of starting points for modifying your PID values.

## K_{P} - Proportional Term

### K_{P} Notes

- Pick
**Time Constant**and**Delay Time**values to keep K_{P}in the**5.0**to**7.0**range. **Decreases**in K_{P}should improve stability.

## K_{I} - Integral Term

### K_{I} Notes

- Changes to the
**Delay Time**will have the greatest effect on the K_{I}factor. **Decreases**in K_{I}should improve stability.**Increases**in K_{I}should significantly**decrease**steady-state error.

## K_{D} - Differential Term

### K_{D} Notes

- Only changes in
**Time Constant**influence the K_{D}term.