<h2>Step 0: Terminal connection</h2>
<p>To do any work on the settings of the board, you'll need to run a Terminal - for setting that up, please see the <a href="https://3dprinting.stackexchange.com/questions/10573/what-is-a-printer-console-terminal">relevant question here.</a></p>
<h2>Step 1: What do we have?</h2>
<p>The second step is dissecting the settings that are set already. To do so, send <code>M503</code> to read the relevant settings from the SRAM of the board and display them in the Terminal of your choice.</p>
<h2>Step 2: Try a PID Autotune</h2>
<p>To run a PID Autotune, just start by sending this for your first hotend to enforce a 3-cycle PID tuning for the 200 °C region:</p>
<p><a href="https://marlinfw.org/docs/gcode/M303.html" rel="nofollow noreferrer"><code>M303 C3 S200</code></a></p>
<p>For your second hotend, you'd send <code>M303 C3 E1 S200</code> - the E-value is 0-indexed and defaults to 0 for the first hotend, so E1 is the second hotend.</p>
<p>For your heatbed (and PLA) you send <code>M303 C3 E-1 S60</code> as -1 is the function dependant value for the heated bed.</p>
<h2>Step 3: Setting the PID settings</h2>
<p>After having obtained the PID settings from running the tuning cycle, we need to send those to the chips. To do so use <a href="https://marlinfw.org/docs/gcode/M301.html" rel="nofollow noreferrer"><code>M301</code></a> for a hotend and <a href="https://marlinfw.org/docs/gcode/M304.html" rel="nofollow noreferrer"><code>M304</code></a> for the heatbed, using the given values from step 2 as parameters.</p>
<p>Note again, that if you have more than one hotend, you absolutely need to have an E-value if you try to set the second hotend, as the default value is, again, E0 for the first hotend.</p>
<h2>Step 4: Saving</h2>
<p>To properly save the values into the EEPROM - provided it is enabled - is to just send one command to finalize:</p>
<ul>
<li><a href="https://marlinfw.org/docs/gcode/M500.html" rel="nofollow noreferrer"><code>M500</code></a></li>
</ul>
<p>If your EEPROM is not enabled, you'd need to take the line you wrote for Step 3 and insert that into your pre-print G-code, thus overwriting the PID settings in the SRAM before each print.</p>

CC BY-SA 4.0
2022-01-11T14:32:03.663Z
2022-01-11T14:32:03.663Z
Trish
<p>The <a href="https://3dprinting.stackexchange.com/questions/12153/updating-marlin-firmware-step-by-step-guide">Firmware Step-by-step guide</a> remarks to only mess with PID-Tuning settings in the firmware when you <em>know what you are doing</em>. Apparently, defining those settings in the firmware is a somewhat involved process, so this begs the question:</p>
<p><strong>How do you acquire the PID-tuning settings properly and update the boars of a printer so it retains these settings</strong> through power cycling?</p>
<p>Let's for simplicity assume there is a Marlin Firmware or a derivative using the same command codes is installed, so we can assume all the commands from the <a href="https://marlinfw.org/docs/gcode/G000-G001.html" rel="nofollow noreferrer">Marlin G-code repository</a> work.</p>

<marlin><knowledgebase><pid>
How to properly run a PID Tuning and update the firmware?
Trish
# How to properly run a PID Tuning and update the firmware?

(Asked by: username_0 on 2022-01-11)

The [Firmware Step-by-step guide](https://3dprinting.stackexchange.com/questions/12153/updating-marlin-firmware-step-by-step-guide) remarks to only mess with PID-Tuning settings in the firmware when you *know what you are doing*. Apparently, defining those settings in the firmware is a somewhat involved process, so this begs the question:

**How do you acquire the PID-tuning settings properly and update the boars of a printer so it retains these settings** through power cycling?

Let's for simplicity assume there is a Marlin Firmware or a derivative using the same command codes is installed, so we can assume all the commands from the [Marlin G-code repository](https://marlinfw.org/docs/gcode/G000-G001.html) work.

**Tags:** marlin, knowledgebase, pid

---

## 1 answers

### Answer by username_0 on 2022-01-11. Score: 2 | Accepted answer

## Step 0: Terminal connection

To do any work on the settings of the board, you'll need to run a Terminal - for setting that up, please see the [relevant question here.](https://3dprinting.stackexchange.com/questions/10573/what-is-a-printer-console-terminal)

## Step 1: What do we have?

The second step is dissecting the settings that are set already. To do so, send `M503` to read the relevant settings from the SRAM of the board and display them in the Terminal of your choice.

## Step 2: Try a PID Autotune

To run a PID Autotune, just start by sending this for your first hotend to enforce a 3-cycle PID tuning for the 200 °C region:

[`M303 C3 S200`](https://marlinfw.org/docs/gcode/M303.html)

For your second hotend, you'd send `M303 C3 E1 S200` - the E-value is 0-indexed and defaults to 0 for the first hotend, so E1 is the second hotend.

For your heatbed (and PLA) you send `M303 C3 E-1 S60` as -1 is the function dependant value for the heated bed.

## Step 3: Setting the PID settings

After having obtained the PID settings from running the tuning cycle, we need to send those to the chips. To do so use [`M301`](https://marlinfw.org/docs/gcode/M301.html) for a hotend and [`M304`](https://marlinfw.org/docs/gcode/M304.html) for the heatbed, using the given values from step 2 as parameters.

Note again, that if you have more than one hotend, you absolutely need to have an E-value if you try to set the second hotend, as the default value is, again, E0 for the first hotend.

## Step 4: Saving

To properly save the values into the EEPROM - provided it is enabled - is to just send one command to finalize:

* [`M500`](https://marlinfw.org/docs/gcode/M500.html)

If your EEPROM is not enabled, you'd need to take the line you wrote for Step 3 and insert that into your pre-print G-code, thus overwriting the PID settings in the SRAM before each print.


---

