You are on page 1of 13

©

All text and images copyright of


Marcus Bowman
except where stated otherwise.

11
ø4 19
3

ø4
R3

Part 1
2  •  

Part 1
This series of articles starts from fundamentals
and covers aspects of CNC programming and
machining which will allow you to produce a
wide range of work on your CNC machine. The
series is not specific to one make or model of
machine tool, but it does feature Mach3 and
Vectric software throughout.
There is a support website for the series at Photo 1: A plinth for a
www.cncintheworkshop.com vase

Some things are changing quickly in the complex machining tasks.


home workshop, and the last 10 years or so We will start with the absolute basics, in this Computer Numerical Control (CNC) is a
has seen a considerable increase in interest first article, and build skills and knowledge loosely applied term, but CNC is part of a
in smaller CNC machine tools. Richard Bar- from there. Supporting resources will be manufacturing system, which means it is
tlett published some interesting early arti- indicated as we go along. one element in a set which forms the whole
cles, but the first really major CNC project of the manufacturing sequence. Although it
for home workshop users was probably the Let’s be clear about a couple of things, is interesting to consider a CNC machine as
articles on building a CNC milling machine, though. a tool in its own right, it is only really useful
by Peter Rawlinson in MEW from September This series is not an attempt to convert eve- as part of a system, so we will take a system
1998 to February/March 2000, We have seen rything in the workshop to CNC. Nor is the view, in this series, and look at all the ele-
significant progress since then, with lots of intention to make MEW into a computer ments required to manufacture a part.
home conversions of milling machines, magazine. Traditional manual skills, wheth-
and a smaller number of lathe conversions. er working at the bench with hand tools, or Workflow is not something we talk about
Leaving aside the large industrial machines, operating a lathe or mill manually, are not very often, in the home workshop, but we
there are some good small or medium superseded by CNC. In fact it would be true frequently use the concept when we tackle
sized CNC mills on the market now, with a to say that a real understanding of the fun- a job. Workflow is simply the method we use
smaller number of commercially available damental aspects of machining, whether to take a piece of raw material and turn it
CNC lathes based on conventional manual by CNC or manual methods, is an essential into a finished article. It is the steps we take,
layouts, a steady supply of second hand ex- component, and for most of us that is based and the methods we use, to do the work
education slant bed lathes, and a full-blown on experience in making things manually. that’s required. For a straightforward one-
CNC slant bed lathe of a size suitable for the There are times when CNC makes a tremen- off job, we may use a few simple operations,
home workshop is just around the corner. dous difference to speed and efficiency or to like a turning operation, some filing, and a
For those interested in developing or using what can be produced because of the com- cut with a hacksaw. But most of us know
CNC in the home workshop, this is an excit- plexity of a machining operation, and other quite well that a workshop project can easily
ing time. times when manual skills will be required involve a considerable time in planning the
to finish a workpiece by doing something best way to do a job, before actually doing
This series of articles sets out to give you a which is better done by hand, or cannot be it; and some jobs must be done in a specific
good grounding in the skills required to set done by CNC. This series is not an attempt order, otherwise we end up not being able
up and use a CNC machine tool, and to take to say that CNC is the be all and end all. I do to grip the work, or we foul a cutter or are
you to the stage at which you feel confident believe, though, that a good understanding left with an impossible machining setup.
in using your CNC mill or lathe to produce of what CNC can accomplish, in a practical For repetition work, workflow is important
real work. Our ambition will not be limited to way, will benefit everyone, even if, in the end, to optimise the manufacturing process and
simple workpieces, and the series will look you do not wish to pursue it in your own allow us to do the work efficiently.
at what is required for some of the more workshop. Preceding all of that is the design process,
  • 3

Design Plan Manufacture


Manually create Manually work out Manually machine
a design how to make the workpiece
on paper the object

Computer Aided Computer Aided Computer


Design Manufacture Numerical Control
(CAD) (CAM) (CNC)

Fig 1: Three main stages in CNC workflow Photo 3: The setup for machining 4 circular plinths

and the need to consider manufacturability before cutting any metal. Information from Even using CNC for just one of these shapes
as we create a design. It is surprisingly easy the CAD program can then be used to ena- would have been quicker than cutting it by
to design parts which cannot be manufac- ble Computer-aided Manufacturing (CAM) hand, because the shape was so accurately
tured easily, if at all. Many of the commer- which makes use of CNC machines to pro- cut. Yes; the job could have been done using
cially available castings we might use in duce finished workpieces. The key to this is a rotary table in a manual mill. It would not
the workshop have extra bits cast into the software for CAD, CAM and CNC, along with have been any easier, though; and it would
pattern. These form chucking pieces, and a compatible CNC machine. have taken much more time to set up the
although they are not required on the fin- We do not always need to use all of this blanks before machining each plinth.
ished article, they are needed to allow the software in the home workshop, but we Photo 4 shows an engraving which could
part to be gripped in a chuck or clamped to will need to carry out all of those stages. be drawn by hand, assuming a high degree
a mill table for the rest of the workpiece to For some tasks, it is quicker and easier to do of artistic ability and a lot of time and con-
be machined. They are the result of consid- some of the stages manually, but in other centration, but could not be planned with-
ering manufacturability at the design stage cases it is impossible to do without all the out the aid of sophisticated software. Once
(or sometimes modifications as a result of elements of the full system. planning has been completed, cutting
bitter experience…). Photograph 1 shows a simple piece of work the design using a CNC machine is quite
Throughout this series, we will look at appro- based on simple shapes, which can be straightforward. Lacking years of practice
priate methods for each of the 3 main stages designed on the back of an envelope and in hand engraving, I can’t think of a way of
in our design – plan – manufacture work- planned on a postcard, then cut on a CNC doing this manually, without an engraving
flow. Some of these will be manual, and oth- mill. In practice, that’s exactly what hap- machine. Even then, the job would have
ers will make use of appropriate software. pened. I had some turned vases which need- required some means of using the sketch to
Fig 1 shows these elements of workflow. ed simple bases to sit on, to complete the guide the cutter, and that introduces a sig-
effect I wanted to achieve (photo 2). Grab- nificant element of variability. In this case,
In the modern home workshop, design can bing a sheet of material, I drew appropri- CNC is much quicker and much more reli-
be carried out at least partly on the comput- ate circles around the existing vases, wrote able.
er, using Computer Aided Design (CAD) soft- a few lines of instructions straight into the
ware which will allow the part to be drawn CNC program which controls my mill, and
and the design to be tested and finalised cut the shapes using one cutter to produce
a concave edge around the shapes, and an
end mill to cut the vertical sides, releasing
the shapes from the sheet. The advantag-
es of using CNC for this job were that the
final cut gave me a finished object which
only required the edges to be burnished
by hand, but the program cut three bases
of the same size, then, with just a few extra
instructions cut a single larger base, and all
Photo 2: The plinth in use without moving the workpiece (photo 3). Photo 4: An engraving of a flower
4  •  

In this series, we will consider the three ele- core software lies at the heart of much of the edge of software and computing skills.
ments required for a successful CNC system CNC control software currently in use indus- I enjoy the LinuxCNC programming capa-
in the home workshop: software for CAD, trially, as well as in the home workshop. Any bilities, but we will say no more about
CAM and CNC; computer hardware for CNC specially written custom control systems that system for the moment, and focus on
control of a machine tool; and the machine should conform to the RS274/NGC stand- Mach3, simply because it is easier to install
tool hardware and electronics. We will ards so that all CNC systems should respond and setup. Mach3 is a commercial product
begin with milling machines and progress in a similar way to a set of standard com- and can be obtained as a demo version at
to lathes. mands. There is room, though, for systems no cost, to allow you to test whether it will
to add facilities or to interpret unassigned work on your computer and machine tool.
commands in a specific way, and commer- The demo version is currently limited to 500
COMPUTER CONTROL cial systems inevitably differ in detail as lines of G code (mill) or 50 lines of G code
manufacturers attempt to sell systems with (lathe), so it is possible to run enough of a
From early beginnings in the 1950s, CNC added bells and whistles. program to make sure it suits your purpose
systems have evolved through proprietary before committing to a licence. You should
industrial systems to the present day when In the home workshop, the two main pieces note, though, that 500 lines of program is a
users in the home workshop can choose of general purpose CNC software are Mach3 real limitation on the size and complexity of
from a range of ready-packaged systems or and LinuxCNC (formerly known as EMC or the program you can run on a mill, so you
general-purpose control software. EMC2). These both respond to the core set will need to buy a full licence sooner rather
Early industrial automation systems were of RS274/NGC commands, but both pro- than later.
mechanical, and were based on cams which vide a user-friendly interface on screen, to Several of the complete CNC mill packages
moved parts of a machine in specific ways, make the system easy for ordinary humans currently available provide an installed copy
and the cam-auto lathe was common in fac- to use. Both systems have developed over of Mach3, either as the demo version or as a
tories. the years, and have gradually taken different full licensed version. Sherline, though, pro-
The next step was Numerical Control (NC), in routes, although they both still respond in vide LinuxCNC, although it is easy enough to
which servo motors controlled by electron- a similar way to the same core RS274/NGC control a Sherline CNC machine tool using
ics moved machine slides to positions speci- commands. Other software systems are Mach3.
fied by holes punched in paper tape. available, and they do essentially the same I have no axe to grind, and regularly use both
Finally, as computer systems became more job, so it is relatively easy to change from LinuxCNC and Mach3. Mach3 is, however,
widely available, Computer Numerical one to another. the more commonly used system at present.
Control (CNC) allowed more flexible con- Mach3 was developed by ArtSoft and is a Both software systems continue to evolve,
trol of slide movement by cutting the time commercial product available as a limited with work underway on a newer version of
required to create punched paper tape and, demo version or a fully licensed version. LinuxCNC, and Mach4 on the horizon.
latterly, adding many user-friendly features LinuxCNC is Open Source software available
to the process of programming and control. free under a GPL licence.
A lot of the early development work for NC Mach3 runs on a PC under the Windows COMPONENT PARTS OF A CNC SYSTEM
and CNC systems was done by universities operating system and uses easily accessible
and military research and development menus to allow the software to be config- In essence, a CNC system comprises a
teams, and there were early moves to stand- ured in various ways, to suit the machine it machine tool with arrangements to move
ardize the way the systems worked, leading is controlling, or to enable common tasks to the position of the tool in relation to the
to the RS274 standard for commands to con- be carried out quite easily. work; and a computer system with software
trol these machines. This led on to the Next LinuxCNC runs on a PC under the Linux to control those movements. The user pro-
Generation Controller (NGC) project by the operating system (and UBUNTU 10.4 in vides a set of commands which the com-
American National Institute for Standards particular) and has evolved into a highly puter system interprets to produce control
and Technology (NIST) which resulted in a capable programming system. It does, signals for motors attached to the machine
set of standards for the RS274/NGC control though, depend on a familiarity with Linux, tool, to move the work or a tool or both.
language interpreter and produced a core and although arguably more flexible than We will not get involved in Computer Sci-
set of software for controlling the move- Mach3 in some ways, that flexibility can only ence, but there are a few key concepts which
ments of the axes of a machine tool. That be fully achieved through a greater knowl- should help clarify some aspects of Mach3,
  • 5

so we will dip our toes in, very gently, to the hardware in the computer system, relieving It wouldn’t be much use if a tool arrived in
shallow end of what goes on under the bon- the rest of the OS, and all the other software position after the workpiece had moved to
net of a computer used for CNC. in the computer system, from having to some other position. Some operating sys-
Fig 2 shows a simplified view of the com- deal with the excruciating detail required tems are designed to operate in real-time,
ponent parts of the software in a computer to control the hardware. Instead, the rest of while most others do their best, succeeding
system, and they have direct relevance both the OS simply passes control requests to the to varying degrees. This is a significant con-
to CNC systems as a whole, and to Mach3 kernel. The kernel uses device drivers (little sideration, and, in the real world, it requires
and similar software. In broad and simplis- bits of software specific to particular hard- some awareness of the problem and some
tic terms, the user uses “high level” software ware devices) to control individual pieces reasonable compromises to achieve a per-
packages such as word processors or games of hardware in the system. You may have formance close enough to real-time to con-
or CNC programs. Those programs use the come across some of these device drivers, trol a CNC system with sufficient accuracy to
Operating System (OS) to run within the especially if you use the Windows OS. Each allow it to produce accurate work. One strat-
computer system. time you add a new piece of hardware to a egy is to use an OS like Linux which can be
computer system, the OS requires a device made to operate close to real-time, another
driver for that hardware. is to use a non-real-time OS like Windows
User interface
but take steps to make the signal handling
Level Softwa As far as the human user is concerned, soft- capabilities sufficiently close to real-time to
gh re
Hi
level softwa ware packages such as Mach3 are “high- allow CNC systems to function.
owating System r
level” programs which are easy for the Mach3 runs under Windows but goes to
e) (OS)
Ope (L
r

Kernel
human operator to use, but they need to considerable lengths to make the CNC con-
communicate with the kernel, because it trol as close to real-time as possible. This
is that kernel which will enable the pack- involves a lot of complex techniques, most
age to send signals out of the computer of which we can afford to ignore. Instead,
to control a machine tool. High level pro- we can remain blissfully ignorant as we use
grams hide the detail of the manipulation Mach3 as a high-level package designed to
of the CPU, memory and peripherals from be convenient for humans to operate.
the user by letting the OS and the kernel
Signals handle those processes. To set Mach3 up Within a CNC software package, there are
in and out
to control a specific machine we will need some settings we can make to allow Mach3
Fig 2: Component parts of the software in a computer to enter appropriate settings within Mach3 to operate our specific CNC machine. Most
system. to allow that high level package to commu- of these settings need to be made just
nicate effectively with the kernel, to make once, for a specific machine, but a few can
The heart of the operating system is the ker- sure the correct signals are sent out to the be altered from time to time, depending on
nel which controls all the hardware resourc- peripheral motors or received from the sen- how we want the machine to behave. The
es in the computer – the memory, the CPU, sors on the machine. On a machine supplied main purpose of the settings is to direct the
mouse, keyboard, and peripheral devices. as a complete package along with software, kernel to use appropriate connections to the
those settings should have been entered CNC motors and sensors, so they provide a
Every computer motherboard has a Basic as the machine was commissioned, before way for abstraction to take place. Once the
Input/Output System (BIOS) which is con- delivery. They can be altered later, though, if kernel has the settings, there should be no
tained in a chip which runs when the com- need be. On a home-constructed machine, need to change these unless the basic physi-
puter is switched on. A BIOS is specific to one it is up to the user to enter appropriate set- cal setup of the CNC machine, its motors and
make and model of motherboard, and its tings. Fortunately, it is not difficult. sensors, changes. The settings are stored in
first task is to load the kernel into the com- a file and each time Mach3 starts up it will
puter. Most kernels are designed to work To complete the picture, a real-time OS is one load the file and use those settings.
as part of a specific Operating System (OS) which is designed to send or receive con- Most of the settings we will want to change
such as a particular version of Windows or trol signals or sensor inputs fast enough to from time to time are not directly related to
Mac OS or Linux, and are designed to pro- control a machine tool so that the required the kernel, but relate to higher level func-
vide “abstraction” between the OS and the movements occur at the appropriate times. tions we humans can use to define the way
6  •  

in which the software interprets the instruc- machines. It would be just as easy to control Z
tions we enter, like the extent to which the a horizontal mill, but the vertical mill tends
CNC machine can deviate from the path we to be more versatile, so that’s what we will
have programmed, rounding corners, allow- deal with, at least for now. C Y
ing speed fluctuations, and other aspects of Vertical mills are typically either benchtop
the operation. mills in which the distance between cutter B
and work is changed by moving the head
When we run the CNC software, we enter up or down, or knee mills in which the table
commands to control the movement of assembly moves up and down and the head X
A
the CNC machine. The NIST core software remains stationary.
built into Mach3 interprets the commands For CNC it doesn’t matter. What is important
and turns those into instructions which can is the position of the Controlled Point (CP), Fig 3: Mill axes reference letters.
be passed to the kernel to control the CNC a specific point which defines the position
machine. The software allows co-ordinated of the tool in relation to the workpiece. The are unlikely to have two rotary axes in use
movement of the various parts of the CNC Controlled Point is usually a point at the at any one time, so swapping a rotary table
machine, and that is why the fact that Win- end of the tool, aligned with the vertical from vertical to horizontal or vice versa will
dows is not a real-time OS makes life so axis of the spindle (photo 5). Moving the be quite convenient. Because we are likely to
challenging for Mach3, under the bonnet. table and/or the head moves the CP rela- be using that same rotary table as an axis, it
In fact, the key to the success of Mach3 is tive to the workpiece. Conventionally, the can remain plugged into the same connec-
the very cunning timer it creates within movement of the CP is described using axes tor and be controlled by the A axis signals
the computer, so that signals are sent to labelled X, Y, Z, A, B and C. The X, Y and Z axes no matter its orientation, horizontal or verti-
stepper motors or servos at a consistent refer to movement right and left, forward cal. We will leave B and C for the moment,
and nearly-real-time rate. This is far from a and back, up and down, as shown in photo because four axes are quite enough for most
simple undertaking, and requires Mach3 to 6. The other 3 axes, A, B and C, can be flex- tasks. You should be aware that most CNC
effectively bypass parts of the Windows OS ibly defined, depending on your machine, software can simultaneously control and
to create a timing system largely independ- and each can be either a rotary or a linear make co-ordinated movements in up to 6
ent of Windows. axis. Where these are rotary axes, they are axes, because the NIST core software built
defined as shown in fig 3 (rotary axes). For into most CNC software packages provides
our purposes, the A axis will normally repre- that control.
A TYPICAL CNC MILL sent rotary movement, typically of a rotary
table mounted either horizontally or verti- Axes are moved by a motor which can be
Most CNC mills in the home workshop cally, as shown in photos 7 and 8 (next page). controlled by signals from a computer or
are easily recognisable as vertical milling From a purely economic point of view, we other similar device. In practice, that means

Photo 5: Controlled point at the end of a cutter. Photo 6: Vertical mill axes.
  • 7

Photo 7: Creatng rotary axis A wrapped around the X axis. Photo 8: Creating rotary axis C wrapped around the Z axis

a stepper motor or a servo. A stepper motor Looking back to early CNC machines in the The controllers (photo 10) are standard
is a brushless DC (direct current) motor home workshop, one of the problems was Geckodrive units (model G201). In fact three
which is designed so that its shaft can make that stepper motors tended to be on the are rebranded Geckodrive units supplied
small rotary movements called “steps”, with small size, and used relatively unsophisti- under a UK manufacturer’s brand name. The
a typical stepper motor being capable of cated electronic controls. Nowadays, power- fourth is a Gecko-branded unit.
200 steps, each of 1.8 degrees, as it makes ful stepper motors are available at reason-
a single full rotation of the shaft. Whereas able cost, and there are standard tried and
a conventional DC motor will spin as long tested electronic devices available to allow
as power is applied, then coast to a stop, a accurate control. Collective experience has
stepper motor will only appear to spin if taught us there are good solutions.
it is rapidly moved in a series of steps. So On my own mill, the stepper motors (photo
although this is a rotary device, its rotation 9) are size 34, rated at 480Ncm, meaning
can be accurately and repeatably controlled. they have a mounting flange of a particular
A typical movement may consist of several physical size (3.4 inches) and capable of a
complete rotations and a partial rotation, all specific holding torque (480Ncm) although
accomplished by making a series of steps. the turning torque drops off rapidly as the
Typically, a stepper motor is controlled using speed of rotation is increased. There is a
two signals; a step signal to make the motor trade-off in motor size and cost, and while
take a step, and a direction signal to control I favour larger motors which can loaf along
the direction of rotation. This means it is a well within their capacity, they are more
relatively simple task to write a program expensive, and require larger power sup-
to control the rotation of a stepper motor. plies than smaller steppers.
It is the kind of programming task typically
undertaken by students learning program-
ming, and it has become a popular task for Photo 10: Controllers containing drive electronics.
hobbyists and students using the Raspberry
Pi computer, the Arduino and lots of other The power supply is home made. The step-
similar systems. pers run at up to 80 volts, and the power
The signals from the computer need to pass supply can provide 78 volts at 30 amps, so
through some electronics on the way to the it is very much more powerful than most
stepper motor, to provide enough power for smaller commercial units, and rather more
the motor. This is called a stepper controller powerful than is required. This power sup-
and it contains the drive electronics. Photo 9: Stepper motor on the Y axis. ply has soft-start, over-voltage protection,
8  •  

and current limiting, to prevent disaster and these include sophisticated rotary axes, and The parallel port has long been the favoured
to protect the electronic motor drive units. some lathe headstock applications, which way to get enough signals out of, and into,
The newest Geckodrive unit, the G203X, has we will look at later. the computer, so that the cable running
considerable protection built in, so that a from the parallel port to the electronics in
simpler power supply may suffice. the CNC machine sends signals to the drive
Many of the well-known suppliers now sell COMPUTER electronics, and receives signals from sen-
powerful stepper motors which require just sors on the machine. Most modern laptops
a little less current, and ready-made power The computer system does not need to be discontinued the use of the parallel port
supplies and control units are available to the very latest all-singing all-dancing model. some time ago, and it has largely been super-
match. It simply needs to be as fast as is required to seded by the USB port and the network port
control the parts of CNC machine as fast as on most laptops and desktops. USB convert-
A servo does the same job as a stepper they needs to move. How fast is that? Real- ers are available, but need careful choice as
motor, but incorporates both a motor and istically, a medium spec computer should users report that many of these do not work
an encoder which provides an error signal do the job, but the devil is in the detail, of as well as is required for Mach3 and other
when the servo has not reached the com- course. The Mach support website at www. CNC programs, possibly because they do
manded position. Electronics in the servo machsupport.com states the minimum not send a full range of signals through the
will continue to move the motor until the specifications required. connectors. However; using a Motion Con-
commanded position is reached. Although Note that running under Windows 7 is not troller solves this problem (see later section).
a stepper motor may receive a series of as simple as might first appear, and Win- The motherboards of many computers have
step and direction signals, there is no way dows XP remains a good option. However; built-in electronics for a video interface
of checking whether it has been able to Windows XP is no longer available for pur- (termed the graphics “card” or video “card”
carry out those steps or whether the motor chase, and I would caution you against cop- for historic reasons) to send signals to a
has stalled, perhaps because a slide has ies available on some of the popular web- monitor. Most off-the-shelf low or medium-
jammed. Under the same circumstances, sites, as these may not pass the Microsoft priced computers will have on-board inte-
a servo motor will continue to indicate an Advantage licence check. In addition, sup- grated video, because it is a cheap way for a
error until it finally manages to reach the port for Windows XP is being withdrawn by manufacturer to provide video outputs on a
commanded position. In fact, the main Microsoft, so that while computers with XP complete computer. The problem with this
issue is likely to be whether a slide has been will continue to run, there will be no further is that integrated video tends to interfere
moved to a particular position. Where there updates, bug fixes or modifications. This is with some functions of the operation of the
is backlash in a feedscrew, and the control not a serious problem at present, but you kernel and makes life difficult for Mach3. The
software does not take this into account, any should be aware that Windows 7 and 8 are recommendation is that integrated video is
reversal in direction will result in some lost the systems which are currently supported disabled, and a separate video card is used
motion due to the backlash using up some by Microsoft. There is no available informa- instead. In this context, a “card” is a separate
of the rotation of the feedscrew. The step- tion about Mach3 running under Windows circuit board which is inserted into a “slot”
per might carry out the required rotation, 8 at present. or connector on the main computer moth-
but the slide will stop short of the intended This means that if you are building or buy- erboard. This allows the kernel to pass a lot
position. There are ways of dealing with ing a new computer, you may have to use of the work involved in preparing signals for
this, in software, but this needs to be set up Windows 7. We will tackle the challenges in a monitor to the graphics/video card which
within Mach3. doing this, because it is the likely route for will contain its own processor and memory
For most small CNC machines, up to Bridge- many of us. to relieve the kernel of much of this task. This
port size, stepper motors are a perfectly Some laptops will cope with Mach3, but aids the stability of Mach3 signals to a CNC
good, and cost effective, way of controlling note carefully that MachSupport does not machine. Laptops generally have integrated
movement, provided they are sufficiently actually recommend a laptop except when video and few have the extra “slots” required
powerful for the task in hand. Servos are using what’s termed an “external motion for additional cards. Experience suggests
more expensive and have more complex controller”. that laptops do work with Mach3, but it’s a
drive electronics. There are, however, a cou- Core requirements for Mach3 are for a par- hit or miss, and Mach support recommends
ple of applications which can really only be allel printer port, and the use of a non-inte- you do not use a laptop, for the simple rea-
effectively achieved using small servos, and grated video controller. son that if a specific laptop does not work
  • 9

with Mach3, there are no real options except JITTER AND LATENCY In addition, the steppers actually require
to use a different make or model of laptop. something more complex than a train of
There is lots of discussion on this on the All computers are not the same, and differ- pulses, because the coils inside the step-
various forums, and some pointers to the ent models of motherboards vary in per- per motor need to be turned on and off in
outcome of the discussions on the sup- formance. The issue is the extent to which a particular sequence. So; we need to send
port website for this series of articles (www. Mach3 can send out signals in near-real- the step and direction signals from the com-
CNCintheworkshop.com). time. Latency refers to the time delay intro- puter to some drive electronics (the stepper
The speed and memory requirements for duced as signals pass through a system. A controller) which generate the appropriate
Mach3 are very low by modern standards, slight delay may cause an error in position- sequence of signals to the stepper coils by
so even an older computer is likely to satisfy ing the cutting tool. Where latency is con- taking account of the direction in which the
those requirements. stant, some of its effects can be offset. stepper has to turn, and alter voltage and
The computer running my mill is dedicated Jitter, on the other hand, is a much more current levels to make the stepper motor
to that task and is built into the cabinet serious problem because it is the variation turn (fig 4).
for the mill. It comprises an ASUS P4P800E in the rate of signals in what is supposed
motherboard (now obsolete) with 8Gb ram, to be a constant stream. Unlike latency, jit-
a separate video card and a separate card for ter varies over time, so is less predictable. In Stepper
the parallel printer port. This is much more machining, jitter can affect surface finish, as motor

memory than is required, of course, but the slides speed up and slow down when
effectively means there is no practical limit they are supposed to be moving at a con-
on what I can do with the machine, for CNC stant speed.
tasks involving Mach3 or other control soft- Latency is related to jitter, but while latency
ware I use. When not using Mach3, I can also might be fairly constant, meaning the delays Controller Power supply
run other CAD and CAM programmes with are relatively constant and the whole pro- (drive electronics)
ease, and simultaneously, if I wish. I tend not gram (or sections of it) just send out signals
to do that, preferring to run them on a sepa- a bit late, jitter refers to the extent to which

DIRECTION
STEP
rate machine, elsewhere; but the capability individual signals in a stream vary from a
is there, for a small additional cost. The com- uniform rate, resulting in one signal hav-
puter is built into a rack mount box (photo ing a different latency than the next, in an Signals from computer
(STEP and DIRECTION)
11), and has two removable hard disk drives unpredictable way.
so that I can swap from Windows to Linux Measurements show clearly that there is Fig 4: The controller contains the drive electronics.
and from one version of Windows to anoth- considerable variation in latency and jitter
er. Totally unnecessary, but quite handy. from one model of computer to another. Connect one side of the drive electronics
This is important, so we will return to this to the computer, the other side to a step-
when we deal with setting up Mach3 and per motor, and feed the power supply to
the stepper driver hardware. the drive electronics. Step and direction
signals from the computer are turned into
appropriate high voltage and high current
INTERFACES signals which are fed to the stepper motor
to make it turn in sympathy with the step
The computer needs to control the stepper and direction signals. Easy really, if you are
motors or servos, and it does this by send- an electronics engineer; a useful black box if
ing a set of signals which normally take the you are an ordinary mortal.
form of a train of pulses to control the steps, Some folks recommend that the computer
and a signal to control the direction. These is connected to a breakout board. There are
are normally referred to as step-direction some good reasons for this:
signals. The signals coming from the com- • a breakout board gives some protec-
puter have no real power, and are at a much tion to the computer, by isolating the
Photo 11: Mill computer. lower voltage than the steppers require. computer’s outputs and inputs from the
10  •  

higher voltages used to drive the step- jitter, and sidesteps the issues related to the

motor control
DIRECTION

To spindle
per motors or servos. speed at which the computer can send sig-

STEP
• a breakout board can simplify the physi- nals out of the parallel port by eliminating
speed
cal connections between the printer relays
control
it entirely and acting as a substitute for the

Breakout board
port and the stepper/servo drive elec- parallel port. Some motion controllers are
tronics. This was the original meaning of mounted internally, inside the computer, as
the term “breakout”, where the connec- charge plug in cards, but the most popular choice
pump
tions for the various signals associated for Mach3 is an external motion controller

DIRECTION
with the parallel port can be made on which connects to the computer via the

CONTROL
STEP
larger, more human-friendly connectors USB port. This provides an ideal solution for
on the breakout board. If soldering is not Signals from computer Pulse train a laptop.
(STEP and DIRECTION) from computer
your forte, this is a significant simplifica- (other control signals) The computer sends signals out of the
tion, as most connections can be made Fig 5: The signal path through a typical breakout USB port to the motion controller, and the
using screw-down connectors. board. motion controller sends signals to the step-
• some breakout boards provide addi- per/servo drive electronics. Because the
tional safety features, notably a charge from the computer before onward transmis- motion controller deals only with creating
pump. When Mach3 runs, it can be sion to the drive electronics (i.e. they have and sending the appropriate signals to the
instructed to send out a continuous built-in latency). Buying a breakout board drive electronics, it can do this in real time, at
stream of pulses and the charge pump from abroad is not a great problem via the high speed, bringing significant benefits. On
will allow the breakout board to operate internet, to be sure, but postage and import the computer, the OS and the kernel attempt
while it is receiving those pulses. If the taxes add considerably to the cost. to deal with lots of other tasks at the same
pulses from Mach3 stop, the breakout time, to move information around the com-
board will recognise this as a fault and puter, deal with the keyboard and a host of
will stop sending out signals to the step- MOTION CONTROLLERS other tasks, which introduces unwanted and
per drive electronics, effectively stop- variable delays leading to jitter, and tends to
ping the machine. In recent times, new devices called motion slow the operation of Mach3. This limits the
• some breakout boards provide relay controllers have appeared (photo 12), and speed of machining, and means that the
outputs for switching things like cool- these solve two significant problems. The motion of the axes tends to be slightly vari-
ant pumps or vacuum extractors. This first is jitter, and the second is the problem able, and the results of that may be visible in
can be done without a breakout board, of increasing numbers of computers which the surface finish as the feedrate of the tool
but, again, it is conveniently done using varies slightly.
the handy connectors on the board. Fig 6 (next page)shows how signals are rout-
• some breakout boards simulate a sec- ed from the computer through the motion
ond parallel port or a dedicated port for controller to the stepper motors or servos.
an external motion controller. This can A Motion Controller like the SmoothStepper
be important. comes with a driver which is easily installed
• some breakout boards incorporate on the computer. That redirects signals
a speed controller so that Mach3 from Mach3 intended for the parallel port,
can not only turn on the motor for and sends corresponding signals to the
the mill spindle, but can control its SmoothStepper via the computer’s USB
speed. This is a very useful facility. Photo 12: SmoothStepper motion controller. port. Although these are a recent develop-
ment, motion controllers provide an effec-
Fig 5 shows the signal path through a typical do not have parallel printer ports. tive way of controlling a CNC machine. It’s a
breakout board. They also solve the problem of computer good solution.
There are, however, some reasons not to use performance and processor speed limiting Some breakout boards combine the best of
a breakout board. There have been some the performance of a CNC machine. both worlds as they now incorporate ports
complaints that some breakout boards On a Windows computer running Mach3, a designed for connection to a motion con-
introduce a delay in processing the signals good motion controller largely eliminates troller. This allows the breakout board to
  • 11

offer additional connectors for relays etc. Fig Signals in & out Signals out
19 shows the signal path when using both to additional devices to stepper drive
such as pendants, electronics,
a motion controller and a breakout board. other steppers and in
or accessories from sensors

SOFTWARE

Parallel Parallel
The primary requirement is for software to
port 2 port 1
take instructions required to move the Con- Fig 6: Signals may be
Signals in

Port 3
trolled Point along a particular path and routed from the computer
from encoders
turn those into electronic signals for stepper through the motion or other devices
motors. That’s Mach3. controller to the stepper Motion Controller
If that is the only software package you use, motors or servos.
you will be able to do quite a lot of fairly USB
straightforward CNC machining on a wide
range of workpieces. If you are a good pro-
grammer, you will be able to do a bit more,
Computer
but there are limits, and Mach3 on its own is
not enough to really make the most of CNC
machining in the home workshop.
In a full CNC system, there are three kinds
of software.

CAD software Signals out


to stepper drive
electronics, and
Computer-aided design (CAD) software in from sensors
is used to create a design in 2 or 3 dimen-
Signals in & out
sions. All workpieces in the real world are 3 to additional devices
dimensional, but many machining opera- such as pendants, Breakout
other steppers board
tions mainly involve movements of the Con-
or accessories
trolled Point in 2 dimensions, so although
many modern CAD programs can produce
designs in 3D, this is not helpful for most
milling operations, because the format of Fig 7: The signal path Parallel Parallel
the data (information in computer-readable when using both a motion port 2 port 1
form) from 2D and 3D designs is fundamen- controller and a breakout Signals in
Port 3

tally different, which causes problems in board. from encoders


or other devices
later stages of the process when the data is
Motion Controller
translated into movements of the slides.
Movements in 2 dimensions (usually X and
USB
Y movements of the slides) combined with a
vertical depth of cut are termed 2D because
once the cutter has reached its depth of cut,
that does not vary, and there are no simul- Computer
taneous co-ordinated movements of X and
Z or Y and Z. Where the depth of cut is var-
ied as X and Y movements take place, this is
12  •  

termed 2½D and this allows the creation of working with information from a CAD pro- DXF format. This is Autodesk’s longstand-
“low-relief” shapes which can be thought of gram, but the same process can be car- ing AutoCAD file format which has become
as a kind of restricted 3D because it allows, ried out with a manually-created design, a universal standard. There are various ver-
say, a flat map of a landscape to be pro- although this is neither as convenient nor sions of this, but most CAM programs can
duced, with X and Y movements as well as as efficient, and anything other than the cope with many of these, so this is the stand-
enough control over the Z axis to produce simplest of shapes is better dealt with by ard format we must look for. This also means
the height-related features of the moun- using CAD then CAM techniques. Because that you can take a DXF file from elsewhere,
tains or the valleys and rivers. 2D machining the CAD and CAM stages of the process are such as one prepared by someone else, and
produces shapes with vertical sides to the so closely linked, some programs combine use it in your CAM program, allowing you to
cuts, whereas 2½D machining can produce both functions, and some of the software we machine an object using a file obtained from
pockets and raised areas on the work which will use in this series of articles do just that. elsewhere. This is important, as it means you
are not restricted to having vertical sides. These are essentially CAM programs which do not always need to design a workpiece
So 2D and 2½D machining covers the vast incorporate CAD capability. A dedicated yourself, but can still machine the object.
majority of what is required in the home CAD program may have more sophisticated Some CAM programs can also accept other
workshop. True 3D machining is a rather drafting capability, but that is not always file formats for 2½D designs from other soft-
different animal, and is outwith the capa- required for designs of low or medium com- ware packages such as AutoCAD, RhinoCAD,
bility of home machinists, at present. How, plexity, so a combined CAD/CAM program is TurboCAD, and many others.
for example, could you machine a fully 3D a way of coping efficiently with the majority Combined CAD/CAM programs automati-
object? Imagine machining a sphere con- of designs. cally deal with data transfer, which takes
taining a contoured map of the world, with A CNC program then uses the output of place inside the program with no need for
the mountains, continents, oceans and riv- the CAM program to carry out machining the user to do anything about this. That’s a
ers. How could you hold the workpiece so to produce the finished object. The output bonus, of course.
that this could be done in one work setup? of the CAM program needs to be prepared
How could you machine the “underside”? differently for each specific CNC program, CAD software of considerable power is
The most likely practical solution on a con- so it is important that the CAM program has available from a number of sources, in all
ventionally constructed mill would be to that capability. The general nature of CAM the usual forms: free, low-cost, and high-end
use multiple work setups in which you set programs means most can output data in a packages, so you can choose how capable
up a block of material and machine part of it, range of formats suitable for a correspond- you want the software to be, whether you
then change the position of the workpiece ing range of specific CNC programs. Because want to design in 2 or 3 dimensions, and
and machine the next part, and so on. That Mach3 is such a widely used program, most how much you want to spend. As always,
is not 3D machining; it is a series of 2½D good CAM or CAD/CAM programs can out- you get what you pay for, but there are some
machining operations. We will deal with the put data in the form required by Mach3. In exceptions, with some good software avail-
challenge of machining 3D objects, in this fact, most can output in more than one form able under the GNU or GPL General Public
series, but you should be aware that this will for Mach3, depending on how you, as the Licence system.
involve techniques to allow 3D objects to be user, want Mach3 to behave. There are some fundamental differences
created using 2D and 2½D machining tech- In the full CAD/CAM/CNC cycle, it is essen- between 2D and 3D design programs, and a
niques on a conventional mill, and that will tial that the data passing between the pro- noticeable difference in the way you might
involve specific work-arounds. In practice, grams used at each stage of the cycle is in approach the design task if you are using
we will use 2D machining for lots of work- a form which each can recognise and use. 2D or 3D software. The current tendency,
pieces, and 2½D machining for the rest. If you are using a separate CAD program, industrially, is to use 3D software such as
for example, it needs to be able to output AutoDesk’s Inventor or the 3D version of
finished designs in a standard format which the old favourite AutoCAD (which takes the
CAM software the following CAM program can read and form of 3D capability within the basic 2D
use. This is where most free or low cost CAD AutoCAD), RhinoCAD 3D, TurboCAD 3D and
Computer-aided Machining (CAM) software programs fall down, and are not of practi- any of many others. These are hugely capa-
is used to turn the features of a finished cal use in a CAD/CAM/CNC system. The ble programs, but they come at a consider-
design into a set of instructions for a CNC basic requirement is that a CAD program able cost, and they output files in a format
machine tool. Normally, this will involve must be able to output data in a standard which not only differs from the standard 2D
  • 13

formats but requires a different CAM pro- the manuals and who do not need the full packages, and although they are widely
gram to prepare for machining. We will con- commercial product. used by the woodworking fraternity with
sider machining designs prepared in a 3D However; the detail of what needs to be gantry mills, they are quite capable of the
CAD package separately, later. It’s an inter- done to make specific packages work with kinds of machining tasks undertaken on
esting challenge but has its own particular Mach3 becomes rather complex, so, in this conventional mills.
requirements. series we will refer specifically to the soft- This is not a sales pitch for these particular
ware by Vectric: Cut2D and VCarve Pro. pieces of software, and you may be able to
CAM software has evolved over the years, Cut2D has become popular in its own right, achieve similar results from other software,
and most is now integrated as part of a and is also supplied with some proprietary but, for the purposes of this series, these
CAD/CAM package. Some high-end pack- CNC mills such as the Sieg KX1 and KX3 are the packages we will use in some of
ages such as EdgeCAM are specifically tai- Hobby Mills supplied by Arc Euro Trade. the examples. The series will not provide
lored to provide efficient machining paths Cut2D is best described as a CAM program detailed step-by-step instructions for using
for the Controlled Point, and do that job very with some added CAD functionality. It is not the software for every single example,
well. Some low cost or free CAM packages a full blown CAD program, but has enough because there are good manuals available.
exist and are particularly useful for specific CAD functions to allow straightforward Currently, a licence for Cut2D costs £95 +
machining tasks like milling circuit boards, 2D designs to be created then turned into VAT and a licence for VCarve Pro costs £395
but, again, the tendency is to add CAM capa- instructions for Mach3 to produce the fin- + VAT. Trial versions of both packages can be
bility to existing design programs. GSimple ished workpiece. It will also import existing downloaded free so that you can try them
is a typical free CAM program, developed designs from a range of other CAD pro- before purchase. Trial versions will not allow
by an enthusiast and quite capable within grams and drawing programs, in which case you to output code for Mach3, so you will
specific limits. It cannot deal with DXF files it performs as a CAM program. not be able to do any machining before
containing “blocks” for example. Nor can it VCarve Pro is Cut2D’s big brother and con- paying for a licence. Cut2D is very capable
machine islands within pockets. For some tains the same CAM functions but has a and can be used for the majority of straight-
workpieces, those are serious limitations. wider range of CAD tools and additional forward model making tasks. It’s relatively
FreeMill is a free 3D milling package capa- tools related to CAM tasks such as optimis- low cost suggests it is an entry level pro-
ble of importing 3D files in specific formats ing part placement, dealing with machining gram designed not only to do a good job
such as VisualMILL, STL, Rhino .3dm, VRML of cylindrical objects on a 4th axis, and a but to entice the user to upgrade to VCarve
and Raw Triangle . It has been created by wider range of engraving tools for text and Pro, or to the much more expensive top of
a commercial company, but is provided other functions. VCarve can use co-ordinat- the range Aspire. We will focus on Cut2D
free using a well-known model in which ed X, Y and Z movements to produce 3D for much of this series, but will make some
good software if provided free to (a) entice effects on the finished work, under specific reference to the more advanced features of
you to pay for training, and (b) entice you circumstances, although it is not a full 3D VCarve Pro from time to time. And because
to upgrade to the full commercial product. machining program. I am a code-head at heart, we will look at
This works well for end-users who can read There is lots of support for these software some hand-coding too.

You might also like