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
- Heat Shrink Tubing
- Soldering Iron
- Exacto Knife
- Wire Strippers
- Handy Hands
Step 2: Update Firmware
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.
Step 3: Make the Cable
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
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.
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
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.
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
And please vote for this project in the UP! contest.