Mach4 Installation Manual
Mach4 Installation Manual
Version 1.0
1 Of 26
Copyright © 2014 Newfangled Solutions, Artsoft USA, All Rights Reserved
The following are registered trademarks of Microsoft Corporation: Microsoft, Windows. Any
other trademarks used in this manual are the property of the respective trademark holder.
Table of Contents
Chapter 1 Introduction to CNC Systems........................................................................................................ 4
Introduction .................................................................................................................................................. 4
Installation .................................................................................................................................................... 6
Downloading ................................................................................................................................................. 6
Installing ........................................................................................................................................................ 7
2 Of 26
Default Modal State .................................................................................................................................... 12
Velocity........................................................................................................................................................ 16
Acceleration ................................................................................................................................................ 17
Backlash ...................................................................................................................................................... 17
Reverse........................................................................................................................................................ 17
Axis Mapping............................................................................................................................................... 18
Home Speed................................................................................................................................................ 19
Spindle ........................................................................................................................................................ 26
3 Of 26
Chapter 1 Introduction to CNC Systems
This chapter introduces you to terminology used in the rest of this manual and explains the purpose
of the different components in a computer numerically controlled (CNC) system. CNC machines are in
many industries and becoming more popular in manufacturing lines. The traditional machine types are
Mills, Routers, Lathes and Plasma cutters. The non traditional things that can be done with a CNC system
can be but not limited it laser measurement, pick and place, quilting, assembly, laser cutting, rapid
prototype, painting and so on. Because of the popularity of CNC's in non traditional CNC industries
Mach4 has been made to be extremely configurable and expandable. The ability to add and remove
modules will be covered in this manual but the screen and scripting customization will be covered in
there respective manuals.
Introduction
This document tells how to install and setup Mach4 motion control software. The foundation of
Mach4 is the core called Mach4Core, Mach4Core can be setup in many configurations for the following
machine configurations general automation, Mill, Router, Lathe, Plasma, Pick and Place, etc... A separate
documents explain how to operate Mach4 with the specific machine types. The user interface has no
relation to the core or motion and/or IO devices used.
YOU WILL NEED TO READ THIS DOCUMENTATION! Mach4 is a very complex software package that
cannot be simply made "to work" without proper configuration. The install and play with the settings
approach may work for other software packages but this is not the case with Mach4. The time spent
reading the manual will save many hours of aggravation and will result in a better running machine. This
manual will give the steps in a logical order that must be followed.
4 Of 26
Mach4 Layout
Mach4 is built on a central core called Mach4Core.dll and is what connects all the parts of Mach4
together. The following diagram (see Drawing 1) shows how all the components are connected:
Drawing 1: Mach4Layout
All IO, Motion and addon devices are plugins allowing them to be setup and configured in Mach4. The
plugins supplied by Newfangled Solutions in the installer are added as appendixes to the end of this
document. Any plugins that are not being used should be removed from the system to lower the
overhead of Mach4 on the computer. Development partners of Newfangled Solutions have access to
Mach4's SDK allowing them to manufacture plugins for other devices and/or functions. The setup,
configuration, and any diagnostics will not be covered in this manual for their devices.
If the machine is setup by an OEM or manufacture as a complete system, many if not all of the steps
in the following chapter may have already been done for you. The machine settings are all saved in the
profile directory with its own named directory. The named directories can be added and removed from
the profiles dialog but it is useful to know where the settings are. The named directory for each machine
contains all the machine settings in it's machine.ini file. The machine.ini file is backed up every time
mach4 is started so the user can roll back settings if there was an error made during software
configuration. The other directories in the named profile directory contain the macros, tool table, fixture
table, ini backups, screw maps and so on. If a new computer is being setup to replace the an existing PC
with Mach4 a simple copy of the profile named directory can be done to move over all the machine
settings.
Installation
Mach4 is distributed by Newfangled Solutions over the internet. The software is available as a single
installer from the web-page with a download size of about 17MB. After install Mach4 will be in demo
mode with a limitation of how long Gcode will execute. The time the software can be run in demo is
about 20 min and then it will randomly stop in the middle of a run. Newfangled Solutions recommends
that Mach4 is setup and tested before purchasing a license. Pricing and options are available at
www.machsupport.com .
5 Of 26
Downloading
Download the installation package from www.machsupport.com . Click on the download link and
save the self-installing file on the desktop or in a convenient folder. Mach4 needs to be install as
administrator, this can be done by right clicking on the self-installing file and telling it to “Run as
Administrator”. If installing in a remote location the installation file can be saved and moved to a
machine that has no web access. The file will require a CD or USB drive to have adequate storage
volume.
Installing
This section will guide the process of installing Mach4 software. If Mach4 has been previously
installed on the machine, Mach4 can be installed on top of a previous installation. There is no need to
uninstall before reinstalling.
If a machine is connected:
The machine that is connected to the computer should be set in a condition that will not allow
motion or IO to be triggered. If the machine can be disconnected please disconnect. If the machine
can't be disconnected please press the E-stop button to put the machine into an E-stop condition.
6 Of 26
Figure 1
A "Copy Profile" is very powerful as it will copy all the machine settings such as the tool data, fixture
data, ini backups, Macros, and all machine settings. This can be used later to make a test profile to allow
changes to be made without harming the running machine profile. The profile can be removed after
testing is finished with the "Delete Profile" button. The profile settings can also be restored to a previous
session if a bad setting has been made. The "Restore Backup" button (see Figure 1) will launch the
Restore Backup dialog (see Figure 2). The machine.ini can be selected by looking at the Date and Time if
the last known running configuration.
7 Of 26
A shortcut can be created to allow the an immediate launch of the software with a selected profile.
By adding the following " /p Mach4Mill" to the end of the target string (see Figure 3) allows
MachGUI.exe to load and immediately load the "Mach4Mill" profile.
Fi in the3target string.
Any other profile can be loaded by changing the profile name after the /p
By the end of this chapter a typical machine should be setup and capable of motion and IO (inputs and
outputs). In order to setup the machine the first step is to install all the plugins that you need for the
machine. Examples of plugins that may be needed could be Parallel Port and Modbus.
Note: If the software is locked the configuration settings may not be available. If the software is locked
non of the configuration dialogs will be available.
8 Of 26
Plugins and their function
The plugins in Mach4 are the building blocks of the system. The plugins all use the Mach4core.dll as a
base but have the power to add functionality to the system. Plugins can perform the following functions
Scipting, Motion, IO, File conversions, File loading, Motion Generation and countless other functions.
The ability to add such functionality is fundamental in the setup of the machine. The most important
plugin is the motion control plugin. A careful selection of plugins needs to be done to add the
appropriate functionality for the machine to be configured.
Fi 4
A plugin must be enabled to allow the plugin to function. The software must be restarted after enabling
or disabling to allow the plugin function to change its state. To remove a plugin highlight the row of the
plugin and press the "Remove" button (see Figure 5).
Configuring Plugins
The configuration of the plugins can be done from the "Configure Plugins" dialog (see Figure 5). Not
all plugins can be configured as they have no settings that can be customized. For the plugins that can be
configured a "configure" plugin button is available to the right of the pugin description. When the
configure button is pressed it will launch the configuration dialog supplied by the Plugin author. The
configuration of the device must be done before the devices IO can be accessed or used by Mach4. The
configuration of the plugins incorporated in the installer will be covered in appendixes to this document.
9 Of 26
Figure 5
10 Of 26
Figure 6
Other Plugins
The rest of the IO devices can be setup at this time if the settings are known. Some plugins that are
not fundamental to the machine can be setup at a later time. It is the responsibility of the installer to
determine what is needed to get the machine running. An example of a plugin that would need to be
setup and configured would be if a PLC was installed to enable the servo amps and machine. In this case
no testing can be done without Modbus communication to the PLC. To many machine configurations can
be done for this manual to take them into account so careful planning on the part of the installer is the
only way to get a system setup.
All configuration settings can be found in the "Mach Configuration" dialog (see Figure 7). The following is
a description of the settings that can be changed in the dialog (see Table 1).
11 Of 26
Setting Description
Units Mode Inch G20 / G21 Millimeters, The default units the machine is setup in such as
Traverse Mode Rapid G00 / Feed G01
Motion Mode Exact Stop G61 / Constant Velocity G64
Number of lines the interpreter can chain together to get to the programmed
Look Ahead Lines
Feedrate
Distance Mode Absolute G90 / Incremental G91, Distance mode used by default
Absolute G90.1 / Incremental G91.1, Distance mode for the IJK circle centers. R
Arc Center Mode
type centers are not effected.
Feed Per Rev G95 / Feed Per Min G94, feed mode used by linear and arc feed
Feed Mode
moved. Feed per rev must have true spindle RPM to be used.
XY Plane G17 / XZ Plane G18 / YZ Plane G19, The plane selection used for Drill
Active Plane
cycles, Arcs and cutter comp
Initial Z G98 / Rapid Plane G99, Selects the can cycle position for the moves in
Cycle Retract
the working axis. The working axis is perpendicular to the current active plane.
Constant RPM G97 / Constance surface Speed G96, Selects the default spindle
Spindle Mode
speed mode.
The init codes are run when the program starts and also when the reset is
Initialization Codes
pressed
Coolant Delay Time to wait for the Coolant to turn on
Mist Delay Time to wait for the Mist to turn on
Jog Increments Increments used for Incjog register
Gcode File The Gcode extensions for files to be executed. This sets the open able extensions
Extensions of the file open dialog.
Include Comments Enabling the selection will add all comments in the Gcode file to the messages
in Message log.
Deref Axis In E-
stop Enabling sets the axis homing to be false when in E-stop is active
Cycle Stop is Enabling will set the axis to do a controlled deceleration when a Cycle Stop is
Controlled Stop commanded. A very slight delay will be seen as the axis comes to a stop.
Table 1: General Settings
12 Of 26
Figure 7
Motor Tuning
Motor tuning is one of the most important settings in configuring a machine. The settings available in
the motor tuning dialog (see Figure 8) will allow the motor to be setup for the appropriate Counts per
Unit, Max Velocity, Acceleration, Backlash, Direction Reversal and delay for enable signal. A detailed
Figure 8
description of each of the settings will be given in the following section.
13 Of 26
Counts Per Unit
The Counts Per Unit is used to convert the users units (Inches, Millimeters, Degrees,etc...) into
encoder counts or step pulses depending on the type of system. The counts per unit is a value that can
be found with mathematics. The value should never be “tuned” or “adjusted” because it is a
mathematical relationship with the drives, screw pitch, reduction ratio and so on. The following
examples will show how this value can be calculated:
𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂
( ) ∗ 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶
𝐼𝐼𝐼𝐼𝐼𝐼𝐼𝐼𝐼
= 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶ℎ
𝑃𝑃𝑃𝑃ℎ𝐷𝐷𝐷
15
(40) ∗ 2000
= 6971.67756𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶ℎ
. 765
Example 2: CNC Lathe with a lead screw
Lead of screw .25 inch Per Rev
Belt Reduction 15 tooth (Input Gear), 30 tooth (Output Gear)
Servo drive with 5000 encoder counts per rev
𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂
(
𝐼𝐼𝐼𝐼𝐼𝐼𝐼𝐼𝐼 ) ∗ 𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝑡𝑝𝑝𝑝𝑝𝑝𝑝
= 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶ℎ
𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆ℎ
15
(30) ∗ 5000
= 40,000𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶ℎ
. 25
As a rule of thumb an inch machine should have the steps per unit greater then 5000 (200 for MM). A
value of 5000 will give a resolution of .0002 inches. A greater number of steps per unit will give better
performance as well as finer resolution. The only issue with a very high count per unit is that the max
velocity can become limited. The motion controller may only be able do deal with a limited number of
counts or steps per sec. Please check your motion controllers documentation to see get the max
frequency of the motors. If you would like to predict the max frequency this can also be done with
mathematics.
𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀 ∗ 𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶𝐶
= 𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂𝑂
60
In the next examples we will consider the max velocity to be 200 Inches per minute
200∗40,000
40,000 counts per unit = 133,333.333𝐻𝐻 = 133.33kHz
60
14 Of 26
200∗6971.67756
6971.67756 counts per unit = 23,238.93𝐻𝐻 = 32.24𝑘𝑘𝑘
60
Velocity
The Velocity in the dialog is the maximum rate in units per min. This is also the velocity that will be
used for rapid moves when running Gcode.
Setting a Stepper:
On a stepper machine to set the max velocity a series of test need to be made. The Steps per Unit
must be set before the axis can be tested. Set a value of a max velocity that seems to be reasonable and
test with a jog at 100% jog rate. If the axis is able to move without missing steps (most times you will
hear a “buzzing” or “squealing” sound when steps are missed, repeat this process until the upper limit is
found. Once the max velocity is found the max velocity should then be set to 20% - 30% less. To insure
that there are no missed steps during motion.
Setting a Servo:
To set the max velocity of a servo machine a small series of tests can be preformed or it can be done
mathematically with some calculations. When testing the max rate of a servo and the max velocity is
exceeded the servo may fault from being out of position (digital servo) or will not get to max velocity and
make an abrupt stop. If ether one of the following happen the velocity must be lowered until the
behavior is fixed. Once the motor is fixed the velocity should be lowered by 5% to insure that the best
performance can be obtained.
Acceleration
The max acceleration sets how quickly the motor can get to speed. The higher the acceleration the
faster the cutting can be done. The higher the acceleration the quicker an axis can reverse and go around
corners. Cycle times can be lowered by running higher accelerations and lowering the max velocity. The
acceleration should not be raised to the point that it causes motor stalling, vibration in the frame, or
other unwanted vibration.
Backlash
Backlash is used to take out mechanical wind up in the drive system. The misconception is that
backlash can be used to fix “slop” in a screw/ ball-nut or slop in a rack and pinion. This can be used to
help fix the machine but is not the proper way to correct the problem. The only way to truly fix the issue
is to fix the mechanical issue. The backlash should never exceed .005 inches or .1 mm .
15 Of 26
Reverse
The reverse section is used to reverse the motion of the motor.
Enable Delay
Enable delay will allow a the enable signals to turn on with a delay. The delay can be used to stage the
enabling of the amps. This can be used to lower the inrush current by enabling the amps one by one.
Axis Mapping
The axis mapping dialog (see Figure 9) is used to set what motors are used for an axis as well as the
homing order and max limits for the axis. The motors can be assigned to an axis with a maximum of 6
motors per axis. The axis will use the lowest max velocity and the lowest acceleration. This is done to
alow slave motors to not have the same motor settings as the other motors associated to he axis. The
steps per unit also do not need to be the same for each motor that is part of the axis.
Figure 9
16 Of 26
Home Direction
This sets the direction to home the axis (see Figure 10). Pos for homing in the positive direction Neg
for homing in the negative direction.
Home Order
The sequence the axis home in can be controlled by setting the “Home Order” (see Figure 10). The
first axis to home will be axis with the number 0 and then subsequent axis will home with the next
greatest home order value. For example if you would like to home the Z axis first then the X and Y at the
same time the values would be as follows:
X=2
Y=2
Z=1
Figure 10
Home Offset
The home offset allows for a shift from the home switch position(see Figure 10). This can be used to
to shift the home position if the home switch is not located at the end of travel.
17 Of 26
Home Speed
The home speed is the rate the machine moves to detect the home switch (see Figure 10). The home
switch will set the machine zero position with the addition of any home offset. The Home Speed is set as
a percentage of the max velocity of the axis. Example :
Home In Place
The Home in Place selection tells the axis to set the machine zero where it is when a home axis is
requested (see Figure 10). This feature is used on machines that have no home switches or an axis that
has no home switch. On a machine with no home switches the axis can be moved to the end of the
travel and lined up with an indicator mark. With the machine at the home position the home can be
triggered for that axis setting the machine position. This will allow the softlimits to be used and fixture
offsets.
Soft Enable
The state of the Soft Enable tells the core if the axis should be checked against the upper and lower
soft limits (see Figure 10). With the soft limits active the axis will decelerate to the Max or Min limit if it
is jogging and will prevent any incremental jogs past the limits. When running Gcode any moves panned
past the limits will not be done and the machine will be put into a stop condition and a soft limit error
will be displayed.
Signals in General
The signals are used to represent the internal state of items needed by the controller or items needed
to trigger IO for special functions. The signals can be triggered by Inputs, Outputs, Plugins, or Lua. When
18 Of 26
a signal changes state, a state change event is propagated throughout the system and will be seen by all
plugins, and Lua event scripts. Later in the customization of Mach4 the utilization of Mach4's signals will
be seen. In the section the setup of triggering IO with signals will be shown. When setting up an IO point
the device's plugin must be first setup. A device could be a motion controller, bussed IO (modbus), Input
device (keyboard), Special Functions in plugins, etc.. The “Device” is the first selection and displays all
Figure 11
the registered IO devices to the system (see Figure 11)
Once the device is selected the appropriate Inputs / Outputs will be displayed in the I/O Name's
column. A drop down list will appear allowing the selection of the desired IO (see Figure 12). With the
Device and IO name selected the signal will now be tied to that IO. The Input signal will change state
when the Input assigned to it changes state, and Outputs are triggered by their associated Output
signals. The high / low state can be inverted by selecting the Active low state.
19 Of 26
Figure 12
20 Of 26
Input Signals
The input signals are used to connect Inputs from devices to Input Signals in the core. Some of the
most important signals are the Homing and Limit inputs. The Homing and Limits are set per motor NOT
per axis. The axis use motors to show what motors drive the axis and to display the state of the limits
and homes. As an example if Motor 1 and Motor 5 where used on the X axis and the + Limit was hit the X
axis would show positive limit as being active. The inputs of the motors are or'ed to the axis states.
Below is a complete list of the Input signals (See Table 2).
21 Of 26
Output Signals
The output signals are used to tie the device outputs to the output signals. The output signals can be
used to drive outputs directly for things such as Spindle ouputs, Coolant, indicator lights on panels and
so on.
22 Of 26
Output Signal Description
Output #0 →
Output #63 Output #0 → #63 are used for OEM and user output signals
Output is active when running Gcode, used for indicator lights to show a file is
Gcode Running
running
Feed Hold Output is active when in a Feed Hold state
Block Delete Output is active when Block delete is active
Single Block Output is active when Single Block is active
Output is active when Reverse Run is active (reverse run is to run a file
Reverse Run
backwards)
Opt Stop Output is active when optional stop is active (stop on M01's in Gcode file)
Machine Enabled Output is active when the machine is in an enabled state
Output is active when a tool change is active or waiting for a Cycle start when
Tool Change
in manual toolchange
Output active when selectable DRO is set to display Distance To Go (distance
Dist To Go
from end point of the current move)
Output active when selectable DRO is set to display Machine Position (position
Machine coord
from the home switch)
Softlimits On Output active when the softlimits are active
Jog Inc Output active when the cores user Jog mode is set to Incremental jog mode
Jog Cont Output active when the cores user Jog mode is set to continuous jog mode
Jog Enabled Output active when the cores user Jog mode is enabled
Output active when the cores user Jog mode is set to Manual Pulse Generator
Jog MPG
(MPG) jog mode
X Homed Output active when a home cycle has been completed for the X axis
Y Homed Output active when a home cycle has been completed for the Y axis
Z Homed Output active when a home cycle has been completed for the Z axis
A Homed Output active when a home cycle has been completed for the A axis
B Homed Output active when a home cycle has been completed for the B axis
C Homed Output active when a home cycle has been completed for the C axis
Dwell Output active when a Dwell is acitve (G4 command in Gcode)
Output toggles when the toolpath is set to report the mouse position and Core
Toolpath Mouse
is set to report clicks. See Lua Script manual to set the core into Toolpath
Down
capture mode
Limit Override Output active when the Limit override is acitve
Charge Pump #1 Output when the Charge Pump #1 should be active
Charge Pump #2 Output when the Charge Pump #2 should be active
Output active when motion is about to be done to set drive to be in high
Current Hi/Low
current mode
Spindle On Output active when the spindle is on
Spindle Fwd Output active when the spindle is running in forward direction
Spindle Rev Output active when the spindle is running in the reverse direction
Coolant On Output active when the Coolant is set to be on
Mist On Output active when the Mist is set to be on
23 Of 26
Output Signal Description
Digitize Trigger Output active with the digitize input is active
Table 3: Output Settings
Spindle
The Spindle dialog allows the configuration and setup of up to 20 spindle rages. The spindle ranges can
be gears and or belt settings to allow for a change in the range of speeds avalable.
Motor as Spindle
With this selection a stepper motor, servo motor, or VFD that can be setup as a motor in the motion
device. The motor will be treated as an out of band axis and will use the motors acceleration settings.
24 Of 26
Tool Path Settings
The toolpath has some parameters that can be changed to allow better visualation of the toolpath.
The colors of the toolpath can be changed to allow for a better “looking” toolpath. But more importantly
is the ablilty to change the color of the toolpath to aid color blind users.
Machine Limits
The machine limits can be show in the toolpath, showing where the machine can traverse to by
displaying dotted lines.
Extended Functionality
To get more extended functionality and or customization, Plugins and or scripts will need to be added
and configured. The Customization and scripting manual covers topics such as on screen buttons to
trigger outputs, Tool changers, Buttons to move the machine to a specific location, hardware buttons for
operator interfaces, etc. Some of the plugins are covered in the appendixes for your convenience . If the
plugin of interest is not covered in the appendix please visit www.machsupport.com and look under
Mach4 plugins for more information.
25 Of 26
Appendix A mcKeyboard (how to get keyboard input)
Purpose:
Reading keyboard inputs and getting all key presses even if Mach4 is not in focus.
Description:
Mach4 has no native way of getting the key presses to the “jog” buttons or any other buttons for
that matter. Mach4 is designed to use inputs to trigger event. This is a fundamental difference
from most software packages and allows custom operator panels to be made with the
maximum amount of functionality. McKeyboard will consume any key presses that it is mapped
to while it is enabled.
Operation:
The disabling of the keyboard can be done many ways. The first way is to click on the CNC
Keyboard Icon in the taskbar and when disabled a red X will appear on the keyboard icon.
Setup:
Test:
26 Of 26