This page gives RepRapFirmware’s M-codes that define temperature
sensors and heater behaviour, set a tool’s temperatures and handle heater faults,
from the Duet3D G-code dictionary as read on 3 December 2026. Setting and waiting for
temperatures, fans and tuning are on
RepRapFirmware temperature
and fans. Version numbers are RepRapFirmware (RRF) versions.
M308: temperature sensors
M308 is the RRF 3 command for sensors, which exist independently of
heaters; M950 links the two. Type names ignore case, hyphens and
underscores.
| Form | Effect |
|---|---|
M308 Sn Y"type" … | Delete sensor n if it exists and create it anew; a pin (P) is needed unless the type uses none |
M308 Sn | Report its settings and last error |
M308 Sn P"nil" | Delete it |
M308 Sn with parameters other than Y | Change its settings |
| Common parameter | Meaning |
|---|---|
S | Sensor number |
P"pin" | Thermistor input pin, or for SPI sensors the output pin used as chip select |
Y"type" | Sensor and interface type, below |
A"name" | Name shown in the web interface |
U, V | Offset and slope correction (3.5 and later, default 0): reading = raw × (1.0 + V) + U, in °C |
Y type | Further parameters |
|---|---|
thermistor | T resistance at 25 °C; B beta, or reciprocal of the Steinhart-Hart B coefficient; C Steinhart-Hart C, default 0; R series resistor (board default if omitted); L, H ADC low and high offset correction, default 0 |
pt1000 | R, L, H as above |
rtd-max31865 (PT100) | R reference resistor (daughterboard default); W wires, 2, 3 or 4; F mains frequency, 50 or 60 |
thermocouple-max31855, thermocouple-max31856 | MAX31856 only: K"c" thermocouple type letter (default K) and F mains frequency. A MAX31855 variant reads one type; Duet boards with it read type K |
dht21, dht22, dht-humidity | The humidity sensor attaches to a primary one with P"Sn.1". dht11 was removed in 3.4 |
bme280, bme-pressure, bme-humidity | 3.5 and later, Duet 3 only. Pressure on P"Sn.1", humidity on .2; a CAN board address goes in front, as in P"10.S20.1" |
bme68x, bme68x-pressure, bme68x-humidity, bme68x-gas | BME680 and BME688 from 3.7, BME690 from 3.7.1, Duet 3 only, on SPI. Pressure .1, humidity .2, gas resistance .3. Gas reads in ohms, −1.0 while not valid; the heater profile is fixed at 320 °C for 150 ms |
mcu-temp | No pin. On a CAN board use a dummy pin with its address, P"1.dummy". The chip maker does not support the sensor of the Duet 3 Mini 5+ and many expansion boards, so readings are not guaranteed |
drivers | Driver temperature state (named drivertemp on expansion boards before 3.4.0). Most Trinamic drivers read 0 normal, 100 warning, 150 error; the TMC2240 gives a real temperature |
drivers-duex | The same for DueX2 or DueX5 on Duet 2 WiFi or Ethernet |
board-temp | 3.7.0 and later, board thermistor of the M23CL and INDX tool board, which can then no longer be set up as a thermistor |
linear-analog | F0 unfiltered, F1 filtered and oversampled (thermistor ports only); B value at zero ADC output, C value at full scale |
current-loop | MCP3204 ADC on SPI, P its chip select; L temperature at 4 mA (default 385), H at 20 mA (default 1600); C ADC channel (default 0); D1 differential, D0 single ended (default) |
ads131.chan0.u, ads131.chan0.b, ads131.chan1 | Duet 3 ADC daughterboard, 3.6 and later; u unipolar, b bipolar. Channel 0 pin spi.cs0 on a 6HC, spi.cs1 on other main boards, plus 2 if stacked on another Duet3D daughterboard; channel 1 pin Sn.1. B reading at minimum (default 0), C at maximum (default 100) |
thermopile_tpis.object, .ambient, .environment | Bondtech INDX radiant heat sensor: T, B, C of its auxiliary thermistor; R model exponent, 3.8 to 4.4, default 4.2; F and W view and radiance of object and surroundings, in 256ths. All but Y are marked temporary, for developers |
L and H override the boards’ own ADC calibration.
M308 S1 P"temp1" Y"thermistor" T100000 B4725 C7.06e-8
M308 S10 P"spi.cs1" Y"bme68x" A"Chamber Temp"
M308 S11 P"S10.1" Y"bme68x-pressure" A"Chamber Pres"
M305: sensors before RRF 3
In RRF 2 and earlier every sensor belongs to a heater, possibly a virtual one
(numbers from 100). RRF 3 does not use M305: each becomes an
M308, placed before the M950 that uses it. With only
P the current values are shown.
| Parameter | Meaning |
|---|---|
P | Heater number (0 bed, 1 first extruder) or virtual heater |
S"name" | Heater name; named virtual heaters appear in Duet Web Control (1.19.2 and later of it also take "name [unit]") |
X | Sensor channel, default the P number |
T | Thermistor resistance at 25 °C; or T"c" thermocouple type on MAX31856, default K |
B, C | Beta (or reciprocal Steinhart-Hart B) and Steinhart-Hart C, default 0 |
R | Series resistor |
L, H | Thermistor: ADC low and high offsets. Current loop: temperatures at 4 and 20 mA |
F | Mains frequency, 50 or 60 (MAX31856, MAX31865) |
W | PT100 wires, 2 to 4 |
| Channel | Sensor |
|---|---|
| 0, 1 … | Thermistor inputs of heaters 0, 1 … |
| 100 …, 150 … | MAX31855 and MAX31856 thermocouples on SPI chip selects CS1 onwards |
| 200 … | MAX31865 PT100 |
| 300 … | Current loop |
| 400 …, 450 … | DHT temperature and humidity; the type 11, 21 or 22 goes in T |
| 500 … | Thermistor inputs with PT1000 sensors; only R, H, L count |
| 1000 | Microcontroller temperature (virtual heater 100 by default) |
| 1001, 1002 | Driver warnings of the main board and of DueX2 or DueX5: 0, 100 warning, 150 shutdown (virtual heaters 101, 102) |
M305 P1 T100000 R1000 B4200
M305 P1 X501 R2200 ; PT1000 on thermistor channel 1
M305 P102 X401 T22 S"DHT temperature"
M307: heater model
A heater is modelled as a first order process with dead time; from the model the
firmware computes PID values, feed-forward and fault detection. Tuning
(M303) normally finds the values. Without M307 a default
is used according to whether the heater serves a tool, bed or chamber (from 3.7 a
chamber has its own, and a CAN board is asked for its default).
M307 Hn alone reports.
| Parameter | Meaning | Versions |
|---|---|---|
H | Heater number (0 is usually the bed) | all |
R | Heating rate in °C/s at full power near ambient | 3.2 and later |
K or Ka:b | Cooling rate in °C/s at 100 °C above ambient. Rate = a / ((Theater − Tambient)/100)E, plus b / (the same) × fan power 0 to 1 | 3.4 and later |
E | Exponent of the cooling curve, default 1.35 | 3.4 and later |
A | Gain: final temperature rise divided by PWM fraction (180 means 90 °C at half power) | 3.1 and earlier; accepted later |
C or Ca:b | Time constant in seconds; two values (fan off, fan full) in 3.2 and 3.3 | 3.3 and earlier; accepted later |
D | Dead time in seconds | all |
B | Non-zero selects bang-bang instead of PID; default 0 for extruders, 1 for bed (and chamber from 3.4) | all |
I | I1 inverts the heating signal (for example Peltier elements). RRF 2 also has I2 full PWM inversion and I3 both; RRF 3 drops I2 and treats I3 as I1, output inversion moving to M950 | all |
S | Maximum PWM, 0 to 1, default 1.0 | all |
V | Supply voltage at calibration, for compensating changes; 0 disables. Hot ends only | 1.20 and later |
F | PWM frequency | RRF 2 and earlier; in RRF 3 set by M950 |
From 1.16 to RRF 2, A-1 C-1 D-1 disables a heater and frees its pin;
in RRF 3 a heater is simply not created. In RRF 3, M307 follows the
M950 of its heater. M500 saves the models.
M307 H1 R2.186 K0.17:0.11 D5.67 S1.00 V24.0 ; 3.4 and later
M307 H1 R2.186 C202.1:155.0 D5.67 S1.00 V24.0 ; 3.2 and 3.3
M307 H1 A346.2 C140 D5.3 B0 S0.8 V23.8 ; 3.0 and 3.1
M309: heater feedforward
Supported from 3.4, mainly for high flow hot ends and pellet extruders. Fan
feedforward comes from tuning (M307 K); M309 adds
feedforward for the extrusion rate.
| Parameter | Meaning |
|---|---|
P | Tool number, default the current tool |
S | Extra PWM (0 to 1) per mm/s of forward filament movement; one value for all the tool’s heaters or one per heater, colon separated. Roughly 0.0475 for 1.75 mm PETG at 235 °C |
T | Extra target temperature in °C per mm/s, listed the same way (3.6.0 and later) |
A | Time in ms, at most 50, by which the adjustment should lead the move; not always achievable (3.6.0 and later) |
Without S, T and A the values are reported.
Extruder-only moves such as retraction and loading get no feedforward. From 3.6.0
it works on heaters of CAN-connected boards.
M568: tool temperatures and spindle speed
3.3 and later. Parameters left out keep their last value, and
M568 Pn alone reports.
| Parameter | Meaning |
|---|---|
P | Tool, default the current one |
R | Standby temperatures, colon separated for several heaters |
S | Active temperatures, likewise |
F | Spindle RPM, positive; applied at once to a running spindle in its direction |
A | Heater state: 0 off, 1 standby, 2 active. For another tool, heaters used by the current tool are left alone |
It does not wait; follow it with M116. R and
S replace the temperature form of G10.
M568 P1 R140 S205
M568 P2 R100:90:20 S185:200:150 A1
Before firmware 1.19 the number meant something else: M568 Ptool
S1 turned automatic mix ratios on (so that one E value
used M567’s ratios) and S0, the default, off. It is no
longer needed or supported.
M570, M562 and M573: faults and power
M570 parameter | Meaning |
|---|---|
H | Heater |
P | Seconds an anomaly must last before a fault, default 5 |
T | Allowed deviation from the target in °C, default 15 |
R | 3.5 and later: failed readings in a row allowed before a fault, default 3 (a fault within a second of a broken or shorted sensor); R0 faults at once and is more easily upset by interference |
S | 1.20 to 3.3: minutes before a print is cancelled after a fault (may be 0); if that happens during an SD print, power off through PS_ON is tried. In 1.14 and earlier, a heater timeout in seconds |
These fields apply to 1.15e and later. From 3.4 what happens after the heater is
shut down is decided by the event system. In RRF 3, M570 follows the
heater’s M950. The dictionary warns that careless values reduce the
protection, which should never be the only protection against fire.
M562 Pheater clears a latched heater fault; from 1.20,
without parameters, on all heaters. A fault that persists trips again.
M573 Pheater reports the PWM averaged over about five
seconds, 0 to 1. It was removed in 3.4, where
echo heat.heaters[1].avgPwm gives the same.
Sources
- G-code dictionary – Duet3D’s documentation of RepRapFirmware’s commands, published under a Creative Commons attribution share-alike licence; this page is written in our own words