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 an Ethernet) 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.
- 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 Duex2 and Duex5 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, 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 3 to 4A 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: http://uk.farnell.com/epcos/b57236s0250m....
Always-on fans ¶
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 http://reprap.org/wiki/G-code#M106:_Fan_... 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, 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 a fan connector as a general purpose output ¶
If you use the I-1 parameter in the m106 command fort 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.