3D printer G-code · Marlin

M304: Set bed PID values (Marlin)

Set bed PID values — Sets the PID values of the heated bed. The bed needs PIDTEMPBED enabled in Marlin; otherwise it works with simple on/off control.

By cnccode · Updated
On this page
  1. What does M304 do?
  2. Parameters
  3. Example
  4. Tips from practice
  5. Related commands
  6. More temperature commands
  7. Frequently asked questions
PropertyValue
CommandM304
FunctionSet bed PID values
FirmwareMarlin
GroupTemperature
SyntaxM304 P I D

What does M304 do?

Sets the PID values of the heated bed. The bed needs PIDTEMPBED enabled in Marlin; otherwise it works with simple on/off control.

Parameters

ParameterMeaning
P I DPID values of the bed

Example

G-code
M303 E-1 S60 C8 U1
M500

Tips from practice

  • Bed PID gives a steadier temperature and less pulsing of lights on the same power supply.

Marlin. Many Marlin commands only exist when the feature is enabled in the firmware build. If the printer answers "Unknown command", the feature is missing. Klipper does not understand most of these settings codes; it uses printer.cfg instead.

More temperature commands

CommandFunctionFirmware
M104Set hotend temperature (no wait)Marlin and Klipper
M109Set hotend temperature and waitMarlin and Klipper
M140Set bed temperature (no wait)Marlin and Klipper
M190Set bed temperature and waitMarlin and Klipper
M141Set chamber temperatureMarlin
M303PID autotuneMarlin
M301Set hotend PID valuesMarlin
PID_CALIBRATEPID tuning (Klipper)Klipper
TEMPERATURE_WAITWait for a temperature rangeKlipper
SET_HEATER_TEMPERATURESet a heaterKlipper

Test it before you print

Paste your start code or a whole file into the 3D printer simulator. It plans every move, shows the time and finds missing waits, cold extrusion and moves outside the bed.

Open the simulator

Frequently asked questions

What does M304 do on a 3D printer?
M304 is set bed PID values. Sets the PID values of the heated bed. The bed needs PIDTEMPBED enabled in Marlin; otherwise it works with simple on/off control.
Does M304 work in Klipper and Marlin?
M304 is a Marlin command. Klipper uses its own commands and printer.cfg settings for this task.
Was this page helpful?