What are the variables for PID control? How to use M301? How to use this command to switch from PID to bang-bang? I'd like to have the 12V PID output of an old Printrboard hotend control a relay that attaches to a 120V crockpot for something I'm making. I have everything working fine using a relay, but because the hotend heater is using PID control, the relay clicks about 3 times per second each time it needs to heat up the crockpot. 

Not only is this sound annoying, but it will likely reduce the life of the relay significantly. I need the crockpot temperature controlled, so the programmatic thermistor control on an old 3D printer board is a huge help, and probably cheaper than the alternatives. Especially since this board has an SD slot built in and can run any code on power-up. In "bang-bang" control, there would be less clicking as the crockpot heats up, and the relay wouldn't be damaged.

I can't update the firmware on my board to use a different pin because it is a really old Printrbot board. All the required software is almost 5 years old and is really difficult to find. Fortunately the Printrboard does support M301. So, I should be able to use this command to switch from PID control to bang-bang.

In Marlin's documentation, it describes a command called M301, along with a lot of variables for using this command. The problem is, I don't know what any of these variables mean. 

M301 [C&lt;value&gt;] [D&lt;value&gt;] [E&lt;index&gt;] [I&lt;value&gt;] [L&lt;value&gt;] [P&lt;value&gt;] 



[C&lt;value&gt;]  

C term (requires PID_EXTRUSION_SCALING)

[D&lt;value&gt;]  

Derivative value

[E&lt;index&gt;]  

Extruder index to set. Default 0.

[I&lt;value&gt;]  

Integral value

[L&lt;value&gt;]  

Extrusion scaling queue length (requires PID_EXTRUSION_SCALING)

[P&lt;value&gt;]  

Proportional value


About the only thing I know for sure is that the extruder index is 0. 

What command would I enter to make this a bang-bang PID controller, so that I don't damage my relay long-term?
What command would I enter to make this a bang-bang PID controller


There's no such thing as a "bang-bang PID controller". "bang bang" is mutually exclusive of PID. The M301 command is only good for fine-tuning the parameters of the PID controller, but it won't let you switch to bang bang. Unfortunately, you must update the firmware if you wish to use bang bang.

You could try setting all values to 0, except P, which you set to an as high value as possible. This will cause the output to be fully on when the temperature is lower than the setpoint, and fully off when higher than the setpoint. However, this can still cause rapid clicking of the relay when the temperature is hovering around the setpoint. Bang bang has some hysteresis built-in (i.e., there is a margin around the setpoint in which the relay will never be toggled); there's no way to emulate this with PID.