but because we do not know the details of your machine or local conditions we can accept
no responsibility for the performance of any machine or any damage or injury caused by its
use. It is your responsibility to ensure that you understand the implications of what you
design and build and to comply with any legislation and codes of practice applicable to your
country or state.
If you are in any doubt you must seek guidance from a professionally qualified expert
rather than risk injury to yourself or to others.
This document is intended to give enough details about how the Mach3Mill software
interacts with your machine tool, how it is configured for different axis drive methods and
about the input languages and formats supported for programming to enable you to
implement a powerful CNC system on a machine with up to six controlled axes. Typical
machine tools that can be controlled are mills, routers, plasma cutting tables.
Preface
Any machine tool is potentially dangerous. Computer controlled machines are
potentially more dangerous than manual ones because, for example, a
computer is quite prepared to rotate an 8" unbalanced cast iron four-jaw chuck
at 3000 rpm, to plunge a panel-fielding router cutter deep into a piece of oak or
to mill the clamps holding your work to the table!
This manual tries to give you guidance on safety precautions and techniques
Although Mach3Mill can control the two axes of a lathe for profile turning or the like, a
separate program (Mach3Turn) and supporting documentation is being developed to
support the full functionality of a lathes etc.
An online wiki format document Customising Mach3 explains in detail how to alter screen
layouts, to design your own screens and Wizards and to interface to special hardware
devices.
You are strongly advised to join one or both of the online discussion fora for Mach3. Links
to join it are at www.machsupport.com You should be aware that, while these fora have
many engineers with a vast range of experience as participants, they do not constitute a
substitute for a machine tool manufacturer's support network. If your application requires
this level of support then you should buy the system from a local distributor or an OEM
with a distributor network. In that way you will get the benefits of Mach3 with the
possibility of on-site support.
Certain portions of text in this manual are printed "greyed out". They generally describe
features found in machine controllers but which are not presently implemented in Mach3.
The description of a greyed out feature here is not to be taken as a commitment to
implement it at any given time in the future.
Thanks are due to numerous people including the original team who worked at National
Institute for Standards and Testing (NIST) on the EMC project and the users of Mach3
without whose experience, materials and constructive comments this manual could not have
been written. Credits are given for individual utilities and features as these are described in
the body of the manual.
ArtSoft Corporation is dedicated to continual improvement of its products, so suggestions
for enhancements, corrections and clarifications will be gratefully received.
Art Fenerty and John Prentice assert their right to be identified as the authors of this work.
The right to make copies of this manual is granted solely for the purpose of evaluating
and/or using licensed or demonstration copies of Mach3. It is not permitted, under this
right, for third parties to charge for copies of this manual.
Every effort has been made to make this manual as complete and as accurate as possible but
no warranty or fitness is implied. The information provided is on an "as is" basis. The
authors and publisher shall have neither liability nor responsibility to any person or entity
with respect to any loss or damages arising from the information contained in this manual,
Rev 1.84-A2 Using Mach3Mill
Page 12
Preface
1-2
Use of the manual is covered by the license conditions to which you must agree when
installing Mach3 software.
Windows XP and Windows 2000 are registered trademarks of Microsoft Corporation. If
other trademarks are used in this manual but not acknowledged please notify ArtSoft
Corporation so this can be remedied in subsequent editions.
Using Mach3Mill Rev 1.84-A2
Page 13
Introduction
2-1
2. Introducing CNC machining systems
2.1 Parts of a machining system
This chapter will introduce you to terminology used in the rest of this manual
and allow you to understand the purpose of the different components in a
numerically controlled milling system.
The main parts of a system for numerically controlled mill are shown in figure 1.1
Figure 1.1 - Typical NC machining system
The designer of a part generally uses a Computer Aided Design/Computer Aided
Manufacturing (CAD/CAM) program or programs on a computer (1). The output of this
program, which is a part program and is often in "G-code" is transferred (by a network or
perhaps floppy disc) (2) to the Machine Controller (3). The Machine Controller is
responsible for interpreting the part program to control the tool which will cut the
workpiece. The axes of the Machine (5) are moved by screws, racks or belts which are
powered by servo motors or stepper motors. The signals from the Machine Controller are
amplified by the Drives (4) so that they are powerful enough and suitably timed to operate
the motors.
Although a milling machine is illustrated, the Machine can be a router or a plasma or laser
cutter. A separate manual describes Mach3 controlling a lathe, vertical borer etc.
Frequently the Machine Controller can control starting and stopping of the spindle motor
(or even control its speed), can turn coolant on and off and will check that a part program or
Machine Operator (6) are not trying to move any axis beyond its limits.
The Machine Controller also has controls like buttons, a keyboard, potentiometer knobs, a
manual pulse generator (MPG) wheel, or a joystick so that the Operator can control the
Rev 1.84-A2 Using Mach3Mill
Page 14
2-2
machine manually and start and stop the running of the part program. The Machine
Controller has a display so that the Operator knows what is happening.
Because the commands of a G-code program can request complicated co-ordinated
movements of the machine axes the Machine Controller has to be able to perform a lot of
calculations in "real-time" (e.g. cutting a helix requires a lot of trigonometrical calculation).
Historically this made it an expensive piece of equipment.
2.2 How Mach3 fits in
Mach3 is a software package which runs on a PC and turns it into a very powerful and
economical Machine Controller to replace (3) in figure 1.1.
To run Mach3 you need Windows XP (or Windows 2000) ideally running on a 1GHz
processor with a 1024 x 768 pixel resolution screen. A desktop machine will give much
better performance than most laptops and be considerably cheaper. You can, of course use
this computer for any other functions in the workshop (such as (1) in figure 1.1 - running a
CAD/CAM package) when it is not controlling your machine.
Mach3 communicates principally via one (or optionally two) parallel (printer) ports and, if
desired, a serial (COM) port.
The drivers for your machine's axis motors must accept step pulses and a direction signal.
Virtually all stepper motor drivers work like this, as do modern DC and AC servo systems
with digital encoders. Beware if you are converting an old NC machine whose servos may
use resolvers to measure position of the axes as you will have to provide a complete new
drive for each axis.
Introduction
Using Mach3Mill Rev 1.84-A2
Page 15
Overview of Mach3 software
3-1
3. An overview of Mach3 Machine Controller software
You are still reading this so evidently you think Mach3 might be an asset in
your workshop! The best thing to do now is to download a free
demonstration version of the software and try it out on your computer. You
do not need a machine tool to be connected up, indeed for the present it is
better not to have one.
If you have bought a complete system from a reseller then some or all of
these installation steps may have be done for you already.
3.1 Installation
Mach3 is distributed by ArtSoft Corp. via the Internet. You download the package as one
self installing file (which, in the present release, is about 8 megabytes). This will run for an
unlimited period as a demonstration version with a few limitations on the speed, the size of
job that can be undertaken and the specialist features supported. When you purchase a
licence this will "unlock" the demonstration version you have already installed and
configured. Full details of pricing and options are on the ArtSoft Corporation website
www.artofcnc.ca
3.1.1 Downloading
Download the package from www.artofcnc.ca using the right mouse button and Save Target
as… to put the self-installing file in any convenient working directory (perhaps
Windows\Temp). You should be logged in to Windows as an Administrator.
When the file has downloaded it can be immediately run by using the Open button on the
download dialog or this dialog can be closed for later installation. When you want to do the
installation you merely run the downloaded file. For example you could run Windows
Explorer (right click Start button), and double-click on the downloaded file in the working
directory.
3.1.2 Installing
You do not need a
machine tool
connected yet. If
you are just
starting it would be
better not to have
one connected.
Note where the
cable or cables
from the machine
tool are plugged
into your PC.
Switch off the PC,
the machine tool
and its drives and
unplug the 25 pin
connector(s) from
the back of the PC.
Now switch the PC
back on.
Figure 3.1 – The installer screen
When you run the downloaded file you will be guided through the usual installation steps
for a Windows program such as accepting the license conditions and selecting the folder for
Rev 1.84-A2 Using Mach3Mill
Page 16
Overview of Mach3 software
3-2
Mach3. On the Setup Finished dialog you should ensure that Initialise System is checked
and click Finish. You will now be told to reboot before running any Mach3 software.
The background image during installation is the standard Mach3Mill screen – do not worry
as Mach3Turn is also being installed.
On the Setup Finished dialog you should ensure that Load Mach3 Driver and Install English Wizards are checked and then click Finish. You will now be told to reboot before
running any Mach3 software.
3.1.3 The vital re-boot
This reboot is vital. If you do not do it then you will get into great difficulties which can
only be overcome by using the Windows Control Panel to uninstall the driver manually. So
please reboot now.
If you are interested in knowing why the reboot is required then read on, otherwise skip to
the next section.
Although Mach3 will appear to be a single program when you are using it, it actually
consists of two parts: a driver which is installed as part of Windows like a printer or
network driver and a graphical user interface (GUI).
The driver is the most important and ingenious part. Mach3 must be able to send very
accurately timed signals to control the axes of the machine tool. Windows likes to be in
charge and runs normal user programs when it has nothing better to do itself. So Mach3
cannot be a "normal user program"; it must be at the lowest level inside Windows (that is it
handles interrupts). Furthermore, to do this at the high speeds possibly required (each axis
can be given attention 45,000 times per second), the driver needs to tune its own code.
Windows does not approve of this (it's a trick that viruses play) so it has to be asked to give
special permission. This process requires the reboot. So if you have not done the re-boot
then Windows will give the Blue Screen of Death and the driver will be corrupt. The only
way out of this will be to manually remove the driver.
Having given these dire warnings, it is only fair to say that the reboot is only required when
the driver is first installed. If you update your system with a newer version then the reboot
is not vital. The install sequence does however still ask you to do it. Windows XP boots
reasonably quickly that it is not much hardship to do it every time.
3.1.4 Convenient desktop icons
So you have rebooted! The installation wizard will have created desktop icons for the main
programs. Mach3.exe is the actual user interface code. If you run it, it will ask which Profile
you wish to use. Mach3Mill, Mach3Turn etc. are shortcuts which run this with a Profile
defined by a "/p" argument in the shortcut target. You will usually employ these to start the
required system.
It is now worthwhile to setup some icons for desktop shortcuts to other Mach3 programs.
Use Windows
Explorer (rightclick Start) and
by right-clicking
on the
DriverTest.exe
file. Drag this
shortcut onto
your desktop.
Other programs
such as a screen
designer and a
manipulator for
screenset files
are available as a
Figure 3.2 – The running DriverTest
Using Mach3Mill Rev 1.84-A2
Page 17
Overview of Mach3 software
3-3
separate download.
3.1.5 Testing the installation
It is now highly recommended to test the system. As mentioned above, Mach3 is not a
simple program. It takes great liberties with Windows in order to perform its job; this means
it will not work on all systems due to many factors. For example, the QuickTime system
monitor (qtask.exe) running in the background can kill it and there will be other programs
which you probably are not even aware are on your system that can do the same. Windows
can and does start many processes in the background; some appear as icons in the system
tray (bottom right of screen) and others do not show themselves in any way. Other possible
sources of erratic operation are local area network connections which may be configured to
automatically speed detect. You should configure these to the actual speed 10 Mbps or 100
Mbps of your network. Finally a machine that has been surfing the Internet may have
gained one or more of a host of "robot" type programs which spy on what you are doing and
send data over the 'net to their originators. This traffic can interfere with Mach3 and is not
something you want anyway. Use a search engine for terms like "Spybot" to locate software
to tidy up your machine.
Because of these factors, it is important, though not mandatory, that you test your system
when you suspect something is wrong or you just want to check that an install went well.
Double click the DriverTest icon that you set up. Its screen shot is in figure 3.2.
You can ignore all the boxes with the exception of the Pulse Frequency. It should be fairly
steady around 25,000 Hz but yours may vary, even quite wildly. This is because Mach3
uses the Windows clock to calibrate its pulse timer and, over a short time scale, the
Windows clock can be affected by other processes loading the computer. So you may
actually be using an "unreliable" clock (the Windows one) to check Mach3 and so get the
false impression that Mach3's timer is unsteady.
Basically, if you see a similar screen to figure 3.2 with only small spikes on the Timer
Variations graph and a steady Pulse Freqency, everything is working well so close the DriverTest program and skip to the section Screens below.
Windows "experts" might be interested to see a few other things. The white rectangular
window is a type of timing analyzer. When it is running it displays a line with small
variations indicated. These variations are the changes in timing from one interrupt cycle to
another. There should be no lines longer than ¼ inch or so on an 17" screen on most
systems. Even if there are variations its possible they are below the threshold necessary to
create timing jitters so when your machine tool is connected you should perform a
movement test to see if jogging and G0/G1 moves are smooth.
You may have one of two things happen to you when running the test which may indicate a
problem.
1) “Driver not found or installed, contact Art.”, this means that the driver is not loaded
into Windows for some reason. This can occur on XP systems which have a corruption
of their driver database, reloading Windows is the cure in this case. Or, you may be
running Win2000. Win2000 has a bug/"feature" which interferes with loading the
driver. It may need to be loaded manually see the next section
2) When the system says, taking over…3…2…1.. and then reboots, one of two things has
occurred. Either you didn’t reboot when asked (told you!!) or the driver is corrupted or
unable to be used in your system. In this case follow the next section and remove the
driver manually, then re-install. If the same thing happens, please notify ArtSoft using
the e-mail link on www.artofcnc.ca and you will be given guidance.
A few systems have motherboards which have hardware for the APIC timer but whose
BIOS code does not use it. This will confuse Mach3 install. A batch file
SpecialDriver.bat is available in the Mach3 installation folder. Find it with
Windows Explorer and double-click it to run it. This will make the Mach3 driver use
the older i8529 interrupt controller. You will need to repeat this process whenever you
download an upgraded version of Mach3 as installing the new version will replace the
special driver. The file OriginalDriver.bat reverses this change.
Rev 1.84-A2 Using Mach3Mill
Page 18
Overview of Mach3 software
3-4
3.1.6 Driver Test after a Mach3 crash
Should you for any reason have a situation when running Mach3 where it crashes - this
might be an intermittent hardware problem or a software bug – then you must run
DriverTest.exe as soon as possible after Mach3 has failed. If you delay for two minutes then
the Mach3 driver will cause Windows to fail with the usual "Blue Screen of Death".
Running DriverTest resets the driver to a stable condition even if Mach3 disappears
unexpectedly.
You may find, after a crash, that it fails to find the driver the first time it is run. In this case
merely run it again as the first run should fix things up.
3.1.7 Notes for manual driver installation and un-installation
You only need to read and do this section if you have not successfully run the
DriverTest program.
The driver (Mach3.sys) can be installed and uninstalled manually using the Windows
control panel. The dialog boxes differ slightly between Windows 2000 and Windows XP
but the steps are identical.
♦ Open the Control panel and double-click on the icon or line for System.
♦ Select Hardware and click Add Hardware wizard. (As mentioned before Mach3's
driver works at the lowest level in Windows). Windows will look for any new
actual hardware (and find none).
♦ Tell the wizard you have already installed it and then proceed to the next screen.
♦ You will be shown a list of hardware. Scroll to the bottom of this and select Add a
new hardware device and move to the next screen.
♦ On the next screen you do not want Windows to search for the driver so select
Install the hardware that I manually select from a list (Advanced)
♦ The list you are shown will include an entry for Mach1/2 pulsing engine. Select
this and go to the next screen.
♦ Click Have disc and on the next screen point the file selector to your Mach3
directory (C:\Mach3 by default). Windows should find the file Mach3.inf. Select
this file and click Open. Windows will install the driver.
The driver can be uninstalled rather more simply.
♦ Open the Control panel and double-click on the icon or line for System.
♦ Select Hardware and click Device Manager
♦ You will be shown a list of devices and their drivers. Mach1 Pulsing Engine has
the driver Mach3 Driver under it. Use the + to expand the tree if necessary. Rightclick on Mach3 Driver gives the option to uninstall it. This will remove the file
Mach3.sys from the Windows folder. The copy in the Mach3 will still be there.
There is one final point to note. Windows remembers all the information about the way you
have configured Mach3 in a Profile file. This information is not deleted by un-installing the
driver and deleting other Mach3 files so it will remain whenever you upgrade the system.
However in the very unlikely event that you need a totally clean installation from scratch
then you need to delete the .XML profile file or files.
3.2 Screens
You are now ready to try out a "dry run" Mach3. It will be much easier to show you how to
set up your actual machine tool when you have experimented with Mach3 like this. You can
"pretend" to machine and learn a lot even if you haven't got a CNC machine tool yet. If you
have got one, then do make sure it is not connected to the PC.
Mach3 is designed so that it is very easy to customize its screens to suit the way you work.
This means that the screens you see may not look exactly like those in Appendix 1. If there
Using Mach3Mill Rev 1.84-A2
Page 19
Overview of Mach3 software
3-5
are major differences then your system supplier should have given you a revised set of
screenshots to match your system.
Double-click the Mach3Mill icon to run the program. You should see the Mill Program Run
screen similar to that in Appendix 1 (but with the various DROs set to zero, no program
loaded etc.).
Notice the red Reset button. It will have a flashing Red/Green LED (simulation of a light
emitting diode) above it and some yellow LEDs lit. If you click the button then the yellow
LEDs go out and the flashing LED turns to solid green. Mach3 is ready for action!
If you cannot reset then the problem is probably something plugged into your parallel port
or ports (a "dongle" perhaps) or the PC has previously had Mach3 installed on it with an
unusual allocation of port pins to the Emergency Stop (EStop signal). By clicking on the
Offline button you should be able to Reset the system. Most of the tests and
demonstrations in this chapter will not work unless Mach3 is reset out of the EStop
mode.
3.2.1 Types of object on screens
You will see that the Program Run screen is made up of the following types of object:
♦ Buttons (e.g. Reset, Stop Alt-S, etc.)
♦ DROs or Digital Readouts. Anything with a number displayed will be a DRO. The
main ones are, of course the current positions of the X, Y, Z, A, B & C axes.
♦ LEDs (in various sizes and shapes)
♦ G-code display window (with its own scroll bars)
♦ Toolpath display (blank square on your screen at the moment)
There is one further important type of control that is not on the Program Run screen:
♦ MDI (Manual Data Input) line
Buttons and the MDI line are your inputs to Mach3.
DROs can be displays by Mach3 or can be used as inputs by you. The background colour
changes when you are inputting.
The G-code window and Toolpath displays are for information from Mach3 to you. You
can, however, manipulate both of them (e.g. scrolling the G-code window, zooming,
rotating and panning the Toolpath display)
Figure 3.3 - The screen selection buttons
3.2.2 Using buttons and shortcuts
On the standard screens most buttons have a keyboard hotkey. This will be shown after the
name on the button itself or in a label near it. Pressing the named key when the screen is
displayed is the same as clicking the button with the mouse. You might like to try using the
mouse and keyboard shortcuts to turn on and off the spindle, to turn on Flood coolant and to
switch to the MDI screen. Notice that letters are sometimes combined with the Control or
Alt keys. Although letters are shown as uppercase (for ease of reading) you do not use the
shift key when using the shortcuts.
In a workshop it is convenient to minimise the times when you need to use a mouse.
Physical switches on a control panel can be used to control Mach3 by use of a keyboard
Rev 1.84-A2 Using Mach3Mill
Page 20
Overview of Mach3 software
3-6
emulator board (e.g. Ultimarc IPAC). This plugsin in series with your keyboard and send Mach3
"pretend" keypresses which activate buttons with
shortcuts.
If a button does not appear on the current screen
then its keyboard shortcut is not active.
There are certain special keyboard shortcuts
which are global across all screens. Chapter 5
shows how these are set up.
3.2.3 Data entry to DRO
You can enter new data into any DRO by clicking
in it with the mouse, clicking its hotkey (where
set) or by using the global hotkey to select DROs
and moving to the one that you want with the
arrow keys)
Try entering a feedrate like 45.6 on the Program
Run screen. You must press the Enter key to
accept the new value or the Esc key to revert to
the previous one. Backspace and Delete are not
used when inputting to DROs.
Caution: It is not always sensible to put your
own data into a DRO. For example the display of
your actual spindle speed is computed by Mach3.
Any value you enter will be overwritten. You can
put values into the axis DROs but you should not
do it until you have read Chapter 7 in detail. This
is not a way of moving the tool!
3.3 Jogging
You can move the tool relative to any place on
your work manually by using various types of Jogging. Of course, on some machines, the
tool itself will move and on others it will be the machine table or slides that move. We will
use the words "move the tool" here for simplicity.
The jogging controls are of a special “fly-out” screen. This is shown and hidden by using
the Tab key on the keyboard. Figure 3.4 gives a view of the flyout.
You can use the keyboard for jogging. The arrow keys are set by default to give you
jogging on the X and Y axes and Pg Up/PgDn jogs the Z axis. You can re-configure these
keys (see Chapter 5) to suit your own preferences. You can use the jogging keys on any
screen with the Jog ON/OFF button on it.
In figure 3.4 you will see that the Step LED is shown lit. The Jog Mode button toggles
between Continuous, Step and MPG modes,
Figure 3.4 - Jog controls
(use Tab key to show and hide
this)
In Continuous mode the chosen axis will jog for as long as you hold the key down. The
speed of jogging is set by the Slow Jog Percentage DRO. You can enter any value from
0.1% to 100% to get whatever speed you want. The Up and Down screen buttons beside
this DRO will alter its value in 5% steps. If you depress the Shift key then the jogging will
occur at 100% speed whatever the override setting. This allows you to quickly jog to near
your destination and the position accurately.
In Step mode, each press of a jog key will move the axis by the distance indicated in the
Step DRO. You can set this to whatever value you like. Movement will be at the current
Feedrate. You can cycle through a list of predefined Step sizes with the Cycle Jog Step
button.
Using Mach3Mill Rev 1.84-A2
Page 21
Overview of Mach3 software
3-7
Rotary encoders can be interfaced (via the parallel port input pins) to Mach3 as Manual
Pulse Generators (MPGs). It is used to perform jogging by turning its knob when in MPG
mode. The buttons marked Alt A, Alt B and Alt C cycle through the available axes for each
of three MPGs and the LEDs define which axis is currently selected for jogging.
The another option for jogging is a joystick connected to the PC games port or USB. Mach3
will work with any Windows compatible "analog joystick" (so you could even control your
X axis by a Ferrari steering wheel!). The appropriate Windows driver will be needed for the
joystick device. The 'stick is enabled by the Joystick button and, for safety, must be in the
central position when it is enabled.
If you have an actual joystick and it has a throttle control then this can be configured either
to control the jog override speed or the control the feed rate override (see Chapter 5 again).
Such a joystick is a cheap way of providing very flexible manual control of your machine
tool. In addition, you can use multiple joysticks (strictly Axes on Human Interface Devices)
by installing manufacturer's profiler software or, even better, the KeyGrabber utility
supplied with Mach.
Now would be a good time to try all the jogging options on your system. Don't forget that
there are keyboard shortcuts for the buttons, so why not identify them and try them. You
should soon find a way of working that feels comfortable.
3.4 Manual Data Input (MDI) and teaching
3.4.1 MDI
Use the mouse or keyboard shortcut to display the MDI (Manual Data Input) screen.
This has a single line for data entry. You can click in it to select it or use press Enter which
will automatically select it.
You can type any valid line
that could appear in a part
program and it will be executed
when you press Enter. You can
discard the line by pressing
Esc. The Backspace key can be
used for correcting mistakes in
your typing.
If you know some G-code commands then you could try them out. If not then try:
G00 X1.6 Y2.3
Which will move the tool to coordinates X = 1.6 units and Y = 2.3 units. (it is G zero not G
letter O). You will see the axis DROs move to the new coordinates.
Try several different commands (or G00 to different places). If you use the up or down
arrow keys while in the MDI line you will see that Mach3 scrolls you back and forwards
through the history of commands you have used. This makes it easy to repeat a command
without having to re-type it. When you select the MDI line you will have noticed a flyout
box giving you a preview of this remembered text.
Figure 3.4 – MDI data being typed
An MDI line (or block as a line of G-code is sometimes called) can have several commands
on it and they will be executed in the "sensible" order as defined in Chapter 10 - not
necessarily from left to right. For example setting a feed speed by something like F2.5 will
take effect before any feed speed movements even if the F2.5 appears in the middle or even
at the end of the line (block). If in doubt about the order that will be used then type several
separate MDI commands in one by one.
3.4.2 Teaching
Mach3 can remember a sequence of lines that you enter using MDI and write them to a file.
This can then be run again and again as a G-code program.
Rev 1.84-A2 Using Mach3Mill
Page 22
Overview of Mach3 software
3-8
On the MDI screen, click the Start Teach button. The LED next to it will light to remind
you that you are
teaching. Type in a series
of MDI lines. Mach3 will
execute them as you
press return after each
line and store them in a
conventionally named
Teach file. When you
have finished, click Stop Teach.
You can type your own
code or try:
g21
f100
g1 x10 y0
g1 x10 y5
x0
y0
All the 0 are zeros in this.
Next click Load/Edit and
go to the Program Run
screen. You will see the
Figure 3.5 – In the middle of teaching a rectangle
lines you have typed are
displayed in the G-code window (figure 3.6). If you click Cycle Start then Mach3 will
execute your program.
When you have used the editor then you will be able to correct any mistakes and save the
program in a file of your own choosing.
Figure 3.6 – Taught program running
3.5 Wizards – CAM without a dedicated CAM software
Mach3 allows the use of addon screens which allow the
automation of quite complex
tasks by prompting the user
to provide the relevant
information. In this sense
they are rather like the socalled Wizards in much
Windows software that guide
you through the information
required for a task. The
classic Windows Wizard will
handle tasks line importing a
file to a database or
spreadsheet. In Mach3,
examples of Wizards include
Figure 3.7 – Table of Wizards from Wizard menu
Using Mach3Mill Rev 1.84-A2
Page 23
Overview of Mach3 software
3-9
cutting a circular pocket, drilling a grid of holes, digitising the surface of a model part.
It is easy to try one out. In the Program Run screen click Load Wizards. A table of the
Wizards installed on your system will be displayed (figure 3.7). As an example click on the
line for Circular pocket, which is in the standard Mach3 release, and click Run.
The Mach3 screen currently displayed will be replaced by the one shown in figure 3.8. This
shows the screen with some default options. Notice that you can choose the units to work
in, the position of the centre of the pocket, how the tool is to enter the material and so on.
Not all the options might be relevant to your machine. You may, for example, have to set
the spindle speed manually. In this case you can ignore the controls on the Wizard screen.
When you are satisfied with
the pocket, click the Post Code button. This writes a Gcode part program and loads
it into Mach3. This is just an
automation of what you did
in the example on Teaching.
The toolpath display shows
the cuts that will be made.
You can revise your
parameters to take smaller
cuts or whatever and re-post
the code.
If you wish you can save the
settings so the next time you
run the Wizard the initial
data will be what is currently defined.
Figure 3.8 – Circular pocket with defaults
Figure 3.9 – Circular Pocket with values set and code posted
Rev 1.84-A2 Using Mach3Mill
Page 24
Overview of Mach3 software
3-10
When you click Exit you will be returned to the main Mach3 screens and can run the
Wizard-generated part program. This process will be often be quicker than reading the
description here.
Figure 3.10 – The result of Circular Pocket ready to run
3.6 Running a G-code program
Now it is time to input and edit a Part Program. You will normally be able to edit programs
without leaving Mach3 but, as we have not yet configured it to know which editor to use, it
is easiest to set up the program outside Mach3.
Use Windows Notepad to enter the following lines into a text file and save it in a
convenient folder (My Documents perhaps) as spiral.tap
You must choose All Files in the Save As Type drop-down or Notepad will append .TXT to
your filename and Mach3 will not be able to find it.
Again all the "0" are zeros in this. Don't forget to press the Enter key after the m0. Use the
File>Load G-code menu to load this program. You will notice that it is displayed in the Gcode window.
On the Program Run screen you can try the effect of the Start Cycle, Pause, Stop, and
Rewind buttons and their shortcuts.
As you run the program you may notice that the highlighted line moves in a peculiar way in
the G-code window. Mach3 reads ahead and plans its moves to avoid the toolpath having to
slow down more than in necessary. This lookahead is reflected in the display and when you
pause.
You can go to any line of code scrolling the display so the line is highlighted. You can then
use Run from here.
Using Mach3Mill Rev 1.84-A2
Page 25
3-11
Note: You should always run your programs
from a hard drive not a floppy drive or USB
"key". Mach3 needs high-speed access to the file,
which it maps into memory. The program file
must not be read-only.
3.7 Toolpath display
3.7.1 Viewing the toolpath
The Program Run screen has a blank square on it
when Mach3 is first loaded. When the Spiral
program is loaded you will see it change to a
circle inside a square. You are looking straight
down on the toolpath for the programmed part,
i.e. in Mach3Mill you are looking perpendicular
to the X-Y plane.
The display is like a wire model of the path the tool will follow placed inside a clear sphere.
By dragging the mouse over the window you can rotate the "sphere" and so see the model
from different angles. The set of axes in the top left hand corner show you what directions
are X, Y and Z. So if you drag the mouse from the centre in an upwards direction the
"sphere" will turn showing you the Z axis and you will be able to see that the circle is
actually a spiral cut downwards (in the negative Z direction). Each of the G3 lines in the
Spiral program above draws a circle while simultaneously lowering the tool 0.2 in the Z
direction. You can also see the initial G00 move which is a straight line.
Overview of Mach3 software
Figure 3.11 Toolpath from Spiral.txt
You can if you wish produce a display like the conventional isometric view of the toolpath.
A few minutes of "play" will soon give you confidence in what can be done. Your display
may be a different colour to that shown in figure 3.11. The colors can be configured. See
chapter 5.
3.7.2 Panning and Zooming the toolpath display
The toolpath display can be zoomed by dragging the cursor in its window with the Shift key
depressed.
The toolpath display can be panned in its window by dragging the cursor in the window
with the Right mouse button held.
Double-clicking the toolpath window restores the display to the original perpendicular view
with no zoom applied.
Note: You cannot Pan or Zoom while the machine tool is running.
3.8 Other screen features
Finally it is worth browsing through some of the other Wizards and all the screens.
As a small challenge you might like to see if you can identify the following useful features:
♦A button for estimating the time that a part program will take to run on the actual
machine tool
♦ The controls for overriding the feedrate selected in the part program
♦ DROs which give the extent of movement of the tool in all axes for the loaded part
program
♦A screen that lets you set up information like where you want the Z axis to be put
to make X and Y moves safe from hitting clamps etc.
♦A screen that lets you monitor the logic levels (zero and one) on all Mach3s inputs
and outputs.
Rev 1.84-A2 Using Mach3Mill
Page 26
Overview of Mach3 software
3-12
Using Mach3Mill Rev 1.84-A2
Page 27
Hardware issues and connecting your machine tool
4-1
4. Hardware issues and connecting the machine tool
This chapter tells you about the hardware aspects of connections. Chapter 5
gives details of configuring Mach3 to use the connected items.
If you have bought a machine that is already equipped to be run by Mach3
then you will probably not need to read this chapter (except out of general
interest). Your supplier will have given you some documentation on how to
connect the parts of your system together.
Read this chapter to discover what Mach3 expects it is going to control and
how you can connect up standard components like stepper motor drivers and
micro-switches. We will assume that you can understand simple schematic
circuit diagrams; if not, then now is the time to get some help.
On the first reading you might not want to bother with sections after 4.6.
4.1 Safety - emphasised
Any machine tool is potentially dangerous. This manual tries to give you
guidance on safety precautions and techniques but because we do not know
the details of your machine or local conditions we can accept no responsibility
for the performance of any machine or any damage or injury caused by its use.
It is your responsibility to ensure that you understand the implications of what
you design and build and to comply with any legislation and codes of practice
applicable to your country or state.
If you are in any doubt you must seek guidance from a professionally qualified expert
rather than risk injury to yourself or to others.
4.2 What Mach3 can control
Mach3 is a very flexible program designed to control machines like milling machines (and
although not described here, turning machines). The characteristics of these machines used
by Mach3 are:
♦Some user controls. An emergency stop (EStop) button must be provided on every
machine
♦Two or three axes which are at right angles to each other (referred to as X, Y and
Z)
♦A tool which moves relative to a workpiece. The origin of the axes is fixed in
relation to the workpiece. The relative movement can, of course, be by (i) the tool
moving (e.g. the quill of a milling spindle moves the tool in the Z direction or a lathe
tool mounted on a cross-slide and a saddle moves the tool in the X and Z directions) or
(ii) by the table and workpiece moving (e.g. on a knee type mill the table moves in the
X, Y and Z directions)
And optionally:
♦ Some switches to say when the tool is in the "Home" position
♦ Some switches to define the limits of permitted relative movement of the tool
♦ A controlled "spindle". The "spindle" might rotate the tool (mill) or the workpiece
(turning).
♦ Up to three additional axes. These can be defined as Rotary (i.e. their movement is
measured in degrees) or Linear. One of the additional linear axes can be slaved to
the X or Y or Z axis. The two will move together at all times in response to a part
Rev 1.84-A2 Using Mach3Mill
Page 28
Hardware issues and connecting your machine tool
4-2
program's moves and to your jogging but they will each be referenced separately.
(see Configuring slaved axes for more details).
♦ A switch or switches which interlock the guards on the machine
♦ Controls for the way coolant is delivered (Flood and/or Mist)
♦ A probe in the tool holder that allows digitising of an existing part
♦ Encoders, such as linear glass scales, which can display the position of parts of the
machine
♦ Special functions.
Most connections between your machine and the PC running Mach3 are made through the
parallel (printer) port(s) of the computer. A simple machine will only need one port; a
complex one will need two.
Connections for control of special functions like an LCD display, a tool-changer, axis
clamps or a swarf conveyor can also be made through a ModBus device (e.g. a PLC or
Homann Designs ModIO controller).
Buttons can be interfaced by a "keyboard emulator" which generates pseudo key presses in
response to input signals.
Mach3 will control all six axes, co-ordinating their simultaneous movement with linear
interpolation or perform circular interpolation on two axes (out of X, Y or Z) while
simultaneously linearly interpolating the other four with the angle being swept by the
circular interpolation. The tool can thus move in a tapering helical path if required! The
feed rate during these moves is maintained at the value requested by your part program,
subject to limitations of the acceleration and maximum speed of the axes. You can move the
axes by hand with various jogging controls.
If the mechanism of your machine is like a robot arm or a hexapod then Mach3 will not be
able to control it because of the kinematic calculations that would be needed to relate the
"tool" position in X, Y and Z coordinates to the length and rotation of the machine arms..
Mach3 can switch the spindle on, rotating in either direction, and switch it off. It can also
control the rate at which it rotates (rpm) and monitor its angular position for operations like
cutting threads.
Mach3 can turn the two types of coolant on and off.
Mach3 will monitor the EStop and can take note of the operation of the reference switches,
the guard interlock and limit switches
Mach3 will store the properties of up to 256 different tools. If, however, your machine has
an automatic tool changer or magazine then you will have to control it yourself.
4.3 The EStop control
Every machine tool must have one or more Emergency Stop (EStop) buttons; usually with a
big red mushroom head. They must be fitted so that you can easily reach one from wherever
you might be when you are operating the machine.
Each EStop button should stop all activity in the machine as quickly as is safely possible;
the spindle should stop rotating and the axes should stop moving. This should happen
without relying on software - so we are talking about relays and contactors. The circuit
should tell Mach3 what you have done and there is a special, mandatory input for this. It
will generally not be good enough to turn off the AC power for an EStop because the
energy stored in DC smoothing capacitors can allow motors to run on for some considerable
time.
The machine should not be able to run again until a "reset" button has been pressed. If the
EStop button locks when pushed then the machine should not start when you release it by
turning its head.
It will not generally be possible to continue machining a part after an EStop but you and the
machine will at least be safe.
Using Mach3Mill Rev 1.84-A2
Page 29
Hardware issues and connecting your machine tool
4-3
4.4 The PC parallel port
4.4.1 The parallel port and its history
When IBM designed the original PC (160k floppy disc drive, 64kbytes of RAM!) they
provided an interface for
connecting printers using a
25 conductor cable. This is
the foundation of the
Parallel port we have on
most PCs today. As it is a
very simple way of
transferring data it has been
used for many things other
than connecting printers.
You can transfer files
between PC, attach copy
protection "dongles",
connect peripherals like
scanners and Zip drives and of course control machine tools using it. USB is taking over
many of these functions and this conveniently leaves the parallel port free for Mach3.
13
25
0 volts
(common)
Figure 4.1 - Parallel port female connector
(seen from back of PC)
1
socket
number
14
The connector on the PC is a 25 way female "D" connector. Its sockets seen from the back
of the PC are shown in figure 4.1. The arrows give the direction of information flow relative
to the PC. Thus, for example, pin 15 is an input to the PC.
Note: Convertors which plug into a USB port and have a 25 pin connector will not drive a
machine even though they are perfectly suitable for the simpler task of connecting a printer.
4.4.2 Logic signals
On first reading, you may wish to skip to the next heading and return here if you have to get
involved with the nitty-gritty of interface circuits. It will probably be useful to read it with
the documentation for your axis drive electronics.
All the signals output by Mach3 and input to it are binary digital (i.e. zeros and ones) These
signals are voltages supplied by the output pins or supplied to the input pins of the parallel
port. These voltages are measured relative to the computer's 0 volt line (which is connected
to pins 18 to 25 of the port connector).
The first successful family (74xx series) of integrated circuits used TTL (transistortransistor logic). In TTL circuits, any voltage between 0 and 0.8 volts is called "lo" and any
voltage between 2.4 and 5 volts is called "hi". Connecting a negative voltage or anything
above 5 volts to a TTL input will produce smoke.1 The parallel port was originally built
using TTL and to this day these voltages define its "lo" and "hi" signals. Notice that in the
worst case there is only 1.6 volts difference between them.
It is, of course, arbitrary whether we say that a "lo" represents a logic one or a logic zero.
However, as is explained below, "lo" = one is actually better in most practical interface
circuits.
For an output signal to do anything, some current will have to flow in the circuit connected
to it. When it is "hi" current will flow out of the computer. When it is "lo" current will flow
into the computer. The more current you have flowing in, the harder it is to keep the
voltage near zero so the nearer to the permitted limit of 0.8 volts "lo" will become.
Similarly, current flowing out of a "hi" will make the voltage be lower and nearer to the 2.4
volts lower limit. So with too much current the difference between "lo" and "hi" will be
even less than 1.6 volts and things will become unreliable. Finally, it's worth noting you are
allowed roughly 20 times more current flowing into a "lo" than you are allowed flowing out
of a "hi".
1
Some people think that integrated circuits work in some way by using smoke. Certainly no one has ever seen
one work after the smoke has escaped!
Rev 1.84-A2 Using Mach3Mill
Page 30
Hardware issues and connecting your machine tool
4-4
So this means that it is best to assign logic 1 to be a "lo" signal. Fairly obviously this is
called active lo logic. The main practical disadvantage of it is that the device connected to
the parallel port has to have a 5 volt supply to it. This is sometimes taken from the PC game
port socket or from a power supply in the device that is connected.
Turning to input signals, the computer will need to be supplied with some current (less than
40 microamps) for "hi" inputs and will supply some (less than 0.4 milliamps) for "lo"
inputs.
Because modern computer motherboards combine many functions, including the parallel
port, into one chip we have experienced systems where the voltages only just obey the "hi"
and "lo" rules. You might find that a machine tool that ran on and old system becomes
temperemental when you upgrade the computer. Pins 2 to 9 are likely to have similar
properties (they are the data pins when printing). Pin 1 is also vital in printing but the other
output pins are little used and may be less powerful in a carefully "optimised" design. A
good isolating breakout board (see next section) will protect you from these electrical
compatibility problems.
4.4.3 Electrical noise and expensive smoke
Even if you skipped the previous
section you had better read this one!
You will see that pins 18 to 25 are
connected to the 0 volt side of the
Figure 4.2 – Three examples of commercially
available breakout boards
computer's power supply. All signals
inside and outside the PC are relative to
this. If you connect many long wires to it, especially if they run near wires carrying high
currents to motors, then these wires will have currents flowing in then that create voltages
which are like noise and can cause errors. You might can even crash the computer.
The axis and perhaps spindle drives, which you will connect to Mach3 through your parallel
port, are likely to work at between 30 and 240 volts and they will be able to supply currents
of many amps. Properly connected they will do no harm to the computer but an accidental
Using Mach3Mill Rev 1.84-A2
Page 31
Hardware issues and connecting your machine tool
4-5
short circuit could easily destroy the entire computer mother-board and even the CD-ROM
and hard drives as well.
For these two reasons you are very strongly advised to buy a device called an "isolating
breakout board". This will provide you with terminals that are easy to connect to, a separate
0 volt (common) for the drives, home switches etc. and will avoid exceeding the permitted
current in and out of the port. This breakout board, your drive electronics and power supply
should be neatly installed in a metal case to minimise the risk of interference to your
neighbours' radio and television signals. If you build a "rat's nest" then you are inviting
short circuits and tragedy. Figure 4.2 shows three commercial breakout boards.
Here ends the sermon!
4.5 Axis drive options
4.5.1 Steppers and Servos
There are two possible types of motive power for axis drives:
♦ Stepper motor
♦ Servo motor (either AC or DC)
Either of these types of motor can
then drive the axes through
leadscrews (plain- or ball-nut),
belts, chains or rack and pinion.
The mechanical drive method will
determine the speed and torque
required and hence any gearing
required between the motor and
machine.
Properties of a bipolar stepper
motor drive are:
1. Low cost
2. Simple 4-wire connection
to motor
3. Low maintenance
Figure 4.3 - Small DC servo motor with encoder (left)
and gearbox
4. Motor speed limited to about 1000 rpm and torque limited to about 3000 ounce
inches. (21 Nm). Getting the maximum speed depends on running the motor or the
drive electronics at their maximum permitted voltage. Getting the maximum torque
depends on running the motor at its maximum permitted current (amps)
5. For practical purposes on a machine tool steppers need to be driven by a chopped
micro-stepping controller to ensure smooth operation at any speed with reasonable
efficiency.
6. Provides open loop control which means it is possible to lose steps under high
loading and this may not immediately be obvious to the machine user.
On the other hand a servo motor drive is:
1. Relatively expensive (especially if it has an AC motor)
2. Needs wiring for both the motor and encoder
3. Maintenance of brushes is required on DC motors
4. Motor speed 4000 rpm plus and a practically unlimited torque (if your budget can
stand it!)
5. Provides closed loop control so drive position is always known to be correct (or a
fault condition will be raised)
Rev 1.84-A2 Using Mach3Mill
Page 32
Hardware issues and connecting your machine tool
4-6
In practice stepper motor drives will give satisfactory performance with conventional
machine tools up to a Bridgeport turret mill or a 6" centre height lathe unless you want
exceptional accuracy and speed of operation.
It is worth giving two warnings here. Firstly servo systems on old machines are probably
not digital; i.e. they are not controlled by a series of step pulses and a direction signal. To
use an old motor with Mach3 you will need to discard the resolver (which gave the
position) and fit a quadrature encoder and you will have to replace all the electronics.
Secondly beware of secondhand stepper motors unless you can get manufacturer's data for
them. They might be designed for 5-phase operation, may not work well with a modern
chopped micro-stepping controller and might have a much lower rated torque than the same
size of modern motor.. Unless you can test them, you may find that they have been
accidentally demagnetised and so be useless. Unless you are really confident of your skills
and experience, then the axis drives should be current products bought from suppliers who
will support them. If you buy right then you will only need to buy once.
4.5.2 Doing Axis drive calculations
A full set of calculations for the axis drives would be very complicated and anyway you
probably do not have all the necessary data (e.g. what is the maximum cutting force you
want to use). Some calculation is, however, necessary for success.
If you are reading the manual for an overview then you might like to skip this section.
Fuller details of the calculations are given in chapter 5.
Example 1 - MILL TABLE CROSS SLIDE
We start with checking the minimum possible move distance. This is an absolute limit to
the accuracy of work done on the machine. We will then check rapid speeds and torque.
As an example suppose you are designing a mill cross-slide (Y axis) drive. You are going to
use a screw with a 0.1" pitch single start thread and a ball nut. You want to aim for a
minimum move of 0.0001". This is 1/
of a revolution of the motor shaft if it is coupled
1000
directly to the screw.
Slide with stepper motor
The minimum step with a stepper motor depends on how it is controlled. There are usually
200 full steps per revolution. You need to use micro-stepping for smooth running over the
full range of feed speeds and many controllers will allow you to have 10 micro-steps per
full step. This system would give 1/
of a revolution as the minimum step which is fine.
2000
Next look at the possible rapid feed speed. Assume, conservatively, that the maximum
motor speed is 500 rpm. This would give a rapid of 50 inches/minute or about 15 seconds
for the full slide travel. This would be satisfactory although not spectacular.
At this speed the micro-stepping motor drive electronics need 16,666 (500 * 200 * 10 / 60)
pulses per second. On a 1 GHz PC, Mach3 can generate 35,000 pulses per second
simultaneously on each of the six possible axes. So there are no problems here.
You now have to choose the torque that the machine will require. One way to measure this
is to set up the machine for the heaviest cut you think you will ever make and, with a long
lever (say 12") on the slide handwheel, turn it at the end with a spring balance (of set of
spring kitchen scales). The torque for the cut (in ounce-inches) is the balance reading (in
ounces) x 12. The other way is to use a motor size and specification that you know works
on someone else's machine with the same type of slide and screw!
As the rapid feed speed was reasonable you could consider slowing it down by 2:1 gearing
(perhaps by a toothed belt drive) which would nearly double the available torque on the
screw.
Slide with servo motor
Again we look at the size of one step. A servo motor has an encoder to tell its drive
electronics where it is. This consists of a slotted disc and will generate four “quadrature”
pulses for each slot in the disc. Thus a disc with 300 slots generates 300 cycles per
Using Mach3Mill Rev 1.84-A2
Page 33
Hardware issues and connecting your machine tool
4-7
revolution (CPR) This is fairly low for commercial encoders. The encoder electronics will
output 1200 quadrature counts per revolution (QCPR) of the motor shaft.
The drive electronics for the servo will usually turn the motor by one quadrature count per
input step pulse. Some high specification servo electronics can multiply and/or divide the
step pulses by a constant (e.g. one step pulse moves by 5 quadrature pulses or 36/17 pulses).
This is often called electronic gearing.
As the maximum speed of a servo motor is around 4000 rpm we will certainly need a speed
reduction on the mechanical drive. 5:1 would seem sensible. This gives a movement of
0.0000167" per step which is much better than that required (0.0001")
What maximum rapid speed will we get? With 35,000 step pulses per second we get 5.83
revolutions [35000/(1200 * 5)] of the leadscrew per second. This is OK at about 9 seconds
for 5" travel of the slide. Notice, however, that the speed is limited by the pulse rate from
Mach3 not the motor speed. This is only about 1750 rpm in the example. The limitation
would be even worse if the encoder gave more pulses per revolution. It will often be
necessary to use servo electronics with electronic gearing to overcome this limitation if you
have high count encoders.
Finally one would check on available torque. On a servo motor less safety margin is
required than with a stepper motor because the servo cannot suffer from "lost steps". If the
torque required by the machine is too high then the motor may overheat or the drive
electronics raise an over-current fault.
Example 2 - ROUTER GANTRY DRIVE
For a gantry router might need a travel of at least 60" on the gantry axis and a ballscrew for
this length will be expensive and difficult to protect from dust. Many designers would go
for a chain and sprocket drive.
We might choose a minimum step of 0.0005". A drive chain sprocket of 20 teeth with 1/4"
pitch chain gives 5" gantry movement per revolution of the sprocket. A stepper motor (ten
micro-steps) gives 2000 steps per revolution so a 5:1 reduction (belt or gear box) is needed
between the motor and sprocket shaft. [0.0005" = 5"/(2000 x 5)]
With this design if we get 500 rpm from the stepper then the rapid feed of 60" would,
neglecting acceleration and deceleration time, take a reasonable 8.33 seconds.
The torque calculation on this machine is more difficult than with the cross slide as, with
the mass of the gantry to be moved, inertia, during acceleration and deceleration, is
probably more important than the cutting forces. The experience of others or experiments
will be the best guide. If you join the ArtSoft user group for Master5/Mach1/Mach3 on
Yahoo! you will have access to the experience of hundreds of other users.
4.5.3 How the Step and Dir signals work
Mach3 puts outne pulse
(logic 1) on the Step output
for each step that the axis is
to make. The Dir output will
have been set before the step
pulse appears.
The logic waveform will be
like that shown in figure 4.4.
The gap between the
pulses will be smaller the
higher the speed of the
steps.
Drive electronics usually
use the Active Lo
configuration for Step
and Dir signals. Mach3 should be setup so these outputs are Active Lo. If this is not done
then the Step signal still goes up and down but the drive thinks that the gaps between the
pulses are the pulses and vice-versa and this often causes very rough or unreliable running
of the motor. The "inverted" pulses are shown in figure 4.5.
4.6 Limit and Home switches
4.6.1 Strategies
Limit switches are used to prevent any linear
axis moving too far and so causing damage to
the structure of the machine. You can run a
machine without them but the slightest mistake
setting up can cause a lot of expensive damage.
An axis may also have a Home switch. Mach3
can be commanded to move one (or all) axes to
the home position. This will need to be done
whenever the system is switched on so that it
knows where the axes are currently positioned.
If you do not provide a Home switch then you
will have to jog the axes by eye to a reference
position. The home switch for an axis can be at
the any coordinate position and you define this
location. Thus the home switches do not have to
be at Machine Zero.
Figure 4.6 - Limit switch - microswitch
mounted on the table is tripped by bed
of machine
As you will see, each axis could need three switches (i.e. limit switches at the two ends of
travel and a home switch). So a basic mill would require nine parallel port inputs for them.
This is not much good as a parallel port only has 5 inputs! The problem can be solved in
three ways:
♦ The limit switches are connected to external logic (perhaps in the drive electronics)
and this logic switches off the drives when the limit is reached. The separate
reference switches are connected inputs to Mach3
♦ One pin can share all the inputs for an axis and Mach3 is responsible for
controlling both limits and detecting home
♦ The switches can be interfaced by a keyboard emulator.
The first method is best and mandatory for a very large, expensive or fast machine where
you cannot trust software and its configuration to prevent mechanical damage. Switches
connected to the drive electronics can be intelligent and only allow motion away from a
switch when the limit is hit. This is safer than disabling the limits so a user can jog the
machine off its limits but does rely on having a sophisticated drive.
On a small machine when you use the second method, it is still possible to use only 3 inputs
to Mach3 for a 3-axis mill (4 for a gantry
type machine - see Slaving) and only two
switches are required as one limit and
reference can share a switch.
The keyboard emulator has a much slower
470 ohm
resistor
+5 volts
response time that the parallel port but is
satisfactory for limit switches on a machine
without highspeed feeds. For details of the
+ limit
to Mach2 input
architecture see Mach3 Customisation
manual.
-
limit
4.6.2 The switches
and Ref
0 volts
There are several choices you need to make
when selecting switches:
Figure 4.7 - Two NC contact switches give
logic OR
Using Mach3Mill Rev 1.84-A2
Page 35
Hardware issues and connecting your machine tool
4-9
If you are going to have two switches
sharing an input then they need to be
connected so the signal is a logic "1" if
either switch is operated (i.e. the
logical OR function). This is easy with
mechanical switches. If they have
normally closed contacts and are wired
in series as shown in figure 4.7, then
they will give an Active Hi signal if
either switch is operated. Note that for
reliable operation you need to "pull up"
the input to the parallel port. As
Figure 4.8 - Optical switch on table with vane on
bed of machine
mechanical switches can carry a
significant current a value of 470R is shown which gives a current of about 10 milliamps.
As the wiring to the switches might be quite long and liable to pickup of noise make sure
that you have a good connection to the 0 volt side of your input (the frame of your machine
tool will not be satisfactory) and consider using shielded cable with the shield connected to
the main ground terminal of your controller.
If you use electronic switches like a slotted detector with a LED and photo-transistor, then
you will need some sort of an OR gate (which could be a "wired-or" if an Active Lo input is
driven by open collector transistors).
Optical switches, if out of the way of coolant, should be OK on a metalworking machine
but are liable to malfunction with wood dust.
Don't use magnetic switches (reed switches or Hall effect devices) on a machine that may
cut ferrous metal or the swarf will "fuzz-up" the magnet.
The repeatability of the operating point, particularly with mechanical switches, is very
dependent on the quality of the switch and the rigidity of its mounting and actuating lever.
The setup in Figure 4.6 would be very imprecise. The repeatability is very important for a
switch to be used
for home.
Overtravel is the
-X
Table
+X
movement of the
switch that
occurs after it
has operated.
-X and
Reference
Frame
+X switch
With a limit
switch it can be
caused by the
Figure 4.9 - Two switches operated by frame with overtravel avoided by
mechanical stops
inertia of the
drive. On an optical switch like figure 4.7 then provided the vane is long enough there will
be no difficulties. A microswitch can be given arbitrary overtravel by operating a roller on it
by a ramp (see figure 4.11). The slope of the ramp does, however, reduce the repeatability
of operation of the switch. It is often
possible to use one switch for both limits
by providing two ramps or vanes.
4.6.3 Where to mount the
switches
The choice of mounting position for
switches is often a compromise between
keeping them away from swarf and dust
and having to use flexible rather than
fixed wiring.
For example figures 4.6 and 4.8 are both
mounted under the table, despite the fact
Rev 1.84-A2 Using Mach3Mill
Figure 4.10 – Mill with tool at X=0, Y=0 position
(note the dog is on limit switch)
Page 36
Hardware issues and connecting your machine tool
4-10
that they need a
moving cable, as
-X
Table
+X
they are much
better protected
there.
-X and
Reference
ramp
+X, X & Ref switch-
+X ramp
You might find it
convenient to
have one moving
cable with the
Figure 4.11 - Ramps operating one switch
Frame
wires in it for
two or more axes (e.g. the X and Y axes of a gantry router could have switches on the
gantry itself and a very short cable loop for the Z axis could then join the other two). Do not
be tempted to share a multi-way cable between motor and switch wiring. You may want to
run two separate cables together and this will not cause trouble if both a shielded (with
braid or foil) and the shields are grounded to one common point at the electronic drives.
You might find it helpful to look at commercial machines and pictures of examples on the
Master5/Mach1/Mach2 Yahoo! group for more ideas and techniques for switches.
4.6.4 How Mach3 uses shared switches
This section refers to the configuration for small machines where Mach3 rather than
external EStop logic is controlled by the switches.
For a full understanding of this you will also have to read the section in chapter 5 on
configuring Mach3, but the basic principle is easy. You connect the two limit switches to
one input (or have one switch and two vanes or ramps). You define, to Mach3, a direction
as the direction to travel to move when looking for a reference switch. The limit switch
(vane or ramp) at that end of the axis is also the home switch.
In normal use when Mach3 is moving an axis and sees its limit input become active it will
stop running (like an EStop) and display that a limit switch has been tripped. You will be
unable to move the axes unless:
1) Auto limit override is switched on (by a toggle button on the Settings screen). In this
case you can click Reset and jog off the limit switch. You should then reference the
machine
2) You click Override limits button. A red flashing LED warns you of the temporary
override. This will again allow you Reset and to jog off the switch and will then turn
itself and the flashing LED off. Again you should reference the machine. An input can
also be defined to override the limit switches.
Note, however, although Mach3 uses limited jogging speed that you will not be prevented,
in either case, from jogging further onto the switch and maybe crashing the axis in a
mechanical stop. Take great care.
4.6.5 Referencing in action
When you request referencing (by button or G-code) the axis (or axes) which have home
switches defined will travel (at a selectable low speed) in the defined direction until the
home switch operates. The axis will then move back in the other direction so as to be off the
switch. During referencing the limits do not apply.
When you have referenced an axis then zero or some other value which is set up in the
Config>State dialog, can be loaded into the axis DRO as its absolute machine coordinate. If
you use zero then the home switch position is also the machine zero position of the axis. If
the reference goes in the negative direction of an axis (usual for X and Y) the you might get
referencing to load something like -0.5" into the DRO. This means that the home is half an
inch clear of the limit. This wastes a bit of the axis travel but if you overshoot, when
jogging to Home, you will not accidentally trip the limits. See also Software Limits as
another way of solving this problem.
Using Mach3Mill Rev 1.84-A2
Page 37
Hardware issues and connecting your machine tool
4-11
If you ask Mach3 to reference before you jog off the switch then it will travel in the
opposite direction (because it says that you are already on the home switch) and stop when
you get off the switch. This is fine when you have a separate home switch or are on the
limit at the reference end of the axis. If, however, you are on the other Limit switch (and
Mach3 cannot know this as they are shared) then the axis moves for ever away from the
actual home point until it crashes. So the advice is always jog carefully off the limit switches, then reference. It is possible to configure mach3 so it will not automatically jog
off the home switch if you are concerned about this problem.
4.6.6 Other Home and Limit options and hints
Home switch not near limit switch
It is sometimes not very convenient to have the home switch at a limit of travel. Consider a
large moving column floor mill or a big planer-mill. The Z travel on the column might be 8
feet and could be quite slow without affecting the overall cutting performance of the
machine. If, however, the home position is the top of the column, then referencing might
involve nearly 16 feet of slow Z travel. If the reference position was chosen half way up the
column then this time can be halved. Such a machine would have a separate home switch
for the Z axis (thus requiring another input on the parallel port but still only four inputs in a
three axis machine) and would use the ability of Mach3 to set any value for an axis DRO,
after referencing, to make machine-Z zero to be the top of the column.
Separate high accuracy home switch
The X and Y axes on a high precision machine might have a separate home switch to
achieve the required accuracy.
Limit switches of multiple axes connected together
Because Mach3 does not take any notice of which limit of which axis has tripped, then all
the limits can be ORed together and fed into one limit input. Each axis can then have its
own reference switch connected to the reference input. A three axis machine still only needs
four inputs.
Home switches of multiple axes connected together
If you are really short of inputs to Mach3 then you can OR the home switches together and
define all home inputs to be that signal. In this case you can only reference one axis at once
– so you need to remove REF All buttons from your screens – and your home switches
must all be at the end of travel on their respective axes.
Slaving
On a gantry type miller or router where the two "legs" of the gantry are driven by separate
motors then each motor should be driven by its own axis. Suppose the gantry moves in the
Y direction then axis A should be defined as a linear (i.e. non-rotational) axis and A should
be slaved to Y - see the chapter 5 on Configuring Mach3 for details. Both axes should have
limit and home switches. In normal use both Y and A will be sent exactly the same step and
direction commands by Mach3. When a Reference operation is performed then the axes will
run together until the final part of referencing which is moving just off the home switches.
Here they will move so that each stops the same distance off its own switch. Referencing
will therefore correct any racking (i.e. out of squareness) of the gantry which might have
occurred when the machine is switched off or due to lost steps.
4.7 Spindle control
There are three different ways in which Mach3 can control your "spindle" or you can ignore
all of these and control it manually.
1. Relay/contactor control of motor On (Clockwise or Counterclockwise) and motor
Off
2. Motor controlled by Step and Direction pulses (e.g. spindle motor is a servo)
3. Motor controlled by a pulse width modulated signal
Rev 1.84-A2 Using Mach3Mill
Page 38
Hardware issues and connecting your machine tool
4-12
1. On/Off motor control
M3 and a screen button will request that the spindle starts in a clockwise direction. M4 will
request that the spindle starts in an counterclockwise direction. M5 requests that the spindle
stops. M3 and M4 can be configured to activate external output signals which can be
associated with output pins on the parallel ports. You then wire these outputs (probably via
relays) to control the motor contactors for your machine.
Although this sounds straightforward, in practice you need to be very careful. Unless you
really need to run the spindle "backwards" it would be better to treat M3 and M4 as the
same or to allow M4 to activate a signal which you do not connect to anything.
Clearly it is possible, in an error situation, for the clockwise and counterclockwise signals to
be active together. This may cause the contactors to short the mains supply. Special
mechanically interlocked reversing contactors can be obtained and if you are going to allow
your spindle to run counterclockwise then you need to use one. Another difficulty is that the
"G-code" definition says that it is legal to issue an M4 when the spindle is running
clockwise under an M3 (and vice-versa). If your spindle drive is an AC motor, just
changing the direction when running at full speed is going to impose very large forces on
the mechanical drive of the machine and will probably blow the AC fuse or trip a circuit
breaker. For safety you need to introduce time delays on the operation of the contactors or
use a modern inverter drive which allows you to change direction with a running motor.
See also the note about the limited number of Relay Activation Signals in the section on
Coolant.
2. Step and Direction motor control
If your spindle motor is a servomotor with a step and direction drive (like the axis drives)
then you can configure two output signals to control its speed and direction of rotation.
Mach3 will take account of a variable step pulley drive or gearbox between the motor and
the spindle. For full details see Motor Tuning in chapter 5
3. PWM motor control
As an alternative to Step and Direction control, Mach3 will output a pulse width modulated
signal whose duty cycle is the percentage of full speed that you require. You could, for
example, convert the duty cycle of the signal to a voltage ( PWM signal on for 0% of time
gives 0 volts 50% gives 5 volts and 100% gives 10 volts) and use this to control an
induction motor with a variable frequency inverter drive. Alternatively the PWM signal
could be used to trigger a triac in a simple DC speed controller.
Figures 4.12 and 4.13
show the pulse width at
approximately 20% of
the cycle and 50% of the
cycle.
Ave
In order for the PWM
spindle speed signal to be
turned into direct current
(actually a direct voltage
Figure 4.12 – A 20% pulse width modulated signal
is generally used as the input to variable speed drives, but you know what we mean) the
pulse signal it must transformed. In essence a circuit is used to find the average of the pulse
width modulated signal.
The circuit can be a
simple capacitor and
resistor or be much more
complex depending (a)
Ave
on how linear you want
the relationship between
the width and the final
output voltage and (b) on
Figure 4.13 – A 50% pulse width modulated signal
the speed of response
you need to the changing pulse width.
Using Mach3Mill Rev 1.84-A2
Page 39
Hardware issues and connecting your machine tool
4-13
You need to take care with the electronics as the inputs of many cheap PWM speed
controllers are not isolated from the mains. Further details can be found in the discussion
and files area of the Mach2DN site and by using "PWM converter" or "PWM Digispeed" as
a search term to Google or your favorite search engine.
The PWM signal is output on the spindle Step pin. You will need to take special
precautions to switch off the motor at low speeds using the Motor
Clockwise/Counterclockwise outputs.
Note: Many users have found that PWM and other variable speed spindle drives are often a
serious source of electrical noise which can cause problems with the machine axis drives,
limit switch sensing etc. If you use such a spindle drive we strongly recommend you to use
an optically isolated breakout board and take care to shield cables and run the power cables
a few inches away from the control cables.
4.8 Coolant
Output signals can be used to control valves or pumps for flood and mist coolant. These are
activated by screen buttons and/or M7, M8, M9.
4.9 Knife direction control
Rotary axis A can be configured so it is rotates to ensure that a tool like a knife is tangential
to the direction of movement in G1 moves of X and Y. This allows implementation of a
vinyl or fabric cutter with fully controlled knife.
Note: in the current version this features does not work with arcs (G2/G3 moves). It is your
responsibility to program curves as a series of G1 moves.
4.10 Digitise probe
Mach3 can be connected to a contact digitising probe to make a measuring and model
digitising system. There is an input signal that indicates that the probe has made contact and
provision for an output to request that a reading is taken by a non-contact (e.g. laser) probe.
To be useful the probe needs to have an accurately spherical end (or at least a portion of a
sphere) mounted in the spindle with its center accurately on the centerline of the spindle and
a fixed distance from a fixed point in the Z direction (e.g. the spindle nose). To be capable
of probing non metallic materials (and many models for digitisation will be made in foam,
MDF or plastic) the probe requires to make (or break) a switch with a minute deflection of
its tip in any (XY or Z) direction). If the probe is to be used with an automatic toolchanger
then it also needs to be "cordless".
These requirements are a major challenge for the designer of a probe to be built in a home
workshop and commercial probes are
not cheap.
A development feature is
implemented to allow the use of a
laser probe.
typically
20 microns
A
4.11 Linear (glass scale)
encoders
Rev 1.84-A2 Using Mach3Mill
B
y
Figure 4.14 - Quadrature signals
x
Start
Page 40
Hardware issues and connecting your machine tool
4-14
Mach3 has four pairs of inputs to each of which an encoder with quadrature outputs can be
connected (typically these might be "glass scale" encoders - see figure 4.15. Mach3 will
display the position of each of these encoders on a dedicated DRO. These values can be
loaded from and saved to the
main axis DROs.
Inside the case of the encoder
is a glass (or sometimes
plastic) strip ruled with lines
(e.g often 10 microns wide)
separated by the same sized
clear space. A light shining
on a phototransistor through
the ruling would give a signal
like A in figure 4.14. One
complete cycle corresponds
Another light and phototransistor located 5 microns away from the first one would give
signal B a quarter of a cycle out from A (hence the name quadrature)
A full explanation is rather long, but you will notice that a signal changes every 5 microns
of movement so the resolution of the scale is 5 microns. We can tell which way it is moving
by the sequence of changes. For example if B goes from lo to hi when A is hi (point x) then
we are moving to the right of the marked start whereas if B goes from hi to lo when A is hi
(point y) then we are moving to the left of the start.
Mach3 expects logic signals. Some
glass scales (e.g certain Heidenhain
models) give an analog sinewave.
This allows clever electronics to
interpolate to a higher resolution
than 5 microns. If you want to use
these than you need to square off
the waveform with an operational
amplifier/comparator. TTL output
encoders will connect directly to
Figure 4.16 – Encoder DROs
the input pins of the parallel port but, as noise will give false counts, they are better
interfaced via what is known as a Schmitt trigger chip. The scales require a DC supply
(often 5 volts) for the lights and any driver chips in them.
Notice:
(a) that you can not easily use a linear scale as the feedback encoder for a servo drive
as the slightest backlash or springiness in the mechanical drive will make the servo
unstable.
(b) it is not easy to connect the rotary encoders on the servo motor to the encoder
DROs. This would be attractive for manual operation of the axes with position
readout. The problem is that the 0 volt (common) inside the servo drive used for the
motor encoders is almost certainly not the same 0 volt as your PC or breakout board.
Connecting them together will cause problems - don't be tempted to do it!
(c) the main benefit of using linear encoders on linear axes is that their measurements
do not depend on the accuracy or backlash of the drive screw, belt, chain etc.
4.12 Spindle index pulse
Mach3 has an input for one or more pulses generated each revolution of the spindle. It uses
this to display the actual speed of the spindle, to co-ordinate the movement of the tool and
work when cutting threads and for orientating the tool for the back boring canned cycle. It
can be used to control feed on a per-rev rather than per-minute basis.
Using Mach3Mill Rev 1.84-A2
Page 41
Hardware issues and connecting your machine tool
4-15
4.13 Charge pump - a pulse monitor
Mach3 will output a constant pulse train whose frequency is approximately 12.5 kHZ on
one or both of the parallel ports whenever it is running correctly. This signal will not be
there if the Mach3 has not been loaded, is in EStop mode or if the pulse train generator fails
in some way. You can use this signal to charge a capacitor through a diode pump (hence the
name) whose output, showing Mach3's health, enables your axis and spindle drives etc.
This function is often implemented in commercial breakout boards.
4.14 Other functions
Mach3 has fifteen OEM Trigger input signals which you can assign for your own use. For
example they can be used to simulate clicking a button or to call a user written macros.
In addition there are four user inputs which can be interrogated in user macros.
Input #1 can be used to inhibit running of the part program. It might be connected to the
guards on your machine.
Full details of the architecture of Input Emulation are given in Mach3 Customisation wiki.
The setup dialog is defined in section 5.
The Relay Activation outputs not used for the Spindle and Coolant can be used by you and
controlled in user written macros.
And a final thought - before you get carried away with implementing too many of the
features in this chapter, remember that you do not have an unlimited number of
inputs/outputs. Even with two parallel ports there are only ten inputs for supporting all
functions and, although a keyboard emulator will help giving more inputs, these cannot be
used for all functions. You may have to use a ModBus device to dramatically expand
custom input/output.
Rev 1.84-A2 Using Mach3Mill
Page 42
Page 43
Configuring Mach3
5-1
5. Configuring Mach3 for your machine and drives
If you have bought a machine tool with a computer running Mach3 then you
will probably not need to read this chapter (except out of general interest).
Your supplier will probably have installed the Mach3 software and set it up
and/or will have given you detailed instructions on what to do.
You are recommended to ensure that you have a paper copy of how Mach3 is
configured should you ever need to re-install the software from scratch.
Mach3 stores this information in an XML file which you can view.
5.1 A configuration strategy
This chapter contains a lot of very fine detail. You should, however, find that the
configuration process is straightforward if you take it step-by-step, testing as you go. A
good strategy is to skim through the chapter and then work with it on your computer and
machine tool. We will assume that you have already installed Mach3 for the dry running
described in chapter 3.
Virtually all the work you will do in this chapter is based on dialog boxes reached from the
Config(ure) menu. These are identified by, for example, Config>Logic which means that
you choose the Logic entry from the Config menu.
5.2 Initial configuration
The first dialog to use is Config>Ports and Pins. This dialog has many tabs but the initial
one is as shown in figure 5.1.
5.2.1 Defining addresses of port(s) to use
Figure 5.1 - Ports and Axis selection tab
If you are only going to use one parallel port and it is the one on your computer's
motherboard then the default address of Port 1 of 0x378 (i.e. Hexadecimal 378) is almost
certainly correct.
If you are using one or more PCI add-on cards then you will need to discover the address to
which each responds. There are no standards! Run the Windows Control Panel from the
Windows Start button. Double click on System and choose the Hardware tab. Click the
Device Manager button. Expand the tree for the item "Ports (COM & LPT)".
Rev 1.84-A2 Using Mach3Mill
Page 44
Configuring Mach3
5-2
Double click the first LPT or ECP port. Its properties will be displayed in a new window.
Choose the Resources tab. The first number in the first IO range line is the address to use.
Note the value down and close the Properties dialog.
Note: that installing or removing any PCI card can change the address of a PCI parallel port
card even if you have not touched it.
If you are going to use a second port repeat the above paragraph for it.
Close the Device Manager, System Properties and Control Panel windows.
Enter your first port's address (do not provide 0x prefix to say it is Hexadecimal as Mach3
assumes this). If necessary check Enabled for port 2 and enter its address.
Now click the Apply button to save these values. This is most important. Mach3 will not
remember values when you change from tab to tab or close the Port & Pins dialog
unless you Apply.
5.2.2 Defining engine frequency
The Mach3 driver can work at a frequency of 25,000 Hz (pulses per second), 35,000 Hz or
45,000 Hz depending on the speed of your processor and other loads placed on it when
running Mach3.
The frequency you need depends on the maximum pulse rate you need to drive any axis at
its top speed. 25,000 Hz will probably be suitable for stepper motor systems. With a 10
micro-step driver like a Gecko 201, you will get around 750 RPM from a standard 1.8o
stepper motor. High pulse rates are needed for servo drives that have high resolution shaft
encoders on the motor. Further details are given in the section on motor tuning.
Computers with a 1 GHz clock speed will almost certainly run at 35,000 Hz so you can
choose this if you need a higher step rate (e.g. if you have very fine pitch lead screws).
The demonstration version will only run at 25,000 Hz. In addition if Mach3 is forcibly
closed then on re-start it will automatically revert to 25,000 Hz operation. The actual
frequency in the running system is displayed on the standard Diagnostics screen.
Don't forget to click the Apply button before proceeding.
5.2.3 Defining special features
You will see check boxes for a variety of special configuration. The should be selfexplanatory if you have the relevant hardware in your system. If not then leave then
unchecked.
Don't forget to click the Apply button before proceeding.
5.3 Defining input and output signals that you will use
Now that you have established the basic configuration it is time to define which input and
output signals you will be going to use and which parallel port and pin will be used for
each. The documentation for your breakout board may give guidance on what outputs to use
if it has been designed for use with Mach3 or the board may be supplied with a skeleton
Profile (.XML) file with these connections already defined.
5.3.1 Axis and Spindle output signals to be used
First view the Motor Outputs tab. This will look like figure 5.4.
Define where the drives for your X, Y and Z axes are connected and click to get a check-
mark to Enable these axes. If your interface hardware (e.g. Gecko 201 stepper driver)
requires an active-lo signal ensure that these columns are checked for the Step and
Dir(ection) signals.
If you have a rotary or slaved axes then you should enable and configure these.
Using Mach3Mill Rev 1.84-A2
Page 45
Configuring Mach3
5-3
If your spindle speed will be controlled by hand then you have finished this tab. Click the
Apply button to save the data on this tab.
Figure 5.4 – Defining the connections for axes and the controlled spindle
If your spindle speed will be controlled by Mach3 then you need to Enable the spindle and
allocated a Step pin/port for it if it uses pulse width modulated control with relays to control
its direction or to allocate Step and Direction pins/ports if it has full control. You should
also define if these signals are active-lo. When done, click the Apply button to save the data on this tab.
5.3.2 Input signals to be used
Now select the Input Signals tab. This will look like figure 5.5.
We assume that you have chosen one of the home/limit strategies from chapter 4.6.
If you have used strategy one and the limit switches are connected together and trigger an
Figure 5.5 – Input signals
EStop or disable the axis drives via the drive electronics then you do not check any of the
Limit inputs.
With strategy two you will probably have home switches on the X, Y and Z axes. Enable
the Home switches boxes for these axes and define the Port/Pin to which each is connected.
If you are combining limits and the home switch then you should enable the Limit --, the
Limit ++ and Home for each axis and allocate the same pin to Home, Limit— and Limit++.
Rev 1.84-A2 Using Mach3Mill
Page 46
Configuring Mach3
5-4
Notice the scroll bar to access the rest of the table which is not visible in figure 5.5.
The Input #1 is special in that it can be used to inhibit running a part program when safety
guards are not in place. The other three (and #1 if not used for the guard interlock) are
available for your own use and can be tested in the code of macros. The Input #4 can be
used to connect an external pushbutton switch to implement the Single Step function. You
may wish to configure them later.
Enable and define Index Pulse if you have a spindle sensor with just one slot or mark.
Enable and define Limits Override if you are letting Mach2 control your limit switches and
you have an external button which you will press when you need to jog off a limit. If you
have no switch then you can use a screen button to achieve the same function.
Enable and define EStop to indicate to Mach3 that the user has demanded an emergency
stop.
Enable and define OEM Trigger inputs if you want electrical signals to be able to call OEM
button functions without a screen button needing to be provided.
Enable and define Timing if you have a spindle sensor with more than one slot or mark.
Enable Probe for digitising and THCOn, THCUp and THCDown for control of a Plasma
torch.
If you have one parallel port then you have 5 available inputs; with two ports there are 10
(or with pins 2 to 9 defined as inputs, 13). It is very common to find that you are short of
input signals especially if you are also going to have some inputs for glass scales or other
encoders. You may have to compromise by not having things like a physical Limit Override
switch to save signals!
You can also consider using a Keyboard Emulator for some input signals.
Click the Apply button to save the data on this tab.
5.3.3 Emulated input signals
If you check the Emulated column for an input then the Port/Pin number and active-lo state
for that signal will be ignored but the entry in the Hotkey column will be interpreted. When
a key-down message is received with code that matches a Hotkey value then that signal is
considered to be active. When a key-up message is received then it is inactive.
The key-up and key-down signals usually come from a keyboard emulator (like the
Ultimarc IPAC or Hagstrom) which is triggered by switches connected to its inputs. This
allows more switches to be sensed than spare pins on your parallel ports but there may be
significant time delays before the switch change is seen and indeed a key-up or key-down
message can get lost by Windows.
Figure 5.6 – Output signals
Using Mach3Mill Rev 1.84-A2
Page 47
5-5
Emulated signals cannot be used for Index or Timing and should not be used for EStop.
5.3.4 Output Signals
Use the Output signals tab to define the outputs you require. See figure 5.6.
You will probably only want to use one Enable output (as all the axis drives can be
connected to it). Indeed if you are using the charge pump/pulse monitor feature then you
may enable your axis drives from its output.
The Output# signals are for use to control a stop/start spindle (clockwise and optionally
counterclockwise), the Flood and Mist coolant pumps or valves and for control by your own
customized Mach3 buttons or macros.
The Charge Pump line should be enabled and defined if your breakout board accept this
pulse input to continually confirm correct operation of Mach3. Charge Pump2 is used if
you have a second breakout board connected to the second port or want to verify the
operation of the second port itself.
Click the Apply button to save the data on this tab.
5.3.5 Defining encoder inputs
The Encoder/MPGs tab is used to define the connections and the resolution of linear
encoders or Manual Pulse Generators (MPGs) used for jogging the axes.
Configuring Mach3
Figure 5.7 – Encoder inputs
The Encoder/MPGs tab is used to define the connections and the resolution of linear
encoders or Manual Pulse Generators (MPGs) used for jogging the axes. It is covered here
for completeness of the description of Config>Ports & Pins.
This dialog does not need an active-lo column as, if the encoders count the wrong way it is
merely necessary to swap the pins allocated for A and B inputs.
5.3.5.1 Encoders
The Counts per unit value should be set to correspond to the resolution of the encoder. Thus
a linear scale with rulings at 20 microns produces a count every 5 microns (remember the
quadrature signal), that is 200 counts per unit (millimetre). If you have Native units set as
inches the it would be 200 x 25.4 = 5080 counts per unit (inch). The Velocity value is not
used.
Rev 1.84-A2 Using Mach3Mill
Page 48
5-6
5.3.5.2 MPGs
The Counts per unit value is used to define the number of quadrature counts that need to be
generated for Mach3 to see movement of the MPG. For a 100 CPR encoder, a figure of 2 is
suitable. For higher resolutions you should increase this figure to get the mechanical
sensitivity you want. We find 100 works well with 1024 CPR encoders.
The Velocity value determines the scaling of pulses sent to the axis being controlled by the
MPG. The lower the value given in Velocity the faster the axis will move. Its value is best
set by experiment to give a comfortable speed when spinning the MPG as fast as is
comfortable.
5.3.6 Configuring the spindle
The next tab on Config>Ports & Pins is Spindle Setup. This is used to define the way in
which your spindle and coolant is to be controlled. You may opt to allow Mach3 to do
nothing with it, to turn the spindle on and off or to have total control of its speed by using a
Pulse Width Modulated (PWM) signal or a step and direction signal. The dialog is shown in
figure 5.8.
Configuring Mach3
5.3.6.1 Coolant control
Code M7 can turn Flood coolant on, M9 can turn Mist coolant on and M9 can turn all
coolant off. The Flood Mist control section of the dialog defines which of the output signals
are to be used to implement these functions. The Port/Pins for the outputs have already been
defined on the Output Signals tab.
If you do not want to use this function check Disable Flood/Mist Relays.
5.3.6.2 Spindle relay control
If the spindle speed is controlled by hand or by using a PWM signal then Mach3 can define
its direction and when to start and stop it (in response to M3, M4 and M5) by using two
outputs. The Port/Pins for the outputs have already been defined on the Output Signals tab.
If you control the spindle by Step and Direction then you do not need these controls. M3,
M4 and M5 will control the pulse train generated automatically.
If you do not want to use this function check Disable Spindle Relays.
5.3.6.3 Motor Control
Check Use Motor Control if you want to use PWM or Step and Direction control of the
spindle. When this is checked then you can choose between PWM Control and Step/Dir Motor.
Figure 5.8 – Spindle Setup
Using Mach3Mill Rev 1.84-A2
Page 49
Configuring Mach3
5-7
PWM Control
A PWM signal is a digital signal, a "square" wave where the percentage of the time the
signal is high specifies the percentage of the full speed of the motor at which it should run.
So, suppose you have a motor and PWM drive with maximum speed of 3000 rpm then
figure 4.12 would run the motor at 3000 x 0.2 = 600 RPM. Similarly the signal in figure
4.13 would run it at 1500 RPM.
Mach3 has to make a trade off in how many different widths of pulse it can produce against
how high a frequency the square wave can be. If the frequency is 5 Hz the Mach3 running
with a 25000 Hz kernel speed can output 5000 different speeds. Moving to 10Hz reduces
this to 2500 different speeds but this still amounts to a resolution of one or two RPM.
A low frequency of square wave increases the time that it will take for the motor drive to
notice that a speed change has been requested. Between 5 and 10 Hz gives a good
compromise. The chosen frequency is entered in the PWMBase Freq box.
Many drives and motors have a minimum speed. Typically because the cooling fan is very
inefficient at low speeds whereas high torque and current might still be demanded. The
Minimum PWM % box allows you to set the percentage of maximum speed at which Mach3
will stop outputting the PWM signal.
You should be aware that the PWM drive electronics may also have a minimum speed
setting and that Mach3 pulley configuration (see section x.x) allows you to set minimum
speeds. Typically you should aim to set the pulley limit slightly higher than the Minimum PWM % or hardware limit as this will clip the speed and/or give a sensible error message
rather than just stopping it.
Step and Direction motor
This may be an variable speed drive controlled by step pulses or a full servo drive.
You can use the Mach3 pulley configuration (see section 5.5.6.1) to define a minimum
speed if this is needed by the motor or its electronics.
5.3.6.4 Modbus spindle control
This block allows the setup of an analogue port on a Modbus device (e.g. a Homann
ModIO) to control spindle speed. For details see the documentation of your ModBus
device.
5.3.6.5 General Parameters
These allow you to control the delay after starting or stopping the spindle before Mach3
will execute further commands (i.e. a Dwell). These delays can be used to allow time for
acceleration before a cut is made and to provide some software protection from going
directly from clockwise to counterclockwise. The dwell times are entered in seconds.
Immediate Relay off before delay, if checked will switch the spindle relay off as soon as the
M5 is executed. If unchecked it stays on until the spin-down delay period has elapsed.
5.3.6.6 Pulley ratios
Mach3 has control over the speed of your spindle motor. You program spindle speeds
through the S word. The Mach3 pulley system allows you to define the relationship
between these for four different pulley or gearbox settings. It is easier to understand how it
works after tuning your spindle motor so it is described in section 5.5.6.1 below.
5.3.6.7 Special function
Laser mode should always be unchecked except for controlling the power of a cutting laser
by the feedrate..
Use Spindle feedback in sync mode should be un-checked.
Rev 1.84-A2 Using Mach3Mill
Page 50
5-8
Closed Loop Spindle Control, when checked, implements a software servo loop which tries
to match the actual spindle speed seen by the Index or Timing sensor with that demanded
by the S word. The exact speed of the spindle is not likely to be important so you are not
likely to need to use this feature in Mach3Turn.
If you do use it then the P, I and D variables should be set in the range 0 to 1. P controls the
gain of the loop and an excessive value will make the speed oscillate, or hunt, around the
requested value rather than settling on it. The D variable applies damping so stabilising
these oscillations by using the derivative (rate of change) of the speed. The I variable takes
a long term view of the difference between actual and requested speed and so increases the
accuracy in the steady state. Tuning these values is assisted by using the dialog opened by
Operator>Calibrate spindle.
Spindle Speed Averaging, when checked, causes Mach3 to average the time between
index/timing pulses over several revolutions when it is deriving the actual spindle speed.
You might find it useful with a very low inertia spindle drive or one where the control tends
to give short-term variations of speed.
5.3.7 Mill Options tab
The final tab on Config>Ports & Pins is Mill Options. See figure 5.9.
Configuring Mach3
Figure 5.9 – Mill Options Tab
Z-inhibit. The Z-inhibit On checkbox enables this function. Max Depth gives the lowest Z
value to which the axis will move. The Persistent checkbox remembers the state (which can
be changed by a screen toggle) from run to run of Mach3.
Digitising: The 4 Axis Point Clouds checkbox enables recording of the state of the A axis
as well as X, Y and Z. The Add Axis Letters to Coordinates prefixes the data with the axis
name in the point cloud file.
THC Options: The checkbox name is self-explanatory.
Compensation G41,G42: The Advanced Compensation Analysis checkbox turns on a
more thorough lookahead analysis that will reduce the risk of gouging when compensating
for cutter diameter (using G41 and G42) on complex shapes.
Homed true when no Home switches: Will make the system appear to be referenced (i.e.
LEDs green) at all times. It should only be used if no Home switches are defined under
Ports & Pins Inputs tab.
Using Mach3Mill Rev 1.84-A2
Page 51
5-9
5.3.8 Testing
Your software is now configured sufficiently for you to do some simple tests with the
hardware. If it is convenient to connect up the inputs from the manual switches such as
Home then do so now.
Run Mach3Mill and display the Diagnostics screen. This has a bank of LEDs displaying the
logic level of the inputs and outputs. Ensure that the external Emergency Stop signal is not
active (Red Emergency LED not flashing) and press the red Reset button on the screen. Its
LED should stop flashing.
If you have associated any outputs with coolant or spindle rotation then you can use the
relevant buttons on the diagnostic screen to turn the outputs on and off. The machine should
also respond or you can monitor the voltages of the signals with a multimeter.
Next operate the home or the limit switches. You should see the appropriate LEDs glow
yellow when their signal is active.
These tests will let you see that your parallel port is correctly addressed and the inputs and
outputs are appropriately connected.
If you have two ports and all the test signals are on one then you might consider a
temporary switch of your configuration so that one of the home or limit switches is
connected via it so that you can check its correct operation. Don't forget the Apply button
when doing this sort of testing. If all is well then you should restore the proper
configuration.
Configuring Mach3
If you have problems you should sort them out now as this will be much easier that when
you start trying to drive the axes. If you do not have a multimeter then you will have to buy
or borrow a logic probe or a D25 adaptor (with actual LEDs) which let you monitor the
state of its pins. In essence you need to discover if (a) the signals in and out of the computer
are incorrect (i.e. Mach3 is not doing what you want or expect) or (b) the signals are not
getting between the D25 connector and your machine tool (i.e. a wiring or configuration
problem with the breakout board or machine). 15 minutes help from a friend can work
wonders in this situation even if you only carefully explain to him/her what your problem is
and how you have already looked for it!
You will be amazed how often this sort of explanation suddenly stops with words like
"…… Oh! I see what the problem must be, it's ….."
5.4 Defining the setup units
With the basic functions working, it's time to
configure the axis drives. The first thing to decide is
whether you wish to define their properties in
Metric (millimetres) or Inch units. You will be able
to run part programs in either units whichever
option you choose. The maths for configuration will
be slightly easier if you choose the same system as
your drive train (e.g. the ballscrew) was made in. So
a screw with 0.2" lead (5 tpi) is easier to configure
in inches than in millimetres. Similarly a 2mm lead
screw will be easier in millimetres. The
multiplication and/or division by 25.4 is not
difficult but is just something else to think about.
Figure 5.10 - Setup Units dialog
There is, on the other hand, a slight advantage in
having the setup units be the units in which you usually work. This is that you can lock the
DROs to display in this system whatever the part program is doing (i.e. switching units by
G20 and G21).
So the choice is yours. Use Config>Setup Units to choose MMs or Inches (see figure 5.10).
Once you have made a choice you must not change it without going back over all the
following steps or total confusion will reign! A message box reminds you of this when you
use Config>Setup units.
Rev 1.84-A2 Using Mach3Mill
Page 52
5-10
5.5 Tuning motors
Well after all that detail it's now time to get things moving - literally! This section describes
setting up your axis drives and, if its speed will be controlled by Mach3, the spindle drive.
The overall strategy for each axis is: (a) to calculate how many step pulses must be sent to
the drive for each unit (inch or mm) of movement of the tool or table, (b) to establish the
maximum speed for the motor and (c) to set the required acceleration/deceleration rate.
We advise you to deal with one axis at a time. You might wish to try running the motor
before it is mechanically connected to the machine tool.
So now connect up the power to your axis driver electronics and double check the wiring
between the driver electronics and your breakout board/computer. You are about to mix
high power and computing so it is better to be safe than smoky!
5.5.1 Calculating the steps per unit
Mach3 can automatically perform a test move on an axis and calculate the steps per unit but
this is probably best left for fine tuning so we present the overall theory here.
The number of steps Mach3 must send for one unit of movement depends on the
mechanical drive (e.g. pitch of ballscrew, gearing between the motor and the screw), the
properties of the stepper motor or the encoder on the servo motor and the micro-stepping or
electronic gearing in the drive electronics.
Configuring Mach3
We look at these three points in turn then bring them together.
5.5.1.1 Calculating mechanical drive
You are going to calculate the number of revolutions of the motor shaft (motor revs per
unit) to move the axis by one unit. This will probably be greater than one for inches and
less than one for millimetres but this makes no difference to the calculation which is easiest
done on a calculator anyway.
For a screw and nut you need the raw pitch of the screw (i.e. thread crest to crest distance)
and the number of starts. Inch screws may be specified in threads per inch (tpi). The pitch is
1/tpi (e.g. the pitch of an 8 tpi single start screw is 1 ÷ 8 = 0.125")
If the screw is multiple start multiply the raw pitch by the number of starts to get the
effective pitch. The effective screw pitch is therefore the distance the axis moves for one
revolution of the screw.
Now you can calculate the screw revs per unit
screw revs per unit = 1÷ effective screw pitch
If the screw is directly driven from the motor then this is the motor revs per unit. If the
motor has a gear, chain or belt drive to the screw with Nm teeth on the motor gear and Ns
teeth on the screw gear then:
motor revs per unit = screw revs per unit x N
s ÷Nm
For example, suppose our 8 tpi screw is connected to the motor with a toothed belt with a
48 tooth pulley on the screw and an 16 tooth pulley on the motor then the motor shaft pitch
would be 8 x 48 ÷ 16 = 24 (Hint: keep all the figures on your calculator at each stage of
calculation to avoid rounding errors)
As a metric example, suppose a two start screw has 5 millimetres between thread crests (i.e.
effective pitch is 10 millimetres) and it is connected to the motor with 24 tooth pulley on
the motor shaft and a 48 tooth pulley on the screw. So the screw revs per unit = 0.1 and
motor revs per unit would be 0.1 x 48 ÷ 24 = 0.2
For a rack and pinion or toothed belt or chain drive the calculation is similar.
Find the pitch of the belt teeth or chain links. Belts are available in metric and imperial
pitches with 5 or 8 millimetres common metric pitches and 0.375" (3/8") common for inch
belts and for chain. For a rack find its tooth pitch. This is best done by measuring the total
Using Mach3Mill Rev 1.84-A2
Page 53
Configuring Mach3
5-11
distance spanning 50 or even 100 gaps between teeth. Note that, because standard gears are
made to a diametral pitch, your length will not be a rational number as it includes the
constant π (pi = 3.14152…)
For all drives we will call this tooth pitch.
If the number of teeth on the pinion/sprocket/pulley on the primary shaft which drives the
rack/belt/chain is Ns then:
shaft revs per unit = 1 ÷ (tooth pitch x N
)
s
So, for example with a 3/8" chain and a 13 tooth sprocket which is on the motor shaft then
the motor revs per unit = 1 ÷ (0.375 x 13) = 0.2051282. In passing we observe that this is
quite "high geared" and the motor might need an additional reduction gearbox to meet the
torque requirements. In this case you multiply the motor revs per unit by the reduction ratio
of the gearbox.
motor revs per unit = shaft revs per unit x Ns ÷Nm
For example a 10:1 box would give 2.051282 revs per inch.
For rotary axes (e.g. rotary tables or dividing heads) the unit is the degree. You need to
calculate based on the worm ratio. This is often 90:1. So with a direct motor drive to the
worm one rev gives 4 degrees so Motor revs per unit would be 0.25. A reduction of 2:1
from motor to worm would give 0.5 revs per unit.
5.5.1.2 Calculating motor steps per revolution
The basic resolution of all modern stepper motors is 200 steps per revolution (i.e. 1.8o per
step). Note: some older steppers are 180 steps per rev. but you are not likely to meet them if
you are buying supported new or nearly new equipment.
The basic resolution of a servo motor depends on the encoder on its shaft. The encoder
resolution is usually quoted in CPR (cycles per revolution) Because the output is actually
two quadrature signals the effective resolution will be four time this value. You would
expect a CPR in the range of about 125 to 2000 corresponding to 500 to 8000 steps per
revolution.
5.5.1.3 Calculating Mach3 steps per motor revolution
We very strongly recommend that you use micro-stepping drive electronics for stepper
motors. If you do not do this and use a full- or half-step drive then you will need much
larger motors and will suffer from resonances that limit performance at some speeds.
Some micro-stepping drives have a fixed number of micro-steps (typically 10) while others
can be configured. In this case you will find 10 to be a good compromise value to choose.
This means that Mach3 will need to send 2000 pulses per revolution for a stepper axis
drive.
Some servo drives require one pulse per quadrature count from the motor encoder (thus
giving 1200 steps per rev for a 300 CPR encoder. Others include electronic gearing where
you can multiply the input steps by an integer value and, sometimes, the divide the result by
another integer value. The multiplication of input steps can be very useful with Mach3 as
the speed of small servo motors with a high resolution encoder can be limited by the
maximum pulse rate which Mach3 can generate.
5.5.1.4 Mach3 steps per unit
So now we can finally calculate:
Mach3 steps per unit = Mach3 steps per rev x Motor revs per unit
Figure 5.11 shows the dialog for Config>Motor Tuning. Click a button to select the axis
which you are configuring and enter the calculated value of Mach3 steps per unit in the box
above the Save button.. This value does not have to be an integer so you can achieve as
much accuracy as you wish. To avoid forgetting later click Save Axis Settings now.
Rev 1.84-A2 Using Mach3Mill
Page 54
Configuring Mach3
5-12
Figure 5.11 - Motor tuning dialog
5.5.2 Setting the maximum motor speed
Still using the Config>Motor Tuning dialog, as you move the Velocity slider you will see a
graph of velocity against time for a short imaginary move. The axis accelerates, maybe
runs at full speed and then decelerates. Set the velocity to maximum for now. Use the
Acceleration slider to alter the rate of acceleration/deceleration (these are always the same
as each other)
As you use the sliders the values in the Velocity and Accel boxes are updated. Velocity is in
units per minute. Accel is in units per second2. The acceleration values is also given in Gs to
give you a subjective impression of the forces that will be applied to a massive table or
workpiece.
The maximum velocity you can display will be limited by the maximum pulse rate of
Mach3. Suppose you have configured this to 25,000 Hz and 2000 steps per unit then the
maximum possible Velocity is 750 units per minute.
This maximum is, however, not necessarily safe for your motor, drive mechanism or
machine; it is just Mach3 running "flat out". You can make the necessary calculations or do
some practical trials. Let's just try it out first.
5.5.2.1 Practical trials of motor speed
You saved the axis after setting the Steps per unit. OK the dialog and make sure that
everything is powered up. Click the Reset button so its LED glows continuously.
Go back to Config>Motor Tuning and select your axis. Use the Velocity slider to have the
graph about 20% of maximum velocity. Press the cursor Up key on your keyboard. The axis
should move in the Plus direction. If it runs away then choose a lower velocity. If it crawls
then choose a higher velocity. The cursor Down key will make it run the other way (i.e. the
Minus direction).
If the direction is wrong then, Save the axis and either (a) change the Low Active setting
for the Dir pin of the axis in Config>Ports and Pins>Output Pins tab (and Apply it) or (b)
check the appropriate box in Config>Motor Reversals for the axis that you are using. You
can akso, of course, just switch off and reverse one pair of physical connections to the
motor from the drive electronics.
If a stepper motor hums or screams then you have wired it incorrectly or are trying to drive
it much too fast. The labelling of stepper wires (especially 8 wire motors) is sometimes very
confusing. You will need to refer to the motor and driver electronics documentation.
Using Mach3Mill Rev 1.84-A2
Page 55
Configuring Mach3
5-13
If a servo motor runs away at full speed or flicks and indicates a fault on its driver then its
armature (or encoder) connections need reversing (see your servo electronics
documentation for more details). If you have any troubles here then you will be pleased if
you followed the advice to buy current and properly supported products - buy right, buy
once!
Most drives will work well with a 1 microsecond minimum pulse width. If you have
problems with the test moves (e.g. motor seems too noisy) first check that your step pulses
are not inverted (by Low active being set incorrectly for Step on the Output Pins tab of Ports
and Pins) then you might try increasing the pulse width to, say, 5 microseconds. The Step
and Direction interface is very simple but, because it "sort of works" when configured
badly, can be difficult to fault-find without being very systematic and/or looking at the
pulses with an oscilloscope.
5.5.2.2 Motor maximum speed calculations
If you feel that you want to calculate the maximum motor speed then read this section.
There are many things which define the maximum speed of an axis:
♦ Maximum allowed speed of motor (perhaps 4000 rpm for servo or 1000 rpm for
stepper)
♦ Maximum allowed speed of the ballscrew (depends on length, diameter, how its
ends are supported
♦ Maximum speed of belt drive or reduction gearbox
♦ Maximum speed which drive electronics will support without signalling a fault
♦ Maximum speed to maintain lubrication of machine slides
The first two in this list are most likely to affect you. You will need to refer to the
manufacturers' specifications, calculate the permitted speeds of screw and motor and relate
these to units per second of axis movement. Set this maximum value in the Velocity box of
Motor Tuning for the axis involved.
The Mach1/Mach2 Yahoo! online forum is a useful place to get advice from other Mach3
users, world-wide, on this sort of topic.
5.5.2.3 Automatic setting of Steps per Unit
You might not be able to measure the gearing
of your axis drive or know the exact pitch of
a screw. Provided you can accurately measure
the distance moved by an axis, perhaps using
a dial test indicator and gage blocks, then you
can get Mach3 to calculate the steps per unit
that should be configured.
Figure 5.12 shows the button on the settings
screen to initiate this process. You will be
prompted for the axis that you wish to
calibrate.
Then you must enter a nominal move
distance. Mach3 will make this move. Be
ready to press the EStop button if it seems to
Figure 5.12 – Automatic steps per unit
be going to crash because your existing
settings are too far out.
Finally after the move you will be prompted to measure and enter the exact distance that
was moved. This will be used to calculate the actual Steps per Unit of your machine axis.
Rev 1.84-A2 Using Mach3Mill
Page 56
Configuring Mach3
5-14
5.5.3 Deciding on acceleration
5.5.3.1 Inertia and forces
No motor is able to change the speed of a mechanism instantly. A torque is needed to give
angular momentum to the rotating parts (including the motor itself) and torque converted to
force by the mechanism (screw and nut etc.) has to accelerate the machine parts and the tool
or workpiece. Some of the force also goes to overcome friction and, of course, to make the
tool cut.
Mach3 will accelerate (and decelerate) the motor at a given rate (i.e. a straight line speed
time curve) If the motor can provide more torque than is needed for the cutting, friction and
inertia forces to be provided at the given acceleration rate then all is well. If the torque is
insufficient then it will either stall (if a stepper) or the servo position error will increase. If
the servo error gets too great then the drive will probably signal a fault condition but even if
it does not then the accuracy of the cutting will have suffered. This will be explained in
more detail shortly.
5.5.3.2 Testing different acceleration values
Try starting and stopping your machine with different settings of the Acceleration slider in
the Motor Tuning dialog. At low accelerations (a gentle slope on the graph) you will be able
to hear the speed ramping up and down.
5.5.3.3 Why you want to avoid a big servo error
Most moves made in a part program are co-ordinated with two, or more, axes moving
together. Thus in a move from X=0, Y=0 to X=2, Y=1, Mach3 will move the X axis at
twice the speed of the Y axis. It not only co-ordinates the movements at constant speed but
ensures that the speed required relationship applies during acceleration and deceleration but
accelerating all motions at a speed determined by the "slowest" axis.
If you specify too high an acceleration for a given axis then Mach3 will assume it can use
this value but as, in practice, the axis lags behind what is commanded (i.e. the servo error is
big) then the path cut in the work will be inaccurate.
5.5.3.4 Choosing an acceleration value
It is quite possible, knowing all the masses of parts, moments of inertia of the motor and
screws, friction forces and the torque available from the motor to calculate what
acceleration can be achieved with a given error. Ballscrew and linear slide manufacturers'
catalogues often include sample calculations.
Unless you want the ultimate in performance from your machine, we recommend setting the
value so that test starts and stops sound "comfortable". Sorry it's not very scientific but it
seems to give good results!
5.5.4 Saving and testing axis
Finally don't forget to click Save AxisSettings to save the acceleration rate before you move
on.
You should now check your calculations by using the MDI to make a defined G0 move. For
a rough check you can use a steel rule. A more accurate test can be made with a Dial Test
Indicator (DTI)/Clock and a slip gage block. Strictly this should be mounted in the
toolholder but for a conventional mill you can use the frame of the machine as the spindle
does not move relative to the frame in the X-Y plane.
Suppose you are testing the X axis and have a 4" gage block.
Use the MDI screen to select inch units and absolute coordinates. (G20 G90) Set up a clamp
on the table and Jog the axis so the DTI probe touches it. Ensure you finish by a move in
the minus X direction.
Rotate the bezel to zero the reading. This is illustrated in figure 5.13.
Using Mach3Mill Rev 1.84-A2
Page 57
Configuring Mach3
5-15
Now use the Mach3 MDI
screen and click the G92X0
button to set an offset and
hence zero the X axis
DRO.
Move the table to X = 4.5
by G0 X4.5. The gap
should be about half an
inch. If it is not then there
is something badly wrong
with your calculations of
Figure 5.13 - Establishing a zero position
the Steps per Unit value.
Check and correct this.
Insert the gage block and move to X = 4.0 by G0 X4. This move is in the X minus direction
as was the jog so the effects of backlash in the mechanism will be eliminated. The reading
on the DTI will give your positioning error. It should only be up to a thou or so. Figure 5.14
shows the gage in position.
Remove the gage and G0 X0 to check the zero value. Repeat the 4" test to get an set of,
perhaps, 20 values and see how reproducible the positioning is. If you get big variations
then there is something wrong mechanically. If you get consistent errors then you can fine
tune the Steps per Unit value to achieve maximum accuracy.
Figure 5.14 - Gage block in position
Next you should check that the axis does not lose steps in repeated moves at speed. Remove
the gage block. Use MDI to G0 X0 and check the zero on the DTI.
Use the editor to input the following program:
F1000 (i.e. faster than possible but Mach3 will limit speed)
G20 G90 (Inch and Absolute)
M98 P1234 L50 (run subroutine 50 times)
M30 (stop)
O1234
G1 X4
G1 X0 (do a feed rate move and move back)
M99 (return)
Click Cycle Start to run it. Check that the motion sounds smooth.
When it finishes the DTI should of course read zero. If you have problems then you will
need to fine tune the maximum velocity of acceleration of the axis.
5.5.5 Repeat configuration of other axes
With the confidence you will have gained with the first axis you should be able to quickly
repeat the process for the other axes.
Rev 1.84-A2 Using Mach3Mill
Page 58
Configuring Mach3
5-16
5.5.6 Spindle motor setup
If the speed of your spindle motor is fixed or controlled by hand then you can ignore this
section. If the motor is switched on and off, in either direction, by Mach3 then this will have
been setup with the relay outputs.
If Mach3 is to control the spindle speed either by a servo drive that accepts Step and
Direction pulses or by a Pulse Width Modulated (PWM) motor controller then this section
tells you how to configure your system.
5.5.6.1 Motor speed, spindle speed and pulleys
The Step and Direction and
PWM both allow you to
control the speed of the
motor. When you are
machining what you and
the part program (the S
word) are concerned with
is the speed of the spindle.
The motor and spindle
speed are, of course,
related by the pulleys or
gears connecting them. We will use the term "pulley" to cover both sorts of drive in this
manual.
Figure 5.15 - Pulley spindle drive
If you do not have motor speed control the choose Pulley 4 with a high maximum speed
like 10,0000 rpm and . This will prevent Mach3 complaining if you run a program with a S
word asking for say 6000 rpm.
Mach3 cannot know without being told by you, the machine operator, what pulley ratio is
selected at any given time so you are responsible for this. Actually the information is given
in two steps. When the system is configured (i.e. what you are doing now) you define up to
4 available pulley combinations. These are set by the physical sizes of the pulleys or ratios
in the geared head. Then when a part program is being run the operator defines which
pulley (1 to 4) is in use.
The machine's pulley ratios are set on the Config>Ports and Pins dialog (figure 5.6) where
the maximum speed of the four pulley sets is defined together with the default one to be
used. The maximum speed is the speed at which the spindle will rotate when the motor is at
full speed. Full speed is achieved by 100% pulse width in PWM and at the set Vel value on
Motor Tuning "spindle Axis" for Step and Direction.
As an example, suppose the position we will call "Pulley 1" is a step down of 5:1 from
motor to spindle and the maximum speed of the motor is 3600 rpm. Pulley 1 maximum
speed on Config>Logic will be set to 720 rpm (3600 ÷ 5). Pulley 4 might be a step up of
4:1. With the same motor speed its maximum speed would be set to 14,400 rpm (3600 x 4).
The other pulleys would be intermediate ratios. The pulleys do not need to be defined in
increasing speeds but the numbers should relate in some logical way to the controls on the
machine tool.
The Minimum Speed value applies equally to all pulleys and is expressed as a percentage of
the maximum speed and is, of course, also the minimum percentage PWM signal ratio. If a
speed lower than this is requested (by the S word etc.) then Mach3 will request you to
change the pulley ratio give a lower speed range. For example, with a maximum speed of
10,000 rpm on pulley 4 and a minimum percentage of 5% then S499 would request a
different pulley. This feature is to avoid operating the motor or its controller at a speed
below its minimum rating
Mach3 uses the pulley ratio information as follows:
♦ When the part program executes an S word or a value is entered into the set speed
DRO then the value is compared with the maximum speed for the currently
Using Mach3Mill Rev 1.84-A2
Page 59
Configuring Mach3
5-17
selected pulley. If the requested speed is greater than the maximum then an error
occurs.
♦ Otherwise the percentage of the maximum for the pulley that has been requested
and this is used to set the PWM width or Step pulses are generated to produce that
percentage of the maximum motor speed as set in Motor Tuning for the "Spindle
Axis".
As an example suppose the max spindle speed for Pulley #1 is 1000 rpm. S1100 would be
an error. S600 would give a pulse width of 60%. If the maximum Step and Direction speed
is 3600 rpm then the motor would be "stepped" at 2160 rpm (3600 x 0.6).
5.5.6.2 Pulse width modulated spindle controller
To configure the spindle motor for PWM control, check the Spindle Axis Enabled and
PWM Control boxes on the Port and Pins, Printer Port and Axis Selection Page tab (figure
5.1). Don't forget to Apply the changes. Define an output pin on the Output Signals
Selection Page tab (figure 5.6) for the Spindle Step. This pin must be connected to your
PWM motor control electronics. You do not need one for Spindle Direction so set this pin
to 0. Apply the changes.
Define External Activation signals in Ports and Pins and Configure>Output Devices to
switch the PWM controller on/off and, if required, to set the direction of rotation.
Now move to the Configure>Ports & Pins Spindle Options and locate the PWMBase Freq
box. The value in here is the frequency of the squarewave whose pulse width is modulated.
This is the signal which appears on the Spindle Step pin. The higher the frequency you
choose here the faster your controller will be able to respond to speed changes but the lower
the "resolution" of chosen speeds. The number of different speeds is the Engine pulse
frequency ÷ PWMBase freq. Thus for example if you are running at 35,000 Hz and
set the PWMBase to 50 Hz there are 700 discrete speeds available. This is almost
certainly sufficient on any real system as a motor with maximum speed of 3600 rpm
could, theoretically, be controlled in steps of less than 6 rpm.
5.5.6.3 Step and Direction spindle controller
To configure the spindle motor for Step and Direction control, check the Spindle Axis
Enabled boxes on the Port and Pins, Printer Port and Axis Selection Page tab (figure 5.1).
Leave PWM Control unchecked. Don't forget to Apply the changes. Define output pins on
the Output Signals Selection Page tab (figure 5.6) for the Spindle Step and Spindle
Direction. These pins must be connected to your motor drive electronics. Apply the changes.
Define External Activation signals in Ports and Pins and Configure>Output Devices to
switch the spindle motor controller on/off if you wish to take power off the motor when the
spindle is stopped by M5. It will not be rotating anyway of course as Mach3 will not be
sending step pulses but, depending on the driver design, may still be dissipating power.
Now move to Configure>Motor Tuning for the "Spindle Axis". The units for this will be
one revolution. So the Steps per Unit are the number of pulses for one rev (e.g. 2000 for a
10 times micro-stepping drive or 4 x the line count of a servomotor encoder or the
equivalent with electronic gearing).
The Vel box should be set to the number of revs per second at full speed. So a 3600 rpm
motor would need to be set to 60. This is not possible with a high line count encoder on
account of the maximum pulse rate from Mach3. (e.g. a 100 line encoder allows 87.5 revs
per second on a 35,000 Hz system). The spindle will generally require a powerful motor
whose drive electronics is likely to include electronic gearing which overcomes this
constraint.
The Accel box can be set by experiment to give a smooth start and stop to the spindle. Note:
that if you want to enter a very small value in the Accel box you do this by typing rather
than using the Accel slider. A spindle run-up time of 30 seconds is quite possible.
Rev 1.84-A2 Using Mach3Mill
Page 60
5-18
5.5.6.4 Testing the spindle drive
If you have a tachometer or stroboscope then you can measure the spindle speed of your
machine. If not you will have to judge it by eye and using your experience.
On Mach3 Settings screen, choose a pulley that will allow 900 rpm. Set the belt or gearbox
on the machine to the corresponding position. On the Program Run screen set the spindle
speed required to 900 rpm and start it rotating. Measure or estimate the speed. If it is wrong
you will have to revisit your calculations and setup.
You might also check the speeds on all the pulleys in the same way but with suitable set
speeds.
5.6 Other configuration
5.6.1 Configure homing and softlimits
5.6.1.1 Referencing speeds and direction
The Config>Home/Softlimits dialog allows you to define what happens when a reference
operation (G28.1
or a screen button)
is performed.
Figure 5.16 shows
the dialog. The
Speed % is used to
avoid crashing into
the stop of an axis
at full speed when
looking for the
reference switch.
When you are
referencing, Mach3
has no idea of the
position of an axis.
The direction it
moves in depends on the Home Neg check boxes. If the relevant box is checked then the
axis will move in the minus direction until the Home input becomes active. If the Home
input is already active then it will move in the plus direction. Similarly if the box is
unchecked then the axis moves in the plus direction until the input is active and the minus
direction if it is already active.
Configuring Mach3
Figure 5.16 – Homing (referencing)
5.6.1.2 Position of home switches
If the Auto Zero checkbox is checked then the axis DROs will be set to the
Reference/Home Switch location values defined in the Home Off. column (rather than
actual Zero). This can be useful to minimise homing time on a very large and slow axis.
It is, of course, necessary to have separate limit and reference switches if the reference
switch is not at the end of an axis.
5.6.1.3 Configure Soft Limits
As discussed above most implementations of limit switches involve some compromises and
hitting them accidentally will require intervention by the operator and may require the
system to be reset and re-referenced. Soft limits can provide a protection against this sort of
inconvenient accident.
The software will refuse to allow the axes to move outside the declared range of the soft
limits of the X, Y and Z axes. These can be set in the range -999999 to + 999999 units for
each axis. When jogging motion gets near to the limit then its speed will be reduced when
inside an Slow Zone which is defined in the table.
Using Mach3Mill Rev 1.84-A2
Page 61
Configuring Mach3
5-19
If the Slow Zone is too big then you will reduce the effective working area of the machine.
If they are set too small then you risk hitting the hardware limits.
The defined limits only apply when switched on using the Software Limits toggle button see Limits and Miscellaneous control family for details.
If a part program attempts to move beyond a soft limit then it will raise an error.
The softlimits values are also used to define the cutting envelope if Machine is selected for
the toolpath display. You may find them useful for this even if you are not concerned about
actual limits.
5.6.1.4 G28 Home location
The G28 coordinates define the position in absolute coordinates to which the axes will
move when a G28 is executed. They are interpreted in the current units (G20/G21) and not
automatically adjusted if the units system is changed.
5.6.2 Configure System Hotkeys
Mach3 has a set of
global hotkeys that can
be used for jogging or
to enter values into the
MDI line etc. These
keys are configured in
the System Hotkeys
Setup dialog (figure
5.17). Click on the
button for the required
function and then press
the key to be used as
hotkey. Its value will
be displayed on the
dialog. Take care to
avoid duplicate use of
a code as this can cause
serious confusion.
Figure 5.17– Hotkeys and OEM trigger configuration
This dialog also enables the codes for external buttons used as OEM Triggers to be defined.
5.6.3 Configure Backlash
Mach3 will attempt to compensate for
backlash in axis drive mechanisms by
attempting to approach each required
coordinate from the same direction. While
this is useful in applications like drilling or
boring, it cannot overcome problems with the
machine in continuous cutting.
The Config>Backlash dialog allows you to
give an estimate of the distance which the
axis must back up by to ensure the backlash is
taken up when the final "forward" movement
is made. The speed at which this movement is
to be made is also specified. See figure 5.18
Note: (a) These settings are only used when
backlash compensation is enabled by the
checkbox.
(b) Backlash compensation is a "last resort"
when the mechanical design of your machine
Figure 5.18 - Backlash configuration
Rev 1.84-A2 Using Mach3Mill
Page 62
Configuring Mach3
5-20
cannot be improved! Using it will generally disable the “constant velocity” features ar
“corners”.
(c) Mach3 is not able to fully honour the axis acceleration parameters when compensating
for backlash so stepper systems will generally have to be detuned to avoid risk of lost steps.
5.6.4 Configure Slaving
Large machines such as gantry routers or mills often need two drives, one on each side of
the gantry itself. If these become out of step then the gantry will "rack" and its cross axis
not be perpendicular to the long axis.
You can use Config>Slaving to configure Mach3 so one drive (say the X axis) is the main
drive and can slave another to it (perhaps the C axis configured as linear rather than rotary).
See figure 5.19
During normal use the same number of step pulses will be sent to the master and slave axes
with the speed and acceleration being determined by the "slower" of the two.
When a reference operation is requested they will move together until the home switch of
one is detected. This drive will position just off the switch in the usual way but the other
axis will continue until its switch is detected when it will be positioned off it. Thus the pair
of axes will be "squared up" to the home switch positions and any racking which has
occurred be eliminated.
Although Mach3 keeps the master and
slaves axes in step, the DRO of the slave
axis will not display offsets applied by the
Tool table, fixture offsets etc. Its values
may thus be confusing to the operator. We
therefore recommend that you use the
Screen Designer to remove the axis DRO
and related controls from all the screens
except Diagnostics. Save As the new design
with a name other than the default and use
the View>Load Screen menu to load it into
Figure 5.19 - Slaving configuration
Mach3.
5.6.5 Configure Toolpath
Config>Toolpath allows you to define how the toolpath is displayed. The dialog is shown in
figure 5.20
Origin sphere, when checked, displays a blob at the point of the toolpath display
representing X=0, Y=0,
Z=0
3D Compass, when
checked, shows arrows
depicting the directions of
positive X, Y and Z in the
toolpath display.
Machine boundaries, when
checked displays a box
corresponding to the
settings of the Softlimits
(whether or not they are
switched on).
Tool Position, when
checked, shows the current
position of the tool on the
display.
Using Mach3Mill Rev 1.84-A2
Figure 5.20 Configure Toolpath
Page 63
Configuring Mach3
5-21
Figure 5.21
-
Initial State configuration
Jog Follow Mode, when checked, causes the lines representing the toolpath to move relative
to the window as the tool is jogged. In other words the tool position is fixed in the toolpath
display window.
ShowTool as above centerline in Turn relates to Mach3Turn (to handle front and rear
toolposts).
Show Lathe Object enables the 3D rendering of the object that will be produced by the
toolpath (Mach3Turn only)
Colors for different elements of the display can be configured. The brightness of each of the
primary colors Red Green Blue are set on a scale 0 to 1 for each type of line. Hint: Use a
program like Photoshop to make a color which you like and divide its RGB values by 255
(it uses the scale 0 to 255) to get the values for Mach3.
The A-axis values allow you to specify the position and orientation of the A-axis if it is
configured as rotary and the display is enabled by the A Rotations checkbox.
Reset Plane on Regen reverts the display of the toolpath display to the current plane
whenever it is regenerated (by double click or button click).
Boxed Graphic displays a box at the boundaries of the tool movement.
5.6.6 Configure Initial State
Config>State opens a dialog which allows you to define the modes which are active when
Mach3 is loaded (i.e. the initial state of the system). It is shown in figure 5.21.
Motion mode:Constant velocity sets G64, Exact Stop sets G61. For details of these option
see Constant Velocity and Exact Stop in chapter 10.
Distance mode: Absolute sets G 90, Inc sets G91
Active plane: X-Y sets G17, Y-Z sets G19, X-Z sets G18
I/J Mode: In addition you can set the interpretation to be placed on I & J in arc moves. This
is provided for compatibility with different CAM post-processor and to emulate other
machine controllers. In Inc IJ mode I and J (the center point) are interpreted as relative to
Rev 1.84-A2 Using Mach3Mill
the starting point of a center format arc. This is compatible with NIST EMC. In Absolute IJ
mode I and J are the coordinates of the center in the current coordinate system (i.e. after
application of work, tool and G92 offsets). If circles always fail to display or to cut properly
(especially obvious by them being too big if they are far from the origin) then the IJ mode is
not compatible with you part program.
Page 64
Configuring Mach3
5-22
An error in this setting is the most frequent cause of questions from users when trying
to cut circles.
Initialization String: is a set of valid G-codes to set the desired initial state of Mach3 when
it is started. These are applied after the values set in the radio buttons above so may
override them. Use the radio buttons wherever possible to avoid confusion. If Use Init on ALL "Resets" is checked then these codes will be applied however Mach3 is reset – e.g.
after an EStop condition.
Other check boxes:
Persistent Jog Mode, if checked, will remember the Jog Mode you have chosen between
runs of Mach3Mill.
Persistent Offsets, if checked, will save the work and tool offsets in the permanent tables
you have selected between runs of Mach3Mill. See also Optional Offset Save.
Optional Offset Save, if checked, will prompt to check that you want to actually do any save
requested in Persistent Offsets.
Copy G54 from G59.253 on startup, if checked, will re-initiaise the G54 offset (i.e. work
offset 1) values from the work offset 253 values when Mach3 is started. Check this if you
want to start up G54 to always be a fixed coordinate system (e.g. the machine coordinate
system) even if a previous user might have altered it and saved a non-standard set of values.
A further discussion of these options is given in chapter 7.
No FRO on Queue, if checked, will delay the application of feed rate override until the
queue of commands waiting to be implemented is empty. This is sometimes necessary to
avoid exceeding permitted sppeds or accelerations when increasing the FRO above 100%.
Home Sw Safety, if checked, will prevent motion of a axis during homing if the home
switch is already active. This is useful to prevent mechanical damage on a machine which
shares limit switches at both ends of an axis with Home.
Shortest Rot, if checked, makes any rotary axis treat the position given as an angle modulo
360 degrees and move by the shortest route to that position.
Debug this run, if checked, gives extra diagnostics to the program designer. On use it on
Art’s special request.
Use Watchdogs, if checked, triggers and EStop is Mach3 seems not to be running correctly.
You may need to uncheck it if you get spurious EStops on slower computers with
operations like loading Wizards.
Enhanced Pulsing, if checked, will ensure the greatest accuracy of timing pulses (and hence
smoothness of stepper drives) at the expense of additional central processor time. You
should generally select this option.
Run Macropump, if checked, will on stattup look for a file MacroPump.m1s in the macro
folder for the current profile and will run it every 200 milli seconds.
Auto Screen Enlarge, if checked, will cause Mach3 to enlarge any screen, and all the
objects on it, if it has fewer pixels than the current PC screen mode so ensuring that it fills
the entire screen area.
Charge pump On in EStop, if checked, retains the charge pump output (or outputs) even
when EStop is detected. This is required for the logic of some breakout boards
Z is 2.5D on output #6, if checked, controls Output #6 depending on the current position in
the program coordinate system of the Z axis. If Z > 0.0 then Output #6 will be active. You
must have a Z axis configured to use this feature but its Step and Direction outputs can be
configured to a non-existent pin, for example Pin 0, Port 0.
Shuttle Accel controls the responsiveness of Mach3 to the MPG when it is being used to
control the execution of lines of GCode.
Lookahead determines the number of lines of GCode that the interpreter can buffer for
execution. It does not normally require tuning.
Using Mach3Mill Rev 1.84-A2
Page 65
Configuring Mach3
5-23
Jog Increments in Cycle Mode: The Cycle Jog Step button will load the values in the list
into the Step DRO in turn. This is often more convenient than typing into the Step DRO.
Code the special value 999 to switch to Cont Jog Mode.
Reference Switch Loc: These values define the machine coordinate position to be set on
referencing, after hitting the Home switch (if provided) for each axis. The values are
absolute positions in the setup units.
5.6.7 Configure other Logic items
The functions of the Config>Logic dialog (figure 5.22) are described below.
Figure 5.22 - Logic Configuration dialog
G20/G21 Control: If Lock DROs to set up units is checked then even though G20 and
G21 will alter the way X, Y, Z etc. words are interpreted (inch or millimetre) the DROs will
always display in the Setup Unit system.
Tool change: An M6 tool change request can be ignored or used to call the M6 macros
(q.v.). If Auto Tool Changer is checked then the M6Start/M6End macros will be called but
Cycle Start does not need to be pressed at any stage.
Angular properties: An axis defined as angular is measured in degrees (that is to say
G20/G21 do not alter the interpretation of A, B, C words)
Program end or M30 or Rewind: defines action(s) to take place at end or a rewind of your
part program. Check the required functions. Caution: Before checking the items to remove
offsets and to perform G92.1 you should be absolutely clear on how these features work or
you may find that the current position has coordinates very different from what you expect
at the end of a program.
Debounce interval/Index Debounce: Is the number of Mach 2 pulses that a switch must be
stable for its signal to be considered valid. So for a system running at 35,000 Hz , 100
would give about a 3 millisecond debounce (100 ÷ 35000 = 0.0029 secs). The Index pulse
and the other inputs have independent settings.
Program safety: When checked enables Input #1 as a safety cover interlock.
Editor: The filename of the executable of the editor to be called by the G-code edit button.
The Browse button allows a suitable file (e.g. C:\windows\notepad.exe) to be found.
Serial output: Defines the COM port number to be used for the serial output channel and
the baud rate at which it should output. This port can be written to from VB script in a
Rev 1.84-A2 Using Mach3Mill
Page 66
Configuring Mach3
5-24
macro and can be used to control special functions of a machine (e.g. LCD display, toolchangers, axis clamps, swarf conveyor etc,)
Other checkboxes:
Persistent DROs, if checked, then the axis DROs will have the same values on startup as
when Mach3 is closed down. Note that the positions of the physical axes are unlikely to be
preserved if the machine tool is powered down, especially with micro-stepper drives.
Disable Gouge/Concavity checks, if unchecked, then, during cutter compensation (G41 and
G42), Mach3 will check if the tool diameter is too large to cut “insider corners” without
gouging the work. Check the box to disable the warning.
Plasma Mode, if checked, this controls Mach3's implementation of constant velocity moves
to suit the characteristics of plasma cutters.
No Angular Discrimination: This is also only relevant to constant velocity working. When
unchecked Mach3 treats changes of direction whose angle is greater than the value set in
the CV Angular Limit DRO as exact stop (even if CV mode is set) to avoid excessive
rounding of sharp corners. Full details of Constant Velocity mode are given in chapter 10.
FeedOveride Persists, if checked, then the selected feed override will be retained at the end
of a part program run.
Allow Wave files, if checked, allows Windows .WAV sound clips to be played by Mach3.
This can be used, for example to signal errors or attention required by the machine.
Allow Speech, if checked, allows Mach3 to use the Microsoft Speech Agent for system
information messages and "right button" Help text. See the Speech option on the Windows
Control Panel to configure the voice to be used, speed of speaking etc.
G04 Dwell param in Milliseconds, if checked then the command G4 5000 will give a Dwell
in running of 5 seconds. If the control is unchecked it gives a dwell of 1 hour 23 minutes 20
seconds!
Set charge pump to 5kHz for laser standby level: In this setting charge pump output or
output(s) are a 5 kHz signal (for compatibility with some lasers) rather than the standard
12.5kHz signal.
Use Safe_Z: If checked then Mach3 will make use of the Safe Z position defined.
Note: If you use a machine without referencing as the initial operation then it is safer to
leave this option unchecked as without referencing the machine coordinate system is
arbitrary.
Tool Selections Persistent, if checked, remembers the selected tool at shutdown of Mach3.
5.7 How the Profile information is stored
When the Mach3.exe program is run it will prompt you for the Profile file to use. This will
generally be in the Mach3 folder and will have the extension .XML. You can view and print
the contents of Profile files with Internet Explorer (as XML is a mark-up language used on
web pages)
Shortcuts are set up by the system installer to run Mach3.exe with default Profiles for a Mill
and for Turning (i.e. Mach3Mill and Mach3Turn). You can create your own shortcuts each
with a different Profile so one computer can control a variety of machine tools.
This is very useful if you have more than one machine and they require different values for
the motor tuning, or have different limit and home switch arrangements.
You can either run Mach3.exe and choose from the list of available profiles or you can set
up extra shortcuts that specify the profile to use.
In a shortcut, the profile to load is given in the "/p" argument in the Target of the shortcut
properties. As an example you should inspect the Properties of the Mach3Mill shortcut.
This can be done, for example, by right clicking the shortcut and choosing Properties from
the menu.
Using Mach3Mill Rev 1.84-A2
Page 67
Configuring Mach3
5-25
An .XML file for a profile can be edited by an external editor but you are very strongly
advised not to do this unless you are fully conversant with the meaning of each entry in the
files as some users have encountered very strange effects with mis-formatted files. Notice
that some tags (e.g. the screen layout) are only created when a built-in default value is
overridden using Mach3 menus. It is much safer to use Mach3's configuration menus to update the XML profiles.
When a new profile is created then a folder for storing its macros will be created. If you are
“cloning” from a profile with custom macros then you must take care to copy any such
custom macros into the new profile.
Rev 1.84-A2 Using Mach3Mill
Page 68
Page 69
Mach3 controls and running a part program
6-1
6. Mach3 controls and running a part program
This chapter is intended for reference to explain the screen controls provided
by Mach3 for setting up and running a job on the machine. It is of relevance
to machine operators and for part-programmers who are going to prove their
programs on Mach3.
6.1 Introduction
This chapter covers a lot of detail. You may wish to skim section 6.2 and then look at the
sections for inputting and editing part programs before returning to the details of all the
screen controls.
6.2 How the controls are explained in this chapter
Although at first sight you may feel daunted by the range of options and data displayed by
Mach3, this is actually organised into a few logical groups. We refer to these as Families of
Controls. By way of explanation of the term "control", this covers both buttons and their
associated keyboard shortcuts used to operate Mach3 and the information displayed by
DROs (digital read-outs), labels or LEDs (light emitting diodes).
The elements of each control family are defined for reference in this chapter. The families
are explained in order of importance for most users.
You should, however, note that the actual screens of your Mach3 does not include every control of a family when the family is used. This may be to increase readability of a
Figure 6.1 - Screen switching control family
particular screen or to avoid accidental changes to the part being machined in a production
environment
A Screen Designer is provided that allows controls to be removed or added from the screens
of a set of screens. You can modify or design screens from scratch so that you can add any
controls to a particular screen if your application requires this. For details see the Mach3 Customisation wiki.
6.2.1 Screen switching controls
These controls appear on each screen. They allow switching between screens and also
display information about the current state of the system.
6.2.1.1 Reset
This is a toggle. When the system is Reset the LED glows steadily, the charge pump pulse
monitor (if enabled) will output pulses and the Enable outputs chosen will be active.
6.2.1.2 Labels
The "intelligent labels" display the last "error" message, the current modes, the file name of
the currently loaded part program (if any) and the Profile that is in use.
Rev 1.84-A2 Using Mach3Mill
Page 70
Mach3 controls and running a part program
6-2
Figure 6.2 - Axis control family
6.2.1.3 Screen selection buttons
These buttons switch the display from screen to screen. The keyboard shortcuts are given
after the names. For clarity in all cases when they are letters they are in upper-case. You
should not, however, use the shift key when pressing the shortcut.
6.2.2 Axis control family
This family is concerned with the current position of the tool (or more precisely, the
controlled point).
The axes have the following controls:
6.2.2.1 Coordinate value DRO
These are displayed in the current units (G20/G21) unless locked to the setup units on the
Config>Logic dialog. The value is the coordinate of the controlled point in the displayed
coordinate system. This will generally be the coordinate system of the current Work Offset
(initially 1 - i.e. G54) together with any G92 offsets applied. It can however be switched to
display Absolute Machine Coordinates.
You can type a new value into any Axis DRO. This will modify the current Work Offset to
make the controlled point in the current coordinate system be the value you have set. You
are advised to set up Work Offsets using the Offsets screen until you are fully familiar with
working with multiple coordinate systems.
6.2.2.2 Referenced
The LED is green if the axis has been referenced (i.e. is in a known actual position)
Each axis can be referenced using the Ref All button. Individual axes can be referenced on
the Diagnostics screen
♦ If no home/reference switch is defined for the axis, then the axis will not actually
be moved but, if Auto Zero DRO when homed is checked in Config>Referencing,
then the absolute machine coordinate of the current position of the axis will be set
to the value defined for the axis in the Home/Reference switch locations table in
the Config>State dialog. This is most often zero.
♦ If there is a home/reference switch defined for the axis and it is not providing an
active input when the Ref is requested, then the axis will be moved in the
Using Mach3Mill Rev 1.84-A2
Page 71
Mach3 controls and running a part program
6-3
direction defined in Config>Referencing until the input does become active. It
then backs off a short distance so that the input is inactive. If the input is already
active then the axis just moves the same short distance into the inactive position.
If Auto Zero DRO when homed is checked in Config>Referencing then the
absolute machine coordinate of the current position of the axis will be set to the
value defined for the axis in the Home/Reference switch locations table in the
Config>State dialog.
The De-Ref All button does not move the axes but stops them being in the referenced state.
6.2.2.3 Machine coordinates
The MachineCoords button displays absolute machine coordinates. The LED warns that
absolute coordinates are being displayed.
6.2.2.4 Scale
Scale factors for any axes can be set by G51 and can be cleared by G50. If a scale factor
(other than 1.0) is set then it is applied to coordinates when they appear in G-code (e.g. as X
words, Y words etc.) . The Scale LED will flash as a reminder that a scale is set for an axis.
The value defined by G51 will appear, and can be set, in the Scale DRO. Negative values
mirror the coordinates about the relevant axis.
6.2.2.5 Softlimits
The Softlimits button enables the softlimits values defined in Config>Homing/Limits.
6.2.2.6 Verify
The Verify button, which is only applicable if you have home switches, will move to them
to verify if any steps might have been lost during preceding machining operations.
6.2.2.7 Diameter/Radius correction
Rotary axes can have the approximate size of the workpiece defined using the Rotational
Diameter control family. This size is used when making blended feedrate calculations for
co-ordinated motion including rotational axes. The LED indicates that a non-zero value is
defined.
6.2.3 "Move to" controls
There are many buttons on different screens designed to
make it easy to move the tool (controlled point) to a
particular location (e.g. for a tool change). These
buttons include: Goto Zs to move all axes to zero, Goto Tool Change, Goto Safe Z, Goto Home.
In addition Mach3 will remember two different sets of
coordinates and go to them on demand. These are
controlled by Set Reference Point and Goto Ref Point,
and by Set Variable Position and Goto Variable
Position
Figure 6.4 – Controlled point
memories & Teach
6.2.4 MDI and Teach control family
G-code lines
(blocks) can be
entered, for
immediate
execution, into the
MDI (Manual Data
Input) line. This is
selected by
clicking in it or the
Rev 1.84-A2 Using Mach3Mill
Figure 6.5 – MDI line
Page 72
Mach3 controls and running a part program
6-4
MDI hotkey (Enter in the default configuration). When
the MDI line is active its color changes and a flyout box
showing the recently entered commands is displayed.
An example is shown in figure 6.5. The cursor up and
down arrow keys can be used to select from the flyout
so that you can reuse a line that you have already
entered. The Enter key causes Mach3 to execute the
current MDI line and it remains active for input of
another set of commands. The Esc key clears the line
and de-selects it. You need to remember that when it is
selected all keyboard input (and input from a keyboard
emulator or custom keyboard) is written in the MDI line
rather than controlling Mach3. In particular, jogging
keys will not be recognised: you must Esc after entering
MDI.
Mach3 can remember all the MDI lines as it executes
them and store them in a file by using the Teach
facility. Click Start Teach, enter the required commands
and then click Stop Teach. The LED blinks to remind
you that you are in Teach Mode. The commands are
written in the file with the conventional name
"C:/Mach3/GCode/MDITeach.tap" Clicking Load/Edit
will load this file into Mach3 where it can be run or
edited in the usual way – you need to go to the Program
Run screen to see it. If you wish to keep a given set of
taught commands then you should Edit the file and use
Save As in the editor to give it your own name and put it
in a convenient folder.
6.2.5 Jogging control family
Jogging controls are collected on a special screen which
flys-out into use when the Tab key is pressed on the
keyboard. It is hidden by a second press of Tab.
This is illustrated in figure 6.6/
Whenever the Jog ON?OFF button is displayed on the current screen then the axes of the
machine can be jogged using (a) the jog hotkeys – including an MPG connected via a
keyboard emulator: the hotkeys are defined in Configure Axis hotkeys; (b) MPG handwheel
(s) connected to an encoder on the parallel port; or a Modbus device (c) joysticks interfaced
as USB Human Interface Devices; or (e) as a legacy feature, a Windows compatible analog
joystick.
If the Jog ON/OFF button is not displayed or it is toggled to OFF then jogging is not
allowed for safety reasons.
6.2.5.1 Hotkey jogging
There are three modes. Continuous, Step and MPG which are selected by the Jog Mode
button and indicated by the LEDs.
Continuous mode moves the axis or axes at the defined slow jog rate while the hotkeys are
depressed
The jogging speed used with hotkeys in Continuous mode is set as a percentage of the rapid
traverse rate by the Slow Jog Percentage DRO. This can be set (in the range 0.1% to 100%)
by typing into the DRO. It can be nudged in 5% increments by the buttons or their hotkeys.
Figure 6.6 - Jogging control
family
This Slow Jog Percentage can be overridden by depressing Shift with the hotkey(s). An
LED beside the Cont. LED indicates this full speed jogging is selected
Step mode moves the axis by one increment (as defined by the Jog Increment DRO) for
each keypress. The current feedrate (as defined by the F word) is used for these moves.
Using Mach3Mill Rev 1.84-A2
Page 73
Mach3 controls and running a part program
6-5
The size of increment can be set by typing it into the Step DRO or values can be set in this
DRO by cycling through a set of 10 user definable values using the Cycle Jog Step button.
Incremental mode is selected by the toggle button or, if in Continuous Mode temporarily
selected by holding down Ctrl before performing the jog.
6.2.5.2 Parallel port or Modbus MPG jogging
Up to three quadrature encoders connected to the parallel ports or ModBus can be
configured as MPGs for jogging by using the Jog Mode button to select MPG Jog Mode.
The axis that the MPG will jogs is indicated by the LEDs and the installed axes are cycled
through by the Alt-A button for MPG1, Alt-B for MPG2 and Alt-C for MPG3.
Over the graphic of the MPG handle are a set of buttons for selecting the MPG mode.
In MPG Velocity Mode the velocity of the axis movement is related to the rotational speed
of the MPG with Mach3 ensuring that the acceleration of the axis and top speed if
honoured. This gives a very natural feel to axis movement. MPG Step/Velocity mode
currently works like velocity mode.
In Single Step mode each "click" from the MPG encoder requests one incremental jog step
(with the distance set as for hotkey Step jogging). Only one request at a time will be
allowed. In other words if the axis is already moving then a “click” will be ignored. In
Multi-step mode, clicks will be counted and queued for action. Note that this means that for
large steps rapid movement of the wheel may mean that the axis moves a considerable
distance and for some time after the wheel movement has stopped. The steps are
implemented with the federate given by
the MPG Feedrate DRO
These step modes are of particular use in
making very fine controlled movements
when setting up work on a machine. You
are advised to start using Velocity Mode.
6.2.5.3 Spindle Speed control family
Depending on the design of your
machine, the machine spindle can be
controlled in three ways: (a) Speed is
fixed/set by hand, switched on and off by
hand; (b) Speed fixed/set by hand,
switched on and off by M-codes via
external activation outputs, (c) Speed set
Figure 6.6 - Spindle speed control family
by Mach3 using PWM or step/direction
drive.
This control family is only important for case (c).
The S DRO has its value set when an S word is used in a part program. It is the desired
spindle speed. It can also be set by typing into the DRO.
Mach3 will not allow you to try to set it (in either way) to a speed less than that set in Min
Speed or greater than that set in Max Speed on Config>Port & Pins Spindle Setup tab for
the chosen pulley.
If the Index input is configured and a sensor which generates pulses as the spindle revolves
is connected to its pin, then the current speed will be displayed in the RPM DRO. The RPM
DRO cannot be set by you – use the S DRO to command a speed..
6.2.6 Feed control family
6.2.6.1 Feed Units per minute
The Prog Feed DRO gives the feed rate in current units (inches/millimetres per minute). It
is set by the F word in a part program or by typing into the F DRO. Mach3 will aim to use
Rev 1.84-A2 Using Mach3Mill
Page 74
Mach3 controls and running a part program
6-6
this speed as the actual rate of the co-ordinated
movement of the tool through the material. If
this rate is not possible because of the
maximum permitted speed of any axis then the
actual feed rate will be the highest achievable.
6.2.6.2 Feed Units per rev.
As modern cutters are often specified by the
permitted cut per "tip" it may be convenient to
specify the feed per revolution (i.e. feed per tip
x number of tips on tool). The Prog Feed DRO
gives the feed rate in current units
(inches/millimetres) per rev of the spindle. It is
set by the F word in a part program or by typing
Figure 6.7 Feed control family
into the DRO.
A revolution of the spindle can either be determined by the S DRO or from the measured
speed by counting index pulses. Config>Logic has a checkbox to define which Mach3 will
adopt.
To employ Feed units/rev, Mach3 must know the value of the chosen measure of the speed
of the spindle (i.e. it must have been (a) defined in an S word or by data entered to S DRO
in the Spindle speed control family or (b) the Index must be connected up to measure actual
spindle speed).
Notice that the numeric values in the control will be very different unless spindle speed
is near to 1 rpm! So using a feed per minute figure with feed per rev mode will
probably produce a disastrous crash.
6.2.6.3 Feed display
The actual feed in operation allowing for the co-ordinated motion of all axes is displayed in
Units/min and Units/rev. If the spindle speed is not set and the actual spindle speed is not
measured then the Feed per rev value will be meaningless.
6.2.6.4 Feed override
Unless M49 (Disable feedrate override) is in use, the feedrate can be manually overridden,
in the range 20% to 299%, by entering a percentage in the DRO. This value can be nudged
(in steps of 10%) with the buttons or their keyboard shortcuts and be reset to 100%. The
LED warns of an override is in operation.
The FRO DRO displays the calculated result of applying the percentage override to the set
feedrate.
6.2.7 Program Running control family
These controls handle the execution of a loaded part program or the commands on an MDI
line.
6.2.7.1 Cycle Start
Safety warning: Note that the Cycle Start button will, in general, start the spindle and axis
movement. It should always be configured to require "two hand" operation and if you are
assigning your own hotkeys it should not be a single keystroke.
6.2.7.2 FeedHold
The Feedhold button will stop the execution of the part program as quickly as possible but
in a controlled way so it can be restarted by Cycle Start. The spindle and coolant will
remain on but can be stopped manually if required.
When in FeedHold you can jog the axes, replace a broken tool etc. If you have stopped the
spindle or coolant then you will generally want to turn them on before continuing. Mach3
Using Mach3Mill Rev 1.84-A2
Page 75
Mach3 controls and running a part program
6-7
will however, remember the axis positions at the time of the FeedHold and return to them
before continuing the part program
Figure 6.8 - Program running family
6.2.7.3 Stop
Stop halts axis motion as quickly as possible. It may result in lost steps (especially on
stepper motor driven axes) and restarting may not be valid.
6.2.7.4 Rewind
Rewinds the currently loaded part program.
6.2.7.5 Single BLK
SingleBLK is a toggle (with indicator LED). In Single Block mode a Cycle Start will
execute the next single line of the part program and then enter FeedHold.
6.2.7.6 Reverse Run
Reverse Run is a toggle (with indicator LED). It should be used after a Feed Hold or Single
Block and the next Cycle Start will cause the part program to run in reverse. This is
particularly useful in recovering from a lost arc condition in plasma cutting or a broken tool.
6.2.7.7 Line Number
Line DRO is the ordinal number of the current line in the G-code display window (starting
from 0). Note that this is not related to the "N word" line number.
You can type into this DRO to set the current line.
6.2.7.8 Run from here
Run from here performs a dummy run of the part program to establish what the modal state
(G20/G21, G90/G91 etc.) should be and then prompts for a move to put the controlled point
in the correct position to for the start of the line in Line Number. You should not attempt to
Run from here in the middle of a subroutine.
6.2.7.9 Set next line
Like Run from here but without the preparatory mode setting or move.
6.2.7.10 Block Delete
The Delete button toggles the Block Delete "switch". If enabled then lines of G-code which
start with a slash - i.e. / - will not be executed.
Rev 1.84-A2 Using Mach3Mill
Page 76
Mach3 controls and running a part program
6-8
6.2.7.11 Optional Stop
The End button toggles the Optional Stop "switch". If enabled then the M01 command will
be treated as M00.
6.2.8 File control family
These controls, figure 6.9, are involved with the file of your part program. They should be
self-evident in operation.
6.2.9 Tool details
In the Tool Details group, figure 6.9, controls display
the current tool, the offsets for its length and diameter
and, on systems with a Digities input, allow it to be
automatically zero to the Z plane.
Unless tool change requests are being ignored
(Config>Logic), on encountering an M6 Mach3 will
move to Safe Z and stop, flashing the ToolChange
LED. You continue (after changing the tool) by clicking
Cycle Start.
The elapsed time for the current job is displayed in
hours, minutes and seconds.
6.2.10 G-Code and Toolpath control
Figure 6.9 – Tool Details
family
The currently loaded part program is displayed in the G-code window. The current line is
highlighted and can be moved using the scroll bar on the window.
The Toolpath display, figure 6.10, shows the path that the controlled point will follow in the
X, Y, Z planes. When a part program is executing the path is overpainted in the color
selected in Config>Toolpath. This overpainting is dynamic and is not preserved when you
change screens or indeed alter views of the toolpath.
On occasions you will find that the display does not exactly follow the planned path. It
occurs for the following reason. Mach3 prioritises the tasks it is doing. Sending accurate
step pulses to the machine tool is the first priority. Drawing the tool path is a lower priority.
Mach3 will draw points on the toolpath display whenever it has spare time and it joins these
points by straight lines. So, if time is short, only a few points will be drawn and circles will
Figure 6.10 - Toolpath family
Using Mach3Mill Rev 1.84-A2
Page 77
Mach3 controls and running a part program
6-9
tend to appear as polygons where the straight sides are very noticeable. This is nothing to
worry about.
The Simulate Program Run button will execute the G-code, but without any tool movement,
and allow the time to make the part to be estimated.
The Program Limits data allow you to check the maximum excursion of the controlled
point to be reasonable (e.g. not milling the top off the table).
The screenshot also shows axis DROs and some Program Run controls.
If you have defined softlimits which correspond to the size of your machine table then it is
often useful to use the Display Mode button to toggle from Job to Table mode to show the
toolpath in relation to the table. See figure 6.11
The toolpath display can be
rotated by left clicking and
dragging the mouse in it. It
can be zoomed by shift-left
clicking and dragging and
can be panned by dragging
a right click.
The Regenerate button will
regenerate the toolpath
display from the G-code
with the currently enabled
fixture and G92 offsets.
Note: It is very important
to regenerate the toolpath
Figure 6.11 – Toolpath in relation to table
after changing the values of offsets both to get the correct visual effect and because it is
used to perform calculations when using G42 and G43 for cutter compensation..
6.2.11 Work offset and tool table control family
Work Offset and Tool tables can be accessed from the Operator menu and, of course, within
a part program but it is often most convenient to manipulate them through this family. Refer
to chapter 7 for details of the tables and techniques like "Touching".
Because of the underlying G-code definitions Work Offset and Tool tables work in slightly
different ways.
Warning: Changing the Work and Tool offsets in use will never actually move the tool on
the machine although it will of course alter the axis DRO readings. However, a move G0,
G1 etc.) after setting
new offsets will be in the
new coordinate system.
You must understand
what you are doing if you
wish to avoid crashes on
your machine.
6.2.11.1 Work Offsets
Mach3 by default uses
Work Offset number 1.
Choosing any value from
1 to 255, and entering it
in the Current Work Offset DRO, will make
that Work Offset current.
Work offsets are
sometimes called Fixture
Figure 6.12 – Work offsets family
Offsets.
Rev 1.84-A2 Using Mach3Mill
Page 78
Mach3 controls and running a part program
6-10
Typing into the DRO is equivalent to a part program issuing G55 to 59 or G58.1 to G59.253
(q.v.).
You can also set the current offset system using the Fixture buttons.
You can change the value of the offset values for the current offset system by typing into
the relevant Part Offset DROs. (Part Offset is yet another name for Work and Fixture
offsets!)
Values can also be set in these DROs by moving the axes to a desired place and clicking as Set or Select button. The X and Y axes and Z axis are set in slightly different ways. Z is
easier to understand so we will describe it first.
The Z offset will usually be set up with a “master tool” in the spindle. The Z for other tools
will then be corrected by the tool table. A gage block or sometimes even a piece of foil or
paper is slid between the tool and the top of the work (if this is to be Z = 0.0) or the table (if
this is to be Z = 0.0). The Z axis is very gently jogged down until the gage is just trapped by
the tool. The thickness of the gage is entered into the Gage Block Height DRO and the Set Z button is clicked. This will set up the Z value of the current work offset so that the tool is at
the given height.
The process for X and Y is similar except the touching might be done on any of four sides
of the part and account has to be taken of the diameter of the tool (or probe) and the
thickness of any gage being used to give “feel” to the touching process.
For example to set the bottom edge of a piece of material to be Y = 0.0 with a tool of
diameter 0.5” and a 0.1” gage block, you would enter 0.7 in the Edge Finder Dia DRO (i.e.
the diameter of the tool plus twice the gage) and click the Select button that is ringed in
figure 6.12.
Depending on your configuration of Persistent Offsets and Offsets Save in Config>State the
new values will be remembered from one run of Mach3 to another.
6.2.11.2 Tools
Tools are numbered from 0 to 255.
The tool number is selected by the
T word in a part program or
entering the number in the T DRO.
Its offsets are only applied if they
are switched On by the ToolOffset On/Off toggle button (or the
equivalent G43 and G49 in the part
program)
In Mach3Mill only the Z offset and
Diameter are used for tools. The
diameter can be entered in the DRO
and the Z-offset (i.e. compensation
Figure 6.13 – Tool Offset
for tool length) be entered directly or by Touching. The Set Tool Offset feature works
exactly as set Z with with Work Offsets.
Tool Offset data is made persistent between runs in the same way as Work Offset data.
6.2.11.3 Direct access to Offset Tables
The tables can be opened and edited directly
using the Save Work Offsets and Save Tool Offsets buttons or the Operator>Fixtures (i.e.
Work Offsets) and Operator>Tooltable menus.
6.2.12 Rotational Diameter control
family
As described in the Feedrate control family, it is
possible to define the approximate size of a
Using Mach3Mill Rev 1.84-A2
Figure 6.14 - Rotational diameters
Page 79
Mach3 controls and running a part program
6-11
rotated workpiece so the rotational axis speed can be correctly included in the blended
feedrate. The relevant diameters are entered in the DROs of this family.
The Axis control Family has warning LED(s) to indicated the setting of non-zero values
here.
Values are not required if rotary movement is not to be coordinated with linear axes. In this
case a suitable F word for degrees per minute or degrees per rev should be programmed.
6.2.13 Tangential control family
On a machine to cut vinyl or fabric it is very useful to
use a rotary axis to control the direction that the knife
points. It will cut best if tangential to the direction in
which the X and Y axes are moving at any time.
Mach3 will control the A axis like this for G1 moves.
Clearly the point of the knife should be as near to the
axis about which a turns and this axis must be parallel
to the Z axis of the machine.
The feature is enabled by the Tangential Control
.button. In most applications there is a limit to the angle through which the knife can be
turned at a corner while it is in the material. This value is defined in Lift Angle. Any corner
where the change in angle required is greater than Lift Angle will cause the Z axis to rise by
the value in Lift Z, the knife will turn and then Z will drop so it re-enters the material in the
new direction.
Figure 6.15 – Tangential control
family
6.2.14 Limits and miscellaneous
control family
6.2.14.1 Input Activation 4
Input activation signal 4 can be configured to
give a hard wired Single Step function
equivalent to the Single button in the Program
Running control family.
6.2.14.2 Override limits
Mach3 can use software to override limit
switches connected to its inputs.
This can be automatic i.e. the jogging performed immediately after a reset will not be
subject to limits until the axis is jogged off the
limit switches. The Toggle button and warning
LED for Auto Limit Override controls this.
As an alternative limits may be locked out
using the OverRide Limits toggle. Its use is
indicated by the LED.
Notice that these controls do not apply if limit
switches are wired to the drive electronics or to
activate EStop. In this case an external
electrical override switch will be needed to
disable the switch circuit while you jog off
them.
Figure 6.16 - Limits control family
6.2.15 System Settings control
family
Note: The controls in this family are not
in one place on the screens released with
Rev 1.84-A2 Using Mach3Mill
Figure 6.17 – System Settings, Safe Z
controls etc.
Page 80
Mach3 controls and running a part program
6-12
Mach3. You will need to hunt for them on Program Run, Settings and Diagnostics
screens.
6.2.15.1 Units
This toggle implements the G20 and G21 codes to change the current measurement units.
You are strongly advised not to do this except in small fragments of part program on
account of the fact that Work Offset and Tool Offset tables are in one fixed set of units.
6.2.15.2 Safe Z
This family allows you to define the Z value which is clear of clamps and parts of the
workpiece. It will be used for homing and changing the tool.
6.2.15.3 CV Mode/Angular Limit
This LED is lit when the system is running in "Constant Velocity" mode. This will give
smoother and faster operation than "Exact stop" mode but may cause some rounding at
sharp corners depending on the speed of the axis drives. Even when the system is in CV
mode a corner with a change of direction more acute than the value given in the Angular Limit DRO will be performed as if Exact Stop was selected. Full details of this are given
under Constant Velocity in chapter 10.
6.2.15.4 Offline
This toggle and warning
LED "disconnects" all the
output signals of Mach3.
This is intended for
machine setup and testing.
Its use during a part
program will cause you all
sorts of positioning
Figure 6.18 - Encoder control family
problems.
6.2.16 Encoder control family
This family displays the values from the axis encoders and allows them to be transferred to
and from the main axis DROs
The Zero button will reset the corresponding encoder DRO to zero.
The To DRO button copies the value into the main axis DRO (i.e. applies this values as a
G92 offset).
The Load DRO button loads the encoder DRO from the corresponding main axis DRO.
6.2.17 Automatic Z control family
Mach3 has the
facility to set a lower
limit for moves in the
Z axis. See
Config>Logic dialog
for the static setting
of this Inhibit-Z
value.
Figure 6.19 – Automatic Z control
There is also a control family which allows this Inhibit Z value to be set while preparing
and before running a G-code program. This is shown in figure 6.19.
Code the program, which might often be a DXF or HPGL import, so that it makes a single
cut or set of cuts at the finally desired Z depth (perhaps Z = -0.6 inch assuming top of
workpiece is Z = 0). The last command should be an M30 (Rewind)
Using Mach3Mill Rev 1.84-A2
Page 81
Mach3 controls and running a part program
6-13
Using the Automatic Z Control controls (a) set the Z-inhibit value to the Z for depth for the
first roughing cut (perhaps Z= -0.05) (b) the Lower Z-Inhibit to the successive cut depths
(we might allow 0.1 as the tool has some side support). The whole job will need seven
passes to get to Z = -0.6, so (c) enter 7 in L (Loop). On pressing Cycle Start the machine
will automatically make the series of cuts at increasing Z depth. The DROs track the
progress decrementing L as they are performed and updating the Z-inhibit value. If the
given number of L does not reach the part program's requested Z depth then you can update
the L DRO and restart the program.
6.2.18 Laser Trigger output family
Mach3 will output a pulse on the Digitise Trigger Out Pin
(if defined) when the X or Y axes pass through trigger
points.
The Laser Trigger group of controls allows you to define
the grid points in the current units and relative to an
arbitrary datum.
Click Laser Grid Zero when the controlled point is at the
desired grid origin. Define the positions of the grid lines in
X and Y axes and click Toggle to enable the output of
pulses whenever an axis crosses a grid line.
This feature is experimental and subject to change in later
releases.
Figure 6.20 – Digitise Pulse
family
6.2.19 Custom controls families
Mach3 allows a machine builder, which could be you or your supplier, to add a whole range
of features by custom screens which can have DROs, LEDs and buttons which are used by
VB Script programs (either attached to the buttons or run from macro files). Examples of
such facilities are given in the Mach3 Customisation manual. These example also show how
different Mach3 screens can look to suit different applications even though they perform
essentially the same function required by a milling machine or router.
Rev 1.84-A2 Using Mach3Mill
Page 82
Mach3 controls and running a part program
6-14
6.3 Using Wizards
Mach3 Wizards are
an extension to the
Teach facility which
allows you to define
some machining
operations using one
or more special
screens. The Wizard
will then generate Gcode to make the
required cuts.
Examples of Wizards
include machining a
circular pocket,
drilling an array of
holes and engraving
text.
The Load Wizards
button displays a table of Wizards installed on your system. You choose the one required
and click Run. The Wizard screen (or sometimes one of several screens) will be displayed.
Chapter 3 includes an example for milling a pocket. Figure 6.22 is the Wizard for engraving
text.
Figure 6.21 – Choosing a Wizard
Figure 6.22 – The Write Wizard screen
Wizards have been contributed by several authors and depending on their purpose there are
slight differences in the control buttons. Each Wizard will however have a means of posting
the G-code to Mach3 (marked Write in figure 6.22) and a means of returning to the main
Mach3 screens. Most Wizards allow you to save your settings so that running the Wizard
again gives the same initial values for the DROs etc.
Using Mach3Mill Rev 1.84-A2
Page 83
Mach3 controls and running a part program
6-15
Figure 6.23 shows a section of the Toolpath screen after the Write button is pressed on
figure 6.22.
Figure 6.23 – After running the Write wizard
The Last Wizard buttons runs the wizard you most recently used without the trouble of
selecting it from the list.
The Conversational button runs a set of wizards designed by Newfangled Solutions. These
are supplied with Mach3 but require a separate license for them to be used to generate code.
6.4 Loading a G-code part program
If you have an
existing part program
which was written by
hand or a CAD/CAM
package then you
load it into Mach3
using the Load G-Code button. You
choose the file from
a standard Windows
file open dialog.
Alternatively you can
choose from a list of
recently used files
which is displayed
by the Recent Files
screen button.
Figure 6.24 – Loading G-Code
When the file is chosen, Mach3 will load and analyse the code. This will generate a toolpath
for it, which will be displayed, and will establish the program extrema.
The loaded program code will be displayed in the G-code list window. You can scroll
through this moving the highlighted current line using the scroll bar.
Rev 1.84-A2 Using Mach3Mill
Page 84
Mach3 controls and running a part program
6-16
6.5 Editing a part program
Provided you have defined a program to be used as the G-code editor (in Config>Logic),
you can edit the code by clicking the Edit button. Your nominated editor will open in a new
window with the code loaded into it.
When you have finished editing you should save the file and exit the editor. This is
probably most easily done by using the close box and replying Yes to the "Do you want to
save the changes?" dialog.
While editing, Mach3 is suspended. If you click in its window it will appear to be locked
up. You can easily recover by returning to the editor and closing it.
After editing the revised code will again be analysed and used to regenerate the toolpath
and extrema. You can regenerate the toolpath at any time using the Regenerate button.
6.6 Manual preparation and running a part program
6.6.1 Inputting a hand-written program
If you want to write a program "from scratch" then you can either do so by running the
editor outside Mach3 and saving the file or you can use the Edit button with no part
program loaded. In this case you will have to Save As the completed file and exit the editor.
In both cases you will have to use File>Load G-code to load your new program into Mach3.
Warning: Errors in lines of code are generally ignored. You should not rely on being given
a detailed syntax check.
6.6.2 Before you run a part program
It is good practice for a part program to make no assumptions about the state of the machine
when it starts. It should therefore include G17/G18/G19, G20/G21, G40, G49, G61/G62,
G90/G91, G93/G94.
Using Mach3Mill Rev 1.84-A2
Page 85
Mach3 controls and running a part program
6-17
You should ensure that the axes are in a known reference position - probably by using the
Ref All button.
You need to decide whether the program starts with an S word or if you need to set the
spindle speed by hand or by entering a value in the S DRO.
You will need to ensure that a suitable feedrate is set before any G01/G02/G03 commands
are executed. This may be done by an F word or entering data into the F DRO.
Next you may need to select a Tool and/or Work Offset.
Finally, unless the program has been proved to be valid you should attempt a dry run,
cutting "air" to see that nothing terrible happens.
6.6.3 Running your program
You should monitor the first run of any program with great care. You may find that you
need to override the feed rate or, perhaps, spindle speed to minimise chattering or to
optimise production. When you want to make changes you should either do this on the "fly"
or use the Pause button, make your changes and the click Cycle Start.
6.7 Building G-code by importing other files
Mach3 will convert files in DXF, HPGL or JPEG
format into G-code which will cut a representation
of them.
This is done using the File>Import
HPGL/BMP/JPG or the File>Import>DXF menu.
Having chosen a file type you have to load the
original file. You are prompted for parameters to
define the conversion and feed and coolant
commands to be included in the part program. You
Figure 6.27 Choosing import filter
the import the data. Mach3 has to create a .TAP working file which contains the generated
G-code, so you will be prompted by a file save dialog for a name and folder for this.
The .TAP file is then loaded into Mach3 and you can run it as with any other part program.
Full details of the conversion processes and their parameters are given in chapter 8.
Rev 1.84-A2 Using Mach3Mill
Page 86
Page 87
Coordinate systems, tool table and fixtures
7-1
7. Coordinate systems, tool table and fixtures
This chapter explains how Mach3 works out where exactly you mean when
you ask the tool to move to a given position. It describes the idea of a
coordinate system, defines the Machine Coordinate System and shows how
you can specify the lengths of each Tool, the position of a workpiece in a
Fixture and, if you need to, to add your own variable Offsets.
You may find it heavy going on the first read. We suggest that you try out
the techniques using your own machine tool. It is not easy to do this just
"desk" running Mach3 as you need to see where an actual tool is and you
will need to understand simple G-code commands like G00 and G01.
Mach3 can be used without a detailed understanding of this chapter but you
will find that using its concepts makes setting up jobs on your machine is
very much quicker and more reliable.
7.1 Machine coordinate system
Pen-holder
Table
Figure 7.1 - Basic Drawing Machine
You have seen that most Mach3 screens have DROs labelled "X Axis", "Y Axis" etc. If you
are going to make parts accurately and minimise the chance of your tool crashing into
anything you need to understand exactly what these values mean at all times when you are
setting up a job or running a part program.
This is easiest to explain looking at a machine. We have chosen an imaginary machine that
makes it easier to visualise how the coordinate system works. Figure 7.1 shows what it is
like.
It is a machine for producing drawings with a ballpoint or felt tipped pen on paper or
cardboard. It consists of a fixed table and a cylindrical pen-holder which can move left and
right (X direction), front and back (Y direction) and up and down (Z-direction). The figure
shows a square which has just been drawn on the paper.
Figure 7.2 shows the Machine Coordinate System which measures (lets say in inches) from
the surface of the table at its bottom left hand corner. As you will see the bottom left corner
of the paper is at X=2, Y=1 and Z=0 (neglecting paper thickness). The point of the pen is at
X=3, Y=2 and it looks as though Z=1.3.
If the point of the pen was at the corner of the table then, on this machine, it would be in its
Home or referenced position. This position is often defined by the position of Home
switches which the machine moves to when it is switched on. At any event there will be a
Rev 1.84-A2 Using Mach3Mill
Page 88
Coordinate systems, tool table and fixtures
7-2
+Y+
Z
Figure 7.2 Machine coordinate system
zero position for each axis called the absolute machine zero. We will come back to where
Home might actually be put on a real machine.
The point of the pen, like the end of a cutting tool, is where things happen and is called the
Controlled Point. The Axis DROs in Mach3 always display the coordinates of the
Controlled Point relative to some coordinate system. The reason you are having to read this
chapter is that it is not always convenient to have the zeros of the measuring coordinate
system at a fixed place of the machine (like the corner of the table in our example).
A simple example will show why this is so.
The following part program looks, at first sight, suitable for drawing the 1" square in Figure
7.1:
N10 G20 F10 G90 (set up imperial units, a slow feed rate etc.)
N20 G0 Z2.0 (lift pen)
N30 G0 X0.8 Y0.3 (rapid to bottom left of square)
N40 G1 Z0.0 (pen down)
N50 Y1.3 (we can leave out the G1 as we have just done one)
N60 X1.8
N70 Y0.3 (going clockwise round shape)
N80 X0.8
N90 G0 X0.0 Y0.0 Z2.0 (move pen out of the way and lift it)
N100 M30 (end program)
Even if you cannot yet follow all the code it is easy to see what is happening. For example
on line N30 the machine is told to move the Controlled Point to X=0.8, Y=0.3. By line N60
the Controlled Point will be at X=1.8, Y=1.3 and so the DROs will read:
X Axis 1.8000 Y Axis 1.3000 Z Axis 0.0000
The problem, of course, is that the square has not been drawn on the paper like in figure 7.1
but on the table near the corner. The part program writer has measured from the corner of
the paper but the machine is measuring from its machine zero position.
7.2 Work offsets
Mach3, like all machine controllers, allows you to move the origin of the coordinate system
or, in other words where it measures from (i.e. where on the machine is to considered to be
zero for moves of X, Y Z etc.)
This is called offsetting the coordinate system.
Using Mach3Mill Rev 1.84-A2
Page 89
Coordinate systems, tool table and fixtures
7-3
+Z
+Y
Pen-holder
Table
Figure 7.3 - Coordinate system origin offset to corner of paper
Figure 7.3 shows what would happen if we could offset the Current Coordinate system to
the corner of the paper. Remember the G-code always moves the Controlled Point to the
numbers given in the Current Coordinate system.
As there will usually be some way fixing sheets of paper, one by one, in the position shown,
this offset is called a Work offset and the 0, 0, 0 point is the origin of this coordinate
system.
This offsetting is so useful that there are several ways of doing it using Mach3 but they are
all organised using the Offsets screen (see Appendix 1 for a screenshot)
7.2.1 Setting Work origin to a given point
The most obvious way consists of two steps:
1. Display the Offsets screen. Move the Controlled Point (pen) to where you want the new
origin to be. This can be done by jogging or, if you can calculate how far it is from the
current position you can use G0s with manual data input
2. Click the Touch button next to each of the axes in the Current Work Offset part of the
screen. On the first Touch you will see that the existing coordinate of the Touched axis
is put into the Part Offset DRO and the axis DRO reads zero. Subsequent Touches on
other axes copy the Current Coordinate to the offset and zero that axis DRO.
If you wonder what has happened then the following may help. The work offset values are
always added the numbers in the axis DROs (i.e. the current coordinates of the controlled
point) to give the absolute machine coordinates of the controlled point. Mach3 will display
the absolute coordinates of the controlled point if you click the Machine Coords button. The
LED flashes to warn you that the coordinates shown are absolute ones.
There is another way of setting the offsets which can be used if you know the position of
where you want the new origin to be.
The corner of the paper is, by eye, about 2.6" right and 1.4" above the Home/Reference
point at the corner of the table. Let's suppose that these figures are accurate enough to be
used.
1. Type 2.6 and 1.4 into the X and Y Offset DROs. The Axis DROs will change (by
having the offsets subtracted from them). Remember you have not moved the actual
position of the Controlled point so its coordinates must change when you move the
origin.
Rev 1.84-A2 Using Mach3Mill
Page 90
Coordinate systems, tool table and fixtures
7-4
2. If you want to you could check all is well by using the MDI line to G00 X0 Y0 Z0. The
pen would be touching the table at the corner of the paper.
We have described using work offset number 1. You can use any numbers from 1 to 255.
Only one is in use at any time and this can be chosen by the DRO on the Offsets screen or
by using G-codes (G54 to G59 P253) in your part program.
The final way of setting a work offset is by typing a new value into an axis DRO. The
current work offset will be updated so the controlled point is referred to by the value now in
the axis DRO. Notice that the machine does not move; it is merely that the origin of
coordinate system has been changed. The Zero-X, Zero-Y etc. buttons are equivalent to
typing 0 into the corresponding axis DRO.
You are advised not to use this final method until you are confident using work offsets that
have been set up using the Offsets screen.
So, to recap the example, by offsetting the Current Coordinate system by a work offset we
can draw the square at the right place on the paper wherever we have taped it down to the
table.
7.2.2 Home in a practical machine
As mentioned above, although it looks tidy at first sight, it is often not a good idea to have
the Home Z position at the surface of the table. Mach3 has a button to Reference all the
axes (or you can Reference them individually). For an actual machine which has home
switches installed, this will move each linear axes (or chosen axis) until its switch is
operated then move slightly off it. The absolute machine coordinate system origin (i.e.
machine zero) is then set to given X, Y, Z etc. values - frequently 0.0. You can actually
define a non-zero value for the home switches if you want but ignore this for now!
The Z home switch is generally set at the highest Z position above the table. Of course if
the reference position is machine coordinate Z=0.0 then all the working positions are lower
and will be negative Z values in machine coordinates.
Again if this is not totally clear at present do not worry. Having the Controlled Point (tool)
out of the way when homed is obviously practically convenient and it is easy to use the
work offset(s) to set a convenient coordinate system for the material on the table.
7.3 What about different
lengths of tool?
If you are feeling confident so far then
it is time to see how to solve another
practical problem.
Suppose we now want to add a red
rectangle to the drawing.
We jog the Z axis up and put the red
pen in the holder in place of the blue
one. Sadly the red pen is longer than
the blue one so when we go to the Current Coordinate System origin the tip smashes into
the table. (Figure 7.5)
Mach3, like other CNC controllers, has
a way for storing information about the
tools (pens in our system). This Tool Table allows you to tell the system
about up to 256 different tools.
+Z
Table
Figure 7.4 - Now we want another color
+Z
+Y
+Y
On the Offsets screen you will see
space for a Tool number and
information about the tool. The DROs
are labelled Z-offset, Diameter and T.
Table
Figure 7.5 - Disaster at 0,0,0!
Ignore the DRO Touch Correction and
Using Mach3Mill Rev 1.84-A2
Page 91
Coordinate systems, tool table and fixtures
7-5
its associated button marked On/Off for now.
By default you will have Tool #0 selected but its offsets will be switched OFF.
Information about the tool diameter is also used for Cutter Compensation (q.v.)
7.3.1 Presettable tools
We will assume your machine has a toolholder system which lets you put a tool in
at exactly the same position each time.
This might be a mill with lots of chucks
or something like an Autolock chuck
(figures 7.10 and 7.11 - where the centrehole of the tool is registered against a
pin). If your tool position is different each
time then you will have to set up the
offsets each time you change it. This will
be described later.
In our drawing machine, suppose the
pens register in a blind hole that is 1"
Figure 7.6 – Endmill in a presettable holder
deep in the pen holder. The red pen is
4.2" long and the blue one 3.7" long.
1. Suppose the machine has just been referenced/homed and a work offset defined for the
corner of the paper with Z = 0.0 being the table using the bottom face of the empty pen
holder. You would jog the Z axis up say to 5" and fit the blue pen. Enter "1" (which will
be the blue pen) in the Tool number DRO but do not click Offset On/Off to ON yet. Jog
the Z down to touch the paper. The Z axis DRO would read 2.7 as the pen sticks 2.7"
out of the holder. Then you click the Touch button by the Z offset. This would load the
(2.7") into the Z offset of Tool #1. Clicking the Offset On/Off toggle would light the
LED and apply the tool offset and so the Z axis DRO will read 0.0 You could draw the
square by running the example part program as before.
2. Next to use the red pen you would jog the Z axis up (say to Z = 5.0 again) to take out
the blue pen and put in the red. Physically swapping the pens obviously does not alter
the axis DROs. Now you would, switch Off the tool offset LED, select Tool #2 , jog
and Touch at the corner of the paper. This would set up tool 2's Z offset to 3.2".
Switching On the offset for Tool #2 again will display Z = 0.0 on the axis DRO so the
part program would draw the red square (over the blue one).
3. Now that tools 1 and 2 are set up you can change them as often as you wish and get the
correct Current Coordinate system by selecting the appropriate tool number and
switching its offsets on. This tool selection and switching on and off of the offsets can
be done in the part program (T word, M6, G43 and G49) and there are DROs on the
standard Program Run screen.
7.3.2 Non-presettable tools
Some tool holders do not have a way of refitting a given tool in exactly the same place each
time. For example the collet of a router is usually bored too deep to bottom the tool. In this
case it may still be worth setting up the tool offset (say with tool #1) each time it is
changed. If you do it this way you can still make use of more than one work offset (see 2
and 3 pin fixtures illustrated below). If you do not have a physical fixture it may be just as
easy to redefine the Z of the work offsets offsets each time you change the tool.
7.4 How the offset values are stored
The 254 work offsets are stored in one table in Mach3. The 255 tool offsets and diameters
are stored in another table. You can view these tables using the Work Offsets Table and
Tool Offsets Table buttons on the offsets screen. These tables have space for additional
information which is not at present used by Mach3
Rev 1.84-A2 Using Mach3Mill
Page 92
Coordinate systems, tool table and fixtures
7-6
Mach3 will generally try to remember the values for all work and tool offsets from one run
of the program to another but will prompt you on closing down the program to check that
you do want to save any altered values. Check boxes on the Config>State dialog (q.v.)
allow you to change this behaviour so that Mach3 will either automatically save the values
without bothering to ask you or will never save them automatically.
However the automatic saving options are configured, you can use the Save button on the
dialogs which display the tables to force a save to occur.
7.5 Drawing lots of copies - Fixtures
Now imagine we want to draw on many sheets of
paper. It will be difficult to tape each one in the
same place on the table and so will be necessary
to set the work offsets each time. Much better
would be to have a plate with pins sticking out of
it and to use pre-punched paper to register on the
pins. You will probably recognise this as an
example of a typical fixture which has long been
used in machine shops. Figure 7.7 shows the
machine so equipped. It would be common for
the fixture to have dowels or something similar so
that it always mounts in the same place on the
table.
Fixture
Table
Figure 7.7 - Machine with two pin
fixture
We could now move Current Coordinate system
by setting the work offsets #1 to the corner of the
paper on the actual fixture. Running the example
program would draw the square exactly as before.
This will of course take care of the difference in Z
coordinates caused by the thickness of the fixture.
We can put new pieces of paper on the pins and
get the square in exactly the right place on each
Fixture
Table
with no further setting up.
We might also have another fixture for three-hole
Figure 7.8 - Three pin fixture
paper (Figure 7.8) and might want to swap between the two and three pin fixtures for
different jobs so
work offset #2
+Z
+Y
could be defined
for the corner of
the paper on the
three pin fixture.
You can, of course
define any point on
the fixture as the
origin of its offset
coordinate system.
For the drawing
machine we would
want to make the
bottom left corner
of the paper be
Table
Fixture
Figure 7.9 - A double fixture
X=0 & Y=0 and
the top surface of the fixture be Z=0.
It is common for one physical fixture to be able to be used for more than one job. Figure 7.9
shows the two and three hole fixtures combined. You would of course have two entries in
the work offset corresponding to the offsets to be used for each. In figure 7.8 the Current
Coordinate system is shown set for using the two-hole paper option.
Using Mach3Mill Rev 1.84-A2
Page 93
Coordinate systems, tool table and fixtures
7-7
7.6 Practicalities of "Touching"
7.6.1 End mills
On a manual machine tool it is quite easy to
feel on the handles when a tool is touching
the work but for accurate work it is better to
have a feeler (perhaps a piece of paper or
plastic from a candy bar) or slip gage so you
can tell when it is being pinched. This is
illustrated on a mill in figure 7.10.
On the Offset screen you can enter the
thickness of this feeler or slip gage into the
DRO beside the Set Tool Offset button. When
you use Sret Tool Offset to set an offset DRO
for a too, then the thickness of the gage will
be allowed for.
For example suppose you had the axis DRO
Z = -3.518 with the 0.1002" slip lightly held.
Choose Tool #3 by typing 3 in the Tool DRO.
Enter 0.1002 in the DRO in Gage Block
Height and click Set Tool Offset. After
the touch the axis DRO reads Z = 0.1002
(i.e the Controlled Point is 0.1002) and
tool 3 will have has Z offset -0.1002.
Figure 7.11 shows this process just before
clicking Set Tool Offset.
Figure 7.10 - Using a slip gage when
touching Z offset on a mill
If you have an accurate cylindrical gage
and a reasonable sized flat surface on the
top of the workpiece, then using it can be
even better than jogging down to a feeler
or slip gage. Jog down so that the roller
will not pass under the tool. Now very slowly jog up until you can just roll it under the tool.
Then you can click the Touch button. There is an obvious safety advantage in that jogging a
bit too high does no harm; you just have to start again. Jogging down to a feeler or gage
risks damage to the cutting edges of the tool.
7.6.2 Edge finding
It is very difficult to accurately set a mill
to an edge in X or Y due to the flutes of
the tool. A special edge-finder tool helps
here, Figure 7.12 shows the minus X
edge of a part being found.
The Touch Correction can be used here
as well. You will need the radius of the
probe tip and the thickness of any feeler
or slip gage.
7.7 G52 & G92 offsets
Figure 7.11 – Entering Z offset data
There are two further ways of offsetting
the Controlled Point using G-codes G52
and G92.
When you issue a G52 you tell Mach3
that for any value of the controlled point
Figure 7.12 - Edge-finder in use on a mill
(e.g. X=0, Y= 0) you want the actual
machine position offset by adding the
Rev 1.84-A2 Using Mach3Mill
Page 94
Coordinate systems, tool table and fixtures
7-8
given values of X, Y and/or Z.
When you use G92 you tell Mach3 what you want the coordinates of the current Controlled
Point to be values given by X, Y and/or Z.
Neither G52 nor G92 move the tool they just add another set of offsets to the origin of the
Current Coordinate system.
7.7.1 Using G52
A simple example of using G52 is where you might wish to produce two identical shapes
ate different places on the workpiece. The code we looked at before draws a 1" square with
a corner at X = 0.8, Y = 0.3:
G20 F10 G90 (set up imperial units, a slow feed rate etc.)
G0 Z2.0 (lift pen)
G0 X0.8 Y0.3 (rapid to bottom left of square)
G1 Z0.0 (pen down)
Y1.3 (we can leave out the G1 as we have just done one)
X1.8
Y0.3 (going clockwise round shape)
X0.8
G0 X0.0 Y0.0 Z2.0 (move pen out of the way and lift it)
If we want another square but the second one with its corner at X= 3.0 and Y = 2.3 then the
above code can be used twice but using G52 to apply and offset before the second copy.
G20 F10 G90 (set up imperial units, a slow feed rate etc.)
G0 Z2.0 (lift pen)
G0 X0.8 Y0.3 (rapid to bottom left of square)
G1 Z0.0 (pen down)
Y1.3 (we can leave out the G1 as we have just done one)
X1.8
Y0.3 (going clockwise round shape)
X0.8
G0 Z2.0 (lift pen)
G52 X2.2 Y2 (temporary offset for second square)
G0 X0.8 Y0.3 (rapid to bottom left of square)
G1 Z0.0 (pen down)
Y1.3 (we can leave out the G1 as we have just done one)
X1.8
Y0.3 (going clockwise round shape)
X0.8
G52 X0 Y0 (Get rid of temporary offsets)
G0 X0.0 Y0.0 Z2.0 (move pen out of the way and lift it)
Copying the code is not very elegant but as it is possible to have a G-code subroutine (See
M98 and M99) the common code can be written once and called as many times as you need
– twice in this example.
The subroutine version is shown below. The pen up/down commands have been tidied up
and the subroutine actually draws at 0,0 with a G52 being used for setting the corner of both
squares:
G20 F10 G90 (set up imperial units, a slow feed rate etc.)
G52 X0.8 Y0.3 (start of first square)
M98 P1234 (call subroutine for square in first position)
G52 X3 Y2.3 (start of second square)
M98 P1234 (call subroutine for square in second position)
G52 X0 Y0 {IMPORTANT – get rid of G52 offsets)
M30 (rewind at end of program)
Using Mach3Mill Rev 1.84-A2
Page 95
Coordinate systems, tool table and fixtures
7-9
O1234
(Start of subroutine 1234)
G0 X0 Y0 (rapid to bottom left of square)
G1 Z0.0 (pen down)
Y1 (we can leave out the G1 as we have just done one)
X1
Y0 (going clockwise round shape)
X0
G0 Z2.0 (lift pen)
M99 (return from subroutine)
Notice that each G52 applies a new set of offsets which take no account of any previously
issued G52.
7.7.2 Using G92
The simplest example with G92 is, at a given point, to set X & Y to zero but you can set
any values. The easiest way to cancel G92 offsets is to enter "G92.1" on the MDI line.
7.7.3 Take care with G52 and G92
You can specify offsets on as many axes as you like by including a value for their axis
letter. If an axis name is not given then its offset remains unaltered.
Mach3 uses the same internal mechanisms for G52 and G92 offsets; it just does different
calculations with your X, Y and Z words. If you use G52 and G92 together you (and even
Mach3) will become so confused that disaster will inevitably occur. If you really want to
prove you have understood how they work, set up some offsets and move the controlled
point to a set of coordinates, say X=2.3 and Y=4.5. Predict the absolute machine
coordinates you should have and check them by making Mach3 display machine
coordinates with the "Mach" button.
Do not forget to clear the offsets when you have used them.
Warning! Almost everything that can be done with G92 offsets can be done better using
work offsets or perhaps G52 offsets. Because G92 relies on where the controlled point is as
well as the axis words at the time G92 is issued, changes to programs can easily introduce
serious bugs leading to crashes.
Many operators find it hard to keep track of three sets of offsets (Work, Tool and G52/G92)
and if you get confused you will soon break either your tool or worse your machine!
7.8 Tool diameter
Suppose the blue square drawn using our machine is the outline for a hole in the lid of a
child's shape-sorter box into which a blue cube will fit. Remember G-codes move the
Controlled Point. The example part
program drew a 1" square. If the
tool is a thick felt pen then the hole
will be significantly smaller than 1"
square. See figure 7.13.
The same problem obviously
occurs with an endmill/slot drill.
You may want to cut a pocket or be
leaving an island. These need
different compensation.
This sounds easy to do but in
Figure 7.13 - Using a large diameter tool (felt pen)
practice there are many "devils in
the detail" concerned with the
beginning and end of the cutting. It is usual for a Wizard or your CAD/CAM software to
deal with these issues. Mach3, however, allows a part program to compensate for the
diameter of the chosen tool with the actual cutting moves being specified as, say, the 1"
Rev 1.84-A2 Using Mach3Mill
Page 96
Coordinate systems, tool table and fixtures
7-10
square. This feature is important if the author of the part program does not know the exact
diameter of the cutter that will be used (e.g. it may be smaller than nominal due to repeated
sharpening). The tool table lets you define the diameter of the tool or, is some applications,
the difference from the nominal tool diameter of the actual tool being used – perhaps after
multiple sharpening. See Cutter Compensation chapter for full details.
Using Mach3Mill Rev 1.84-A2
Page 97
DXF, HPGL and image file import
8-1
8. DXF, HPGL and image file import
This chapter covers importing files and their conversion to part programs by
Mach3
It assumes a limited understanding of simple G-codes and their function.
8.1 Introduction
As you will have seen Mach3Mill uses a part program to control the tool movement in your
machine tool. You may have written part programs by hand (spiral.txt is such an example)
or generated them using a CAD/CAM (Computer Aided Design/Computer Aided
Manufacturing) system.
Importing files which define "graphics" in DXF, HPGL, BMP or JPEG formats provides an
intermediate level of programming. It is easier than coding by hand but provides much less
control of the machine than a program output by a CAD/CAM package.
The Automatic Z control feature (q.v) and repetitive execution decrementing the Inhibit-Z
value is a powerful tool for making a series of roughing cuts based on imported DXF and
HPGL files.
8.2 DXF import
Most CAD programs will allow you to output a file in DXF format even though they do not
offer any CAM features. A file will contain the description of the start and finish of lines
and arcs in the drawing together with the layer that they are drawn on. Mach3 will import
such a file and allow you to assign a particular tool, feed rate and "depth of cut" to each
layer. The DXF file must be in text format, not binary, and Mach3 will only import lines, polylines, circles and arcs (not text).
During import you can (a) optimise the order of the lines to minimise non-cutting moves.
(b) use the actual coordinates of the drawing or offset them so that the bottom leftmost point
is 0,0, (c) optionally insert codes to control the arc/beam on a plasma/laser cutter and (d)
make the plane of the drawing be interpreted as Z/X for turning operations.
The DXF import is in the file menu. The dialog in figure 8.1 is displayed.
Figure 8.1 - DXF import dialog
Rev 1.84-A2 Using Mach3Mill
Page 98
DXF, HPGL and image file import
8-2
8.2.1 File loading
This shows the four stages of importing the file. Step 1 is to load the DXF file. Clicking the
Load File button displays an open file dialog for this. Figure 8.2 shows a file with two
rectangles and a circle.
Figure 8.2 - a drawing of eight lines and one circle
8.2.2 Defining action for layers
The next stage is to define how the lines on each layer of the drawing are to be treated.
Click the Layer Control button to display the dialog shown in figure 8.3.
Turn on the layer or layers which have lines on them that you want to cut, choose the tool to
use, the depth of cut, the feedrate to use, the plunge rate, the spindle speed (only used if you
have a step/direction or PWM spindle controller) and the order in which you want the layers
cutting. Notice that the "Depth of cut" value is the Z value to be used in the cut so, if the
Figure 8.3 - Options for each layer
Using Mach3Mill Rev 1.84-A2
Page 99
DXF, HPGL and image file import
8-3
surface of the work is Z = 0, will be a negative value. The order may be important for issues
like cutting holes out of a piece before it is cut from the surrounding material.
8.2.3 Conversion options
Next you choose the options for the conversion process (see step 3 on figure 8.2).
DXF Information: Gives general details of your file which are useful for diagnostic
purposes.
Optimise: If Optimise is not checked then the entities (lines etc.) will be cut in the order in
which they appear in the DXF file. If it is checked then they will be re-ordered to minimise
the amount of rapid traverse movement required. Note that the cuts are always optimised to
minimise the number of tool changes required.
As Drawn: If As Drawn is not checked then the zero coordinates of the G-code will be the
"bottom left corner" of the drawing. If it is checked then the coordinates of the drawing will
be the coordinates of the G-code produced.
Plasma Mode: If Plasma Mode is checked then M3 and M5 commands will be produced to
turn the arc/laser on and off between cuts. If it is not checked then the spindle will be
started at the beginning of the part program, stopped for tool changes and finally stopped at
the end of the program.
Connection Tol. Two lines on the same layer will be considered to join if the distance
between their ends is less than the value of this control. This means that they will be cut
without a move to the "Rapid Plane" being inserted between them. If the original drawing
was drawn with some sort of "snap" enabled then this feature is probably not required.
Rapid plane: This control defines the Z value to be adopted during rapid moves between
entities in the drawing.
Lathe mode: If Lathe Mode is checked then the horizontal (plus X) direction of the drawing
will be coded as Z in the G-code and the vertical ( plus Y) will be coded as minus X so that
a part outline drawn with the horizontal axis of the drawing as its centerline is displayed and
cut correctly in Mach3Turn.
8.2.4 Generation of G-code
Finally click Generate G-code to perform step 4. It is conventional to save the generated Gcode file with a .TAP extension but this is not required and Mach3 will not insert the
extension automatically.
You can repeat steps 2 to 4, or indeed 1 to 4 and when you have finished these click Done.
Mach3 will load the last G-code file which you have generated. Notice the comments
identifying its name and date of creation.
Notes:
♦ The generated G-code has feedrates depending on the layers imported. Unless your
spindle responds to the S word, you will have to manually set up the spindle speed
and change speeds during tool changes.
♦ DXF input is good for simple shapes as it only requires a basic CAD program to
generate the input file and it works to the full accuracy of your original drawing
♦ DXF is good for defining parts for laser or plasma cutting where the "tool"
diameter is very small
♦ For milling you will have to make your own manual allowances for the diameter of
the cutter. The DXF lines will be the path of the centreline of the cutter. This is
not straightforward when you are cutting complex shapes.
♦ The program generated from a DXF file does not have multiple passes to rough out
a part or clear the centre of a pocket. To achieve these automatically you will need
to use a CAM program
Rev 1.84-A2 Using Mach3Mill
Page 100
8-4
♦ If your DXF file contains "text" then this can be in two forms depending on the
program which generated it. The letters may be a series of lines. These will be
imported into Mach3. The letters may be DXF Text objects. In this case they will
be ignored. Neither of these situations will give you G-code which will engrave
letters in the font used in the original drawing although the lines of an outline font
may be satisfactory with a small v-point or bullnose cutter. A plasma or laser
cutter will have a narrow enough cut to follow the outline of the letters and cut
them out although you have to be sure that the centre of letters like "o" or "a" is
cut before the outline!
8.3 HPGL import
HPGL files contain lines drawn with one or more pens. Mach3Mill makes the same cuts for
all pens. HPGL files can be created by most CAD software and often have the filename
extension .HPL or .PLT.
DXF, HPGL and image file import
Figure 8.4 – HPGL import filter
8.3.1 About HPGL
An HPGL file represents objects to a lower precision than DXF and uses straight line
segments to represent all curves even if they are circles.
The import process for HPGL is similar to DXF in that a .TAP file is produced which
contains the G-code produced from the HPGL
8.3.2 Choosing file to import
The import filter is accessed from File>Import HPGL/BMP/JPG and the HPGL button on
the dialog. Figure 8.4 shows the import dialog itself.
First choose the Scale corresponding to that at which the HPGL file was produced. This is
usually 40 HPGL units per millimetre (1016 units per inch). You can change this to suit
different HPGL formats or to scale your g-code file. For example, choosing 20 (rather than
40) would double the size of the objects defined.
Now enter the name of the file containing the HPGL data or "Browse" for it. The default
extension for browsing is .PLT so it is convenient to create your files named like this.
Using Mach3Mill Rev 1.84-A2
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.