Connecting and configuring fans
The Duet and Duet WiFi support three kinds of fans: always-on fans, thermostatically-controlled fans, and G-code controlled fans. Different 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.
- The Duet WiFi has 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 main (12/24V) 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.
Mixed-voltage setups are not directly supported, 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.
Caution: the fan outputs do not have built-in flyback diodes, 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). The PWM fan outputs are rated to 1.5A max current draw.
The Duet 0.8.5 and Duet WiFi 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 WiFi, 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 WiFi 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 WiFi 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 WiFi it defaults to being on at power up.
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. 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.