Connecting thermistors or PT1000 temperature sensors
The Duet series supports 4 types of temperature sensor: thermistor and PT1000, thermocouple, and PT100. This section describes how to connect thermistors or PT1000.
This document is relevant to: all Duet boards
Firmware versions: all firmware versions
Connecting thermistors or PT1000 sensor
Connect thermistors or PT1000 sensors to the appropriate pin headers on the Duet. For Duet 2 WiFi / Ethernet and Maestro, use thermistor inputs 1, 2 and 3, which are labelled BED_TEMP, E0_TEMP and E1_TEMP. For Duet 3, there are four temperature inputs, temp0 to temp3. Duet 3 Expansion boards have three temperature inputs (temp0 to temp2). Duet 3 Tool boards have two temperature inputs (temp0 and temp1). Thermistors and PT1000 sensors are not polarised, so can be connected either way around.
Make sure that there are no short circuits between your temperature sensor wiring and any other wiring (particularly heater and fan wiring, which will be at a higher voltage), or you may damage your Duet board.
In RepRapFirmware 1.x and 2.x on Duet 2, BED_TEMP, E0_TEMP and E1_TEMP map, by default, to Bed temperature, first heater temperature and second heater temperature respectively. You can use different temperature input pins for a heater, by remapping the temperature sensor input pins; see Remapping temperature sensors to different pins below. In RepRapFirmware 3.x you need to define the pin a temperature sensor uses anyway (there are no defaults), so you can map any temperature pin to any heater.
Thermistor and heater example:
;Duet 2 M308 S1 P"e0temp" Y"thermistor" T100000 B4092 ; sensor 1 M950 H1 C"e0heat" T1 ; create heater and map sensor 1 ;Duet 3 M308 S1 P"121.temp0" Y"thermistor" T100000 B4725 C7.06e-8 ; sensor 1 (toolboard) M950 H1 C"121.out0" T1 ; create heater and map sensor 1 (toolboard)
PT1000 and heater example:
;Duet 2 M308 S1 P"e0temp" Y"pt1000" ; sensor 1 M950 H1 C"e0heat" T1 ; create heater and map sensor 1 ;Duet 3 M308 S1 P"121.temp0" Y"pt1000" ; sensor 1 (toolboard) M950 H1 C"121.out0" T1 ; create heater and map sensor 1 (toolboard)
Configuring multiple sensors and heaters
In RRF 3.x, a typical config.g would define the bed and hot end temperature sensor definitions with M308 and map them to the relevant heater created with M950:
M308 S0 P"bedtemp" Y"thermistor" T100000 B3950 ; sensor 0 M950 H0 C"bedheat" T0 ; create bed heater and map sensor 0 M308 S1 P"e0temp" Y"thermistor" T100000 B4725 C7.06e-8 ; sensor 1 M950 H1 C"e0heat" T1 ; create heater and map sensor 1 M308 S2 P"e1temp" Y"thermistor" T100000 B4138 ; sensor 2 M950 H2 C"e1heat" T2 ; create heater and map sensor 2
RepRapFirmware 1.x and 2.x
The thermistor or PT1000 types are configured using the M305 commands in config.g. The heaters and temperature sensor channels are numbered 0 for the bed, then 1, 2, 3... for each extruder.
For PT1000, use the M305 command as for a thermistor, but add parameter X500+n where N is the channel number. Other parameters are not required.
Thermistor and heater example:
M305 P0 T100000 B3950 ; set bed thermistor parameters
PT1000 and heater example:
M305 P1 X501 ; heater 1 uses a PT1000 connected to thermistor channel 1
Configuring multiple sensors and heaters
In RRF 1.x and 2.x, the P parameter in M305 refers to the temperature sensor AND heater channel, where P0 is the bedtemp pins, P1 is e0temp (first hotend) and P2 is e1temp (second hotend). A typical config.g might be:
M305 P0 T100000 B3950 ; set parameters for heater 0 M305 P1 T100000 B4725 C7.060000e-8 ; set parameters for heater 1 M305 P2 T100000 B4138 ; set parameters for heater 2
The M305 (RRF 1.x and 2.x) and M308 (RRF 3.x) commands take similar parameters to define the temperature sensor characteristics. For example, to set the first hot end thermistor parameters, use a command like this:
;RRF 1.x and 2.x M305 P1 T100000 B4725 C7.060000e-8 ; set parameters for heater 1 ;RRF 3.x M308 S1 P"e0temp" Y"thermistor" T100000 B4725 C7.06e-8 ; sensor 1
In RRF 1.x and 2.x, the P parameter identifies the heater/thermistor channel that the command applies to, where P0 is bedtemp, P1 is E0TEMP, P2 is E1TEMP. P3 to P7 are the temperature inputs on the Duex expansion board.
In RRF 3.x, the S parameter configures the sensor number the command applies to. The P parameter defines the pins the sensor is connected to. The Y parameter defines the sensor type, "thermistor" or "pt1000".
The T parameter (T100000) means that the resistance at 25C is 100Kohms.
The B parameter (B4725) means that the thermistor B value over the temperature range of interest is 4725.
Manufacturers of thermistors typically quote the B value over quite a small temperature range. This is fine for the bed thermistor, but the effective B value over the temperature range of the extruder may be somewhat different.
For greater accuracy, in firmware 1.17 and later you can add a C parameter. Here are some suitable T, B and C values for popular thermistors:
|Thermistor type||Used by||T parameter (resistance @ 25C)||B parameter||C parameter|
|Semitec 104GT2||E3D hot ends||100000||4725||7.06e-8 1|
|Epcos B57863S0103F040||RepRapPro Ormerod heated bed||10000||3988|
|Honeywell 135-104QAD-J01||RepRapPro Ormerod/Huxley/Mendel hot end||100000||4138|
|Typical Chinese bed heater thermistor||Various bed heaters||100000||3950|
1 The C parameter can be written in Scientific notation as shown here or in normal decimal notation (in this example C0.0000000706, just be careful to use the right number of zeros); see below for an explanation of the C parameter.
If you have a datasheet for the thermistor you are using, and if it provides a resistance-versus-temperature table, you can calculate the correct value for the B and C parameters. The simplest way is to use the calculator on the heater tab of https://configurator.reprapfirmware.org/.
For the technically minded: firmware 1.17 and later uses the Steinhart-Hart thermistor model. The M305/M308 C parameter is the Steinhart-Hart c parameter, the M305/M308 B parameter is the reciprocal of the Steinhart-Hart b parameter, and the Steinhart-Hart a parameter is calculated from the resistance at 25C. If you don't provide a C parameter, then C defaults to zero and the Steinhart-Hart equation reduces to the beta-value equation.
PT1000 sensors connected to thermistor inputs have lower resolution than PT100 sensors connected via the PT100 daughter board. The accuracy of PT1000 sensors should be very good on the Duet 3 and Duet 2 Maestro and generally good on the Duet 2 Wifi and Ethernet. However, it may be poor on the Duet 0.6, Duet 0.85 and other SAM3X8E-based electronics. For these boards, you can calibrate the Duet's on-board analogue-to-digital converter to improve this; see Temperature calibration and ADC tuning below.
Remapping temperature sensors to different pins
In RRF 3.x, you can simply change the pin allocation in the P parameter in the M308 command to use a different pin. For example, if you want the bed thermistor connected to e0temp (assuming it is available), use:
;RRF 3.x M308 S0 P"e0temp" Y"thermistor" T100000 B3950
In RRF 1.x and 2.x, use the X parameter in M305 to do this, where X is the desired thermistor input channel. See M305 for a list of available input channels:
;RRF 1.x and 2.x M305 P0 X1 T100000 B3950 ; set bed thermistor parameters
Configuring a temperature sensor with no heater
In some cases, you'll want a temperature sensor that is not mapped to a heater.
In RRF 1.x and 2.x, for sensors with no controllable heater, you need to create a "virtual heater" in order to be able to use the sensor. Use P parameter with number 103 or higher (101, 102 and 103 are reserved for the MCU and stepper driver temperatures see Heaters), define a sensor name with the S parameter (which will make it show up in DWC), define the "heater" ADC channel with the X parameter (ie the pins the temperature sensor is connected to), and then define temperature sensor values (T, B, C). eg:
;RRF 1.x and 2.x M305 P103 S"Chamber" X2 T100000 B4725 C7.060000e-8
RRF3.x handles this use case better, by allowing sensors to be defined independently of heaters, up to a max of 32 sensors. These will be shown on the 'Extras' section of the 'Tools + Extras' tab in DWC. Example:
;RRF 3.x M308 S3 A"Chamber" P"e1_temp" Y"thermistor" T100000 B3950
Temperature calibration and ADC tuning
Using M305/M308 H and L parameters, it is possible to tune the Duet's analogue-to-digital converter's (ADC's) high and low gain offset to improve readings from thermistors and/or PT1000 temperature sensors. There are a number of reasons why you might want to do this:
- Some thermistors meant for high-temperature work (for example those provided with the Dyze hot end) may have such a high resistance at room temperature that they read as open. This will generally cause heater faults as soon as you start heating.
- Duet 3 MB6HC boards sometimes exhibit different errors on different ADC channels. As a result, the hardware self-calibration isn't perfect.
- The ADC on the Duet 0.6 and 0.8.5 is not calibrated automatically, so you may need to calibrate it in order to get accurate readings, especially at low temperatures or when using PT1000 sensors.
For the above cases, see Calibrating thermistor and PT1000 readings
There has also been discussion of a number of workarounds; a search of the forum may yield some good suggestions. For really satisfactory results you may need to switch to a thermocouple, PT100 or PT1000 sensor.
The M305/M308 R parameter
The R parameter is the value (in ohms) of the series resistor, which is part of the temperature sensing circuit on the controller electronics. You do not need to specify this value as it is set by the firmware which detects the hardware used and sets the value accordingly, unless you are using certain versions of the Duet 0.6 or DueX4 expansion boards.
Early Duet 0.6 boards, and most or all Duet 0.6 boards sold by Replikeo, use 1K series resistors instead of 4.7K. Likewise, DueX4 0.2 boards and earlier DueX4 0.2a boards use 1K resistors. For these boards, use R1000 in the corresponding M305 commands.
The default values for Duet boards are:
|Duet version||R value|
|Duet 2 WiFi / Ethernet||4700|
|Duex 2 and Duex 5 expansion boards||4700|
|Duet 2 Maestro||2200|
|DueX4 version 0.2a||older boards 1000, newer boards 4700|
|DueX4 version 0.2||1000|
|Duet 06||older boards 1000, newer boards 4700|