The FAQ Mach3 page may also be of some help to understand basic concepts.

 

FAQ Mach4


 


 

How do I set up Mach4 and the SmoothStepper?

Please visit our Mach4 Getting Started Page.

 


 

How do I upload a copy of my Mach4 profile?

Open the profile you wish to send to us in Mach4, then go to Menu -> Help -> Support -> Package Current Profile...

Package Profile

Save your profile with an appropriate name, and remember which folder you saved it in.

Save Profile

In the forum post you are writing, go down to the Attachments section, and click on Add File.  Navigate to the profile you just saved, and select it.  It should then appear to the left of the Add File button.

Add File

After you submit your post, please make sure that your profile is attached in your post.

 

 


Where do I learn more about Mach4 itself?

The best place is on the Mach Support website itself! 

 


Logging in Mach4?

If something weird is happening in Mach4, I will usually ask you for a Log File so I can see exactly what happened in Mach4 and the ESS plugin.  To do this, go to Menu -> Diagnostic -> Logging...

Logging Menu

Then Press the Play button in the Log Window to start recording the messages.

Logging Window

Just before you cause the event to happen or just before you start the run, please press the 'Clear' button to get rid of any extraneous information in the log file.

After the event occurs, pleas press the save button to save the data, and then upload it to us if requested or relevant.   If possible try to make the log as short and concise as possible (I don't need 20 minutes worth of data if you can make it happen in 20 seconds), but also don't delete relevant information either.   What is really helpful is if you can say my problem X happened at this specific time (what ever it happens to be) in the log file.


If you place mc.mcCntlSetLogging(inst,1) in your screen_load_script this will automatically turn the logging on for you.

 

 

 


Exact Stop Mode or Cutting (Constant Velocity) Mode?

Please click here to learn more about Exact Stop Mode and Cutting (Constant Velocity) Mode.

 

 


How do the Spindle buttons work in Mach4?

In the wx4 screenset, the lower right corner of the main Mach window looks like this:

Spindle Buttons

When you press the Spindle CW button you see the LED light up, but nothing happens. When you press the Spindle CCW button you see the LED light up, but nothing happens.  It should be working, but why isn't it?  When you press Spindle CW or Spindle CCW you are turning the spindle on, but with the last commanded speed.  Upon startup of Mach4, the last commanded speed is set to a default value of 0 RPM.  Only after you issue a new speed command will the CW or CCW buttons start at that speed. If you go to the MDI tab and type in a command similar to this, you should get Spindle movement:  M3 S1000

(Make sure you press Cycle Start to get the MDI command to execute!)

The buttons on the screen call lua script functions (Menu -> Operator -> Lua Script).

MDI and G-Code use Macros, some of which are standard macros (M3, M4 and M5), and custom macros that you can create and place in your "C:\Mach4Hobby\Profiles\YOUR PROFILE\Macros\" folder.   Here is an example of how to create a macro in Mach3, but it is essentially the same here in Mach4, you just save it to this folder path instead.

 


My Spindle (or something else) should be working, but it isn't!

This might have to do with a missing Macros folder in your "C:\Mach4\Profiles\YOUR PROFILE NAME\" folder.

 


Spindle RPM Source

Here is the Spindle Configuration step in the Getting Started Guide.

You have to choices for your RPM selection source:

  • Spindle Index - This will give you a single pulse per revolution of your spindle shaft.  On a mill or router setup, this will usually be sufficient since you are running at hundreds or thousands of RPMs, and you are not relying on a precise RPM readings.  The exception to this would be if you were doing slow speed tapping.

 

  • Spindle Encoder A - this will allow you to read multiple pulses per revolution, with the pulses updating the RPM.  This is very useful for low RPM lathe threading, especially with heavier cuts.  The additional pulses per rev will tell the SmoothStepper what the instantaneous RPM is, and it will adjust the Z and X axis motion to compensate and deliver a quality threading pass. 

You would hook your encoder's A channel up to the Spindle Encoder A input; set the Pulses Per Rev to the number of encoder pulses per Rev (you may need to divide by 2 or 4).  If your Encoder has more than 1,000 or 10,000 pulses per prev, you should consider adding a RPM prescalar, so that the RPM updates are not too frequent.  If the pulses are too frequent, you may lose RPM resolution and/or stability.

 


Spindle PID

Introduction to the SmoothStepper’s Spindle PID Speed Controller

Here is the Spindle Configuration step in the Getting Started Guide.

There are two methods for spindle speed control: Open Loop and Closed Loop. 

 Open Loop Control.png

With the Open Loop method Mach controls your spindle by:

  • In relay Mode: The GCode turning the Spindle On or Off (Your Router or VFD may allow you to manually specify a commanded speed).
  • In OB Mode (Step/Dir, CW/CCW or Quadrature modes) the GCode commands to move a certain number of steps every second.
  • In PWM mode your GCode specifies a specific rate (by a duty cycle percentage which is then turned into a specific voltage and amperage via your VFD), and Mach and the ESS assume that the spindle is really moving at that rate.

Open loop mode works well if you have a powerful spindle or the loading on the spindle does not slow it down significantly compared to when it is cutting air.

 Closed Loop Control.png

However, if there are significant changes in spindle loading, that loading may slow down the speed of your spindle significantly; negatively affecting the quality of your cut or breaking tools. The Closed Loop method avoids this by looking at the reported spindle speed and adjusting the current PWM duty cycle value up or down so that the measured spindle speed will match the commanded spindle speed.  With the SmoothStepper the Closed Loop method utilizes a PID controller (only available in PWM mode).

 

A PID based controller is comprised of Proportional Gain (Kp), Integral Gain (Ki) and Derivative Gain (Kd) constants.  These three constants are used to calculate the Error Results ERp, ERi and ERd, and these three error results are summed together and used to adjust the current PWM duty cycle value up or down.

 

The Kp term you specify is the Proportional Gain, which is simply a constant correction term value multiplied by the error amount.  This term may be sufficient by itself in situations where your spindle’s loading does not change significantly with respect to its power.  In this case you could leave the Ki = 0.0 and Kd = 0.0 to disable them.  The Error Result Proportional (ERp) would stay constant if the error amount stayed constant over time.

 

In situations where the loading on your spindle changes significantly and quickly, the remaining Ki and Kd terms can increase your performance significantly.

 

The Ki term you specify is the Integral Gain, which is a correction term that responds to size of the error over time.  The longer the error amount exists the larger the influence the Error Result Integral (ERi) term will have, and it can dominate the Error Result Proportional term quickly (when configured properly).  The Error Result, Integral (ERi) is designed to minimize the error amount as quickly as possible to get you back to zero error (although this can lead to overshooting).

 

The Kd term you specify is the Derivative Gain, which is a correction term that responds to instantaneous rate of change of the error amount.  The faster the error amount changes the larger the influence the Error Result Derivative (ERd) term will have, and it can dominate the Error Result Proportional and Error Result Integral terms very quickly (when set up properly).  The Error Result, Derivative (ERi) neutralizes the other two terms and leaves you at zero error without undershooting or overshooting the set point (when configured properly).

 

You should never use negative values for Kp, Ki or Kd Terms.  The larger a Kp, Ki or Kd Term value is, the larger the effect it will have.

 

Recommended initial values are Kp = 0.25  Ki = 1.0  Kd = 0.3

 

Spindle Speed feedback for the PID is provided by the Spindle Index signal/pin.

 

 PID Tuning

 

 

 

 


Setting Up Step Dir Spindle as an OB axis.

OB means an Out of Band axis.   If you read about the Spindle section on page 24 of 26 (Mach4 CNC Controller Software Installation and Configuration Guide Version 1.0).  Essentially you are using a motor output and disregarding the ‘position’ the motor is at (y = 27.1” or x = 48.567”).  Instead you are just using the motor’s acceleration settings to generate a velocity (step pulses or quadrature signals), and you are feeding that output signal into your VFD or spindle motor driver.

To run your spindle in Step/Dir, CW/CCW, or Quadrature mode, please follow these instructions.

1) In the ESS Configuration 'Spindle' tab: Set your Spindle selection to 'OB' mode.  This is effectively handing control of the spindle over to Mach4.

OB_ESS_Spindle.png
 
 
2) In the ESS Configuration 'Motors' tab: Set Motor 5 (or another Motor) to  Step/Dir, CW/CCW or Quadrature mode as desired.
 
OB_ESS_Motors.png
 
 
3) In the ESS Configuration 'Pins Config' tab:  For the two output pins that will control your spindle (I will use Port 1 Pin 16 and Port 1 Pin 17), give then an Alias similar to this:
  • For Step/Dir Mode - 'M5 Step For Spindle' and 'M5 Step For Spindle'
  • For CW/CCW Mode - 'M5 CW For Spindle' and 'M5 CCW For Spindle'
  • For Quadrature Mode - 'M5 Quad A For Spindle ' and 'M5 Quad B For Spindle'
 
OB_ESS_Pins_Config.png
 
 
4) In the ESS Configuration 'Output Signals' tab: Map the two pins you just assigned to Motor 5's corresponding pins.  (If you used a Motor other than 5 back in step 2, make the same modification here.)   You may also assign the relays for Spindle On, Spindle Fwd and Spindle Rev as desired at this point.
 
OB_ESS_Output_Signals.png

 

5) In the Mach Configuration 'Motors' tab:  Select Motor 5 in the right hand column.  (If you used a Motor other than 5 back in step 2, make the same modification here.) 

If you wish to work in terms of RPM, assign the following:

  • Set the 'Counts' per unit to 1.0  (Changing this field will affect the Velocity and Acceleration fields, so hit Apply, switch to a different motor and then come back to this motor again to continue.)  You want 1.0 since this will multiply the Velocity field.
  • Set the 'Velocity Units/Minute' to your maximum RPM for your spindle  _OR_    60 x the maximum RPM for your spindle
  • Set the 'Acceleration Units/(Sec^2)' to the change in RPM every minute divided by 60.   This will control the acceleration for your spindle.
  • Backlash may be left blank
  • You may set an Enable delay

 

OB_Mach4_Motors.png

 

6) In the Mach Configuration 'Axis Mapping' tab:   In OB1 (6)'s Master Column, choose Motor 5. (If you used a Motor other than 5 back in step 2, make the same modification here.)  You may use a different OB#, but you must then make the same change in the next step.

OB_Mach4_Axis_Mapping.png

 

7) In the Mach Configuration 'Spindle' tab:

In Range 0:

  •  MinRPM, Accel Time and Decel time will be ignored.
  • You need to change the MaxRPM to a non-zero number, since Mach4 will silently dismiss all spindle commands if MaxRPM is 0.  A 1 will suffice, but I would use your Max Spindle Motor RPM for consistency.  Otherwise this field is ignored by Mach when in Step/Dir, CW/CCW, or Quadrature Spindle modes.
  • Feedback Ratio will only be used for the Spindle Feedback (index) signal.

Now set your Max Spindle Motor RPM to your desired RPM.

Now set your Step/Dir Spindle Axis to the value chosen in the previous step.

OB_Mach4_Spindle.png

 

 8) You will now be able to issue MDI or G-Code commands for Spindle movement, like:

  • M3 S1000    --Starts the Spindle CW at 1000 RPM
  • M4 S5000    --Starts the Spindle CCW at 5000 RPM
  • M5              --Stops the Spindle

 

Important Notes:

  • Remember that Mach4 starts up with a default spindle speed of 0.  You will need to issue a S#### command to change the spindle speed from 0 RPM.
  • Remember that in Mach4,  pressing the Enter Key will not start an MDI command.  You will need to click on 'Cycle Start' to start an MDI command.
  • In Mach4, if you press 'Disable' or EStop while the spindle is running, Mach4 will think it is still running when you try to start it again, and ignore your new command!  If you try starting it, and it doesn't start, try switching to the other direction or using M5 to stop the spindle, and then try starting it again.

 

 

 


 

 

Homing Issues

Homing works correctly in Mach4 with the ESS.  However, once in a while a few users have reported that homing stops working for some reason.  Here are the settings to check to get homing to work correctly again:


In the ESS Config:

  • Make sure all axes which can home are enabled and make sure home switch pins config and input signals mappings are enabled and mapped.
  • Set Approach and back off velocities are within reasonable range (i.e. set X(200/20), Y(200/20) and Z(100/10).


In the Mach4 Config:

  • Make sure all axes which are configured are enabled in Axis Mapping. (Those which can home and those which cannot home)
  • In Homing/Soft Limits, set Home order for all configured axes (suggestion for normal gantry machine z(1), x(2), y(3) and if more axes are used have their order greater than 3 so that they home after x,y and z. This makes debugging easier. Have all disabled axes at order zero.
  • Make sure all axes which cannot home have "home in place" checked in the homing tab.

 

To generate an offset from the home switch after homing, you must use a lua script to generate the offset move.

 

 


 

 

Why doesn't Goto Zero work for the Z axis in Mach4?

For safety, the Z axis "Goto Zero" is disabled by default; to modify this, edit this section of the Screen Load Script:

function GoToWorkZero()
    mc.mcCntlMdiExecute(inst, "G00 X0 Y0 A0")--Without Z moves
    --mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")--With Z moves
end

 

 


 

 

Feed Hold and Spindles or Lasers

In the Menu -> Configure ->Mach... -> General tab you have two options for the Feed Hold stopping the spindle and restarting it, which would also apply to the laser.  When using a laser, and you press Feed Hold, you typically would not want the laser to keep lasing. 

Laser and Feed Hold

 

 


 

 

Lua Errors in Mach4

"Lua: Error occurred while opening file. Cannot open "C:\Mach4Hobby\Profiles\YOUR PROFILE NAME\Macros\mcLua.mcc:" No such file or directory".

Close Mach4, and then go into your "C:\Mach4Hobby\Profiles\YOUR PROFILE NAME\Macros\" folder.  Delete all of the *.mcc files (complied lua script files) in that folder.  The next time you start Mach4, it will automatically recompile all of your scripts (*.mcs) and generate new *.mcc files.

 

Mach4 build 4092 marked the transition from lua 5.2 to lua 5.3.  This will affect ALL compiled scripts.

If you are using a profile or scrips created BEFORE Mach4 Build 4092, and using a Mach4 build later than that (or the other way around) you should:

1. Make a backup copy of your entire "C:\Mach4Hobby\" folder and keep it in a safe place. 

2. Open "C:\Mach4Hobby\Profiles\" and then perform a search for  "*.mcc" in that folder and below. 

3. Delete all of the *.mcc files that are found.  When you open Mach4 the next time it will recompile all of the scripts.

 

 


 

 

Lua Code to Save to a File

Here is some handy lua code that will create a new file and pop up a message box where you enter the desired feed rate.

Just add the function to screen load script and call the function from a button:

function CreateNewTeach()

local MyNum = wx.wxGetNumberFromUser("Select or enter a feed rate", "Feed Rate:", "Teach Feed Rate", 50, 1, 1500) --Default, min, max
local MyGcode = string.format("(File created using CreateNewTeach function)\nF%0.4f", MyNum)
local Teach = wx.wxGetCwd() .. "\\GcodeFiles\\Teach.tap" --Define the file name and location
file = io.open(Teach, "w+") --Open the file in update mode, all previous data is erased
--file = io.open(Teach, "a+") --Append update mode, previous data is preserved, writing is only allowed at the end of file.
file:write (MyGcode) --Write the Gcode file
file:flush (Teach) --Save written data
file:close (Teach) --Close file
end

 


 

 

Mach4 Input Signal Descriptions

This is a list of the Input Signals that Mach4 and the ESS provide for you on the 'Input Signals' tab.  Inputs are signals collected from external devices (or circuits) and read into the ESS/Mach4.  For each Input Signal that you wish to use, you will need to Enable it (Green Check) and then Map a Pin Alias or Port and Pin# to that signal.   A Input Pin may feed multiple Input Signals.

This is covered some in on page 21 of the  Mach4 CNC Controller Software Installation and Configuration Guide Version 1.0

 

  • E-Stop:  This is a courtesy signal from your hardware (Motor Driver or E-Stop Button or other appropriate hardware) that informs the ESS and Mach4 that an Emergency Stop has occurred.  Your E-Stop hardware is responsible for shutting down motors as required for safety.  Never rely on software to stop motors!  Please read our Safety section.

 

Here are the home and limit switch signals for your motors:

  • Motor 0 ++ Limit:  Positive limit switch for Motor 0 (When active, this will stop all motor movement.)
  • Motor 1 ++ Limit:  Positive limit switch for Motor 1 (When active, this will stop all motor movement.)
  • Motor 2 ++ Limit:  Positive limit switch for Motor 2 (When active, this will stop all motor movement.)
  • Motor 3 ++ Limit:  Positive limit switch for Motor 3(When active, this will stop all motor movement.)
  • Motor 4 ++ Limit:  Positive limit switch for Motor 4 (When active, this will stop all motor movement.)
  • Motor 5 ++ Limit:  Positive limit switch for Motor 5 (When active, this will stop all motor movement.)
  • Motor 0 -- Limit:  Negative limit switch for Motor 0 (When active, this will stop all motor movement.)
  • Motor 1 - - Limit:  Negative limit switch for Motor 1 (When active, this will stop all motor movement.)
  • Motor 2 - - Limit:  Negative limit switch for Motor 2 (When active, this will stop all motor movement.)
  • Motor 3 - - Limit:  Negative limit switch for Motor 3 (When active, this will stop all motor movement.)
  • Motor 4 - - Limit:  Negative limit switch for Motor 4 (When active, this will stop all motor movement.)
  • Motor 5 - - Limit:  Negative limit switch for Motor 5 (When active, this will stop all motor movement.)
  • Motor 0 Home:  Home switch input for Motor 0 (This is used to home your axis, and is sometimes shared with Motor 0 -- .)
  • Motor 1 Home:  Home switch input for Motor 1 (This is used to home your axis, and is sometimes shared with Motor 1 -- .)
  • Motor 2 Home:  Home switch input for Motor 2 (This is used to home your axis, and is sometimes shared with Motor 2 -- .)
  • Motor 3 Home:  Home switch input for Motor 3 (This is used to home your axis, and is sometimes shared with Motor 3 -- .)
  • Motor 4 Home:  Home switch input for Motor 4 (This is used to home your axis, and is sometimes shared with Motor 4 -- .)
  • Motor 5 Home:  Home switch input for Motor 5 (This is used to home your axis, and is sometimes shared with Motor 5 -- .)
  • Motor 0 Index:  If a rotational motor/axis or a servo motor (with index pin), this provides the precise rotational home. ESS Only.
  • Motor 1 Index:  If a rotational motor/axis or a servo motor (with index pin), this provides the precise rotational home. ESS Only.
  • Motor 2 Index:  If a rotational motor/axis or a servo motor (with index pin), this provides the precise rotational home. ESS Only.
  • Motor 3 Index:  If a rotational motor/axis or a servo motor (with index pin), this provides the precise rotational home. ESS Only.
  • Motor 4 Index:  If a rotational motor/axis or a servo motor (with index pin), this provides the precise rotational home. ESS Only.
  • Motor 5 Index:  If a rotational motor/axis or a servo motor (with index pin), this provides the precise rotational home. ESS Only.

 

Servo motors use encoders to know where they are, and they can (but do not need to) feed this information back into the ESS and Mach4/3.  Encoders may be used with stepper motors, but this is not common.  If the rising edge of the A Phase leads the B Phase, that indicates a step in one direction.  If the rising edge of the B Phase leads the A Phase, that indicates a step in the other direction.   The cumulative change is steps is tracked so that the current position may be known. These may be used for something else, by try to save them for the corresponding motor, for the sake of clarity.

  • Encoder 0 Phase A:  This encoder phase input is used with the phase B input to provide position information to the ESS for motor 0. 
  • Encoder 0 Phase B:  This input is used with the phase A input.
  • Encoder 1 Phase A:  This encoder phase input is used with the phase B input to provide position information to the ESS for motor 1.
  • Encoder 1 Phase B:  This input is used with the phase A input.
  • Encoder 2 Phase A:  This encoder phase input is used with the phase B input to provide position information to the ESS for motor 2.
  • Encoder 2 Phase B:  This input is used with the phase A input.
  • Encoder 3 Phase A:  This encoder phase input is used with the phase B input to provide position information to the ESS for motor 3.
  • Encoder 3 Phase B:  This input is used with the phase A input.
  • Encoder 4 Phase A:  This encoder phase input is used with the phase B input to provide position information to the ESS for motor 4.
  • Encoder 4 Phase B:  This input is used with the phase A input.
  • Encoder 5 Phase A:  This encoder phase input is used with the phase B input to provide position information to the ESS for motor 5.
  • Encoder 5 Phase B:  This input is used with the phase A input.
  • Spindle Encoder Phase A: This encoder phase input is used with the phase B input to provide position information to the ESS for the Spindle.
  • Spindle Encoder Phase B:  This input is used with the phase A input.

 

Auxiliary encoders may be used to track devices other than your Spindle and Motors.  Pendants allow you to manually move a motor by spinning a MPG (Manual Pulse Generator) that feeds an A/B quadrature pulse signal into an encoder:

  • Aux Encoder 0 Phase A:  This general purpose encoder phase input is used with the phase B input.
  • Aux Encoder 0 Phase B:  This general purpose input is used with the phase A input.
  • Aux Encoder 1 Phase A:  This general purpose encoder phase input is used with the phase B input.
  • Aux Encoder 1 Phase B:  This general purpose input is used with the phase A input.
  • Aux Encoder 2 Phase A:  This general purpose encoder phase input is used with the phase B input.
  • Aux Encoder 2 Phase B:  This general purpose input is used with the phase A input.

 

 

  • Inhibit Jog:  When active, Mach4 will not Jog.
  • Inhibit MPG: When active, Mach4 will not respond to changes in the MPGs
  • Limit Override: When a limit switch is active, motors are not allowed to move.  When this signal is activated (or a screen set Limit Override button is activated), the motors are allowed to jog in order to move off of the limit switch.
  • Inhibit Motion:  When active, Mach4 will not generate motion.
  • No Wait: TODO
  • Path Selection (Head): TODO

 

These are Probe inputs:

  • Probe (G31 or G31.0):  Probe (or digitize) input for the G31 or G31.0 command
  • Probe 1 (G31.1):  Probe (or digitize) input for the G31.1 command
  • Probe 2 (G31.2):  Probe (or digitize) input for the G31.2 command
  • Probe 3 (G31.3):  Probe (or digitize) input for the G31.3 command

 

 Additional Spindle Input signals:

  • Spindle At Speed:  If your VFD provides this signal, it will inform the system that the Spindle is at the commanded speed.
  • Spindle At Zero:  If your VFD provides this signal, it will inform the system that the Spindle is stopped or at 0 RPM.
  • Spindle Index: This will feed in the Spindle's RPM information, since this will (typically) activate once every revolution.  (Some setups may trigger multiple times per revolution for enhanced accuracy.)  The Spindle Encoder (above) can generate much more precise speed measurements at lower RPMs.

 

These THC signals are used for Torch Height Control (with the Z Axis) in plasma cutting systems.  The goal of THC is to keep the plasma cutter's tip at the optimal distance from the metal work piece, to ensure the optimal cut quality in the metal.

  • THC On (Arc Okay):  This signals indicates that the plasma cutter's torch Arc is OK (active and stable).  This is also referred to as Arc Okay.
  • THC Up:  This signal indicates that the THC unit wants the Z axis to move up.
  • THC Down:  This signal indicates that the THC unit wants the Z axis to move down.

 

  • Tool Group Reset:
  • Tool Life Override:
  • Tool Retract:
  • Tool Skip:
  • User Interrupt:

 

 

These are for jogging motors:

  • Jog X + : This will jog the X axis in the (+) direction.
  • Jog X - :  This will jog the X axis in the (-) direction.
  • Jog Y + : This will jog the Y axis in the (+) direction.
  • Jog Y - :  This will jog the Y axis in the (-) direction.
  • Jog Z + :  This will jog the Z axis in the (+) direction.
  • Jog Z - :  This will jog the Z axis in the (-) direction.
  • Jog A + :  This will jog the A (or U) axis in the (+) direction.
  • Jog A - :  This will jog the A (or U) axis in the (-) direction.
  • Jog B + :  This will jog the B (or V) axis in the (+) direction.
  • Jog B - :  This will jog the B (or V) axis in the (-) direction.
  • Jog C + :  This will jog the C (or W) axis in the (+) direction.
  • Jog C - :  This will jog the C (or W) axis in the (-) direction.
  • Jog OB + : This will jog the OB axis in the (+) direction.
  • Jog OB - :  This will jog the OB axis in the (-) direction.
  • Jog OB + : This will jog the OB axis in the (+) direction.
  • Jog OB - :  This will jog the OB axis in the (-) direction.
  • Jog OB + :  This will jog the OB axis in the (+) direction.
  • Jog OB - :  This will jog the OB axis in the (-) direction.
  • Jog OB + :  This will jog the OB axis in the (+) direction.
  • Jog OB - :  This will jog the OB axis in the (-) direction.
  • Jog OB + :  This will jog the OB axis in the (+) direction.
  • Jog OB - :  This will jog the OB axis in the (-) direction.
  • Jog OB + :  This will jog the OB axis in the (+) direction.
  • Jog OB - :  This will jog the OB axis in the (-) direction.

Here are 64 general purpose inputs:

  • Input #0:  General purpose input that can be mapped to any function
  • Input #1:  General purpose input that can be mapped to any function
  • ...
  • Input #62:  General purpose input that can be mapped to any function
  • Input #63:  General purpose input that can be mapped to any function

 

 


 

 

Mach4 Output Signal Descriptions

This is a list of the Output Signals that Mach4 and the ESS provide for you on the 'Output Signals' tab.  Mach4 and the ESS will generate Output Signals  Inputs are then provided external devices (or circuits) to use. For each Output Signal that you wish to use, you will need to Enable it (Green Check) and then Map a Pin Alias or Port and Pin# to that signal.   A Output Pin may only receive its commands from a single Output Signal.  However, a single Output Signal may feed up to 3 Output Pins.

This is covered some in on pages 22 through 26 of the Mach4 CNC Controller Software Installation and Configuration Guide Version 1.0

 

Each motor may be set to Step/Dir, Quadrature or CW/CCW (Clockwise/Counterclockwise) mode.  These signals go to your Motor Drivers, so they may drive the motors, generating motion.   The Dir indicates the direction the motor is supposed to move, the Step is a single pulse for each step (or micro step) your motor should make.  In CW/CCW mode the CW line would have a pulse for a step in one direction, the CCW line would have a pulse for a step in the other direction.  In Quadrature mode two Phases are generated. If the rising edge of the A Phase leads the B Phase, that indicates a step in one direction.  If the rising edge of the B Phase leads the A Phase, that indicates a step in the other direction:

  • Motor 0 Step,  Motor 0 CW or Motor 0 Quad A
  • Motor 0 Dir,  Motor 0 CCW or Motor 0 Quad B
  • Motor 1 Step,  Motor 1 CW or Motor 1 Quad A
  • Motor 1 Dir,  Motor 1 CCW or Motor 1 Quad B
  • Motor 2 Step,  Motor 2 CW or Motor 2 Quad A
  • Motor 2 Dir,  Motor 2 CCW or Motor 2 Quad B
  • Motor 3 Step, Motor 3 CW or Motor 3 Quad A
  • Motor 3 Dir,  Motor 3 CCW or Motor 3 Quad B
  • Motor 4 Step,  Motor 4 CW or Motor 4 Quad A
  • Motor 4 Dir,  Motor 4 CCW or Motor 4 Quad B
  • Motor 5 Step,  Motor 5 CW or Motor 5 Quad A
  • Motor 5 Dir,  Motor 5 CCW or Motor 5 Quad B

Any motor (0 through 5) may be assigned to any Mach4 axis (X, Y, Z, A/U, B/V, C/W, OB1, OB2, OB3, OB4, OB5 or OB6).

 

Enable signals will be active when the machine is enabled, and may be used to enable your motor drivers.  However, it may be advisable to have the motor driver enables controlled by a hardware based E-Stop circuit!  These enables signals can be turned on after a delay (Mach4 Config -> Motor Tuning tab). If the axis that uses the motor is not enabled the motor will not get an enable signal.

  • Motor 0 Enable:  This is the enable output for Motor 0
  • Motor 1 Enable:  This is the enable output for Motor 1
  • Motor 2 Enable:  This is the enable output for Motor 2
  • Motor 3 Enable:  This is the enable output for Motor 3
  • Motor 4 Enable:  This is the enable output for Motor 4
  • Motor 5 Enable:  This is the enable output for Motor 5

 

Laser Related Outputs:

  • Laser PWM/XY Velocity PWM: This is the PWM output to run a laser or generate an XY Velocity PWM signal.

Spindle related outputs.

  • Spindle Step or PWM: This will take the commanded spindle speed in RPM and convert it to an output signal with a duty cycle between 0% and 100%, which your spindle speed control module will convert into an analog voltage (typically 0v to 10 V DC).  This analog voltages is used by your VFD to run your spindle at the commanded RPM. 
  • Spindle Motor Dir:  This output retains the current spindle direction even when the spindle stops.  It only switches state when a direction change is ordered (which prevents spindle direction glitching).
  • Spindle On: This output is active when the spindle is active
  • Spindle Fwd: This output is active when the spindle is running forwards (CW)
  • Spindle Rev: This output is active when the spindle is running in reverse (CCW)

 

Misc outputs:

  • Alarm:
  • Charge Pump:  This output provides a 12.5 kHz signal when active, so external hardware knows that Mach4 and the ESS are running.
  • Coolant, Flood (M08, M09):  This output activates the Flood Coolant with M08 and shuts it off with M09.
  • Coolant, Mist (M07, M09):  This output activates the Mist Coolant with M07 and shuts it off with M09.
  • Current Hi/Low: This output activates to change a drive from low current to high current mode, for upcoming motion.
  • Cut Recovery: Cut Recovery Signal
  • Digitize Trigger:  This output activates when the Probe is active with a G31/G31.x command.
  • Dist To Go: This output activates when the DRO (Digital Read Outs) are in Distance to Go mode (which is the distance to go to reach the end point of the current move).
  • Dwell: This output activates while a G4 Dwell command is active.
  • ESS, Is Moving: This output activates when motion is being generated by Mach4 and the ESS.
  • Feed Hold:  This output activates when Feed Hold is active.
  • G-Code Running:  This output activates when G-Code is running (typically used for an indicator light).
  • Jog Cont: This output activates when jogging is set to continuous jog mode.
  • Jog Enabled: This output activates when jog mode is enabled.
  • Jog Inc: This output activates when jogging is set to incremental jog mode.
  • Jog MPG:  This output activates when jogging is set to Manual Pulse Generator (MPG) jog mode (from a pendant or similar device).
  • Limit Override:   This output activates when the Limit Override is active.
  • Machine Coord: This output activates when the DRO (Digital Read Outs) are in Machine Coordinates mode (distance from the Home Switches) instead of the Work Coordinates mode (relative to a 'Zero' position, which may or may not be your home switches).
  • Machine Enabled: This output activates when the machine is enabled.
  • Parts Finished: This output activates when the G-Code finishes running, and the parts are finished.
  • Retract Signal

 

  • Run Ops - Block Delete:  This output activates when Block Delete is active.
  • Run Ops - Opt Stop (M01): This output activates when optional stop is active (when a G-Code file calls M01).
  • Run Ops - Reverse Run: This output activates when Reverse Run is active.  (This runs a G-Code file backwards.)
  • Run Ops - Single Block:  This output activates when Single Block is active.

 

  • Soft limits On: This output activates when soft limits are active.
  • Spindle Speed Check: Set to wait for the spindle speed to be stable
  • Toolpath Mouse Down: This output toggles when the toolpath is set to report the mouse position and Mach4 Core is set to report clicks. See the Mach4 Lua Script manual to set the core into Toolpath capture mode.
  • Tool Change:  This output activates when an automatic tool change is occurring, or while a manual tool change is waiting for a Cycle Start.
  • Tool Change B:
  • Waiting On Tool Signal

 

 

  • X ++ switch active:  Activated when one of the motors that makes up the X axis has a positive limit switch pressed.
  • X - - switch active:  Activated when one of the motors that makes up the X axis has a negative limit switch pressed.
  • X Home switch active:  Activated when one of the motors that makes up the X axis has a Home switch pressed.
  • X Axis is Homed: This will be active as long as the axis has been homed sucessfully.

 

  • Y ++ switch active:  Activated when one of the motors that makes up the Y axis has a positive limit switch pressed.
  • Y - - switch active:  Activated when one of the motors that makes up the Y axis has a negative limit switch pressed.
  • Y Home switch active:  Activated when one of the motors that makes up the Y axis has a Home switch pressed.
  • Y Axis is Homed: This will be active as long as the axis has been homed sucessfully.

 

  • Z ++ switch active:  Activated when one of the motors that makes up the Z axis has a positive limit switch pressed.
  • Z - - switch active:  Activated when one of the motors that makes up the Z axis has a negative limit switch pressed.
  • Z Home switch active:  Activated when one of the motors that makes up the Z axis has a Home switch pressed.
  • Z Axis is Homed: This will be active as long as the axis has been homed sucessfully.

 

  • A/U ++ switch active:  Activated when one of the motors that makes up the A axis has a positive limit switch pressed.
  • A/U - - switch active:  Activated when one of the motors that makes up the A axis has a negative limit switch pressed.
  • A/U Home switch active:  Activated when one of the motors that makes up the A axis has a Home switch pressed.
  • A/U Axis is Homed: This will be active as long as the axis has been homed sucessfully.

 

  • B/V ++ switch active:  Activated when one of the motors that makes up the B axis has a positive limit switch pressed.
  • B/V - - switch active:  Activated when one of the motors that makes up the B axis has a negative limit switch pressed.
  • B/V Home switch active:  Activated when one of the motors that makes up the B axis has a Home switch pressed.
  • B/V Axis is Homed: This will be active as long as the axis has been homed sucessfully.

 

  • C/W ++ switch active:  Activated when one of the motors that makes up the C axis has a positive limit switch pressed.
  • C/W - - switch active:  Activated when one of the motors that makes up the C axis has a negative limit switch pressed.
  • C/W Home switch active:   Activated when one of the motors that makes up C the axis has a Home switch pressed.
  • C/W Axis is Homed: This will be active as long as the axis has been homed sucessfully.

 

  • OB1 ++ switch active:  Activated when one of the motors that makes up the OB1 axis has a positive limit switch pressed.
  • OB1 - -  switch active:  Activated when one of the motors that makes up the OB1 axis has a negative limit switch pressed.
  • OB1 Home switch active:  Activated when one of the motors that makes up the OB1 axis has a Home switch pressed.

 

  • OB2 ++ switch active:  Activated when one of the motors that makes up the OB2 axis has a positive limit switch pressed.
  • OB2 - - switch active:  Activated when one of the motors that makes up the OB2 axis has a negative limit switch pressed.
  • OB2 Home switch active:  Activated when one of the motors that makes up the OB2 axis has a Home switch pressed.

 

  • OB3 ++ switch active:  Activated when one of the motors that makes up the OB 3axis has a positive limit switch pressed.
  • OB3 - - switch active:  Activated when one of the motors that makes up the OB3 axis has a negative limit switch pressed.
  • OB3 Home switch active:  Activated when one of the motors that makes up the OB3 axis has a Home switch pressed.

 

  • OB4 ++ switch active:  Activated when one of the motors that makes up the OB4 axis has a positive limit switch pressed.
  • OB4 - - switch active:  Activated when one of the motors that makes up the OB4 axis has a negative limit switch pressed.
  • OB4 Homeswitch active:  Activated when one of the motors that makes up the OB4 axis has a Home switch pressed.

 

  • OB5 ++ switch active:  Activated when one of the motors that makes up the OB5 axis has a positive limit switch pressed.
  • OB5 - - switch active:  Activated when one of the motors that makes up the OB5 axis has a negative limit switch pressed.
  • OB5 Home switch active:  Activated when one of the motors that makes up the OB5 axis has a Home switch pressed.

 

  • OB6 ++ switch active:  Activated when one of the motors that makes up the OB6 axis has a positive limit switch pressed.
  • OB6 - - switch active:  Activated when one of the motors that makes up the OB6 axis has a negative limit switch pressed.
  • OB6 Home switch active:  Activated when one of the motors that makes up the OB6 axis has a Home switch pressed.

 

  • Output #0:  General purpose output.
  • Output #1:  General purpose output.
  • ...
  • Output #62:  General purpose output.
  • Output #63:  General purpose output.


 

 

 

 

 


Laser Setup

Lasers can be very dangerous, especially to your eyesight.  The appropriate Laser goggles are a MUST!  Please refer to your Laser's manual, manufacture, or vendor to determine the appropriate Laser eye protection and other safety requirements.

Please make sure that you read and understand our Safety page too!

Starting with ESS Mach4 plugin build 221, we now have a dedicated Laser PWM signal, support for a Laser Gate signal and software specifically for Laser Vector and Laser Raster modes.

Laser Vector mode, relies on using GCode to control the motion of the laser head (or the laser emission point on your Z axis).  You will activate the Laser output before starting a cut, and then deactivate the Laser output when fishing a cut, all in GCode.

Laser Raster mode uses a little bit of GCode to position the starting point of the raster, but after that, it consumes the data from a bitmap image, and burns the image pixel by pixel based off of the 8 bit color data in the image.

The traditional method of using the Spindle PWM output for a laser is no longer necessary nor the best choice, a Spindle and Laser may now be used in the same GCode program since they are separate devices.

 

Setting Up The Configuration:

1. To set up a Laser, go to Mach4 Menu -> Configure ->Control..>(was Mach4) -> Plugins.  Make sure that the Core, LUA, Regfile and ESS plugins are enabled.

 Laser Plugins

 

2. Now, go to Mach4 Menu -> Configure ->Plugins... -> ESS ### -> Pins Config Tab:

  • Determine which output pin will be your Laser PWM output pin (I picked 2-17).  
  • Determine which output pin will be your Laser Gate output pin (I picked 2-16).  If your Laser does not use a Gate signal, YOU WILL STILL NEED TO ASSIGN ONE, but you may pick any unused output on the ESS, since you will not need to (or be able to) wire it up.

Pins Config

3. In the Mach4 Menu -> Configure -> Plugins... -> ESS ### -> Output Signals Tab:

  • Set the "Laser PWM" signal to the Laser PWM output pin selected in the last step. 
  • Scroll down to the Output Numbers area, and select an unused one.  I picked Output #20, and assigned it to the Laser Gate output pin selected in the last step.

Laser PWM

Laser Gate

4. In the Mach4 Menu -> Configure -> Plugins... -> ESS ### -> Laser Tab - Laser Settings:

  • Set the Laser Gate Output # to the Output signal selected in the last step.  This step is required for the ESS's FPGA to generate a PWM output signal.
  • Set the Raster PWM frequency and Vector PWM Frequency that you want the ESS to send to your laser in each of those those modes.
  • Synrad Lasers may be damaged if the PWM frequency is above 20 kHz, other Lasers may be as well.  To set the PWM frequency above 20 kHz, you must check the box for "Allow PWM frequencies over 20 kHz".  If you do this, YOU MAY DAMAGE YOUR LASER, which will be entirely your fault and your responsibility!
  • If you are not connecting the Laser Gate pin to your laser, you may leave all the Gate Delay and Gate Duration settings alone.  If you are using the Laser Gate, consult with your Laser's manual for the best settings. 
  • The Gate Delay Percentage represents the OFF time of the Gate signal
  • The Gate Duration Percentage represents the ON time of the Gate Signal.
  • These signals are synchronized with the pixel's PWM value that is currently being burned.  The purpose of the Gate signal is to force your Laser to emit/discharge at the appropriate time to burn the correct pixel. 
  • Gate Delay and Duration values will affect the intensity and/or color of the burned area.
  • Delay allows time for the new PWM value to be read by the Laser, and will cause the next Duration Discharge to be at the correct intensity. 
  • Duration is the amount of time that the Laser is emitting.  If you double the duration value, you will likely double the emitted power (not counting for non-linearity or maxing it out).
  • The total Gate Delay + Gate Duration percentages must sum up to 100% or less.   If the total is larger than 100% , the delay value will be automatically reduced to reach 100%.
  • If the total Gate Delay + Gate Duration value is less than 100%, more off time will be added after the Duration percentage has completed, to reach 100%.
  • The Synrad 5 kHz mode will "tickle" the Gate signal, when the PWM value is below a specific threshold (nearly off or off). This tickling will keep the Laser ready to emit when the next PWM value requiring an emission is received.

LaAser Tab

5. In the Mach4 Menu -> Configure -> Plugins... -> ESS ### -> Laser Tab - Default Image Settings in RASTER mode.  These fields are populated into Mach4 registers at startup, and not modified by the config settings until the next startup. You may override these settings by calling Macros from your GCode or in Mach4:

  • Depending on the starting corner of your image, you may need to check "Flip Image Horizontally" to get the orientation and lettering to appear correct.  This will flip or mirror your image left to right.
  • Depending on the starting corner of your image, you may need to check "Flip Image Vertically"to get the orientation and lettering to appear correct.  This will flip or mirror your image top to bottom.
  • In an image, pure white (or the pixel value of 255) will burn with full intensity, and pure black (or the pixel value of 0) will not burn at all.  To switch this, check "Invert Image Intensities".
  • "Compensate for X Acceleration Distance" means that the plugin will calculate the distance it takes to get up to the commanded velocity, which is where the pixels will be burned.  The plugin will automatically move in the opposite direction before it starts to burn the first line of the image, so that the first image pixel will occur at the starting point of the Laser Raster.  If you are using the "_Laser_Raster_Velocities.txt" file to manually adjust the Pre-Comp offset, that will be in addition to this automatically calculated value.
  • If "Skip the Laser Raster Start Window" is unchecked, you will be prompted with a confirmation window before the Laser Raster Starts.  Check this, if you do not want to see the confirmation window.
  • "Laser Raster Even Rows Only" may be checked, and then only the Even Numbered rows (all in the same direction) will be burned.  This is useful if you wish to check the overlap distance of your laser beam, or if you are having alignment issues with your Odd Numbered rows (i.e. a single vertical line is being rastered as two vertical lines - in this case, you would need to adjust your Motor Delay Distance).

 6. Download these lua macros, unzip them, and place them in your "C:\Mach4Hobb\Profiles\YOUR_PROFILE_NAME\Macros\" folder.  These macros will be discussed in the next section.  When the Macros are run, they should send information to the log file.  If you don't see anything in the log file, then you most likely are using an old version of the ESS plugin OR you do not have LUA and Regfile plugins enabled back in step 1.

 

 Laser Vector Operations:

With the Spindle you would use a command similar to M3 S1000 to turn the spindle on and then set the speed to 1000 RPM, M5 would be used to turn it off again.  Since these commands are used by the Spindle, we won't reuse them for the Laser.  Instead, the following lua scripts will be used to control the Laser's PWM and gate signals (using Mach4's ESS Registers):

1. m2003 uses the comments area immediately after on a single line of GCode to configure Laser's PWM parameters:

  • m2003 (LASER_VECTOR_PWM_PERCENTAGE=33.33) <- This will set the PWM Duty Cycle from 0% to 100%
  • m2003 (LASER_VECTOR_FREQUENCY=20000) <- This will set the PWM frequency to 20 kHz
  • m2003 (LASER_VECTOR_GATE_DELAY=0.5) <- This will set the Gate Delay to 0.5 ms
  • m2003 (LASER_VECTOR_GATE_DURATION=0.5) <- This will set the Gate Duration to 0.5 ms

2. m2004 will be used to Enable the Laser for Vector Mode (but not activate it).  This macro also processes any recent changes made by m2003 commands, and is required to make changes to the parameters.

3. m62p#  will activate the laser.  Replace the # with your Gate Output Signal number, which would be 20 from the settings above:  m62p20  This command when followed by a GCode motion command (G0, G1, G2 or G3) will activate the laser (assuming it was enabled), and have the activation synchronized with the start of the motion command.

4. m63p#  will deactivate the laser.  Replace the # with your Gate Output Signal number, which would be 20 from the settings above:  m63p20  This command when followed by a GCode motion command (G0, G1, G2 or G3) will deactivate the laser (assuming it was enabled), and have the laser shutoff synchronized with the start of the new motion command.

5. m2005 will be used to Disable the Laser for Vector Mode.  It will shut off the Laser PWM signal and the Laser Gate Signal.

A simple square can be lased with this code:

 

(Start of GCode)
G01 X0 Y0 Z1 F50

m2003 (LASER_VECTOR_PWM_PERCENTAGE=33.3)
m2003 (LASER_VECTOR_FREQUENCY=20000)
m2003 (LASER_VECTOR_GATE_DELAY=0.5)
m2003 (LASER_VECTOR_GATE_DURATION=0.5)

m2004 (This will Enable the Vector Laser)

G01 X1 Y1 Z1

M62 P20   (This will turn ON the Laser Gate and PWM with the next motion command)

G01 X2 Y1
G01 X2 Y2
G01 X1 Y2
G01 X1 Y1

M63 P20   (This will turn OFF the Laser Gate and PWM with the next motion command)

(Move to the next position, and then start a new laser cut if desired...)





(When done and ready to quit)

M2005 (This will Disable the Vector Laser)
G01 X0 Y0 Z1

(End of GCode)

 

 

 

 Laser Raster Operations:

The intent is to give the user a significant level of flexibility with regards to controlling the laser raster settings, which means that there are many macro commands available for the user.   If you don't want to utilize all of them, you can just copy and paste the code provided below, and after some initial tweaking, just reuse the same GCode every time for every image.  All you need to do is change the image you are pointing to.

An important point to note  is that the feedrate is currently locked at 1024 pixel per second with build 221, but will be able to increase greatly with the next major update.  As a result your feedrate will depend upon your image's DPI.  Your speed in inches/min is 60 * 1024 / DPI.  Your speed in mm/min is 60 * 1024 / pixels per mm. The software will ignore your commanded feedrate (while in build 221) and calculate the appropriate feedrate.  The lower the DPI the faster the X axis velocity while burning a line of the image.  The Y axis will merely step up a row, and it will typically not reach its max velocity before the move is over.

Here are the lua script commands used to set up the Laser Raster:

1. m2000 (C:\image.bmp)    This command will look for the image.bmp picture in your C drive.   You can point to any folder location you wish, and use any image name that you wish.  The requirement is that the image be a 256 color (8 bit) gray scale bitmap or a 24 bit RGB bitmap without an alpha channel.  I have used the GIMP Photo Editing software to create and modify my test images, but most other image editors will work as well. 

2. m2001 (Comment)

  • m2001 (UNITS=IN) This will tell the software that all your commanded values will be in Inches.  This must be the same as the default units for your profile in Mach4's  General Tab for Machine Setup Units.  If your default units are metric, you must call m2001 (UNITS=MM) for the software to run.
  • m2001 (FEEDRATE=900.9) you may specify your desired feedrate.  However for Build 221, it will be ignored and the appropriate, calculated, feedrate will be used.
  • m2001 (IMAGE_STARTING_CORNER=#) The Laser Raster will start from the commanded corner and work to the opposite corner.  Replace the # with 1, 2, 3 or 4.  1 means start from the Lower Left corner of the image.   2 means start from the Lower Right corner of the image.  3 means start from the Upper Right corner of the image.   4 means start from the Upper Left corner of the image.
  • m2001 (IMAGE_COLOR_CHANNEL= #) If you are using a 256 color gray scale image, this command is not important.  If you are using an 24 bit RGB image, this command allows you to select which color channel the image data will be taken from.  1 means the Red color channel.2 means the Green color channel.   3 means the Blue color channel.  4 means the average of all three color channels.
  • m2001 (IMAGE_INVERT_INTENSITIES=0) 0 Means that pure white (or the pixel value of 255) will burn with full intensity, and pure black (or the pixel value of 0) will not burn at all.  1 means that pure black (or the pixel value of 0) will burn with full intensity, and pure white (or the pixel value of 255) will not burn at all. This will override the default setting in the Laser tab for  "Invert Image Intensities".
  • m2001 (IMAGE_FLIP_X=0) Depending on the starting corner of your image, you may need to set this to 1 to get the orientation and lettering to appear correct, by flipping or mirroring your image left to right.  This will override the default setting in the Laser tab for "Flip Image Horizontally".
  • m2001 (IMAGE_FLIP_Y=0) Depending on the starting corner of your image, you may need to set this to 1 to get the orientation and lettering to appear correct, by flipping or mirroring your image top to bottom.  This will override the default setting in the Laser tab for "Flip Image Vertically".
  • m2001 (PWM_MAX=100) This will set the Maximum PWM Duty Cycle corresponding to a pixel intensity value of 255 (full burn value). Depending on the speed of the raster, a 100% value may be too high.
  • m2001 (PWM_MIN=15) This will set the Minimum PWM Duty Cycle corresponding to a pixel intensity value of 0 (no burn value). Depending on the speed of the raster, a 0% value may be too low.  This is ideally set just low enough that it does not burn the surface of the material, but a pixel value of 1 will.
  • m2001 (SHOW_WINDOW_TO_START=1) When set to 1, you will be prompted with a confirmation window before the Laser Raster Starts.  Set this to 0 if you do not want to see the confirmation window. This will override the default setting in the Laser tab for "Skip the Laser Raster Start Window".


3. m2002 (This starts the Laser Raster) This will tell the software to start the laser raster process. 

 

When the laser raster process starts, a log file is created and updated at "C:\Mach4Hobby\Plugins\_PROCESSING LASER COMMANDS LOG.txt".  This file will explain what is happening and what, if anything, went wrong.

If you are using servo motors, they will likely have following error.  This is compensated for in the "C:\Mach4Hobby\Plugins\_Laser_Raster_Velocities.txt" file.  The file is created after your first Laser Rastering attempt, and is internally documented.

 

Here is an example GCode file to raster an image:

 

(Start of GCode)

G0 X2 Y2 (Starting corner for the image)

M2000 (C:\GCode\Test.bmp)

M2001(UNITS = IN)
M2001(FEEDRATE = 600.000000)
M2001(IMAGE_STARTING_CORNER = 3)
M2001(IMAGE_COLOR_CHANNEL = 1)
M2001(IMAGE_INVERT_INTENSITIES = 1)
M2001(IMAGE_FLIP_X = 0)
M2001(IMAGE_FLIP_Y = 0)
M2001(PWM_MAX = 90)
M2001(PWM_Min = 5)
M2001(SHOW_WINDOW_TO_START = 1)

M2002(This starts the Laser Raster)

G0 X0 Y0

(End of GCode)

 

 

 


 

Laser Image Files

Here is a known good Image file and the GCode file that runs it.  You will need to change the path in the GCode file to point to the image location on your PC.

 

Not all photo editing software is created equally.  In fact some of it is quite horrid and cannot even output the headers correctly for image files!  When the header files in the image are mangled, you will get error messages similar to:

"The image offset is 1078 bytes declared vs 54 bytes calculated"

or

“This image has 0 bytes declared vs 207740 bytes calculated!”

In these cases, please try GIMP.  It is free and open source software, that is simple to use but also very powerful, and best yet, it works.

 

Once GIMP is installed, open your image file into it, and then export the image (to the same or a different name).  As you do the export process, please make sure to:

  • Expand "Select File Type (By Extension)" and select "Windows BMP Image"    -    "bmp" for Bitmap, and then click on export. 
  • Under Compatibility Options, CHECK the box for "Do not write color space information"
  • Select 24 bits "R8 G8 B8)"

 

Gimp Export

Gimp Export File Type

 

Gimp Export Options

 

 


 

Laser Raster Line Alignment

For Laser Rastering, each row starts by accelerating up to the commanded velocity (feed rate) at which point the SmoothStepper will start issuing the PWM values for each pixel.  Once all of the pixel data for the row has been used (over the distance commanded for the row in the image), the X axis motion then decelerates to a stop so the Y line distance can be moved before the next row is rastered in the opposite direction.  If you motors or axes have lag (this could even be just a little backlash pullout) you will have a horizontal offset in your rastered image.  You can easily see if this is the issue by selecting the option in the Laser tab for "Laser Raster Even Rows Only", and the alignment issue will be gone on your next image. Please make sure you uncheck this option after you have verified that this is the issue.

To fix this issue, you will need to adjust your "Motor Delay Distance" in C:\Mach4Hobby\Plugins\_Laser_Raster_Velocities.txt  

Your delay distance will need to be essentially 50% of the distance you are off by in your original alignment at that velocity or feed rate.  The faster your feed rate, the larger your Motor Delay distance will need to be.  It is best to enter specific distance values for all of your common feed rates, but the software will interpolate the distance based off of higher and lower values.  Once these changes have been made your image should be in perfect alignment.  More information regarding the setup is inside the "_Laser_Raster_Velocities.txt" file itself.  Please make sure to include one or two distance lines for feed rates faster than you expect to use so you are covered on the high end if you forget.

First try with Laser Raster Line Alignment Issues

Fox Bad

 


Second and Third tries with Laser Raster Line Alignment Issues, and success on the Fourth attempt.

Fox Good

 

The image above shows that the alignment was corrected with the proper motor delay distance.  However, the quality of the image still suffers a little bit due to insufficient resolution; increasing the DPI would help to improve the quality of the image.

 

 


 

(Torch) Height Control

 

Height Control (HC) is also commonly referred to as Torch Height Control (THC) and is commonly used in plasma cutting operations.  However, this can also be used with Oxy-Acetlyne, water jet and Laser cutting operations.  For this reason we will not use the term torch when referring to Height Control.

 

Changes in Mach4 vs Mach3:

In Mach3, Height Control was partially integrated into the Mach3 program, had no real error reporting when something went wrong, and used the same M3 macro as the spindle. 

In Mach4, the we started from scratch to implement Height Control and everything is inside the ESS plugin (and TMC3in1 plugin as appropriate).  This allowed us to have more flexibility, better error reporting and better performance overall.  Another significant change is that instead of M3 we now use M62 to turn the torch on and instead of M5 we use M63 to turn the torch off.   This has two distinct benefits.  The first is that you won't accidentally turn on the Spindle in a machine that has a spindle and a plasma unit - a giant safety improvement.  The second reason is that the M3 macro is not coordinated with your motion data and may be off by up to half a second!  This is not a huge issue when you start a spindle and let it get up to speed for a few seconds, but when you are vaporizing metal, milliseconds count!  With M62 and M63 the torch on and off commands are precisely synchronized with the start of the next motion command. This also allows for precise timing of a pierce delay.

Types of Height Control:

  • Manual Mode.  This allows you to use the keyboard to adjust the Z height up and down, which is the simplest form of height control but it is 100% manual.  This is common in Oxy-Acetlyne and water jet cutting. (Operationally this is almost identical to Up/Down Mode so the two modes are combined together. The only differences are two inputs and a button to select which mode you are in.) There are no anti dive capabilities here, other than the operator.

 

  • Up Down Pins Mode (like with Proma Controller).  This is the simplest kind of automated Height Control, and it offers the least flexibility.  You have to manually adjust your target tip volts on the Proma controller, and the SmoothStepper just responds to UP and Down input signals to control the Z Height.  (Operationally this is almost identical to Manual Mode so the two modes are combined together. The only differences are two inputs and a button to select which mode you are in.) There are almost no anti dive capabilities here.

 

  • Mach4's built in THC Mode (totally independent of the SmoothStepper).  This utilizes a PLC to read the tip volts.  Mach allows you to change your target tip voltage, and will generate Up and Down Z motion to correct the height.  However, there is some lag and there are limited anti dive capabilities.

 

  • The TMC3in1 Torch Height Controller, which was designed to interface directly to the ESS and adjust the cut height over 1000 times per second.  Since it communicates directly with the ESS and there is no buffering of data, there is almost no lag in response.  There are 6 different Anti Dive modes, and almost all of the run time settings for the TMC3in1 can be controlled by macros in your GCode!  This offers the most flexibility and performance.

 

 

 

 


 

ESS Specific Height Control Features

This is a new section that is currently being written...

  • Arc Okay going out will cause a feed hold while cutting. The Resume Cutting button will enable so you may fire the forch and resume cutting.
  • Probe activation while torch is on will cause a feed hold, if enable on the ESS Config -> Probe tab. The Resume Cutting button will enable so you may fire the forch and resume cutting.
  • There is a pierce counter available so you may keep track of your pierces.
  • Recision Delay after Pierce

 

 

 


 

Height Control - Up Down Pins Mode (Proma Style) and Manual Mode (Oxy-Acetylene)

Requires:

ESS Plugin.   Open the Zip file and place the "Warp9Mach4.m4pw" and the  "Warp9Mach4.sig" files in "C:\Mach4Hobby\Plugins\" folder.  Overwrite the existing files if prompted.

 

m2020 Height Control Command Script.  Place this file in the "C:\Mach4Hobby\Profiles\YOUR PROFILE NAME\Macros\" folder.

  • m2020.mcs script.  (You may need to right click on the link and then click Save As)

 

Screen Set. Place this file in the "C:\Mach4Hobby\Screens\" folder.

 

Optional:

  • Sample Height Control Profile - Your motors, motor tuning and limit switches and EStop will be different.. When you first open Mach4, in the Select Profile window, you may Import this profile.

 

Sample GCode:

This sample GCode has a G31 probe command for touch off, you should adjust the numerical values as appropriate for your machine!  The positions of the cuts and the feed rates should also be adjusted for your system.

  • Manual Mode GCode example - NONE.  Manual Mode does not really need any GCode other than possibly setting the Z Max and Z Min Height Control limits.  If you want to add that in, you can copy those lines out of the following example.
  • Up Down Mode sample GCode.  This was made with the SheetCam Default Up Down.job

How Height Control Works - Manual Mode

In order to keyboard buttons or screen set buttons to manually adjust the Z axis height while cutting, you need to do several things:

  • Get Mach4 working with your motors, home and limit switches, and other basic equipment by following the Getting Started Guide here.
  • Follow the Core Height Control setup instructions below, and also the Manual Mode specific requirements.
  • Enable Mach.
  • Press the "H.C. ON/OFF" to turn Height Control On.  Without this set to ON, the ESS will ignore all Height Control Signals.
  • Make sure that the Height Control Mode Type is set to the correct mode (1, HC_MODE_TYPE_MANUAL).  You can do this with either the Height Control Mode Type setting in the ESS config, or with the "Set HC Manual" button on the screenset.
  • Manual mode ignores the Torch Relay and Arc Okay signals.
  • While GCode is running you may press the Up or Down keys on the keyboard or the Up or Down buttons on the screen set. The ESS will respond to these commands and adjust the Z axis height accordingly.

 

How Height Control Works - Up Down Pins Mode

In order to allow a (Proma style) Torch Height Controller to automatically adjust the Z axis height while cutting, you need to do several things:

  • Get Mach4 working with your motors, home and limit switches, and other basic equipment by following the Getting Started Guide here.
  • Follow the Core Height Control setup instructions below, and also the Up Down Pin Mode Specific requirements.
  • Enable Mach.
  • Press the "H.C. ON/OFF" to turn Height Control On.  Without this set to ON, the ESS will ignore all Height Control Signals.
  • Make sure that the Height Control Mode Type is set to the correct mode (2, HC_MODE_TYPE_UP_DOWN_PINS).  You can do this with either the Height Control Mode Type setting in the ESS config, or with the "Set HC UP/Dn Pins" button on the screenset.
  • Activate the torch in GCode.  Once the Arc Okay signal activates, the ESS will respond to the Z axis movements commanded by the Height Controller.

 

 

Core Height Control Setup Instructions:

1. Open the Mach4 Configuration:  Menu -> Configure -> Control...

TMC

 

2. In the Plugins tab , you will need at least these plugins enabled:

  • Core
  • LUA
  • Regfile
  • ESS
  • Optional - Keyboard Inputs.  You will need this if you are going to use keyboard keys.

If you don't have all these plugins enabled, the hardware will not work right.  You may use additional plugins as needed.

If you enable any plugins, you will need to restart Mach4 for those plugins to function properly.

Plugins

 

3. Open the ESS Configuration:  Menu -> Configure -> Plugins... -> ESS

TMCPlugin Choices.png

 

4.  H.C. tab:

  • For Manual Mode
    • Height Control Mode, select "Manual Up/Down (Oxy-Acetylene)".  This will be your default choice but it can be modified with the screen set button. 
    • Select an input number for the Keyboard Up Key and an input number for the Keyboard Down Key.  These input numbers will be from 0 through 63.  Don't reuse the same input number.  We will continue setting the keyboard up here.
    • You may ignore Z axis limits, or select Work Coordinate limits.  Machine Coordinate limits are not recommended.
    • You don't NEED to use a Torch relay, but you may want to.
  • For Up Down Pin Mode
    • Height Control Mode, select "Hardware Controller: Up Down Pins (Proma Style)". This will be your default choice but it can be modified with the screen set button. 
    • You may ignore Z axis limits, or select Work Coordinate limits.  Machine Coordinate limits are not recommended.
    • Enable the Torch Relay and select an available output number between 0 and 63.  Which ever number you choose, you will need to use that number for M62P# (followed by a G0/G1/G2/G3 motion command)to turn the torch on and M63P# (followed by a G0/G1/G2/G3 motion command) to turn the torch off. Assign this output number signal to the Port # and Pin used by the relay that controls your torch.   You may also assign a pierce delay time after Arc Okay before your GCode motion is executed again.

TMC

 

5. Pins Config tab - The critical pins here are:

  • For Manual Mode:
    • You don't need any special pins, except for whatever you need to turn on your cutting device.
  • For Up Down Pin Mode you will need pins for:
    • The Arc Okay (THC ON) input signal
    • THC UP input signal
    • THC DOWN input signal
    • Probe (touch off) input signal
    • Torch Relay output signal

Pins for the rest of your equipment:

  • Dummy Laser Gate Signal - This was the last row of the H.C. tab
  • Your motor pins - set as needed
  • Your homing and limit pins - set as needed
  • Your EStop and Probe pins - set as needed
  • Etc...

TMC

 

6. Input Signals tab:

  • For Manual Mode:
    • You don't need any special signals. 
  • For Up Down Pin Mode you will need signals for:
    • The Arc Okay (THC ON) input signal
    • THC UP input signal
    • THC DOWN input signal
    • The probe signal used for the G31 touch off.
  • All other input signals are as needed for your your system.
  • If/Once you finish setting up the Keyboard Inputs to Inputs 9 and 10, they will appear as Keyboard in the Mapping column.

TMC

 

7. Output Signals tab:

  • For Manual Mode:
    • You don't need any special pins. 
  • For Up Down Pin Mode you will need pins for:
    • Output # for your torch relay

 

All other output signals are as needed for your your system.

  • Your Motor signals
  • Any other outputs signals you may need

TMC

 

Your profile should be set up with the core configuration required for Height Control to work.  The exception is keyboard inputs for Manual Mode.

 

 8. Open the Keyboard plugin: Menu -> Configure -> Plugins... -> Keyboard Inputs

 

 TMC

 

 

 9. Add two inputs, "HC Z UP" and "HC Z DOWN".  Press the area under "Key" to select the keyboard keys you wish to use.  After pressing OK, RESTART MACH4.  If you don't restart, the keyboard keys will not work.

 

 TMC

 

 

 9. Open the Mach4 Config and go to the Inputs tab.   "Menu -> Configure -> Control... -> Input Signals"

  • Set input #9 to "HC Z UP" (or the input # you picked with the key name you used).
  • Set input #10 to "HC Z DOWN" (or the input # you picked with the key name you used).
  • Those two keyboard keys should now make your Z axis move up and Down when Mach4 is Enabled, H.C. is turned ON, and you are set to Manual Up/Down HC mode.

 

 

 

How to use the Screen Set

 

TMC

 

1. Press Enable in the lower left of the Mach4 screenset, otherwise some of the buttons will have no effect.


2. You need to click on the "H.C. ON/OFF" button to allow Height Control to move the Z axis.


3. "Set HC Manual" will force this screenset into Manual Mode.

  • Clicking on "Manual Z Up" or pressing the corresponding keyboard key for "HC Z UP" will move the Z axis Up, both in idle mode and while running GCode.
  • Clicking on "Manual Z Down" or pressing the corresponding keyboard key for "HC Z DOWN" will move the Z axis Down, both in idle mode and while running GCode.

4. "Set HC Manual" will force this screenset into Manual Mode.

  • If your Torch is activating the "Arc Okay" signal (THC ON), then the Hardware Controller can command the Z Axis Up with the "THC UP" signal or the Z Axis Down with the "THC DOWN" signal.
  • If the "Arc Okay" signal goes out, cutting will be halted.  Tee "Resume Cutting" button will be become clickable, so you can backup to a good pierce point and then resume the cut.

5. The "Reset Pierces" button will reset the number of pierces to 0 and clear the red indicator showing that the number of pierces exceeds the specified limit.

Watch the videos listed near the start of this article to see this screenset in use.

 

 


Available M2020 (...) macro commands for Up Down Mode and Manual Mode

You DON'T need to use any of these macro commands listed here!  However, they provide the ability to automate your projects in the CAM post-processor and to have much more control than with any other Height Controller that we know of.

These macro commands allow you to adjust TMC3in1 and ESS Height Control settings directly from your GCode!  This allows you to set up your post processor to configure your entire job.   It is recommended to include a G04 P0.1 command after the last M2020(...) macro in a group of macros (or after a single one by itself) so that the macro will be processed before the next line of GCode is acted upon.

The bold portion is what you put in your GCode, including the opening and closing parens ().  The non-bold text afterwards is my description of the command, and SHOULD NOT BE IN YOUR GCODE.

The value after the equal sign is an example value, use the actual value that you need. 

 

  • m2020 (HC_Z_MAX_VALUE=1.001) Set the Z Max Value if using Machine coordinate or Work coordinate Z axis limits.
  • m2020 (HC_Z_MIN_VALUE=-0.12) Set the Z Min Value if using Machine coordinate or Work coordinate Z axis limits.
  • m2020 (HC_WORK_Z_ZEROED=1) This tells the SmoothStepper that the work coordinates just changed and that the Z Max and Z Min should be recalculated.
  • m2020 (ESS_TORCH_TOGGLE) This should only be used by a screen set button or a recovery script.
  • m2020 (ESS_TORCH_RESUME_WAIT_FOR_ARC_OKAY=1) This should only be used by a screen set button or a recovery script.
  • m2020 (ESS_TORCH_RESUME_USE_PIERCE_DELAY_WAIT_FOR_ARC_OKAY=1) This should only be used by a screen set button or a recovery script.
  • m2020 (ESS_TORCH_STATE=1) 1 will turn the torch on, 0 will turn the torch off.  While you could use it in your GCode instead of M62P#/M63P#, you shouldn't because it will not be timed with motion.  This should only be used by a screen set button or a recovery script.  This won't wait for Arc Okay or give you a pierce delay.
  • m2020 (ESS_DELAY_AFTER_ARC_OKAY=512)  This sets the precision delay time in ms (milliseconds) from when the Arc Okay input signal activates until X, Y or Z axis motion will occur.

 

 


 

Height Control - Mach4's built in THC Mode

The SmoothStepper does not have anything to do with THC in this mode (other than moving motors, controlling outputs and reading inputs).  This version of THC is performed totally in Mach4 by lua scripts written and maintained by Mach4 (Newfangled Solutions). 

Here is the current Mach4 Plasma Configuration PDF as of 2019 04 25.  You should check your "C:\Mach4Hobby\Docs\Plasma_Configuration.pdf" file to see if it is newer or if they have an updated version on their website.

 


 

Height Control - TMC3in1

 

TMC3in1 Main Small.png

The TMC3in1 was designed by Texas Micro Circuits, however, we now sell them here.

Your olasma unit needs to provide a divided tip voltage output of 50:1, 40:1, 30:1, 20:1, 16.67:1 or 15:1 for this the TMC3in1 to work with it.

The information in this article only applies to the Mach4 specific settings and operation. You still need to follow the original TMC3in1 documentation for all other aspects of the setup and operation.

The Mach4 TMC3in1 plugin will auto update the TMC3in1 firmware if needed (as of plugin versions TMC3in v011 and ESS v242).

 

Requires

ESS Plugin.   Open the Zip file and place the "Warp9Mach4.m4pw" and the  "Warp9Mach4.sig" files in "C:\Mach4Hobby\Plugins\" folder.  Overwrite the existing files if prompted.

 

TMC3in1 Mach4 Plugin.  Open the Zip file and place the "TMC3in1.m4pw" and the  "TMC3in1.sig" files in "C:\Mach4Hobby\Plugins\" folder.  Overwrite the existing files if prompted.  Make sure that you enable this TMC3in1 plugin in  Menu -> Configure -> Control... (used to be Mach…) -> Plugins tab.

 

m2020 Height Control Command Script.  Place this file in the "C:\Mach4Hobby\Profiles\YOUR PROFILE NAME\Macros\" folder.

  • m2020.mcs script.  (You may need to right click on the link and then click Save As)

 

Screen Set. Place this file in the "C:\Mach4Hobby\Screens\" folder.

 

Optional

  • Sample Profile - Your motors, motor tuning and limit switches and EStop will be different.. When you first open Mach4, in the Select Profile window, you may Import this profile.

 

Additional BOBs

The TMC3in1 requires both the expansion port and Port 3 of the ESS - any BOB that uses port 3 of the ESS will prevent the use of the TMC3in1.  In addition here is a (non exhaustive) list of BOBS that won't allow the TMC3in1 to seat without modifying the BOBs:

  • The original C25.  (The C25S should work.)

 

Sample GCode:

This sample GCode has the G31 probe command for touch off commented out.  You should uncomment it and adjust the numerical values as appropriate for your machine!  The corner positions of the square and the feed rates should also be adjusted for your system.

Anti Dive Mode 1 (time delay after Arc Okay) is a great way to start cutting while preventing diving just after the pierce.  You can add in the other Anti Dive modes as needed to suit your situations.

 

Target Tip Voltage

Your plasma system manual will be a good starting point to determine your Target Tip Voltage for the material and speed you will be cutting at. However, the specified values may cause constant diving and tip crashes.  It is very common to wind up using a Target Tip Voltage 5V, 10V and in some cases 20V higher than specified in the plasma manual in order to achieve a good quality cut without diving!

A good way to test is to cut a part with the H.C. ON/OFF button disabled (so that the Z axis will not be adjusted).  Adjust your Z axis height above the material to achieve a good quality cut.  Watch the Actual Tip voltage that is being reported on the longer straight cuts, and then use that voltage as your target tip voltage.

 

Videos

These four videos are sequential and build upon information shown in the previous video.

 

How Height Control Works

In order to allow the TMC3in1 to adjust the Z axis, you need to do several things:

  • Enable Mach, the TMC3in1 will be brought up in the next two to three seconds.
  • Press the "H.C. ON/OFF" to turn Height Control On.  Without this set to ON, the ESS will ignore the Height Control Signals from the TMC3in1.
  • The TMC3in1 plugin will ensure that Height Control Mode Type is set to the correct mode at Mach4 startup (3, HC_MODE_TYPE_VELOCITY_COMMANDS)
  • Activate the torch.  Once the Arc Okay signal comes on, the ESS will respond to the Z axis movements commanded by the TMC3in1.

 

 

Assembly

The bottom of TMC3in1's PCB is 3/4" away from the top of the ESS's PCB.  You will need (four) 0.75 inch long standoffs. Nylon are recommended. 6-32 are preferred but 8-32 work too.

If one end of the 3/4" standoff is male, it can pass through the ESS's mounting hole and screw into a female standoff supporting the ESS (assuming the same thread size/pitch). You would then use a screw from above the TMC3in1 to attach into the female end of the 3/4" standoff that is now supporting the TMC3in1.

Standoffs

 

 

Setup Instructions:

1. Open the Mach4 Configuration:  Menu -> Configure -> Control...

TMC

 

2. In the Plugins tab , you will need at least these plugins enabled:

  • Core
  • LUA
  • Regfile
  • TMC3in1
  • ESS

If you don't have all these plugins enabled, the hardware will not work right.  You may use additional plugins as needed.

If you enable any plugins, you will need to restart Mach4 for those plugins to function properly.

TMC

 

3.   Open the TMC3in1 Configuration:  Menu -> Configure -> Plugins... -> TMC3in1

TMC

 

4.  In the General tab, you may:

  • Activate the Log Data Files option, which will start a new data log every time you pres Enable and end it when you press Disable.  The log file will be saved to "C:\Mach4Hobby\TMC3in1\" with a current date and time for the file name.  The log file will show almost everything happening inside the TMC3in1.
  • The plugin frequency option has been tested at 9 Hz and seems to work well.  The TMC3in1 plugin does not do much other than display the current cut information and send settings down to the TMC3in1.  All the real time operations happen inside the TMC3in1 hardware.
  • The Simulator will allow you to test for Z axis movement.
  • Ignore fields 2 and 6 for the time being.

TMC

 

5. In the Tip Voltage tab, you need to:

  • Enter the correct Tip Voltage Divider Ratio used by your plasma system.

 

  • If Using HyperTherm, select Negative Tip Volts.  Most other systems will use Positive tip volts.  Check your owner's manual to make sure you know what you need!

 

  • The Target Band (or Dead Band) is the +/- voltage band in which no HC action occurs - the Z axis stays stationary.

 

  • The Linear Response Band is the voltage range that produces proportional speed adjustments in the Z axis. The closer you are to the target tip volts, the slower the move will be, the farther away the faster the move will be.  This prevents overshoot of the target tip volts.  Outside of this range, the move will be at your Max Z axis velocity setting in motor tuning.  Here is a graph showing the Velocity Response vs the Tip Voltage.  Velocity Response vs Voltage.png

 

  • THC Offset is used to trim the tip volts, but is usually not needed.  If the torch is off and the voltage displayed is significantly off from 0V you can use this voltage to have the screen display near 0V  when the torch is off.

TMC

 

6.  Anti Dive Modes 1 & 2 tab:

  • Enabling THC delay after Arc Ok is used to prevent diving at the start of a cut(right after the pierce). The field provided is the length of delay in seconds that THC will be inhibited after the Arc Okay signal activates.

 

  • When enabled, the TMC3in1 will need to receive a M62P# command in GCode before THC response is allowed.

A M63P# command will disable THC response.
Port 3 Pin 14 controls this feature, and needs to be assigned to an Output#.
I will assume you are using Output04, but you may use any available output modifying the code accordingly.

M62P04
G1 X5
(THC will be allowed)

(It will move the X from 5.0 to 1.0 with THC active)

M63P04
G1 X1
(THC is NOT allowed)

TMC

TMC

 

7. Anti Dive Mode 3 - Velocity tab:

  • This is a velocity based Anti Dive feature to prevent the torch from diving due to slow velocities at the beginning of a cut, the end of a cut, and in corners. The provided field allows you to specify the lower end velocity % at which point THC will be inhibited if 'i' is enabled. This requires that you enable the Laser PWM/XY Velocity PWM output signal in the ESS on Port 3 Pin 16.

TMC

 

8. Anti Dive Modes 4, 5 & 6 - Voltage tab:

  • A) Enable Voltage Based Anti Dive Modes 4, 5 and 6.

 

  • B) Averaged Tip Volts (ATV) Buffer size, 1 ms to 800 ms (default).  This ATV value is used for Anti Dive Modes 4, 5 and 6.  A longer buffer reacts slower to changes in tip voltage.

 

  • C) Percentage difference allowed between Actual tip volts and the Averaged tip volts window
    before AD Mode 4 activates, which will disable THC

 

  • AD Mode 4)  THC response rate percent when Anti Dive Mode 4 is active.  
    100% will give normal THC speed response,
    50% means THC will respond at half speed,
    0% will disable THC response - This is the normal value.
    This mode prevents the change in Z height, when the Actual Tip Voltage changes rapidly for a short period of time.
    This will prevent diving into pre-cut lines, but allow for responding to inclined or bent metal.

 

  • AD Mode 5) This prevents diving when crossing a pre-cut line.
     ATV voltage limit, above the target tip volts, that will disable THC.

 

  • AD Mode 6) This prevents rising when the material warps up towards the torch.
     ATV voltage limit, below the target tip volts, that will disable THC.

 

 

TMC

 

9. Open the ESS Configuration:  Menu -> Configure -> Plugins... -> ESS

TMC

 

10.  H.C. tab:

  • For the TMC3in1 you will need to Select Hardware Controlled.
  • You may ignore Z axis limits, or select Work Coordinate limits.  Machine Coordinate limits are not recommended.
  • Enable the Torch Relay and select an available output number between 0 and 63.  Which ever number you choose, you will need to use that number for M62P# (followed by a G0/G1/G2/G3 motion command)to turn the torch on and M63P# (followed by a G0/G1/G2/G3 motion command) to turn the torch off.  Make surethis output number signal has Port 3 Pin 17 assigned to it, since that is the pin that controlls the TMC3in1's torch.   You may also assign a pierce delay time after Arc Okay before your GCode is executed again.
  • If you are going to use Anti Dive Mode 3 (velocity) you will need to enable the "Laser PWM/XY Vel PWM" box here, and in the output signals tab assign Port 3 Pin 16 to "Laser PWM/XY Vel PWM".   You will also need to select any unused output number signal (in this case 5) and any unused output pin (in this case Port 2 Pin 17) for the laser gate signal.  We won't be using it, but the ESS will not generate our PWM signal if the gate is not assigned.

TMC

 

11. Pins Config tab - The critical pins here are:

  • Port 3 Pin 10 - The Arc Okay (THC ON) input signal
  • Port 3 Pin 14 - The Activate/Deactivate THC signal for Anti Dive Mode 2
  • Port 3 Pin 16 - XY Velocity PWM signal used for Anti Dive Mode 3 (velocity)
  • Port 3 Pin 17 - TMC3in1 Torch Relay

Adjustable Pins:

  • Dummy Laser Gate Signal - This was the last row of the H.C. tab
  • Your motor pins - set as needed
  • Your homing and limit pins - set as needed
  • Your EStop and Probe pins - set as needed

TMC

 

12. Input Signals tab:

  • Here you can see how the required Arc Okay pin is assigned.
  • The probe pin will be used for the G31 touch off.
  • All other pins are as needed for your your system.

TMC

 

13. Output Signals tab:

The required pins are:

  • Laser PWM/XY Vel PWM {P3-16}
  • Output # for Torch Relay {P3-17}
  • Output # for Anti Dive Mode 2 Activate signal {P3-14}
  • Dummy Laser Gate Signal on any Output # and any output pin since we don't use it.

Adjustable Pins:

  • Your Motor pins
  • Any other outputs you may need

TMC

 

 Your profile should be set up with the core configuration required for the TMC3in1 to work.

 

 

 

How to use the Screen Set

 

TMC

 

 

1. Press Enable in the lower left of the Mach4 screenset, the TMC3in1 will activate, and this area of the screen will come to life.


2. You need to click on the "H.C. ON/OFF" button to allow Height Control to move the Z axis.

 

3. If the "Arc Okay" signal goes out, cutting will be halted.  The "Resume Cutting" button will be become clickable, so you can backup to a good pierce point and then resume the cut.

4. The "Reset Pierces" button will reset the number of pierces to 0 and clear the red indicator showing that the number of pierces exceeds the specified limit.

5.  Pressing the "Mark Log" button will increment a counter inside of the log file.

Watch the videos listed near the start of this article to see this screenset in use.

 


Available M2020 (...) Macro Commands for TMC3in1 Mode

You DON'T need to use any of these macro commands listed here!  However, they provide the ability to automate your projects in the CAM post-processor and to have much more control than with any other Height Controller that we know of.

These macro commands allow you to adjust TMC3in1 and ESS Height Control settings directly from your GCode!  This allows you to set up your post processor to configure your entire job.   It is recommended to include a G04 P0.1 command after the last M2020(...) macro in a group of macros (or after a single one by itself) so that the macro will be processed before the next line of GCode is acted upon.

The bold portion is what you put in your GCode, including the opening and closing parens ().  The non-bold text afterwards is my description of the command, and SHOULD NOT BE IN YOUR GCODE.

The value after the equal sign is an example value, use the actual value that you need. 

 

  • m2020 (HC_Z_MAX_VALUE=1.001) Set the Z Max Value if using Machine coordinate or Work coordinate Z axis limits.
  • m2020 (HC_Z_MIN_VALUE=-0.12) Set the Z Min Value if using Machine coordinate or Work coordinate Z axis limits.
  • m2020 (HC_WORK_Z_ZEROED=1) This tells the SmoothStepper that the work coordinates just changed and that the Z Max and Z Min should be recalculated.
  • m2020 (ESS_TORCH_TOGGLE) This should only be used by a screen set button or a recovery script.
  • m2020 (ESS_TORCH_RESUME_WAIT_FOR_ARC_OKAY=1) This should only be used by a screen set button or a recovery script.
  • m2020 (ESS_TORCH_RESUME_USE_PIERCE_DELAY_WAIT_FOR_ARC_OKAY=1) This should only be used by a screen set button or a recovery script.
  • m2020 (ESS_TORCH_STATE=1) 1 will turn the torch on, 0 will turn the torch off.  While you could use it in your GCode instead of M62P#/M63P#, you shouldn't because it will not be timed with motion.  This should only be used by a screen set button or a recovery script.  This won't wait for Arc Okay or give you a pierce delay.
  • m2020 (ESS_DELAY_AFTER_ARC_OKAY=512)  This sets the precision delay time in ms (milliseconds) from when the Arc Okay input signal activates until X, Y or Z axis motion will occur.
  • m2020 (TMC3IN1_LOAD_DEFAULT_CONFIG_VALUES=1)       This should be at the beginning of each GCode program to load all of the default config values.  This will overwrite any and all TMC3in1 register values that you may have modified with TMC3in1 config values.  If you are intentionally modifying TMC3in1 register values, you should omit or comment out this command.
  • m2020 (TMC3IN1_AD1_DELAY_ENABLED=1)  Enable Anti Dive Mode 1: Time Delay.  1 turns ON, 0 turns OFF.
  • m2020 (TMC3IN1_AD1_DELAY_VALUE=1.6)  Set the Time Delay for 1.6 seconds.
  • m2020 (TMC3IN1_AD2_M62_M63_ENABLED=1)  Enable GCode Based Anti Dive Mode 2 {AD2} M62/M63 Mode.   1 turns ON, 0 turns OFF.
  • m2020 (TMC3IN1_AD3_VELOCITY_ENABLED=1)  Enable Velocity Based Anti Dive Mode 3 {AD3}.   1 turns ON, 0 turns OFF.
  • m2020 (TMC3IN1_AD3_VELOCITY_PERCENT=95) If Anti Dive Mode 3 is enabled, THC is Inhibited if X-Y Velocity Drops Below 95% of the commanded Feedrate.
  • m2020 (TMC3IN1_AD4_VOLTAGE_ENABLED=1)   1 turns ON, 0 turns OFF.
  • m2020 (TMC3IN1_AD4_VOLTAGE_BUFFER=800)
  • m2020 (TMC3IN1_AD4_VOLTAGE_CHANGE_PERCENT=4.01)
  • m2020 (TMC3IN1_AD4_VOLTAGE_RESPONSE_PERCENT=0.00)
  • m2020 (TMC3IN1_AD5_VOLTAGE_ABOVE=15.1)    
  • m2020 (TMC3IN1_AD6_VOLTAGE_BELOW=14.4)    
  • m2020 (TMC3IN1_TARGET_TIP_VOLTS = 115.7)     
  • m2020 (TMC3IN1_TARGET_BAND_VOLTS=3.1)   
  • m2020 (TMC3IN1_LINEAR_RESPONSE_BAND_VOLTS_ABOVE = 15.1)  
  • m2020 (TMC3IN1_LINEAR_RESPONSE_BAND_VOLTS_BELOW=25.2)  
  • m2020 (TMC3IN1_OFFSET_VOLTS=0.01)   

 

 

 


 

SheetCam Setup

This is the SheetCam setup guide for Mach4 and the ESS.   Please be aware that there are two versions:

 

 

Up Down Pins Mode SheetCam Setup

1. Download and install SheetCam TNG Stable or Development from here.  Either Development or Stable will work, but only Development will allow you to import the rules.  It takes about 90 seconds to recreate the rules from the screenshots below.

 

2. Open SheetCam, then go to "Menu -> Options -> Machine"

SheetCam

 

SheetCam

 

 

2a. Click on the "Post Processor" tab, and then at the bottom click on "Import Post", select this file (after you have downloaded to your machine - you may need to right click and "Save As")

 

2b. While still in the "Post Processor" tab, click on "Edit Post",  Find the two lines:

  • torchOnCode = " M62P3 (>>>Torch ON<<<)"
  • torchOffCode = " M63P3 (<<<Torch OFF>>>)"

Change the P3 to match the output number you have selected for your torch relay.   P3 is for Output#3, P27 is for Output#27, etc...

SheetCam

 

2c.  Save the file and close out of SheetCam.  This step is required for the post processor to update SheetCam correctly.

 

 

3. If you DON'T have a tool table. Here is a Default Up Down.job file to use if you don't have anything.  Download the file (you may need to right click and "Save As").  Open the file, and it will launch SheetCam for you.  There is a sample part to cut.

 

4. In SheetCam click on "Menu ->Tools -> Cutting Rules".  You may need to drag on the window to the right to widen it.  Click on "Load" to import these rules.  (If you already have some rules you will need to add these new ones or modify your existing rules to match).  Select this file (after you have downloaded to your machine - you may need to right click and "Save As") ESS UP DOWN Mach4 v001.rule These values are in inches, and you may need to modify the distances to match your machine's capabilities.  These are just a starting point.

 

SheetCam

SheetCam

 

 

5a. All the numerical values I provided are just place holder values.  You will need to adjust them to meet the needs or your processes.  You will need to adjust your "Menu -> Options -> Machine - Post Processor -> Set custom post Options" values.  You can change these values as appropriate.

SheetCam

 

 

5b.  If you click on "Menu ->Tools -> Tool Table" and switch to the plasma tab, you can edit all of your plasma tools at once.  Or you can just double click on an individual tool from the main screen's Tools window. 

SheetCam

 

 

6. Import your CAD file (or use the provided default.job) and you should be able to generate GCode now by clicking on "Menu -> File -> Run Post Processor".  Please read the SheetCam manual or watch YouTube videos to learn how to use the rest of SheetCams many features.

 

 

 

 

TMC3in1 Setup

1. Download and install SheetCam TNG Stable or Development from here.  Either Development or Stable will work, but only Development will allow you to import the rules.  It takes about 90 seconds to recreate the rules from the screenshots below.

 

2. Open SheetCam, then go to "Menu -> Options -> Machine"

SheetCam

 

SheetCam

 

 

2a. Click on the "Post Processor" tab, and then at the bottom click on "Import Post", select this file (after you have downloaded to your machine - you may need to right click and "Save As")

  • TMC3in1 Mach4 v003.scpost Version 003.  This has been modified so that you specify the "Pierce Drop to Fire Torch" which will bring you down to pierce height.
  • TMC3in1 Mach4 v002.scpost Version 002 added GCode comments to make it easier to see where the Torch is turning on and off, along with when a Probe/Reference is happening (as shown in 2b below).
  • TMC3in1 Mach4 v001.scpost

 

2b. While still in the "Post Processor" tab, click on "Edit Post",  Find the two lines:

  • torchOnCode = " M62P3 (>>>Torch ON<<<)"
  • torchOffCode = " M63P3 (<<<Torch OFF>>>)"

Change the P3 to match the output number you have selected for your torch relay.   P3 is for Output#3, P27 is for Output#27, etc...

SheetCam

 

2c.  Save the file and close out of SheetCam.  This step is required for the post processor to update SheetCam correctly.

 

 

3. Do just step 3a or both steps 3B and 3c.

3a. If you DON'T have a tool table. Here is a Default TMC3in1 v003.jobt template file to use if you don't have anything.  Download the file (you may need to right click and "Save As").  Open SheetCam and click on "Menu ->File -> Open Job Template" and select this file.  

  • This will provide you with two code tools (shown in step 3b) that you will need for the rules in the next step to work.   Make sure that you are using Output#4 for AD2, otherwise edit the Tool Code so that the outputs match your P#.
  • This will also provide the Rules

 SheetCam

 

 

 

3b. If you already have a tool table. Click on "Menu ->Tools -> Code" Add the two following Code snippets - but don't include the quotes:

  • Code Name: "THC Inhibited via AD2"  Actual Code Snippet: "M63P4 (***THC Inhibited, AD2***)"  SheetCam

 

  • Code Name: "THC Allowed via AD2"  Actual Code Snippet: "M62P4 (+++THC Allowed, AD2+++)"SheetCam

 

Make sure that you are using Output#4 for AD2, otherwise edit the Tool Code so that the outputs match your P#.

The asterisks and pluses were added to the comment lines above to make it easier to see them in the GCode.

The Code Snippets should now appear in your Tools Window.  Close SheetCam.  You don't need to save your changes to the current file, but you do need to save the default tool set when prompted, so click Yes for the default tool set save prompt so these values are saved.  Otherwise you may delete them (repeatedly) by pressing Control-Z in a higher level window... Don't ask.

SheetCam

 

 

3c. In SheetCam click on "Menu ->Tools -> Cutting Rules".  You may need to drag on the window to the right to widen it.  Click on "Load" to import these rules.  (If you already have some rules you will need to add these new ones or modify your existing rules to match).  Select this file (after you have downloaded to your machine - you may need to right click and "Save As") TMC3in1 Mach4 v003.rule  These values are in inches, and you may need to modify the distances to match your machine's capabilities.  These are just a starting point.

Make sure that the Inhibits and Allows are in the same places that I have highlighted.  If they are not, double click on the rule and change the code snippet selection so that they match.

SheetCam

SheetCam

 

 

4. All the numerical values I provided are just place holder values.  You will need to adjust them to meet the needs or your processes.  You will need to adjust your "Menu -> Options -> Machine - Post Processor -> Set custom post Options" values.  AD1 and AD3 ENABLE are set to 1 (enabled) to begin with, since this will stop most diving.  Once you are comfortable with that, enable AD2 by setting it to 1 and get used to working with that.   Once you have that working, enable AD4 and get that working correctly with your system.

SheetCam

 

 

5.  If you click on "Menu ->Tools -> Tool Table" and switch to the plasma tab, you can edit all of your plasma tools at once.  Or you can just double click on an individual tool from the main screen's Tools window.  You will see that at the bottom of each tool you may set the desired Target Tip Volts, Target Band Volts, Linear Response voltages and the precision ESS Delay after Arc Okay values.  You can set these values differently for each tool, and the TMC3in1 will use these values automatically for your job.

SheetCam

 

 

6. Import your CAD file (or use the provided default.job) and you should be able to generate GCode now by clicking on "Menu -> File -> Run Post Processor".  Please read the SheetCam manual or watch YouTube videos to learn how to use the rest of SheetCams many features.

 

 

 

 

Go to top