Genuine Reseller of
Genuine Reseller of
How to CNC
How to CNC
Questions this blog is aimed at answering:
- I have built my CNC router now what?
- I am interested in a CNC, what software is required?
- What can I do with a CNC?
- What does the term “Tool Chain” mean?
- What CAD/CAM do you recommend?
The process is about the same for all CNC machines whether a 3D printer, laser or a commercial milling center. Basic steps are:
- Create a drawing
- Create the toolpaths (Gcode) and send to the machine
- Watch the magic happen (or in some cases disaster)
Let’s start with the first one. Creating a drawing. First you will need to decide if your application requires a 2D (flat) object or a 3D object. The appropriate CAD or computer aided drafting program can be selected from this requirement.
2D - Let us say you are using a hobby grade laser, you may be able to make your drawing in something like microsoft paint and export as a .jpg. The application may not be appropriate though for something like a 3D printer. In the laser example, we can import a .jpg into CorelDraw or open source programs like Peter Van Der Walt’s Laserweb and get to the next step. You can also get 2D drawings from almost all 3D software, the export file type will depend on the application. In the example of using a CNC router, you will export a 2D drawing in a file format of .DXF which is a 2D format as well.
3D - We can use a free software here or a commercial software. If you are just getting started we advise something like Google Sketchup, it is free to download and you can start using it immediately. If you have never drafted or drawn anything in a CAD program we encourage you to spend a fair amount of time getting used to this. It can be frustrating, there is a huge number of people that go to formal school for designing and drafting and make a great living at it, don’t give up, spend a week or so in there drawing, you will get where you need to be. Consider it adding to your skill set. We will also provide an example in a commercial software like SolidWorks.
Example: Creating a drawing
We will draw a simple cylinder. Let us make it 10mm in diameter and 6.35mm in height. One note here, always be very conscious of your drawing units, mm or inches. If we get to the end and you want a 10mm cylinder and you draw a 10 inch cylinder.. Well, the difference is huge! Another note, concerning milling or routing applications, note we chose to make this cylinder 6.35mm in height, why? One part of this process is thinking ahead at the materials you have available. If you are in the US and plan on making something think of what material is available to you while designing. If the part you want to make is 8mm in height you will need to use ½” or 12.7mm thick material. We chose to make this part 6.35mm thick as the aluminum we have available is ¼” thick.
Now for a 3D printer we need to look at our printer build volume and not go beyond that. Simply put, be forward thinking of your manufacturing capability as well as materials available.
Let us first set units. When you first open Sketchup it will ask you what template you want to use, there are slight variances amongst them but let’s choose one of the millimeter templates. If you have already opened up a drawing go to the top toolbar and select Window>Preferences>Template in this example we will use Woodworking - Millimeters.
File> New> Part
To check units - Tools>Options>Document Properties> Units> MMGS
We could also do this in AutoCAD and several other programs, do a search on CAD programs and find something that feels right to you. Budget will be a major contributor to where you end up.
Note: if we want to build in imperial units your selections above would be for Feet or IPS, respectively. Don’t worry about the machine getting confused on units, our Gcode (G20 or G21) will tell the machine what we are doing.
We now have a clean slate and are ready to draw our circle.
In SketchUp, in the upper tool bar, shapes, use the drop down and find circle. You will now have the ability to chose the plane you want to draw in. In sketch up the Z is blue, X is red, Y is green. Click the circle button and move your circle around these axes, you can see the circle change color, this relates to the plane you are drawing on. This can be very important if you are making something that will use all three planes. In our example we are going to create something in the X/Y plane. How does this relate to our physical machine? On a 3D printer, CNC router, laser, etc X is movement from left to right looking at the machine, Y is forward and backwards and Z is up and down. If you jog your machine and these vary, you will need to change the physical wiring or remap your axis, we won’t go too much deeper here. That may be a different topic for a different blog.
In SolidWorks we need to select our plane in the right hand menu and then click sketch on the upper toolbar tabs then click circle.
We are well on our way now.
In Sketch up, let us make our circle 10mm in diameter. Click on the origin, a circle will appear, note in the bottom right hand side of the screen you see radius, recall radius is half of diameter, so let’s enter via your keyboard 5mm.
In SolidWorks, click on the origin, we chose the top plane, draw a circle and note the radius is shown in the left hand column, again choose 5mm.
Now, let us extrude the drawing 6.35mm. In SW, click the features tab, click extrude Boss/Base, type 6.35mm:
Now click the green check mark in the upper right hand corner of the screen.
In Sketchup, in the upper toolbar click the push/pull icon and hover over your circle. Again type your distance via the lower right hand distance box, 6.35mm.
Nice! We now have a 3D model, congratulations!!
Now the next steps will be determined on what manufacturing process we are going to use, 3D printer, milling, router, laser, etc. Our current model means nothing to these machines. What our next step will be is making this model into something a machine can understand. Probably a good idea to save these models now. Just click save in whatever program you are using.
Example: Creating tool paths
Let us pick up right where we left off. Let us start with the 3D printer example. We are going to export our model from above in a .stl file. This can be kind of a booger in sketchup. If you go to file>export>3D model, you will note a couple of selections in the file type drop down, but they do not match .stl file extension type. What you will need to do is google “sketchup stl extension” follow the steps provided in the extension warehouse. We won't go into much detail here, other than it can be frustrating, but not too bad. Once you can get the extension to work, now you can go to file>3D model> .stl. Save your file type.
In Solidworks this is super easy, File>SaveAs>(file type).STL.
Now let’s look at what is required to get a file for CNC machining process. The file type required for these operations is .DXF.
Again in SketchUp we need to install a plugin. In SW it is as simple as file>save as>DXF. A note on saving DXF files. Prior to saving our file we need to adjust our view. What direction will our endmill enter the plane? Recall we will be milling in the X/Y plane on a 2D sketch and our end mill will be entering the workpiece in the Z direction, therefore we need to adjust our view to be looking directly down at the model we created. As an example let’s take the SW model.
Here is exactly as the screen left off after we extruded the part. If we save this file as a DXF in this view we get:
Our next process would try to machine this directly, not what we want. Think in this way, what shows here will be machined or drawn on the 2D X/Y plane. We are looking for a cylinder.
So we need to adjust our view in the model to be looking down on our cylinder and now our DXF output looks like:
This is exactly what we want.
Model view does not play as important of a roll in STL files as we can rotate the part.
One other note, .STL files are not just for 3D printing. We can do more advanced machining with a good program by importing .STL files into a CAM software and do things like waterline roughing and finishing. We are not going to go into detail on this here, that is a much more advanced topic.
Alright, for our 3D printer we have an .stl, for our machining we have a DXF. So far pretty easy right?
Let’s move on to the next process. Creating G-Code. We need to change our drawing into something the controller can understand.
G-code is a set of commands sent to a CNC machine that translate to bite size pieces of movement. Move to X 350, move down Z -3.1, move to Y 25, it really is all there is to it and this is what a CNC controller understands. There are commands to go to the home position, turn a spindle or extruder on, turn on mist systems, etc.
3D printer - let’s use another free program here, repetier host. Repetier host will allow your 3D printer and laptop to communicate, send gcode. This is a single download to take care of two processes. Simplify3D is a paid for example.
Example: Creating toolpaths/Gcode
3D Printing - Let us open up Repetier Host:
You may be able to simply hit the connect button if you are on a RAMPS controller. This will connect your 3D printer to your machine. If not you will need to investigate what drivers are required, quick google search will render what you need.
Now let us add our cylinder.stl file to repetier host. Click the “+” symbol on the upper right hand side, or simply drag and drop your file into the screen.
Don’t worry if your model is rotated, you can can use the tools at the top of the Object placement window to rotate it and lay flat. Do make sure it is positioned completely flat on the build surface, just click the lay flat button.
Now let us create the gcode. Go to the Slicer tab. Click configuration. We must tell the machine what is attached. This will be much like CNC example below, we need to tell the machine how fast we want to move, what size tool or, in this case nozzle is attached, etc. Many of these parameters are based on your machine rigidity, hot end, etc. A good place to start is with the default parameters with 3D printing. You will need to know your nozzle size, your filament diameter, your base filament temperature for extruding and suggested bed temp. Slicer will make suggestions, they are a good starting point. More advanced setting will not be covered here.
We just used default setting. Hit save and it will go back to the Repetier host screen. Now click Slice with Sli3r. You just created Gcode.
You should be able to simply hit play, the machine will home itself and start the print.
CNC routing or milling machine - there are numerous options on the next step as far as CAM software goes. We really like CamBam and will use it to explain the process here. Again there are numerous options, this will be controlled by your budget and feel. In our opinion, the more you spend here the more you get, google “CAM software”. There are free options and we suggest this to get started, once you have moved into more complex machining you may find the limit of free softwares. CamBam is free to use, with limits, for about 40 uses.
Machining - We have our file, let’s change it to something useful in CamBam.
Open up CamBam:
We are looking down at our X and Y, basically the spoiler board of your CNC router, or bed of your mill.
Next, on the top bar click the open file tab, and let’s find the DXF you created previously, in this example the cylinder.dxf file.
Perfect, a few small steps that are just good practice, we won’t go into detail, but highlight the entire part, right click in the screen, Edit> Join, select the entire part, right click Transform> Align> left= 0, bottom = 0, upper = 0, this will move the sketch to where home is in the bottom left. We do the transform as we personally prefer the starting point to be on the lower left hand corner, wherever the red and green lines bridge in the center will be the physical starting point of the machine with respect to the cut you will be making.
Excellent. Now comes the part you will spend most of your time on during a very extensive machining process, this example will be easy. If you were making something with complex geometry, multiple tool changes, finishing passes, etc, drawing the part and actual machine time may be less than the time you would spend here creating tool paths.
Ok now lets create our tool path for this piece. We need to first know the tool we will want to use to cut this part on a mill or a router. We are going to get much more specific here and say that we want this part cut on an R7 CNC with a 3.175mm single flute end mill and our material is aluminum that is 6.35mm or ¼” thick.
Highlight the circle and click on the brown colored circle button the top of the toolbar, called profile.
We want our disk to be 10mm on the OD. On the right hand side of the screen you will see a box that states Inside/Outside, we want outside, if we were looking to create a 10mm hole we would choose inside. Basically it’s where the tool will do work.
Next we want to set the depth increment box, this will be what you hear people refer to as depth of cut, basically how far down will each pass in the X/Y plane will be. We cannot use a 3.175mm tool to make one pass at 6.35mm depth. Well.. you probably could but the cut would look terrible, and you most likely will break the end mill prior to making all the way through. For now let’s just leave this at .4mm.
Next is the target depth, recall we want to cut all the way through this and the metal is 6.35mm thick. Also note that we are cutting down into the Z plane, there is much more to this but we are going to do it a particular way, once you have made a few cuts you can experiment with where you want your Z height. Let us set this at -6.35mm.
The next box is a big one. Have you heard the term feeds and speeds? Check out our blog post on this. There is a ton to feeds and speeds. We simply can’t dive into all that in this post, you are probably tired of reading this by now.. :). For now let’s set this at 450, this translates to 450mm/m.
The next one is the same way, feeds and speeds stuff, for now let us set this to 10.
The last box is tool diameter, there are some awesome tricks we may go into in a more advanced blog post, but for now let us put our tool diameter at 3.175.
Well guys we are ready for the next step, creating Gcode.
In the upper left hand box, as shown above you see a tree, one is labelled Machining. Right click this and hit Produce Gcode.
Save the file as cylinder.gcode.
We have rotated our screen to show the tool paths, in green.
This is the physical path the tool will take on your machine.
There are so many more advanced options available, we are simply going over the top level here. We may later produce a blog post about these advanced options.
A note here, we have now created G-code that is ready to send to our machine. It may seem as though this all is a very long and complicated process, but we want to state here that after a few times doing this you will be able to create this drawing, export, create tool paths and Gcode for this example in under 15 minutes.
We will now send this code to our machine. Much like Repetier host above we need to communicate our Gcode to our machine. In this example we will use a TinyG as the controller and a free web based program called Chilipeppr by John. The hardware side of things will not be covered here, we will assume you have your machine set up and wired into the controller. If you need an example please look at the R7 or OX manual for more information about connecting your machine to the TinyG.
Let us open google chrome and search Chilipeppr.com/tinyg. You will instantly see the interface open up.
If this is the first time you have used this, you will need to download the Serial port JSON server, this is the box in the lower RH corner of the screen above. Download, unzip the file, and open SPJS.exe. If you have the USB cable running from the Tinyg to your laptop, refresh Chilipeppr, click the port list tab in the Serial port JSON Server window, and click the checkbox next to the TinyG com port and you are now connected.
You will want to jog your machine, via the Axes widget on the upper right hand side of your screen, you will most likely need to expand this window if this is your first time. Do this by clicking the down arrow at the top of this window to reveal:
Jog the machine to the lower left hand corner of the spoiler board. Lower the end mill to the surface of the material you are going to machine, in our example a 6.35mm thick piece of aluminum.
Now click, in the jog or Axes window, Set G54 to zero, then click set Machine Zero, then click set G54 to zero again.
Your machine is now zero’d. Drag and drop your cylinder.gcode into the window.
In the image above we are not connected to the machine so our Serial port JSON window does not show the correct port, yours should.
Now turn your spindle on. On the R7 this will be with your VFD, on the OX this will be via the spindle speed control. Crank it up to about 10k RPM.
On the left hand side of the window you will see a Gcode widget window. Hit the play button.
Enjoy. If you are chattering slowly turn down the spindle speed, for more on this please see our speeds and feeds blog post.
That is it, these are highlights, there is so much more you can do, we wanted to provide this simple example to get you started. Begin experimenting with different settings and more advanced files. You will be creating amazing things in no time!