For my first instructable, I thought I would share how I added a fan to the Prusa Mendel we built at my school, since I had trouble finding precise instructions on how to do so. The main reason for mounting a fan on your X-Carriage is to assist in Rep-Rap bridging functions by cooling the extruded plastic faster, thus allowing the machine to bridge larger distances. The fan plugs right into the Sanguinololu (v1.3a) electronics and is controlled by PWM through the Pronterface software, simple!

In order to control the fan, we need to put together a small electronics package that will take the Sanguinololu's 0-5v command signals and translate them into higher current (12v), which will drive the fan. My solution bundles all of the electronics onto the end of a cable which connects to the accessory pins on the main board, a standard computer fan connector is attached to the end of the cable, allowing you to change out fans / electronics as necessary, a big plus in my book.

Before we get started, a little disclaimer:

I go to architecture school, I have no formal training in electrical engineering. I hold no responsibility for any harm caused by this instructable. That being said, if I made a mistake, tell me!

Oh Yeah - You MUST be able to update your printer's firmware in order to complete this project

Now for the fun stuff  >>>> 

Step 1: Collect Tools and Supplies

1x....... TIP120 Transistor
1x....... 2.2K Resistor
1x....... 1N4001 Diode
1x....... 22uf Capacitor (might not be the best choice, but what I had on hand. 10uf may work better)
1x....... 3 Pin Fan Connector (Harvested from computer motherboard)
1x....... 3-4 wire cable ( I harvested mine from an old computer CD-ROM drive, it had connectors on it that fit the Sanguinololu's pins!)
1x....... 12vdc Cooling Fan (40mm seems to be a good fit)

- Electrical Tape
- Solder
- Heat Shrink Tubing
- Super-Glue

- Soldering Iron
- Pliers
- Exacto Knife
- Wire Strippers
- Handy Hands
- Breadboard 

Step 2: Update Firmware

Firm, not Hard.
In your printer's firmware file (I use Marlin, but the steps are similar for Sprinter and others ), go to the pins.h tab, basically where all of the pin assignments are detailed. Scroll down until you see the Sanguinololu boards. Find the fan pin listed under Sanguinololu, it should be set to -1, change this to 4. Compile your new firmware and upload it to the board.

Easy, right?

Step 3: Make the Cable

Hack The Connector.
We are going to be accessing the accessory pins on the Sanguinololu. The pins we want access to are the 12v pin, the Ground pin, and pin D12, which is the pwm. The pins are layed out in an "L" configuration on the board, which means we need to hack our connector into an "L" configuration. With the 4 pin female connector I had, this was extremely easy. I simply used an exact knife to sever one of the holes from the other three, and used Super-Glue to re-attach the two parts in an "L" shape. Just take care not to cut into any of the holes or cut into any of the wires and you should be fine. Check out your Sanguinololu board if you are wondering how to glue the parts together. The GND pin should be on the bottom left with the other three pins up top, hooking into the 12v, 5v (unused), and D12 pins. I also severed the connection between the 5v pin and my cable to prevent any shorts. Check out the pics below to see what it should look like.

Strip the Other Side.
Just like it says, cut the connector off the other side of the cable and strip the wires ( I had a red, white, and un-insulated cable which ran to both center pins).

Next Step: Prototype

Step 4: Prototype

Break out the Breadboard.
Consult my simplified circuit diagram below and lay everything up on the breadboard.

A few things to note:

The silver stripe of the Diode should be on the side connected to the +12v wire and positive lead from the fan. The other leg connects to the negative fan lead.

The side with the silver stripe on the Capacitor should connect to the Emitter of the Transistor (right leg when looked at with the writing facing you). the other leg connects to the Collector and negative lead from the fan.

Test It!
Plug the +12v, GND, and D12 wires into the correct positions as indicated in the diagram and plug the other end into the corresponding pins on your Sanguinolou. Power up your printer and corresponding software and type M106 S255 into the G-Code command line, you fan should start when you send the command. Typing M106 S0 should turn the fan off. You can enter any value between 0 and 255 after S, and it will set your fan to the corresponding speed. If you don't feel like dealing with the software, just hook up 12v and GND wires from a PSU as usual and connect a 5v lead from the PSU to the resistor, this will at least let you know everything is connected O.K.

If everything is working up to this point then congrats! You are ready to solder it all up, if not go back and try to figure out what you did wrong. You can PM me for help too.

Step 5: Make It Permanent

Solder Time.
I chose to solder everything together without a perfboard, right at the end of my cable. It was a little tricky to cram everything together and make the connections, but with a steady hand and a small soldering iron tip, its totally achievable. You could also put everything on a board, but I think having the whole package in one cable is pretty nice. I used a lot of heat shrink tubing to keep everything insulated, and then used a big piece to keep it all together after I was done. The fan connector pokes out of the end, making it possible to change fans without having to splice wires.

Pretty slick!

Now just plug everything in and mount the fan on your X-Carriage. There are lots of X-Carriage designs on thing verse with a built-in fan attachment, or you could just use zip ties, like me.

Step 6: Enjoy Upgraded Bridging Capability

The only thing left to do is change the cooling settings in your G-Code program (In Slicr the settings are under the Filament tab) and figure out what to print.


And please vote for this project in the UP! contest.
<p>It works! But I really don't understand why pin 4 corresponds to D12 on Atmega 644P. Could someone please enlighten me?</p>
<p>This was a confusion for me too, but it can be cleared up by looking at the Sanguinolulu PCB: <a href="http://reprap.org/wiki/File:Sanguinololu-photo-top.jpg" rel="nofollow">http://reprap.org/wiki/File:Sanguinololu-photo-top...</a></p><p>If yo look at the look at the connector at the bottom right hand side, there is a connector pin labeld PWM/D12, If you follow the trace in the photo, it goes to Pin 5 of the processor. Pin 5 on the 644, is PB4 which is **Arduino D4**.</p><p>I don't know the history of the SanguinoLuLu board or connector, but the connector D12 label is not the same as the Arduino D12!</p><p>The schematic for the Sanguinolulu is here: http://reprap.org/mediawiki/images/f/f5/Sanguinololu_1.3a.png</p>
<p>Hi! I did it!! It works fine, its a simple circuit. I chose this way, it seems simpler, and because don't like using that much tape.</p><p>I added two more pins, one is 12v and the other is 5v in order not to lose them, maybe in other case I'll need to use them</p><p>Thanks!</p><p>Mart&iacute;n</p>
<p>Hey,<br>Thanks for putting this up :) Seems like this is the only tut on the net about attaching fans to Sanguinololu!</p><p>Could you help me understand what the capacitor is for? I know a little bit of electronics but I dont see what the capacitor is doing in the circuit.<br></p><p>Thanks :)</p>
Thanks. I made a fan controller based on your instructable and it seems to work fine (though I haven't used it for printing yet).
It's perfect! I want to have two pins with this option, so i can control a fan and a Led. Do you know if it's possible with a Sanguinololu ?

About This Instructable



More by jackricci:Make Living Copies of Your Favorite Plants... Automagicallly Add a Cooling Fan to your Rep-Rap (Sanguinololu) 
Add instructable to: