Connecting and configuring fans
The Duet supports a variety of fans. Two-, three-and four- wire PWM-capable fans, running at voltages of 5V, 12V, VIN or an externally-supplied voltage (depending on Duet board). Fans can be always-on, thermostatically-controlled, and/or G-code controlled.
Scope
This document is relevant to: all Duet boards
Firmware versions: all firmware versions
Caution
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.
Overview
Table of Duet boards and fan outputs
Duet board | Number of fan headers | Current limit | Supported voltages | ||
---|---|---|---|---|---|
Always-on | 2-pin | 4-pin | |||
Duet 3 MB6HC | 1 | 3 | 3 | 800ma @ 12V), 10A @ VIN (fuse) | 12V / VIN / external power, in 2 banks |
Duet 3 Mini 5+ | - | 2 | 2 | 800ma @ 12V, 7.5A @ VIN (fuse) | 12V / VIN / external power, in 2 banks |
Duet 2 WiFi/Ethernet | 2 | 3 | - | 2A @ 5V (total 5V/3.3V), 1A @ VIN (fuse) | 5V / VIN / external power |
Duet 2 Maestro | 1 | 3 | - | 2A @ 5V (total 5V/3.3V) | 5V / VIN / external power, in 2 banks |
Duet 0.85 | 2 | 2 | - | 2A (total 5V/3.3V) | 5V (extra wiring need) / VIN |
Duet 0.6 | - | 1 | - | 2A (total 5V/3.3V) | 5V (extra wiring need) / VIN |
Board-specific notes
- Duet 3 Mainboard 6HC: the 3-pin jumpers above each bank of fan connectors (OUT3 to OUT6, and OUT7 to OUT9) select the voltage for each bank of fans, of either VIN (10A fuse) or 12V (800mA, supplied by onboard 12V regulator. You can supply a different voltage to the centre pin of the 3-pin jumper, pin VOUTLCx, to run different voltages.
- Duet 3 Mini 5+: the 3-pin jumpers above each bank of fan connectors ((OUT3 and OUT4, OUT5 and OUT6)) select the voltage for each bank of fans, of either VIN (7.5A fuse) or 12V (800mA, supplied by onboard 12V regulator. You can supply a different voltage to the centre pin of the 3-pin jumper, pin VOUTLCx, to run fans at different voltages.
- Duet 2 WiFi / Ethernet: the 3-pin jumper (V_FAN) allows you to select whether all fans (three controlled fan connectors FAN0, FAN1 and FAN2 plus two always-on fan connectors) are powered from the VIN supply or from the Duet's 5V supply. You can supply a different voltage to the centre pin of the 3-pin jumper, pin V_FAN, to run fans at different voltages.
- Duet 2 Maestro has two 3-pin jumpers (V_FAN_A and V_FAN_B) to select fan pin voltages between VIN or the Duet's 5V supply. V FAN A controls FAN0, FAN1 and the always-on fan pins, V_FAN_B controls FAN2. Fans can be You can supply a different voltage to the centre pin of the 3-pin jumper, pin V_FAN_A or V_FAN_B, to run fans at different voltages.
- For Duet 2 WiFi and Ethernet, 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)
General recommendations
- Our intention is that in a 3D printer with a single print head, you define/use Fan0 for the print cooling fan and Fan1 for the heatsink fan. This is the easiest configuration to use because it's what most G-code slicing software (and the firmware, in RRF 2.x and earlier) expects by default.
- If you have a multi-tool setup, you can define the print cooling fan of each tool as part of the tool. This gets around the issue of Slicer software not supporting multiple part cooling fans. See Allocating fans to tools below.
- 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.
- See table above for our recommendations on continuous current draw. However, a current 'blip' that goes over this limit for a few seconds while the fan starts up should not harm them.
Firmware settings
RepRapFirmware 3.x and later
Fans are first defined and configured by M950, then operated by M106.
RepRapFirmware 2x and earlier
For details of the configuration options available see the M106 gcode section
Always-on fans
Most Duet boards provide at least one connector 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 board, 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. Duet boards support this mode of operation. Plug your fan into one of the PWM fan pins, and configure it as a thermostatic fan for the appropriate 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 2 WiFi / Ethernet in RRF 2.x 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/define 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.
In RRF 2.x, on Duet 2 WiFi/Ethernet, 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 3 or 4 wire fans
4-wire fans have a separate PWM input wire and an RPM sensor. On Duet 3, there are 4-pin fan headers specifically for these kinds of fan. On Duet 2, 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 if the Duet WiFi/Ethernet, 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 F25000 ; invert PWM of fan 1, and set PWM frequency to 25kHz
If using RepRapFirmware 3 then apply pin inversion and set the PWM frequency in the M950 command instead.
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 2 Wifi / Ethernet you have the following options using a buck-down converter:
- Wire the buck regulator input directly to the VIN terminals, and the output to the centre pin of V_FAN1
- 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
- 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
- Here is an example implementation of a buck converter being used to power 12v fans and LEDs in a 24v system.
Note that the Duet 3 has an internal 12v regulator so no buck converter is needed.
Using fans with mixed voltages
When using mixed fan voltages, the voltage fed to the centre pin of the V_FAN jumper must be the highest fan voltage in use. You can use a lower voltage fan in the same system by connecting the positive fan wire to the lower voltage supply (e.g. +12V from a buck regulator) and the negative fan wire to the FAN- pin of your chosen fan connector (leave the VFAN pin of that connector not connected).
Notes
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.
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....
- 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.
35 Comments
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 -