How can I add an extra fan, controlled by a microcontroller, to my board? I recently discovered this kit after reading this Instructables, Adding More Extruders to Any 3d Printer: 


  


I'm pretty sure I can use this kit with my board since it uses the same drivers as mine. But that's for motors, not fans. And while I know G-code pretty well, I'm not sure how I would use this to activate and deactivate a fan from G-code. There is probably a better way to do this.

The board I am using is from an FLSUN Large Scale 3D printer. Here is a picture of the board: 



There appears to be only one labeled pin for the fan. BUT even if there are other pins that I don't recognize, they would have to be controlled by a micro controller (G-code commands). There appear to be a bunch of un-used pins in the bottom right of the board. But if this board just can't do it, there is a newer board here: [link removed]. 

It does seem like it is using Arduino and the newer board might have extra pins for a fan. But at that point, would it be easier (cheaper) to just control the fan from the extruder extender kit? Would I just set it as an extruder with a really high filament extrusion speed and send appropriate G-code commands when needed to run it at max voltage?

I know on my Lulzbot Mini there is a "parts cooling" fan which allows you to cool off the layers as your structure rises vertically. This is a fan I want. The parts cooling fan must be controlled by the micro controller. It only comes on when printing vertically.

I would like to actually add two fans like this to my 3D printer. One of them is a >= 5&nbsp;V cooling fan like above. Another is a regular 12&nbsp;V cooling fan for an extra extruder that I am adding.
The MKS Gen L v1.0 Board you are using does support microcontroller controlled fans without doing some surface level modification to the board via the D9/FAN. The port you marked FAN is not a controllable port, it runs a direct 12/24&nbsp;V all the time and should be used for the Hotend cooling solution. The ports D7/HE1 and D10/HE0 are for two hotendes, corresponding to E0 and E1.



Variant A: Swappy Fans

This is the more tricky variant and does need both coding and wiring expertise.

You'll have to run both hotend cooling fans via that one port in the top left corner. Make sure they are running fast enough to keep the heatsinks cool and prevent heat creep!

Your custom Firmware will have to define D9 as a microcontroller controlled Fan instead of a 100&nbsp;% running fan as the normal firmware is most likely.

Without extra hardware, you can't get 2 individually controllable ports from D9, but you can use, the fact that you don't want part cooling for a hotends in 'resting' position. So a pair of couple Normally Closed switches cab achieve disabling of the resting hotend's part cooling fan:


make a wire splitter for D9, so that you have both + and both --wires connect to the one +/--pin on the board. You'll have the part cooling fans in parallel now. 


Do the same for the Hotend Cooling Fans!

connect each +-line to a Normally Closed switch, which is installed on the hotend in a way so it triggers and opens the line if the hotend is in the resting (homing) position.
As the line connects when the hotend moves into the build volume, the part cooling fan on the currently active hotend starts to spin while the one of the non-active hotend is isolated.


Variant B: MOSFETs and Safety

An alternate source for the part cooling fan signals might be the SERVOS1/SERVOS2 group, where D4 to D6 and D11 are accessible. This leaves the FAN and top-left 12 V pinnings free for the hotend cooling. The downside is, that these pins don't likely provide 12 V but at best a 5 V digital output. However, a 0 to 5 V signal can be used to control a separate MOSFET which outputs 0 to 12 V, which then can power the part cooling fans. Due to the power draw of the Fans, a simple step-up converter is not a solution it needs a separate power supply.

The Main benefit is, that this does draw less power from the board than Variant A and does not re-pin D9. The "Cooling Fan Board" could use a 6-line ribbon cable to connect to the SERVOS1 pins, using the 5V as reference for the MOSFETs, D4/D5 as the trigger signal and GND as return lines.

A pre-assembled board that could serve in this position would be a L298N Driver. Due to how it is set up, one could run both part cooling fans, if their speed is set up to be always equal.