Up to this point, I’ve been able to mechanically assemble my ZTW CNC router, wire it electrically and find a shelving system to store it. I also came up with a way to mount my Dremel tool to it and move the axes manually using Mach3. So far, so good, but the real beauty of a CNC machine isn’t manually jogging it, it’s programming a code and letting it cut things for you. Here’s a couple of my first cuts using automatic computer control. I’ll explain how it’s done after the break.
This is accomplished via something called “G-Gode” or General Code. In addition to CNC routers, it can be used for milling machines, lathes, water jet machines, CNC punches, or nearly any other CNC machine you can think of. Possibly you have some vague idea of how it’s programmed, but if not, I found a series of tutorials on Youtube about basic CNC G-code programming. Like with my router, they are using a version of Mach3 which is a bonus. Here’s the first video for an introduction to everything.
So after watching this video, I decided to program a simple cut using G-Code. It’s really not that hard, the “G0” command causes the motor to run at the maximum speed rate, so it’s not for cutting, and using “G1” lets you specify the speed rate. The way I programmed it is to go from point-to-point. If it’s at an angle it interpolates a straight path between the two. The results are the second, “Z-shaped” cut. Here’s the G-code used to produce this:
Watch the video series embedded above for some background on this, but “g1” is to go at a certain feed rate, specified by the “fxxx” command (f200 in this case). Xx, Yx, and Zx are the position that the router will go to. G0 isn’t for cutting, but makes the router traverse at full speed.
To load the program in Mach3, just go to file-open and search for the gcode file you’ve generated. It can be written in any text editor or generated with CAM (computer aided machining) software. If you’d like to try this code, just copy and paste what’s written above into Wordpad, save it, then open (you may have to specify “all files”) in Mach3.
The square cut was generated using Inkscape and an extension called Gcode tools. I haven’t figured out everything with this yet, so that’s good material for another post. Here’s the G-code I used for this.
(Generated by gcodetools from Inkscape.)
(Using default header. To add your own header create file “header” in the output dir.)
G21 (All units in mm)
G00 X3.985218 Y25.565561
G01 Z-0.125000 F100.0(Penetrate)
G01 X22.985219 Y25.565561 Z-0.125000 F100.000000
G02 X25.106540 Y24.686881 Z-0.125000 I0.000000 J-3.000000
G02 X25.985219 Y22.565562 Z-0.125000 I-2.121321 J-2.121319
G01 X25.985219 Y3.565569 Z-0.125000
G02 X25.106538 Y1.444232 Z-0.125000 I-3.000038 J0.000000
G02 X22.985219 Y0.565546 Z-0.125000 I-2.121320 J2.121299
G01 X3.985218 Y0.565546 Z-0.125000
G02 X1.863898 Y1.444232 Z-0.125000 I-0.000000 J2.999984
G02 X0.985218 Y3.565569 Z-0.125000 I2.121358 J2.121337
G01 X0.985218 Y22.565562 Z-0.125000
G02 X1.863897 Y24.686881 Z-0.125000 I2.999999 J0.000000
G02 X3.985218 Y25.565561 Z-0.125000 I2.121321 J-2.121320
G01 X3.985218 Y25.565561 Z-0.125000
(End cutting path id: rect2987)
G00 X0.0000 Y0.0000
(Using default footer. To add your own footer create file “footer” in the output dir.)
So that’s it for now. The machine is functional, but I still have a lot to do to learn to use it well. Stay tuned as I perfect my CNC techniques, and hopefully at some point it will lead to even cooler projects. It should be a great tool once I get everything worked out! Update 12/15/2011: It’s come a long way, check out this post about milling your router to make it flat or this one about choosing the right CAM software.
For more information, check out these posts about wiring the router, modifying a shelving unit for it, or this post about assembling the router itself! If you’d actually like to buy one of these kits, Zen Toolworks sells them. I’m using a 7×12 model.