Search This Blog

Friday, July 15, 2016

CNC (Computer Numerical Control ) Machines and How They Work


CNC – Computer Numerical Control – Taking digitized data, a computer and CAM program is used to control, automate, and monitor the movements of a machine. The machine can be a milling machine, lathe, router, welder, grinder, laser or waterjet cutter, sheet metal stamping machine, robot, or many other types of machines. For larger industrial machines, the computer is generally an on-board dedicated controller. But for more hobbyist types of machines, or with some retrofits, the computer can be an external PC. The CNC controller works together with a series of motors and drive components to move and control the machine axes, executing the programmed motions. On the industrial machines there is usually a sophisticated feedback system that constantly monitors and adjusts the cutter's speed and position.
Desktop CNC – There are many smaller modelmaker-hobbyist style desktop CNC machines. In general these are lighter weight, less rigid, less precise, slower, and less expensive than their industrial counterparts, but can do well for machining objects out of softer materials such as plastics, foam, and wax. Some desktop machines may run a lot like a printer. Others have their own closed command system and perhaps even dedicated CAM software. A few will also accept standard G-code as input. Some industrial standard desktop machines do exist with dedicated controllers for doing precise small work.
CAM – Computer Aided Machining or Manufacturing – Refers to the use of various software packages to create toolpaths and NC code to run a CNC controlled machine, based on 3D computer model (CAD) data. When the two are used together, this is generally referred to as CAD/CAM.
Note: CAM does not actually run the CNC machine, but just creates code for it to follow. It is also not an automatic operation that imports your CAD model and spits out the correct NC code. CAM programming, like 3D modeling, requires knowledge and experience in running the program, developing machining strategies, and knowing what tools and operations to use in each situation to get the best results. While there are simple programs that for the inexperienced user to get started without too much difficulty, more sophisticated models will take an investment in time and money to become proficient.
NC code – A special relatively simple computer language that a CNC machine can understand and execute. These languages were originally developed to program parts directly at the machine keyboard without the aid of a CAM program. They tell the machine what moves to execute, one by one, as well as controlling other machine functions such as spindle and feed speeds, coolant. The most common language is G-code or ISO code, a simple alphanumeric programming language developed for the earliest CNC machines in the 70s.
Postprocessor - While G-code is considered the standard, each manufacturer can modify certain parts such as auxiliary functions, creating a situation where G-code made for one machine may not work for another. There are also many machine manufacturers, such as Heidenhain or Mazak, that have developed their own programming languages. So, to translate the CAM software’s internally calculated paths into specific NC code that the CNC machine can understand, there is a bridge software piece software called a postprocessor. The postprocessor, once configured correctly, outputs the appropriate code for the chosen machine, so that in theory at least, any CAM system can output code for any machine. Postprocessors may be free with the CAM system or added cost extras.

CNC controlled machines, general

CNC machines can have several axes of movement, and these movements can be either linear or rotary. Many machines have both types. Cutout machines like lasers or waterjets generally have just two linear axes, X and Y. Milling machines usually have at least three, X, Y, and Z, and can have more rotary axes. A five axis milling machine is one that has three linear axes and two rotary, allowing the cutter to operate in a full 180º hemisphere and sometimes more. Five axis lasers exist as well. A robot arm might have more than five axes.

Some limitations of CNC controlled machines

Depending on their age and sophistication, CNC machines can be limited to the capabilities of their control and drive systems. Most CNC controllers only understand straight line movements and circular arcs. In many machines, the arcs are restricted to the principal XYZ planes as well. Rotary axis movements can be considered like linear movements, just degrees instead of distance. To create arc movements or linear movements that are at an angle to the principal axes, two or more axes must interpolate (move precisely in a synchronized manner) together. Linear and rotary axes can also interpolate simultaneously. In the case of five axis machines, all five must be perfectly synchronized – no easy task.
The speed at which the machine controller can receive and process the incoming data, transmit commands to the drive system, and monitor the machine’s speed and position is critical. Older and less expensive machines are obviously less capable in this, much in the same way that an older computer will work less well and more slowly (if at all) on demanding tasks than a newer one.

Interpret your 3D and spline data first

A typical problem is how to set up your files and do your CAM programming so that the machine executing your parts will work smoothly and efficiently with the data. Since most CNC controls only understand arcs and lines, any form that is not describable with these entities needs to be converted into something usable. Typical things that need converting are splines, i.e. general NURBS curves that are not arcs or lines, and 3D surfaces. Some desktop machine systems are not able to understand circular arcs either, so everything must be converted into polylines.
Splines can be broken up into a series of line segments, a series of tangent arcs, or a combination of both. You can imagine the first option as a series of chords on your spline, touching the spline on each end and having a certain deviation in the middle. Another way is to convert your spline into a polyline. The fewer segments you use, the coarser the approximation will be, and the more faceted the result. Going finer increases the smoothness of the approximation, but also dramatically increases the number of segments. You can imagine that a series of arcs might be able to approximate your spline within tolerance with fewer, longer pieces. This is the main reason for preferring arc conversion over simple polyline conversion, especially if you are working with older machines. With newer ones, there is less of a problem.
Imagine surfaces as the same kind of spline approximation, just multiplied many times in the across direction with a space between (usually called the stepover). In general, surfaces are done using all line segments, but there are situations where arcs or a combination of lines and arcs can also be used.
The size and number of segments are determined by the accuracy required and the method chosen, and will directly influence the execution. Too many short segments will choke some older machines, and too few will make a faceted part. The CAM system is usually where this approximation is done. With a skilled operator who knows what the user needs and the machine can handle, it is usually no problem. But some CAM systems may not handle splines or certain types of surfaces, so you might need to convert the entities in the CAD software first (Rhino) before going into CAM. The translation process from CAD to CAM (via a neutral format such as IGES, DXF, etc.) may also occasionally cause problems, depending on the quality of the import/export functions of the programs.

Common conventions used in describing CNC procedures

Your project can be:
2 Axis if all the cutting takes place in the same plane. In this case, the cutter does not have any capability of movement in the Z (vertical) plane. In general the X and Y axes can interpolate together simultaneously to create angled lines and circular arcs.
2.5 Axis if all the cutting takes place entirely in planes parallel to the principal plane but not necessarily at the same height or depth. In this case, the cutter can move in the Z (vertical) plane to change levels, but not simultaneously with the X,Y movements. An exception might be that the cutter can interpolate helically, that is, do a circle in X,Y while moving simultaneously in Z to form a helix (for example in thread milling).
A subset of the above is that the machine can interpolate any 2 axes together simultaneously, but not 3. This does make a limited number of 3D objects possible, by cutting in the XZ or YZ planes, for example, but is much more limited than full 3 axis interpolation.
3 Axis if your cutting requires simultaneous controlled movement of the X,Y,Z axes, which most free-form surfaces require.
4 axis if it includes the above plus 1 rotary axis movement. There are two possibilities: 4 axis simultaneous interpolation (also known as true 4th axis). Or just 4th axis positioning, where the 4th axis can reposition the part between 3 axis operations, but does not actually move during the machining.
5 axis if it includes the above plus 2 rotary axis movements. Besides true 5 axis machining (5 axes moving simultaneously while machining), you also often have 3 plus 2 or 3 axis machining + 2 separate axes positioning only, as well as in rarer cases 4 plus 1 or continuous 4 axis machining + a single 5th axis positioning only. Complicated, isn't it…
Let’s assume you have a working CNC machine that you’ve just acquired, but that you know very little about CNC.  Let’s further assume it is a mill and that you will primarily be focused on cutting metal.  You’re probably ready to start milling custom chopper parts, build a tool changer, or maybe scratch build a Colt 1911 handgun.  With CNC, you can build almost anything and you’re chomping at the bit to get started on your pet projects.
Not so fast!  Remember, you just got the machine and you’re a beginner.  You’re not ready for those projects yet.
Here are 10 things you should focus on to maximize your chances of becoming quickly successful:
1.  Buy Some Decent Cutters

Don’t get the package of assorted sizes of imported Chinese cutters of indeterminate quality.  You don’t need the solid green unobtanium aerospace cutters from Men-In-Black-Cutter-Supply, just get some decent cutters from a reliable source that has reasonable prices like  Try for a name brand, perhaps one that’s on sale at a supplier like Enco.  Knowing you have a reasonable cutter eliminates a whole bunch of variables that govern your success or failure.  I would also go with HSS when you’re just starting out.  You’ll eventually want carbide for a lot of uses, but HSS is cheaper and more forgiving.  Get yourself a few sizes:
–  1/2″
–  1/4″
– 3/16″
Nothing smaller at this stage until you’ve learned on less delicate cutters.  Buy 2 or 3 flutes for aluminum and some 4 flutes for steel.  I’d get 3 of each in each size to start.  You are going to break some cutters, so just get over it and be used to the idea.  It’s a good thing at this stage to remind you to wear your safety glasses because you will break some cutters!
While you’re at it, buy a full twist drill assortment.  HSS from a decent brand on sale will work fine.  I like the idea of replacing the ones I break with cobalt over time.
2.  Get a Decent Vise, a Clamping Kit, and a set of Parallels
Yeah, I know, vises are expensive, but workholding is very important.  Get a decent Kurt-style vise for your mill, it’ll be money well spent on a valuable piece of tooling that will last for years.  In my shop I have used Kurts purchased from eBay and a couple of brand spankin’ new Glacern vises.  There is sneaky stuff that goes on when you clamp a workpiece into the vise.  If you don’t have a good one, the workpiece will shift and you’ll be wondering what happened.
You’ll need a way to mount your vise to the T-slots of your table, so you may as well get a clamping kit too.  Any old kit will do.  Buy the one that is on sale at Enco or some place similar.
Lastly, you’ll need a set of parallels, at least until you get proficient at making step jaws.
3.  Get yourself a misting setup for coolant and use it while being paranoid about chip buildup
If your machine didn’t come with flood coolant, and isn’t set up for it, get yourself a misting setup.  I got mine off eBay for about $100.  It’s a Noga.  There are a lot of different brands.  Get a jug of coolant to go with it.  I use KoolMist, but again, there are a lot of brands.  Now train yourself to be paranoid about chip buildup.  Recutting chips is bad for cutters and in the worst case leads to breakage.  Being paranoid means you’re watching the cut like a hawk and you fiddle with your mister’s nozzle until you figure out how to position it right the first time and every time thereafter to blow away the chips from the cut.  
4.  Learn how to use MDI
Your next step is to learn to run your CNC as though it was a manual mill with power feeds and DRO’s on every axis.  In the process you’ll learn some basic g-codes so that you have some idea what your program is doing the first time you run a real g-code program (that’s a little ways away yet!).  It’s very convenient to be able to do this trick, and you can learn all about it through the .  .  Start out with the cutter way high and don’t try make any moves in the Z-axis so you won’t crash the cutter into anything.  Practice making moves in X and Y.  Until the cutter goes where you want it to and you’re not making mistakes.  One more trick: don’t use G00 in MDI–that makes the machine move in rapids mode which is as fast as it can go.  Use G01 and set a relatively slow feedrate.  “G01 F20” will make the machine move at 20 inches per minute (or metric units if you’re in metric).  You’ll have a lot more time to react this way if it starts heading into trouble.  Visualize pressing the red E-Stop many times so it’ll be almost automatic when you need it.
5.  Get yourself a feeds and speeds calculator and use it

You’re getting close to making your first cuts, so why not do yourself a favor and get a feeds and speeds calculator so you can make sure your spindle speeds and feedrate are perfect for that first cut?
Rules of thumb and setting up by ear have little place in CNC, though they can work out okay but not optimally for manual machining.  CNC is a much tougher work style for cutters than manual machining is.  It’s much more dependent on you to get your feeds and speeds right from the get go.  So get a Feeds and Speeds Calculator.  .   It doesn’t cost much more than 1 single cutter to get started, and you can use it for 30-days completely free.
Best of all, there’s a great deal just for beginners and hobbyists that we call “G-Wizard Lite”:

6.  Get yourself a Z-height measuring gizmo and learn to use it to touch off your tool lengths.  While you’re at it, get an Edge Finder and use it to touch off your Part Zeros.
Your machine needs to know where the tip of the tool is or terrible things can happen.  As a beginner, you tell it by using a Z-height measuring gizmo of some kind.  The gizmo will involve a needle that you lower the tool until the needle is zeroed, a touch plate, or you can even get by with a gage block.  Learn how to use these to tell the machine what your tool length is.  This process tells your machine where the tip is in Z.  To establish the position of X and Y you’ll need and Edge Finder.  The first thing you’ll do after sticking a piece of material in your vise and inserting a tool in the spindle is to set these zeros.

7.  Learn to Tram your Mill and Vise

Tramming is what machinists call getting things square by sweeping an indicator around.  It’s a basic skill everyone needs to learn.  When you first start machining, get into the habit of checking your mill’s tram every time you walk out into the shop.  You’ll know later on whether you need to do it every time, but for now, you could use the practice.  While you’re at it, be sure you know how to tram your vise so the jaws are aligned properly with one axis or the other.  Let’s don’t try to square you mill just yet, but tramming the mill and vise are a good step at this stage.  
8.  Start out with aluminum, brass, and mild steel.  Avoid stainless.
Okay, the very next step involves making some cuts.  Sorry if it seems like you had to do a lot before getting there, but I did say I wanted to tell you some things that will help you succeed and there’s quite a few things in that category!
One more is to avoid difficult materials for your first cuts.  Stick with aluminum or brass.  When you’re doing okay there, graduate to mild steel.  Only after you feel like you’ve pretty well mastered cuts in these materials, you’re not breaking or wearing cutters out too quickly, and your surface finishes no longer look like the material was attacked by a pack of rabies-infected beavers should you even consider a difficult material like stainless steel.  Take a look around some metal supplier catalogs.  Google up “Speedy Metals” for example (Google so you can see some other suppliers too) and look through their site.  Get an idea what “Mild Steel” might be and the different shapes and materials that are available to you.
9.  For your first project, learn how to square a block of material and make yourself a few sets of step jaws in aluminum 

Let’s quit procrastinating and make some chips.  For this step, you’re going to start by learning how to square a block of material. Get your saw and cut out some pieces of material that are slightly oversized to serve as vise jaws.  Google “Kurt Vise Jaw Dimensions” to find drawings of jaws if you need some.  As mentioned, cut the stock slightly oversized from aluminum.  Now you need to square those blocks.  Squaring means you will make a series of milling cuts until all sides are properly parallel or perpendicular to one another, at which point the workpiece is “square”.

One thing about the Turner’s Cube material squaring:  I use a Face Mill, but you should start out doing it with multiple passes and a 1/2″ endmill.   Why?  Because Face Mills generate a lot of force.  You can stall the spindle, yank the work out of the vise and throw it across the room, and other shenanigans a beginner could do without.  Leave the face mill in a drawer if you have one already and do it with a 1/2″ endmill the first time until you know a little more what you’re doing.
Having squared the material, your next task is to cut it to size by continuing to mill it until it is a perfect fit for your vise jaws (you’ll need 2 square pieces, one for each jaw).  The last step is to drill and countersink the mounting holes.
Actually, I wasn’t completely truthful.  Once you have mounting holes, the last step is to mill a step along each jaw, maybe 1/8″ square.  Now you can use that step instead of parallels when you drop material into the vise.  Over time, you’ll learn a lot more tricks with aluminum jaws, but remember: it all started here with your first set.
10.  Graduate to CAD/CAM
Friend, you’re now able to do the basics.  Sure, there’s a lot more learning to do, but you’re in a position to have a leg up on the manual machinist down the street who has a Bridgeport and no CNC.  Your next step is to start pumping out the g-code.  To do that, you’ll need to be proficient with CAD/CAM.  This is going to be your biggest step yet.  Neither CAD nor CAM is very easy to learn.  I give myself 2 weeks to feel comfortable with a new program, and I’ve had the luxury of learning quite a few so far.  If this is your first time, get ready to drink from the firehose.  I wish I could give you a bunch of pointers to make it easy, but unfortunately it isn’t easy and every program is different.  If you can, choose which programs you’ll use based on an ability to get help from someone.  Ideally, help from a friend who already uses the software and is proficient.  If not, consider a course at a nearby community college–it’ll be well worth the time and money spent.  If you have no help available in your area, you’ll have to fall back on the Internet.  Start by watching a bunch of videos.  Try to follow along with your software if you can.  Find the online forums where people go to get help with these programs.
I do have two thoughts to simplify this part of the learning curve.  First, don’t learn CAD and CAM at the same time–it’s just too much.  Start with CAM.  Get to where you’ve drawn 6 to 12 parts in your CAD program and feel like you may not be the fastest CAD operator in the West, but you can get it to do what you need to do.  Once you’ve reached that point, then start to learn CAM.
The thing about CAM is everyone thinks you load a drawing, push a button, and out pops g-code.  Unfortunately, there is more to it than that.  So my second tip is don’t make your first CAM software have to be the one you’ll use for life.  The latter will lead you down the path of loading up on features, which means the CAM package will be even harder to learn.  Right now you want the shortest path to making some parts.  Later, you can consider whether your entry-level CAM needs an upgrade.  You’ll be surprised at how far you can go with simple CAM though, so give it a chance.  The absolute easiest to learn and use package I’ve ever come across is MeshCAM, bar none.  That’s why it is an integral part of Carbide 3D’s Nomad CNC Mill for non-machinists.  It’s also why I decided CNCCookbook should offer to sell MeshCAM to it’s visitors.  We’ll make you a sweet heart deal, even through in a copy of our G-Wizard Feeds and Speeds Calculator at a great combination price.  
Bonus:  Delay the need for CAD/CAM a little while with Conversational CNC
Many talented manual machinists run afoul of CADCAM and it stalls their ability to be productive on CNC machines quickly.  Even after they’ve learned CADCAM, they’re still left with the feeling that manual machining can make simple parts faster than CNC, because they don’t have to stop to make a CAD drawing and run it through the CAM package to get g-code.  Instead, they can just make a simple bracket with 4 holes shooting from the hip.  Conversational CNC makes it possible to do that with a CNC machine.  Imagine changing the long essay test that is CADCAM to a quick multiple-choice quiz.  That’s what Conversational CNC is all about.  Here’s the pictorial menu of Conversational CNC operations that can be performed on a mill:
You pick the operation, a popup asks a few simple questions, you press the Insert button, and you’ve got your g-code.  We’ve built Conversational CNC right into our G-Wizard Editor product so you won’t have to purchase an expensive stand alone Conversational package.
You’ll still need to learn CADCAM, but with Conversational CNC you can be making simple parts before finishing the CADCAM learning curve.