DIY CNC Router
I've been thinking of making myself a benchtop CNC machine for a while now. I worked with a group of friends and fellow students to make one as our Senior Project at the University of Cincinnati. We got it functioning towards the end, but it wasn't the smoothest machine you'd seen. Now that I've got a little more cash and I'm not under any time constraints I've decided to take another swing at this. I plan on taking what I learned while building the previous machine and some things I've found since and building a better, maybe even cheaper CNC Router.
For starters I'll be setting the design and control software up using a prepackaged version of Linux Ubuntu called LinuxCNC. You can download the live CD and get help and more information from the website LinuxCNC.org I'll go more into depth on LinuxCNC and the included CNC control software later on. First we'll need to design parts to mill with our CNC Router.
If you aren't familiar with the program, Google Sketchup is a free CAD program that's pretty easy to learn. There is a professional version you can purchase, but the free version provides more than enough features for the everyday hobbyist.
In order to install/run Sketchup on linux you have to follow these steps.
- 1) Make sure you have the latest version of Wine installed. This can be done using the Ubuntu Software Center.
- 2) Download the Sketchup Installer for Windows from Google's web site.
- 3) In a terminal window run "wine /tmp/GoogleSketchUpWEN.exe" and complete the normal install procedure. Note "/tmp/" should be replaced by the location you saved the sketchup installer to. You should then be able to run Sketchup by going to Applications->Wine->Programs->Google Sketchup 8->Google Sketchup.
- 4) You will most likely get an error message the first time you try to run Sketchup complaining about GL something or other. To fix this go back to the terminal window and run "wine regedit".
- Go to HKEY_CURRENT_USER\Software\Google\SketchUp8\GLConfig\Display
- Double click HW_OK, change the value to 1, and click ok
You should now be able to run Sketchup on linux. If you still have problems there's an entire Wine Wiki page dedicated to running Sketchup on linux
While Sketchup is a great easy program to create designs and drawings with, the free version does not contain a native way to export your design to G-Code. G-Code is the language the CNC uses to tell the motors where to move the cutting tool. Lucky for us, others have created tools we can use to take a part/design from Google Sketchup and convert it to G-Code to run in our CNC application to bring our designs into reality. This is a 2 step process where we'll export our design from Sketchup in STL format. We can then open this STL file in a program called PyCAM that will spit out G-Code for us.
- STL Export Plugin
First we need to download and install the Sketchup plugin that will allow us to export to STL format. This site has a link to download the plugin and install instructions. To install the plugin all you have to do is place the files downloaded in the Sketchup plugin folder, which should be something like "C:\program files\google\google sketchup [VERSION]\plugins". The next time you run Sketchup you'll find the plugin under the "Tools" menu. When you run the plugin select the same units you designed in to export, then select "stl", and save the file somewhere you can find it later.
|STL Export Plugin|
- PyCAM G-Code Generator
- PyCAM G-Code Generator
The program we'll be using to convert from STL to G-Code is PyCam. You can download it using the Ubuntu Software Center. You'll need to make sure you have Python from the software center in order to run PyCam. Now before you leave the Software Center you'll want to download the Python Specializing Compiler aka Psyco. Psyco is used to speed up python programs like PyCam.
Now you're ready to run PyCam and generate your G-Code tool paths. Once you open PyCam select File->Open Model and select the STL file you exported from Google Sketchup. Your model will show up in the PyCam Visualization window.
The first thing you'll want to do is go to Settings->Preferences. Under GCode change the safety height to a much lower level. I've set mine to 2.
Next select the Tool tab and modify or create the tools with what your router will be using to cut your parts. I plan on using drill/milling bits, so I select the Cylindrical tool and change the diameter to that of my bit, 3/64" or about 0.0469". Also, Make sure you adjust your feedrate setting or you will break your bits or worse, your machine.
The Processes and Bounds tabs can be left alone. Now on the Tasks Tab uncheck Rough, make sure that Semi-finish and Finish are checked, and change the Tool for both to the Cylindrical tool you set up earlier. Select Generate All and let PyCam do it's business.
|PyCam GCode Generation|
Depending on the complexity of your part this can take some time to complete. Just be patient and remember the old saying, "A watched pot never boils." When it's done you'll see a new tab in PyCam called Toolpaths with a count of the tool paths created. On this tab you can review the toolpaths generated including machine times and a simulation of each tool path. If you're satisfied with the simulated results select Export All and save the G-Code tool path.
LinuxCNC In progress... LinuxCNC and EMC2
- Machine Configuration
- Open File
The cheapest stepper drivers that I could find were these Easy Driver Boards from Sparkfun for $15 each. To drive 4 motors (2 x, 1 y, and 1 z) these would run me $60+S&H. I decided to look into DIY driver boards and found a couple really good instructables that cover a simple, functional 3 axis stepper drive really well. Tom McWire wrote the original instructable and Samr371 wrote a nice follow up with some more details. I ordered the parts for this circuit and built a single driver circuit on a breadboard to drive LEDs since I didn't have any stepper motors yet. It worked so I moved on to making the full size board with a few modifications from the original design. I opted to use a through hole mounted DB25 pin connector instead of the soldercup piece used in the instructables. I also added connection points on the board for limit switches, an EStop button, and a relay to control power to the router. The final modification I've made is adding an extra set of output circuits for running 2 x-axis motors from 1 set of control ICs. You may be able to do this by simply doubling the power resistor (light bulb) value of the other 2 sets and connecting 2 motors to the one output. I'll try changing the value, but if that doesn't work out so well I'll have a backup plan I can use without making a whole new board.
|Test Schematic and Full Schematic|
(Link PCB Express Schematics)
With the design worked out I started looking at fabricating the board. After botching one toner transfer attempt by inverting the bottom trace print out I entertained the idea of having the boards professionally made. If you're willing to spend the extra money you can save a lot of hassle with toner transfer, etching, and drilling the board. There are several different fabrication houses to choose from. I like to use the free ExpressPCB software to create schematics and PCB layouts. It's free and easy to use. They offer a service to submit orders for your designed PCBs directly from the software, but charge $51 + $10 S&H for 3 identical 3.8 x 2.5 inch boards without solder mask or silkscreens. solder masks and silkscreens are by no means necessary, but for $60 I would expect to get them. After some searching I came across a group called DorkbotPDX. This is a group of DIY/Hacker/Innovator types, one of which has started an amazing PCB ordering service, cutting costs by combining several small PCBs into an order for a single large one. They charge a flat $5 per square inch for 3 identical boards and that price includes free USPS shipping in the US. With that in mind I broke my board design down into the smallest 3 identical boards I could.
(Link PCB Express Layout)
With a 1.9 x 2.4 inch board this service would run a whopping $22.80, about a third of the price of PCBExpress. With the individual components of this driver board costing a little over $20 having the boards fabricated will cost you about the same as buying the 3 Sparkfun EasyDriver boards, but those can only handle 750mA while these boards should handle 2A no problem. If you don't want to fork out the extra $20+ to have the boards professionally made, keep reading.
If you don't know the toner transfer method of homemade PCBs I'll cover it briefly here. This process involves using a laser printer to print your circuit design onto glossy magazine pages or pages specifically designed for this purpose. The idea is that the paper doesn't absorb the toner like a normal sheet of paper does. You then align that print with a copper plated board, and transfer the design to the copper using an iron or laminating machine. You then place the board in an etching solution which will eat away the areas of the board not covered by toner. you can then clean the toner off the board revealing your homemade PCB. This process can be tricky and there are many web sites that give good tips and tricks to complete the procedure correctly. From personal experience I suggest you iron longer than you think is necessary, soak the board in water for a whole hour after ironing to make paper removal easy and smooth, and cutting alignment holes in the board and paper before ironing. When you go to print your design for this method be sure to mirror the top layer before printing. Above all, be patient. If the transfer doesn't come out right clean the board with alcohol and try again.
|Toner Transfer PCB Printouts|
Note that the top layer print out above is already mirrored as you can see from the footer text.
DIY Stepper Drivers from Instructables.com In progress...
- Enjoy and feel free to report any problems or suggestions to email@example.com.