A 5V to 12V PWM converter

Here is a list of what I used to add a regular 12V PC chipset fan to you my Sanguinololu v1.3b (should work on v1.2 or superior) :

  1. A 2-pin 40mm 12V fan (3-pin should work too using the 12V and GND pins only)
  2. An IRLMS2002 SMD MOSFET
  3. A 10 kOhm SMD resistor
  4. An SMD Schottky diode
  5. Three 2-pin connectors (one for the FAN, two for the Sanguinololu)
  6. A piece of heat-shrink tube
  7. Some wire
  8. Some Kapton

The idea was to use the 5V PWM pin from the Sanguinololu to pilot the 12V fan. In order to do so, I used a simple MOSFET and a 10 kOhm pull-down resistor. I also added a flyback diode to the fan that the MOSFET is controlling. Of course, if you have a 5V fan, you just need the flyback diode.
In order to have a nice connector for the fan and no piece of PCB hanging, I tried to fit everything inside the heat-shrink tube.

The schematic of the converter : Fan-Schematics.png

Building it

I first soldered the diode directly on the 2-pin connector.

IMG_20140317_113359.jpg IMG_20140317_115021.jpg

Then I soldered two of the MOSFET Drain pins on the 2-pin connector GND pin (on the other side of the connector this time). The blue paste was some nail polish I put to isolate the 12V pin, but it did not work as expected since the heat was melting the nail polish... Eventually, I had to use some Kapton instead, but this is not shown in the pictures.

IMG_20140317_151757.jpg

The last component needed was the pull-down resistor I soldered between the Gate and Source pins.

IMG_20140317_172754.jpg IMG_20140317_172821.jpg

Here is the final result with the protecting heat-shrink tube :

IMG_20140317_174624.jpg

To connect it to the Sanguinololu, I used two 2-pin connectors : one for the 12V and GND pins, and one for the D12 5V PWM pin (leaving one hole of the connector empty).
It had be connected as follows :

Sanguinololu_connector.png
IMG_20140913_153431.jpg

I then printed these nice fan mount and duct from Thingiverse, and mounted everything in place.

IMG_20140913_153626.jpg IMG_20140913_153708.jpg


Final touch

From a software point of view, the fan needed to be enabled with the proper pin in the Sanguinololu firmware. I'm using Sprinter as firmware, so I had to edit Sprinter/pins.h, and replace

#define FAN_PIN -1

by

#define FAN_PIN 4 // D12 PWM pin

in the Sanguinololu pin assignment (MOTHERBOARD == 62).

Once the firmware rebuilt and flashed, I had a working fan mounted on my Prusa i3 !