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.
Note: I don't think there is a way to install all of the applications for linuxcnc on an existing linux operating system, but you can install a simulator only version to test things out. I was able to get the sim version installed on my netbook running ubuntu 14 following these instructions from the linuxcnc.org site. I did run into one snag. The libgnomeprintui2.2-dev package apparently is incompatible with ubuntu 14, so I removed it from the dependencies in ~/git/linuxcnc/debian/control.in.
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.
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...
I would probably use this most to be able to quickly and reliably create my own custom printed circuit boards. With this in mind I will design the work area around the dimensions of a 2-sided copper clad board you can buy for about $5 at Radioshack. These boards are 4.5" x 6.125". I thought that aluminum angle would provide a sturdy, light weight, affordable frame and set out designing my machine from 3/4 inch aluminum angle.
I decided that two pieces of aluminum angle stacked together would make a nice sturdy rail system for my carriages to ride on. Each carriage will sandwich its rail between bearings with two bearings to ride along the edge of the rail. This should keep both the vertical and horizontal alignment.
|Rail and Carriage|
I decided to run the x axis separate from the y and z axis in an attempt to minimize vibration and associated inaccuracies in the machine. The Y axis is mounted to vertical posts and the z axis affixed to the y carriage.
|Y & Z Rail and Carriage|
Put it all together and add some additional bracing for the finished machine.
The full sketchup model can be found in the 3D Warehouse
Cutting Aluminum Angle
The first step in constructing the machine is to cut your aluminum angle. You can do this with a hack saw, dremel tool, or with a miter or chop saw. I'm cutting mine with a miter saw. If you plan to do the same use an old blade or one you don't mind possibly ruining. A blade with 60, 80, or more teeth is preferable to get a cleaner cut. It's a good idea to spray a little DW40 on the blade or use some wax lubricant to keep the blade and angle from overheating. It's also a good idea to clamp the angle to the fence or table on both sides of the blade to limit the possibility of the angle catching and shooting off who knows where. As you should any time when using power tools, WEAR SAFETY GLASSES. This will create metal shavings and getting them in your eyes really sucks. Trust me.
Drilling Aluminum Angle
If you have a drill press this step is a lot easier. If not you can drill these using a hand drill. Just try to be as accurate as possible. No one is perfect, but the more play you have in these holes, especially on the carriage pieces, the more play you'll have in machine movement. You'll want to spray some WD40 on the drill bit as you drill here to keep the drill bit and angle from overheating.
Images: Carriage Measurements, Drilling
My original plan was to attach a router or dremel tool to the machine for cutting. After talking with a friend I started considering using a high powered laser to burn away etch resist instead.
Turns out it's pretty easy, and fairly cheap to make your very own high powered burning laser. There are several resources online where people discuss making your own high powered laser in great detail. LaserPointerForums.com is a great place to get all kinds of info on lasers. rog8811 posted an image that I used to build my first driver circuit based on an lm317 chip.
Once I started playing around with lasers I learned they were trickier than I initially thought. Laser diodes are apparently extremely sensitive to ESD. They'll also eat just about as much power as you give them until they burn up. I ended up destroying a few lasers before I started to get the hang of working with them. The first one I broke the leads trying to mount it in a flashlight housing. The second one worked for a while, but I think I supplied too much voltage and in turn too much power. At this point I asked the good folks over at laserpointerforums.com for some advise to quit destroying lasers. Their tips in a nutshell:
- Wear an anti-static wrist strap when working with laser diodes
- Use a test load to verify driver current
- Short the driver before attaching it to the diode
- Solder the diode driver connections for reliability
First I test the driver output using a test load made of 1N45404 diodes and a 1 Ohm, 3 Watt resistor. I designed it using plans from laserpointerforums.com. There are a few pages on the subject, at least, and most of them are more or less the same design. If you lack the skills or motivation to build one yourself, jufran88 sells a very nice kit at a decent price. With 4 diodes jumperred in to simulate my diode voltage drop the driver was reading about 1.26 Volts across the 1 Ohm resister, indicating the driver is supplying a steady 1.26 Amps.
Next I mounted my heatsink to a 2 inch by 5 inch, 1/8 inch piece of aluminum that I will later mount to my CNC machine. I applied thermal paste to the bottom of the heat sink to help transfer heat to the aluminum backplate. I also mounted my driver on this piece using plastic standoffs I had on hand.
I placed a 12mm fan behind the setup on my "test bench" and fired it up. I was highly impressed by the results. I pointed the laser across the room at an unfinished wall as I adjusted the focus to test close range effects. Later I noticed there was a nice burn patch on one of the 2x4s just from me adjusting the focus. The beam is strong enough for me to see and I'm confident it will do the job of removing etch resist (spray paint) with no problem.
I will cut another piece of aluminum the same size to mount the 12mm fan to. Then I'll join these 2 pieces together and they will make up my "Etcher head".
- Enjoy and feel free to report any problems or suggestions to email@example.com.