CNC From the Absolute Basics

by Jon Freeman

Part 1 - Engineering in Miniature - Sep 2013

This is the first in a series of articles designed as a gentle introduction to the subject of CNC, or Computer Numeric Control, and how it might find a place in the home workshop.

We will begin by looking at what makes a CNC machine different from any other machine. Then we will look at some uses we might find for CNC machines in the home workshop, which leads into a look at how CNC machines are used. This introduces the idea of programming but as we will see, a programme is only a list. Anyone who has ever written a list is capable of writing a programme. Will the programme do something useful? Will the programme cause any harm? These are two central questions we'll keep firmly in mind at all stages. Introducing the concept of “Defensive Programming” and encouraging its use, the aim is to show how quickly and easily, and of greatest importance how safely, we can make CNC machines work for us.

To get the most out of the series you do not need access to a CNC machine, but you will find a personal computer (PC) with an internet connection useful, as much of the fun in store will involve looking at 'Mach 3', a widely used piece of CNC machine control software, downloadable from the internet. Figure 1 shows the main Mach 3 CNC Demo software 'Programme Run' screen.

To keep things simple, we'll look at the kind of machines where something rotates and something else moves along straight axes. In normal use of a lathe the work rotates against the cutting tool which may be moved along either or both of two axes. With a drilling machine the drill rotates and either it or the work move in the same axis as that of the drill, and similarly with a vertical milling machine or mill-drill the tool rotates and the work may be moved along any combination of three axes at once. In other words, we are not considering the more exotic machines such as industrial robots used to assemble cars or washing machines on a factory production line, these typically employ advanced kinematics and mechanisms not likely to be found in the home workshop.

How CNC machines differ from their manual counterparts

We make items using a conventional lathe or milling machine by turning handles to move the work against a cutting tool. With a CNC machine, the handles are replaced (or supplemented) by motors to produce the movements, and the motors are driven by a computer executing programmed motion commands. That is CNC in a nut shell. However, CNC technology has opened up new possibilities. Laser cutters and plasma cutters are examples of machines capable of cutting large and complex shapes from plate material. CNC drilling machines capable of drilling a hundred or more holes per minute make printed circuit boards affordable. Modern computers are fast enough to simultaneously control motors fitted to more than one machine axis, enabling CNC machining of shapes that are either difficult or impossible to achieve using manual machines – the typical human machine operator may be quite good at turning one handle at a constant-ish speed, but few can manage to cut a neat looking arc by twiddling two handles at varying speeds at the same time!

In recent years, small vertical milling machines or mill-drills have become increasingly affordable and popular additions to the home workshop. The Sieg KX1 and KX3 machines are examples of the small mill with the addition of all drive motors and drive control electronics required to provide basic but useful CNC machines. Connect a KX1 or KX3 to a PC running Mach 3 software and you have a CNC milling system, and examples shown here were developed using the KX3 set-up shown in Figure 2.

One of the most obvious uses for a CNC machine is to produce a number of identical items. To produce the very first one might involve quite a lot of work, drawing and producing the programme for the machine to run. Having done this, it becomes a trivial task to produce the second and subsequent identical items. Apart from batch production, CNC also lends itself to the speedy production of complex shapes. Any model loco builder who has ever hacked out a set of fish-bellied coupling rods the hard way could have saved themselves a lot of time using a CNC milling machine instead of hack saws and files!

Safe use of CNC machines

Safety! All machine tools are potentially dangerous, CNC machines are no exception. It is all too easy to programme a CNC machine to very rapidly cause extensive damage to itself, and to you, if any part of you gets in the way. Keeping safety at the front of our minds at all times, there are two outcomes we want when planning any job.

The first, and most important intended outcome must be that “Nothing Bad Will Happen”.

With that in mind, we can begin to consider the second intended outcome, that “Something Good Will Happen”.

Programming – Making a start

Keeping both intentions in mind, and never losing sight of which is the more important and why, will help us to write robust, safe programmes. Machines are dumb. Computers are dumb. They will (often) respond to our programmes by doing what we think we have instructed them to do, but they are not psychic and can not necessarily be expected not to do what we have not told them, not to do! (Please re-read the previous sentence until it makes some sense to you!) For example, a well designed programme will probably finish with some instructions simliar to : -

STOP
END PROGRAMME

What do you think might happen if we forget to tell the machine to 'STOP', or we forget to tell it where the programme ends? The simple answer is that we should never just assume, the consequences could be dangerous. Therefore, keeping safety at the top of our priority list at all times, it might be a good programming practice to write the

STOP
and
END PROGRAMME

lines before we write any other lines of our programme. By these means at least our programme will 'STOP', and will 'END', even if it does nothing else. This is our first example of 'Defensive Programming'.

Planning

We all make mistakes. Some mistakes put us in danger. This is one good reason to spend time learning to use the CNC software in 'Simulation Mode', also called 'Demo Mode'. This is a good habit to get into and should you progress into using a real CNC machine, it is always a good part of the plan to run a simulated cutting run before launching onto the real machine.

Planning a machining job, whether for manual or CNC machines, seems like a sensible starting point, and the thinking involved is much the same. Using our experience and knowledge of the tools and materials to be used, we will come up with a plan and decide upon a sequence of operations required to complete the task in hand. Often this might involve repeating some part of the sequence. For example, turning down a piece of material to make a pin or bolt of some kind might take several cuts to reduce part of its length to the final diameter. Estimating the number and type of cutting operations, and organising this into some sensible order, is a reasonable start to a plan. This discipline of planning helps maintain the happy situation where the scrap bin seldom overflows. Think twice, cut once! Of course with simple manual jobs we can often get away with muddling through, but any job for a CNC machine needs planning. We could then write a list of the stages involved in making our part. A list of instructions – this is a programme. A CNC machine has no intelligence and can not spot your mistakes, it will faithfully try to execute the list of instructions, the programme, you give it.

The importance of good planning to achieve the safe, desired outcome can not be over emphasised. Failure to plan amounts to planning for failure. Good planning involves developing the sequence or list of stages to be executed, and then using manual machines, we achieve our goal by twiddling machine handles to go through all the stages sequentially. To use a CNC machine instead, we write down the list - the programme - give this to the CNC machine and then stand well back and watch in amazement as all the hard work just happens before our eyes.

Example CNC machining job – Motion Bracket Plates

Fig 3 – Four of these were to be cut from 3mm mild steel plate

As a first example, a batch of four motion bracket plates, shown in Figure 3, was required. Looking briefly at the overall strategy developed in 'The Plan'. Each part measuring only around 67mm by 46mm, the four could be cut from a strip of 100mm wide plate, setting up the machine once to cut out the four. From a programming point of view, the easiest option would have been to programme the complete cutting sequence for one part, and then using some 'step and repeat' function, extend the programme to cut the other three, one after the other. While this would have worked, it becomes very tedious on a basic CNC machine like the KX3, to keep stopping to manually change the tools. This raised the question of how many tools and tool changes were needed? One option would have been to do the whole lot using just one slot drill. The problem here is that it would need to be of no larger diameter than the smallest hole, in this case 3mm. It would also have taken a long time cutting all of this out using such a tiny tool. The smallest slot drill to hand was too big anyway (having previously broken too many tiny cutters!) so the decision was made to drill all the holes first, mill out the waste in the openings, and finally to mill the finished parts out of the parent stock.

Fig 4 – Showing positions of tool plunge holes

Thinking ahead, whether to use a slot drill or end mill. Either might be used depending on what was at hand on the day, but slot drills are good for plunging right through the sheet whereas end mills are not. So noting there is already one larger hole to drill, two extras were positioned in the waste area. These could then be used as plunge points for either a slot drill or end mill – keeping options open. Figure 4 shows the positions of the tool plunge holes.

Fig 5 – Four copies positioned for cutting

The next part of the job was to lay the pattern out four times with sufficient space between to leave room for the slot drill or end mill and in such a way as to not be too wasteful of material. This is shown in Figure 5 which was drawn using a CAD system, then measurements and positions were extracted from that, but let's not get into too much detail here, this is just a quick overview of 'The Plan'!

Fig 6 – Centre drilling

Figure 6 shows the first phase of machining, centre drilling all hole positions. After the last hole the machine was programmed to stop and prompt the operator to fit a 3mm drill and then press 'Start'. The machine then proceeded to drill the sixteen 3mm holes before once again coming to a stop and prompting for the next size drill etc. There are other ways, possibly better ways of doing this. For example centre drilling could have been eliminated by using a four facet 3mm carbide stub drill to drill all holes through to start with. However, this workshop was only equipped with the standard set of twist drills.

Fig 7 – Drilling completed

Figure 7 shows the hole drilling completed. The machine was programmed to halt and prompt the operator to fit a slot drill or end mill of the size required to finish the job.

Fig 8 – Cutting out irregular shaped hole

Having pressed 'Start' for a final time, the machine proceeded to cut the waste out of the four openings. This is shown in Figure 8. With no need of further tool changes, the programme continued to cut the finished parts out of the parent stock as shown in Figure 9, where it can also be seen from the burr thrown up on the final cut that the tool was no longer all that sharp! Rapid tool wear may have resulted from use of non-ideal tool speeds and feed rates.

Fig 9 – Cutting finished component from parent material

Of course there are is more to it than that, setting up the manual or CNC machine involves mounting the work-piece and making sure all the right tools are in all the right places etc.

Having done all that careful planning and setting-up, what could possibly go wrong? Well, we all make mistakes sometimes. When using a manual lathe, a momentary lapse of concentration and oops – instead of winding the slide to move the tool away and clear, the handle gets turned the wrong way and we've ruined the job and maybe broken a tool. We realise what's happened quite quickly and hopefully the damage done is not too great. But apart from looking on in open-mouthed horror, what do we do when the CNC milling machine proceeds to plough through our mounting fixtures before plunging the tool into the table at speed? The answer is that we take extra care in planning to avoid as many disasters as possible, and then use the computer to plot some graphic simulations before we commit to cutting material. Later we will see just how easy this can be and just how useful in saving us from disaster.

Of course many simple, particularly one-off jobs, may be completed just as well in a fraction of the time using conventional machines, or even hand tools, but having taken the time and trouble to write a programme, the CNC machine can run this over again, which can save time making even small batches of the same item, or if you need to make another one in the future.