Skip to main content

Site Navigation

Your Account

Choose Language

Connecting and configuring fans

The Duet supports three kinds of fans: always-on fans, thermostatically-controlled fans, and G-code controlled fans.


Fans are polarised. When connecting a fan to a fan connector, the positive wire (usually red) must be connected to the VFAN pin of that connector. The negative wire (normally black) must be connected to the FAN- pin if it is a controlled fan connector, or the GND pin if it is an always-on fan connector. If you connect the fan the wrong way round, you may damage the fan, the Duet, or both.


  • The Duet 2 WiFi and Ethernet boards have three controlled fan connectors FAN0, FAN1 and FAN2 plus two always-on fan connectors. A jumper (V_FAN) allows you to select whether all fans are powered from the VIN supply or from the Duet's 5V supply. FAN1 is on by default at power up, for maximum safety when you configure it as a thermostatically-controlled fan.
  • The Duet 2 Maestro has three controlled fan connectors FAN0, FAN1 and FAN2 plus one always-on fan connector. The fan voltage is jumper-selectable in 2 blocks.
  • Our intention is that in a 3D printer with a single print head, you use the Fan0 output for the print cooling fan and the Fan1 output for the heatsink fan. This is the easiest configuration to use because it's what the firmware expects by default.
  • The Duex 2 and Duex 5 have 6 further PWM controllable fans (FAN3 - FAN8). (Versions before 0.8 had 5 fan connections see the Duex hardware pagefor details)

Older members of the Duet family have different provision for connecting fans:

  • The Duet 0.6 has a single connector labelled FAN0 for a controlled fan. You can connect always-on fans to the 2-row header above the extruder motor output.
  • The Duet 0.8.5 has two controlled fan connectors FAN0 and FAN1 plus two always-on fan connectors.

Mixed-voltage setups are not directly supported on the Duet 2 WiFi/Ethernet, but the Duet switches the fans' connections to ground, so you may be able to connect each fan's positive side to the appropriate voltage and its negative side to the appropriate pin on the Duet. Each controlled fan can be configured in firmware as a gcode controlled fan or as a thermostatically-controlled fan.

We recommend no more than 1.5A continuous current draw from each fan output, although up to 3.5A for a few seconds while the fan starts up will not harm them.

For details of the configuration options available for various firmware versions see the M106 gcode section

Cautions when connecting brushed DC motors e.g. air pumps

  • Duet 06 and 085 boards, and Duet 2 (WiFi/Ethernet) boards prior to PCB revision 1.02, do not have built-in flyback diodes on the fan outputs , because standard brushless fan motors do not need them.
    • If you connect a brushed DC motor to a fan output, you must connect a flyback diode in parallel with the motor.
    • A 1N400x diode (where x = any digit in 1..7) is suitable. Connect the cathode of the diode (the end with the stripe) to the positive fan wire (the V_FAN terminal on the Duet) and anode to the negative fan wire (the FANx- terminal on the Duet).
  • Brushed DC motors may have high start currents, which may exceed the rating of the mosfet.
    • Before connecting a brushed DC motor to a fan output on the Duet, use a multimeter to measure its DC resistance several times.
    • Rotate the motor shaft slightly between readings and take the lowest reading you see (ignore any transient readings while the shaft is being rotated).
    • Divide this value into the V_FAN voltage (typically you will use V_IN) to get the peak current at startup.
    • If this peak current is greater than 3A then you should connect a surge reducing thermistor in series with the fan to reduce the startup current. Here is an example of a thermistor that may be suitable:
    • Alternatively, if you have a spare heater output and you are using firmware 2.02 or later then you can use the heater output as an additional fan output (see later). You must always use a flyback diode if you connect a brushed DC motor to a heater output.

Always-on fans

The Duet 2 provide two connectors for fans that should be on any time the power is on. Many setup guides suggest this is how you should wire your hot end fan (but see thermostatic fans, below) to prevent heat from creeping back and melting the filament, jamming the hot end. You may also wish to attach a fan to move air across the underside of the Duet 2, keeping the stepper drivers cool. Simply plug any such fan into one of these sockets, connecting the red wire to V_FAN and the black wire to GND.

If you want to run your other fans on a Duet 2 from 5V but your always-on fans from 12/24V, you can wire them directly across the power supply pins and ignore the Duet's connectors.

Thermostatically controlled fans

As mentioned above, many hot ends require a fan to keep the heatsink cool, so that the filament remains solid until it passes through the heat break into the melt zone. This fan should be on any time the hot end is hot enough to melt plastic, but can safely be off when the hot end is cool even if the rest of the machine is on. The Duet 2 supports this mode of operation. Plug your fan into one of the PWM connectors, say FAN1, and configure it as a thermostatic fan for the appopriate heater by putting the appropriate M106 G-code in config.g. For example:

M106 P1 T45 H1

This sets fan 1 to run any time the temperature of heater 1 is above 45 Celsius. See for details. We recommend you use the FAN1 connector for a thermostatically-controlled hot end fan, because on the Duet 2 it defaults to being on at power up, to provide maximum safety if you restart your Duet when the hot end is hot.

A thermostatically controlled hot end fan will be turned on automatically when you auto tune any heater that it monitors.

G-code controlled fans

Printing PLA (and perhaps other plastics) benefits from additional cooling of printed layers, particularly when layers are printing quickly. That said, excessive cooling can cause problems with first layer adhesion or even interfere with a new layer's bonding to the previous one. Many slicer programs will introduce fan control G-codes to run the fan strongly for layers that print quickly, and only start running the fan after the first few layers. Attach such a fan to one of the connectors FAN0, FAN1, or FAN2. If your slicer doesn't support specifying which fan to control, it defaults to FAN0.

The gcode command to set the fan speed is M106 Pnn Svv where nn is the fan number (default 0 if the P parameter is not present) and vv is the required speed. The speed can be expressed either in the range 0 to 1, or in the range 0 to 255. A value of 1 or less will be assumed to be in the range 0 to 1. A value of 0 corresponds to off, and a value of 1 or 255 corresponds to full speed.

FAN1 is set up as a thermostatically-controlled fan by default because it is typically used to control the hot end heatsink fan. To use it as a normal controlled fan, you must first cancel thermostatic mode by sending M106 P1 H-1.

Allocating fans to tools

Most slicers do not yet support having multiple separate print cooling fans so they simply send M106 Snnn, rather than allowing the choice of which fan is allocated to which hotend.

To solve this, other fan channels can be mapped to fan 0 when a specific tool is selected for example:

M563 P0 D0 H1 ; tool 0 uses extruder 0, heater 1 (and fan 0)
M563 P1 D1 H2 F1 ; tool 1 uses extruder 1, heater 2 and fan 1
M563 P2 D2 H2 F2 ; tool 2 uses extruder 2, heater 2 and fan 2

After this whenever tool 0 is selected, sending M106 Snnn will control fan 0. With tool 1, fan 1 and tool 2 fan 2.

For more examples see the tool definition section of the config.g file.

Connecting 4 wire fans

4-wire fans have a separate PWM input wire. The recommended connections are:

Red (or yellow, if there is no red wire) and black wires: connect them to the + and - pins respectively of an always-on fan connector.

Blue wire (PWM control): connect it to the FAN- pin of your chosen controlled fan connector.

Tacho wire (whatever wire is left, usually green or yellow): optionally, connect it to the cathode of a small signal diode (1N4148 should be OK) and connect the anode of the diode to pin PB6 on the expansion connector, to provide a reading of the fan RPM. Or you can leave it not connected.

In the M106 command for that fan, use the I1 parameter to correct the PWM sense, e.g.:

M106 P1 I1 ; invert PWM of fan 1

Using 12V fans when VIN is 24V

If you need to use 12V fans but your VIN is 24V and all your fans are 12V, then on the Duet Wifi and Duet Ethernet you have the following options using a buck-down converter:

  1. Wire the buck regulator input directly to the VIN terminals, and the output to the centre pin of V_FAN1
  2. Wire the buck regulator positive input to the VIN end of V_FAN, the output to the centre pin of V_FAN, and ground to any power ground connection (possibly the ground side of an always-on fan output)2
  3. Put a jumper on V_FAN at the VIN end. Wire the buck regulator input to an always-on fan output. Wire the positive wires of 12V fans directly to the buck regulator output, and the negative wires to the FAN- pins of the controlled fan outputs as usual3


1 all the fans must be 12V and there is no fuse protection

2 all the fans must be 12V and the input of the buck regulator is protected by the 1A fuse

3 the connection of a 12V fan is more complicated, but you can use 24V fans as well. The buck regulator input is fuse protected

Using a fan connector as a general purpose output

If you use the I-1 parameter in the M106 command for a fan, then the fan is disabled which frees up the pin for use as a general purpose I/O pin that can be controlled using M42.


It may be good to know that according to the 4 wire fan specification the correct frequency is 25000Hz so using M106 P0 I1 F25000 will correctly configure the fan. Also note that Intel fans don’t officially support turning off the fan using PWM, but Noctua fans do.

imqqmi - Reply

There doesn’t seem to be any mentions anywhere of being able to connect the RPM sense of multiple fans since the only mention I see is the connection to PB6. Is it possible to have multiple 4-wire fans with their own RPM sense. I would love to have RPM readout for my extruder cooler and my two parts coolers. It seems like it should be possible but I’m hitting a wall trying to find documentation on how.

Daniel Maupin - Reply

Currently only one RPM signal can be connected.

Manuel Coenen -

Duet 3 will allow the RPM of multiple fans to be read. It’s possible that we may add this facility to Duet 2 as well, because Duet 2 and 3 will share most of the firmware source code.

David Crocker -

That would be awesome if it was added to the 2 as well. There is plenty of spare I/O to use so I wouldn’t think it would be too difficult. The hardest part for me if finding the time to code it. If you end up needing someone to beta test it I do have multiple 4 wire fans on mine to easily do some testing.

Daniel Maupin -

Add Comment

View Statistics:

Past 24 Hours: 43

Past 7 Days: 270

Past 30 Days: 1,300

All Time: 21,571