photograph of a MOSFET MOS module sitting infant of 5015 part cooling fan, used to fix broken fan ports on 3D printer boards.

External MOSFET Controlled Fans


Broken 3D printer fan port ? Run an extra controllable part cooling fan or a 12V fan on a 24V printer ? Follow our External MOSFET Controlled Fans guide.

a photograph showing MOSFET's within their protective anti-static holder. MOSFET's are particularly susceptible to static energy.

Firstly what is a Metal–Oxide–Semiconductor Field-Effect Transistor (Say that when your drunk) or better known by its acronym as a MOSFET. In short MOSFET’s are used to switch and or act as an amplifier of the received signal. Quite often they are used to relieve the current load on an electrical component so a particular part is not damaged.

However in the case of a 3D printers fan port we are going to be using its ability to adjust a PWM signal. Pulse-Width Modulation is used to “Pulse” a signal length either faster or slower in order to change the power output to the fan. Consequentially instead of a flat on and off switch we now have a digital means of controlling an analogue fan. Perfect for controlling our 3D printers part cooling fan.

Required Items

Affiliate Links Below:

Mosfet Driver Module

3 Pin Dupont Connector

3 Pin JST-XH 2.54mm Pitch Connector

26 AWG Cables

Assembly

Connecting an external MOSFET module to a fan in order to control its power output is a simple affair. Especially if the purchased module is preassembled, then all that remains todo is the cable wiring. (See Required Items list above)

3D Printer Board to MOSFET Board

close-up photograph of the MOFET MOS Module showing the modules 3 pin connector SIG, VCC, and GND used to connect the MOSFET PWM module to the 3d printer board

Firstly think about where you are going to be placing the MOSFET Module. Moreover be sure to measure the cable length required from the 3D printer board to the MOSFET Module. Furthermore 26AWG Silicone cable will be fine for this task.

Moreover on one end of the cable we need a 3 pin JST-XH 2.54mm pitch female connector. While on the other we are going to need a 3 pin DUPONT / JST-SM 2.54mm pitch female connector.

While you can use hand pliers to crimp the connections. However I would recommend using a crimping tool. Personally I found it makes a superior grip and connection.

a wiring diagram showing the connections from a MOSFET MOS Module to a 3d printer. In this case a SKR V1.4 3d printer board. Furthermore from the MOS Module the SIG connects to the signal pin on the SKR V1.4 which is the lowest pin on the jst-xh 2.54mm 3 pin connector. The VCC from the MOS Module connects to the top pin of the SKR V1.4 connection. While the GND from the MOS Module connects to the GND on the SKR V1.4 which is the middle pin.

Before Inserting the DUPONT female connectors into their housing. Ensure to match up the correct connectors from the 3D printers mainboard to that of the MOSFET Module. For Example on the V to VCC, GND to GND, Signal to Signal.

Now connect the MOSFET Module with its new cable. Locate a spare switch on your 3D printer that has PWM. In order to determine this please refer to the mainboard manufactures schematic.

MOSFET Board to Fan

close-up photograph of the MOSFET MOS Module V+ and V- connections. These are connected directly to a part cooling fan.

Next is a nice simple step on connecting the External MOSFET Controlled Fans. Presumably you will already have the wiring that connect the fan to the 3D printer board in place. Simply unplug, cut off the connector and strip the wires back removing the silicone cover. Furthermore you may need to extend the cable slightly in-order reach the MOSFET Module board.

Once the cabling is organised, simply insert positive fan cable into the V+ and the negative into V- terminal connector.

Power Supply to MOSFET Board

close-up photograph of the MOSFET MOS Module VIN and GND connections. These are connected directly to the power supply. The voltage max be the same as the attached fan. For instance if 12V 5015 fan is used then the MOSFET VIN and GND must be connected to a 12v power supply psu or buck convertor.

Another simple wiring step if you are running the fans at the same voltage as the board there may be a spare pin that you can use to power the fan then simply strip back the wiring and insert the positive into VIN and the ground into GND.

However if you are wishing to use a 12V fan with a 24V power supply you will need to use the lowered voltage from a buck convertor. It is then a simple job of attaching the buck convertors out power cable to the retrospective VIN and GND on the MOSFET module.

Changing Fan Pins in Marlin Firmware

Depending on your usage there are some simple changes that need to be made within the 3D printers firmware. Below are example of these setting changes within the Marlin 2 Firmware.

A point of note – If the fans don’t initially work some boards require the #define FAN_SOFT_PWM option to be enabled. Moreover this can be found within the Configuration.h file. However in this example the SKR V1.4 does not require it to be enabled on the P1_00 port.

Furthermore the port used in the below examples with the SKR V1.4 is purely for example purposes. Importantly you can use another port if required.

What to disable ? In order to enable

screenshot of the pins_BTT_SKR_V1_4.h configuration file for the bigtreetech skr v1.4. This screenshot shows disabling the PS_ON_PIN and POWER_LOSS_PI. Allowing the use of an external MOSFET to help fix broken 3d printer boards fan ports.

Regardless of what pin you decided to use, any reference to that pin connector needs to be removed. So that it will not cause a conflict and confuse Marlin with duplicated pin configurations.

Furthermore the below examples are using the SKR V1.4 pins file. While the path below showing where the pin file is located.

Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h

In the example of using pin P1_00 it is currently associated with the Power Supply Control and the Power Loss Detection.

Simply disable the #define PS_ON_PIN P1_00 and #define POWER_LOSS_PIN by placing two forward slashes in front of the options.

Remember this is only example of disabling previous pins that had been associated with the pin now being used by the MOSFET module.

//// Power Supply Control
//#ifndef PS_ON_PIN
//#define PS_ON_PIN P1_00 //MNV – A reminder where disabled
#endif
//// Power Loss Detection
//#ifndef POWER_LOSS_PIN
//#define POWER_LOSS_PIN P1_00 //MNV – A reminder where disabled
#endif

Extruder Cooling Fan

Within the Configuration_adv.h file within Marlin there is the #define E0_AUTO_FAN_PI N which is used to assign the extruder cooling fan to its correct pin number.

Continuing with the example PIN number of P1_00, replace the -1 with the pin number.

screenshot of Marlin 2 3d printer firmware showing the extruder part cooling fan PIN number configuration.

#define E0_AUTO_FAN_PIN P1_00

Additionally you can alter the required fan power output and what temperature you would like the fan to kick in. Furthermore by default the 255 fan speed is equivalent to 100%.

#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255

If you haven’t already don’t forget to disable any references in the 3D Printers Board Pin File as mentioned in the What to disable ? In order to enable section.

If you are running a dual extruder setup with limited switch inputs available, you can use the same MOSFET module. IF and only IF, the MOSFET module supports the combined amperage of two fans. Normally its around 0.3 – 0. 6 A each fan. However always double check. Additionally you will need to place an adequate heatsink on the MOSFET to help keep it cool.

Within Marlin you would simply define the same pin for both extruder auto fans. This will cause the fans for both extruders to kick in when one or the other extruders reaches the desired temperature.

#define E0_AUTO_FAN_PIN P1_00
#define E1_AUTO_FAN_PIN P1_00

That’s it for setting an extruder cooling by using External Controlled MOSFET Fans.

Chamber Cooling Fan

However perhaps you want to setup an enclosure cooling fan, using External Controlled MOSFET Fans that again kicks in with a predefined temperature. It is the exact same principle as the extruder cooling fan.

Furthermore set the chamber fan PIN number and the desired temperature and speed settings within the Configuration_adv.h file.

screenshot of marlin 2 firmware configuration for assigning a pin or connector to control a fan used within a 3d printers enclosure. Furthermore this also shows the 3d printers enclosure fan can be set to start at a selected temperature and what at speed will the fan operate

#define CHAMBER_AUTO_FAN_PIN P1_00

#define CHAMBER_AUTO_FAN_TEMPERATURE 30
#define CHAMBER_AUTO_FAN_SPEED 255

If you haven’t already don’t forget to disable any references in the 3D Printers Board Pin File as mentioned in the What to disable ? In order to enable section.

While you can control more than one fan however ensure the total amperage of the fans can be handled by the MOSFET and always use a heatsink on the MOSFET itself.

Part Cooling Fan

Compared to the above methods, when assigning part cooling fans there is just a few extra lines of code to add. Importantly what needs changing is dependent on if this is a fix for a faulty fan port or a 2nd part cooling fan.

Let’s begin by disabling any references to the used port in the mainboard pin file as mentioned in the What to disable ? In order to enable section.

2nd Part Cooling Fan

screenshot of Marlin 2 3d printer firmware showing two extruder part cooling fans PIN number configuration for FAN_PIN and FAN1_PIN. Pin numbers such as P1_00 for a part cooling fan will change depending upon what 3d printer board is being used.
2nd Part cooling fan code

Within the mainboards pin file check if the FAN_PIN is written anywhere. If found, only add the 2nd line of code from below.

However if it is not found then add both of the following lines. While remembering the use the correct pin number for your fan.

#define FAN_PIN P2_03 // Original On-board PWM Fan
#define FAN1_PIN P1_00 // External MOSFET Controlled Fan

Configuration_adv.h file

screenshot of marlin 2 3d printer firmware showing the FAN_MUX settings used in a dual extruder setup. Allowing separate fans to be controlled for each hot end as it is being used and printed with.

One final step in order to setup the 2nd part cooling fan. Found within the Configuration_adv.h file, it sets the correct fan to use with the correct extruder.

The below example is using the SKR v1.4 with a dual extruder and dual part cooling fan. While P2_03 refers to the original PWM fan port and P1_00 refers to the new External MOSFET Controlled Fan.

#define FANMUX0_PIN P2_03 // Original On-board PWM Fan
#define FANMUX1_PIN P1_00 // External MOSFET Controlled Fan

Broken Fan Port Fix

screenshot of Marlin 2 3d printer firmware, showing a single part cooling fan number configuration for FAN_PIN. Pins numbers such as P1_00 for a part cooling fan will change depending upon what 3d printer board is being used.
Replacement faulty fan port code

However for those with a faulty fan port we need to swap the old pin number to the new port in the mainboard pins file. If you are unable to find the definition add the line of code below.

#define FAN_PIN P1_00

That’s it all done, this article should have covered most aspects where you may need to use an External Mosfet in order to control a fan and retain variable power output. As always thank you for reading.

If you found this guide useful, please consider a donation to help keep the Make ‘N’ Print website running. For further information please have a look at our support us page

Thank You


© 2019-2020 Copyright - All Rights Reserved.