Skip to main content

M31 Motion Control Setup Manual

{{@2007#bkmrk--1}}

The M31 is an industrial-grade motion controller for MachPro CNC systems. It serves as a stable hardware bridge between your Windows PC and machine drives, communicating over Ethernet to ensure synchronized, precise motion.

Key Features

  • Axis Support: Base support for 6 axes, with scalable license upgrades to 8 or 12 axes.
  • Control Flexibility: Supports both high-end EtherCAT and traditional step-and-direction protocols.
  • Expandability: Allows you to connect EtherCAT I/O modules, absolute encoders, and servos so the machine never loses position.

WARNING: Incorrect installation can cause death, injury, or equipment damage. Do not attempt to install this controller until thoroughly reading and understanding this manual.

1 Introduction

Several PDF documents are attached. Within this document are several wiring diagrams, and the PDF files are the source of the diagrams. Some of the PDF files are 3D files and they are indicated in their name: ------3D.pdf. If you open them with either Acrobat Reader or the Foxit PDF Reader , you can rotate the images for more details.

Reference Diagram

Use the diagram below as a reference throughout the manual.

Specifications

Please observe the maximum voltage on each pin. Some pins are 24 VDC compatible, some are 5 VDC, some are 3.3 VDC, and some are 0 VDC. Exceeding their max voltage will cause serious damage to the M31 Motion controller.

Item Specification
Input Power 24 VDC
Max Power Consumption 48 W
Motor Drives
Stepper Channels 6 motors
Step and Direction Axis Control 5 VDC Single Ended and Differential
Connection Terminal Blocks
Max Pulse Speed 1.6 MHz
EtherCAT Network
Device Types Servo Motors, Stepper Motors, VFDs, I/O Modules, etc.
Max Devices 30
Max Motors 6 motors by default (8 and 12 motor options available)
Quadrature Encoder Channel 1
Connection Terminal Blocks, 5 VDC Differential
Max Frequency 1.6 MHz
Spindle 1
Opto-Isolator Outputs Forward and Reverse Open Drain / Open Collector outputs
Analog Speed Signal 0-10 VDC
Encoder Feedback Yes
Digital Outputs 8 (PNP Sourcing)
Voltage 16 - 24 VDC
Max Current 250 mA
Pulse Width Modulation (PWM) Not yet available
Inputs 16 (opto-isolated, for PNP/Sourcing sensors)
Voltage 16-24 VDC
Input Current Range 3 - 6 mA
Isolated Yes
Enable Circuit 2
Hardware Enable Relay Dry Contacts, 5 VDC Enable or 24V Enable
Drive Enable Relay Dry Contacts
Servo Drive Alarm 1 (NPN Sinking with 24VDC pull-up)
Voltage 5-24 VDC
Input Current Range 3 - 6 mA
Emergency Stop Circuit Normally Closed Connection
Ethernet Port 10/100 MHz
Dimensions 7.125" (L) × 3.75" (W) × 1.875" (H)
Optimal Temperature Range 32° to 100°F (0° to 38°C)
Humidity 30% - 60% RH

Status LEDs

Each LED has a single color.

LED ON OFF
Power Green - M31 is powered No Power
CPU Blue blinking - M31 CPU is active
  • Standby Mode (blip a little more than once a second)
  • Run Mode (double blip/heartbeat)
  • Bootloader (rapid flash)
CPU is not enabled
E-Stop Red - E-Stop pressed, or the E-Stop circuit is incomplete E-Stop is not active
Hardware Enable Orange - Hardware Enable is on No Hardware Enable signal
Drive Enable Orange - Drive Enable is on No Drive Enable signal
Spindle FWD Green when spinning forward
Spindle REV Green when spinning in reverse
Drive Alarm Red - One or more drives are in alarm state All drives report good

Tools Required

A small, flat head screwdriver is needed for the I/O terminals.

Recommendations

If your system is running 480 VAC we recommend using line filters before the servo drives and VFDs to minimize electrical noise from the VFDs.

The M31 Motion Controller and the drives can supply 24 VDC, but they do not have high current capacity. We recommend adding separate 24 VDC power supplies. Specific suggestions for success:

  1. Use separate 24 VDC supplies for I/O and field loads if current is high.
  2. Tie all 0 V terminals to a single 0 V / ground bar in the main cabinet.
  3. Bond this bar to PE at one place.
  4. Keep motion controller and drive I/O referenced to this same 0 V bar.
  5. Use isolated I/O for external panels and long cables.

This approach prevents large ground potential differences while still offloading the 24 VDC outputs on drives and motion controllers.

MachPro Startup

On the desktop of your control, there is a MachPro shortcut for your machine type.

After double clicking on your MachPro shortcut, a window will come up asking to Press Cycle Start to Enable Mach and Home All Axes . By default on a new installation, MachPro will home in place. While you are configuring your control, click Cancel to prevent the system from enabling before you have configured it.

This prompt can be turned off in the MachPro settings if desired.

Firmware Update

On your first start of the MachPro software, it will check to ensure that you have the latest firmware for the M31 motion controller. If not, you will see an update screen.

Follow the prompts to update the M31 firmware. When it has completed the process, it needs to reboot the M31, and it will prompt for your approval to do that. Once the M31 is running again, and both the Firmware and FPGA are current, close the M31 Upgrade window.

Restart the MachPro software to ensure smooth operation.

If you have problems with the automated upgrades, you should use the manual upgrade process. MachPro Manual Upgrade of M31 Firmware and FPGA

The configuration menus are locked if the system is enabled, and all the menu options will be grayed out. You need to disable the system in order to make configuration changes.

Hardware Startup (J8)

To power the M31, you must supply 24VDC to the power connection located at the top right of the board as shown below. The LED labeled PWR will be green when 24VDC is supplied.

Emergency Stop (E-Stop Circuit J6)

The emergency stop connector is located in the upper right corner of the M31. When the emergency stop terminals are connected together, the red E-Stop LED turns off and the controller can then enable. This is a safety circuit that immediately disables the system when the circuit is broken.

Important: The M31 motion controller will not operate unless the Emergency Stop (E-Stop) circuit is complete.

Multiple E-Stop Devices

  • Connect all E-Stop devices in series in the same E-Stop circuit.
  • In a series circuit, any open contact will open the entire E-Stop circuit.
  • If you need specialized safety circuits, please contact support.

Adding an E-Stop Button to the M31 Board

  • Use an E-Stop button that does not require its own supply voltage.
  • This type is often called a “voltage-free” or “dry contact” E-Stop.

If the E-Stop button requires a supply voltage

  1. Wire the E-Stop button to a relay input.
  2. Use the relay output contacts in the E-Stop circuit.
  3. Ask a qualified electrician to design and verify this wiring.

M31 E-Stop Input Mapping

  • The Emergency Stop input is mapped to M31 1DI.ESTP.
  • Pull down Configure > Control and click the Input Signals tab
  • Scroll down the input signals to reach the E-Stop signal
  • When configured correctly, opening the E-Stop terminals will disable the system.
  • The system will only operate when the E-Stop circuit is closed and healthy.

Tip: The most effective way to wire an E-Stop circuit is with 24VDC all the time the machine is enabled. If someone presses the E-Stop button, or a wire is cut, the machine will be disabled. Any event that takes away the 24VDC will disable the machine. When mapping the M31 input to the MachPro software signal, set that input as Active Low. When the input from the M31 goes low (the 24VDC is removed) the E-Stop signal will go high and the machine will disable.

Hardware and drive enable overview (J12)

Before you use hardware enable or drive enable, configure the emergency stop circuit.

The M31 includes two control circuits: hardware enable and drive enable.
These circuits remain inactive until you configure the emergency stop (E-stop) circuit.

Use the default settings unless your application requires changes.

Accessing the enable settings

  1. Open Configure > Control.
  2. Select the Settings tab.

Available options

In the Settings tab, you can:

  • Set the delay between hardware enable and drive enable.
  • Choose which outputs turn off when the system disables.

I/O Diagnostics

The M31 and MachPro have a rich set of diagnostics.

  • Each input and output on the M31 has an associated LED
  • The M31 Diagnostic screen shows the status of all I/O at the motion controller level (click Diagnostic > M31)
  • The MachPro Input Signals screen shows the state of all enabled signals in the State column (click Configure >Control, then click Input Signals)
  • The MachPro Machine I/O screen also shows the state of all mapped I/O (click the Service tab, then the Machine I/O tab)

While you are wiring and mapping I/O signals, confirm that each I/O port is changing correctly at the M31 - with its diagnostic LEDs, and in the MachPro software.

If you click any of the graphics below, they will open in a new window or tab at their full size.

M31 Diagnostics

  • Input pin 1 is active - 1DI.01.01
  • The E-Stop is active - 1DI. ESTP
  • There is power to the board.
  • The blue CPU LED will blink when the CPU is active

M31 Plugin Diagnostics

  • Click the Pin icon to keep this window on top of other windows
  • The table at the top lists the current status of all motors connected to the M31
  • In the row directly under the motors table there is a GCode Message Cntr. If this number is active, then the M31 and MachPro are communicating normally.
  • The bottom section shows the status of all physical inputs and physical outputs on the M31

MachPro I/O Diagnostics

  • The M31 Status window shows that 1DI.01.01 has 24VDC
  • The Control Configuration window shows that this input from the M31 is mapped to MachPro Input #1. Because this input is a tool setter with a normally closed status, the Active Low status was turned on. Now, when the tool touches, the circuit will open, and the software input signal will trigger. All of these settings can be changed from this window.
  • The Machine I/O dashboard tells us that there is currently no tool touching the tool setter pad.

Configure the Dedicated Network Interface (J20)

The M31 motion controller connects to the control computer through a static IP Ethernet connection.

Follow the Microsoft guide below to manually set your network adapter to communicate with the M31: Microsoft Instructions: Manually Configure IPv4 Settings Scroll to the bottom and expand the section titled “To specify IPv4 settings manually.”

Then perform the following steps:

  1. Set IP address to: 192.168.208.10
  2. Set Subnet mask to: 255.255.255.0
  3. Save the settings and close the window.
  4. Connect the Mach J20 port to the dedicated network port on the control computer.

The M31 IP address (192.168.208.35) and the computer adapter IP (192.168.208.10) are pre-configured if you purchase both a CNC control and the M31

If you need to reset the IP address on the M31:

  • Verify: The M31 has 24VDC power
  • Verify: The M31 and computer are connected with an ethernet connection
  • Open the VSI Device Manager software

You should see the VSI Device Manager icon on your windows desktop

If not, click the Windows Start button and search for VSI

The VSI Device Manager will appear as one of the windows below.

  1. Click Scan Network
  2. Click the device that the scan locates. It will show the current IP address on the line at the top as well as an editable field in the lower right corner.
    • You may not see an M31 in the VSI Device Manager. Still follow steps 3 through 6.
  3. Enter 192.168.208.35
  4. Click Set New IP Addr
  5. Click Close
  6. Close MachPro, power cycle the enclosure, and restart MachPro. This ensures that all network and software changes are fully enabled.

2 Axis Setup

M31 Motion Controller

All of the drives and external I/O will be wired into the M31. The M31 motion controller uses EtherCAT and step and direction to control the axes.

  • The axis drives and motors need to be wired, configured, and calibrated for accurate motion in this Axis Setup section. Once that is completed, machine zero, limits, homing, and fixtures can be configured in the Inputs and Homing Setup section.
  • The M31 will support both Step and Direction, and EtherCAT devices simultaneously.

Step and Direction Connection and Configuration (J13 - J18)

The M31 supports differential or single-ended outputs. For differential outputs there are two signals for step (step + and step -) and two signals for direction (direction + and direction -). For single-ended there is only one signal for both step and direction.

Note: The M31 does not support powering and controlling motors directly. It is designed to supply control signals to a drive, which will power and control the motor.

Motor Drives
Stepper Channels 6 Motors
Step and Direction Axis Control 5 VDC Single Ended and Differential
Connection Terminal Blocks
Max Pulse Speed 1.6 MHz

If using step and direction, wire the drives to J13-J18.

Connect to a single-ended drive input, 0 VDC Common

Also see the attached PDF files (2D and 3D) in the upper left corner of this window

Use this when

  • The controller has true differential (RS-422) step/dir outputs.
  • The drive has single-ended step/dir inputs.

Connections

  • Connect S+ → drive STEP input.
    Drive label examples: “PUL”, “STEP”, “CP”.
  • Connect D+ → drive DIR input.
    Drive label examples: “DIR”, “CW/CCW”.
  • Connect controller 0 V → drive input common / signal ground.
    Drive label examples: “PUL-”, “DIR-”, “COM”, “GND”, “SG”, “DCM”.
  • We recommend that you run a single 0 V wire from the J11 block to your drives. This is a series/pass-through connection.
  • Connect the 0 V output of the power supply to the first drive. Then connect the 0 V terminal of that drive to the 0 V terminal of the next drive. Continue this pattern for all drives.
  • Example: M31 J11 0 V → Drive 1 (0 V) → Drive 2 (0 V) → Drive 3 (0 V)

Do not connect

  • Leave S- and D- unconnected.

Why

On many controllers, S- and D- are the inverted, actively driven outputs of the differential pair. If you tie them to 0 V, you can short an output or distort the signal. This can cause missed steps or faults.

Connect to a single-ended drive input, 5 VDC common

Connect to a differential (RS-422) drive input

Use this when

  • The controller has true differential (RS-422) step/dir outputs.
  • The drive has differential step/dir inputs.

Connections (typical)

  1. Connect S+ → drive STEP+ input.
    Drive label examples: “PUL+”, “STEP+”, “CP+”. 2. Connect S- → drive STEP- input.
    Drive label examples: “PUL-”, “STEP-”, “CP-”. 3. Connect D+ → drive DIR+ input.
    Drive label examples: “DIR+”, “CW+”. 4. Connect D- → drive DIR- input.
    Drive label examples: “DIR-”, “CW-”, “CCW-”.

0 V connection

  • In most differential interfaces, a separate 0 V wire is not required for the signal to work, because the receiver measures the voltage difference between “+” and “-”.
  • If the drive manual specifies a signal ground, shield drain, or COM connection for noise control, connect it as specified.
  • If the drive manual does not require a 0 V connection, then do not connect it. Do not use S- or D- as a ground.

Notes

  • Use twisted pairs: S+ with S-, and D+ with D-.
  • If you use cable shield, bond it per your grounding standard and the drive manual (usually at one end).
  • If you have a dual channel (2 motors) stepper drive, please contact MachLabs support for the correct configuration.

Step and Direction Plugin Configuration

M31's default motor configuration will work for step and direction systems. If you need to add motors beyond motor5, the Control Output Index must match the Motor number.

All unused motor tabs should have Control Output and Feedback Source values set to Undefined.

In Step and Direction use, set the Feedback Source Index on all tabs to 0

EtherCAT Network Configuration (J19)

The M31 uses a standard EtherCAT physical connection plan. The computer connects via Ethernet to J20 on the M31 motion controller. J19 on the M31 is then used to connect to each of the EtherCAT devices.

  • Put servo & stepper drives first in the EtherCAT chain (closest to the controller).
  • Put I/O devices and safety relays in the middle.
  • Put VFDs last (at the end of the chain). VFDs make electrical noise — keeping them last lowers interference.
  • Use shielded network cable for all EtherCAT devices.
  • Cable length: keep each cable between 1 foot and 100 meters (about 0.3 m – 100 m).
  • Good cable management: keep cables neat, do not bend them sharply, and separate network cables from high-power lines when possible.
**Load the EtherCAT configurations**

Pull down Configure > Plugins > M31 and select the EtherCAT tab

You may need to refresh the network several times to retrieve all of the information. If any of the devices report a status of Unsupported, please contact MachLabs support using the information at the end of this manual.

This is the list of MachPro compatible EtherCat devices  EtherCAT Devices 

After downloading the configuration you will need to close the M31 Config window and restart MachPro for all configurations to be loaded.

EtherCAT Network Troubleshooting

  1. Close the MachPro software and then shut down the computer.
  2. Cycle the power on the whole machine.
  3. Restart the computer and the MachPro software. Recheck to see if you are still having a problem.
  4. Verify that the GCode Message CNTR is still active in the M31 Status window (Diagnostic > M31).
  5. Verify the EtherCAT chain between drives. Disconnect the cable from drive 1 to drive 2, and refresh the network. You may need to refresh several times to fully populate the drive list.
  6. If that works, reconnect drive 1 to drive 2, and disconnect drive 2 from drive 3. Repeat until the drive list will not populate. The EtherCAT chain is getting stuck at that drive.
  7. Check the parameters you programmed into that drive.

If the list of online devices in right column still does not populate with valid devices, please contact MachLabs support.

EtherCAT Drive Configuration

Before calibrating EtherCAT servos, you must know your motor resolution and cap it to 17 bits or 131072 counts per motor revolution. This is the maximum number of counts per revolution that the M31 supports.

17 Bit Resolution

Motion based on 17 bit encoders is accurate enough for the majority of CNC systems, and it also allows you to select from a range of servo drives and motors. However, the drives will need to be configured to provide 17 bit encoder output even if they support a higher encoder count. This is a configuration change that is often made on servo drives, and it may be listed as Drive Ratio, User Parameter, Encoder Output Resolution, or Edge/Pitch.

Yaskawa Sigma5 and Sigma7 drives use parameter PnB02 set to 8 to change their output to 17 bit.

Each drive manufacturer has its own way to adjust the number of pulses that it will report for each rotation of the motor shaft. You need to ensure that you can configure any drives you plan to use with the M31 for 17 bit output.

Count Bits Conversion Result
less than 131,072 (stepper drives) less than 17 none use the maximum resolution of the drive
131,072 2^17 none needed 131,072
1,048,576 2^20 8 131,072
8,388,608 2^23 64 131,072
16,777,216 2^24 128 131,072

Example of how the math works: The last row is a 24 bit drive.

2^24 = 16,777,216 pulses for each rotation of the motor shaft. Try dividing that by these numbers: 8, 16, 32, 64, 128

In this case 16,777,216 / 128 = 131,072 which is the number of pulses we are looking for. So, if you have a 24 bit drive, you need the drive parameter where you can plug in 128, and have the drive send 131,072 pulses per rotation to the M31.

Checking Resolution

How many bits is your drive sending to the M31? This process is easiest if the motor is not mounted on the machine.

  1. Power up the system and MachPro, but leave MachPro disabled, which will allow the motors to be rotated by hand
  2. Pull down Diagnostic > M31
  3. Determine which axis you are checking and clear its position data. In the example above, Axis 0 has been selected. When the Clear Position button is pressed, the feedback value will be zeroed.
  4. Now rotate the motor shaft by hand one full rotation and note the feedback value. If it is a stepper motor, you may see approximately 10,000. If it is a servo motor you should see a number close to one of the numbers in the first column of the table above.
  5. If it is more than 131,072, your goal is to reconfigure the drive so that 1 rotation of the motor shaft produces approximately 131,072 pulses.

When you have configured all of your drives to use 17 bit resolution, save and close all open windows. Close MachPro.

Configure individual EtherCAT motors

After restarting MachPro pull down Configure > Plugins > M31 and select the Motor[0] tab

The example below shows Motor[0] configured as an EtherCAT drive and connected to a Leadshine drive [1]L7N(COE)

  1. Select EtherCAT Drive as the Control Output Type
  2. Set the Index to 0
  3. Select the first EtherCAT Drive for Motor[0]
  4. Select ECAT Feedback as the Feedback Source
  5. Set the Index to 0
  6. Select the type of Homing configuration you are using for this motor.
- Each motor has a Control Output SubID, and Feedback Index. The default is to leave those fields set to 0 for all motors.

Configure Multi-Axis EtherCAT drives

  • These are not standard drives that have one motor controlled by one drive. If you have standard drives, skip this section.
  • The Control Output EtherCAT Device will remain the same for all motors attached to your multi-axis drive
  • Set the Control Output SubID value to match the motor number.

Notes:

  • We recommend that you carefully label all motors, drives, and cables at the connection points. Do this before you install them, and your installation will be less frustrating.
  • The maximum following error is usually set to one or two rotations of the motor shaft. You may need to adjust for your system. Following error occurs when an axis is physically blocked from moving, or when part of the axis mechanics are slipping and commanded motion does not result in feedback motion.
  • Under the homing section are the instructions for gantry squaring, and for enabling Absolute Encoder.
  • All unused motor tabs need to be set to Undefined

Enabling Axes

After the drives are connected to the M31, open up MachPro, and enable the axes as follows:

Note: This may already be setup depending on your system.

  1. On the menu bar, click Configure >Control . Then select the Motors tab (pictured below).

Note, if menu options are greyed out (not active/select-able), disable the system to allow configuration changes

  1. Enable all the motors that are to be controlled by setting the respective boxes in the right pane to checks. In the example below, motors 0, 1, and 2 are enabled.
  2. To test motor direction before proceeding press Apply and OK to save and close.
  3. Click the flashing red Enable button in the lower left corner of the screen to enable the system.
  4. Use your pendant, the panel jog buttons, or the on-screen jog buttons to carefully test each axis direction.
  5. I have moved the jog rate slider almost all the way down to test my motion. Be very careful in testing axes with master and slave motors. Because of the gearing mechanics, they will typically need to rotate in opposite directions from each other.
  6. If a motor moves the wrong direction, it can be reversed in the Motors tab.
  7. On the menu bar, click Configure >Control . Then select the Motors tab (pictured below).
  8. Check the Reverse? box for each motor that needs to be reversed.
  9. Press Apply to save any changes.
  10. Next, select the Axis Mapping tab as pictured below. Associate the enabled motors to the applicable axis. In this example, Motor0 is the X master, Motor1 is the Y master, and Motor2 is not mapped to an axis. In this EtherCAT system the VFD and spindle are motor 2, but will not be used for axis movement. No slave axes are configured on this system.
  11. If you have an axis with two motors - such as a gantry - one motor will be the master and the second will be the slave. In the slave column, select the motor that will be running in slave mode. In this example X axis has Motor0 as the master and Motor2 as the slave. The Homing section contains a link to gantry setup.
  12. Press Apply and OK to save and close.
  13. Carefully test jogging.

If you have been running your motors on a test bench, you now need to mount the motors on the machine in their running configuration.

WARNING The machine can be crashed very easily at this point. The axes need to be calibrated and the limits configured before doing any significant motion with your machine

Axis Calibration

Before calibrating the axes, set the backlash value to 0 for each axis. Configure > Plugins > M31 and select each motor individually to check the backlash settings.

Go to Configure > Plugins > Machine Calibration.

Select the type of configuration you would like to perform from the window:

  • Manual - Calculate the axes by comparing distance traveled vs. distance commanded. See Manual Calibration below for instructions. Manual calibration provides very accurate settings if you do not know all of your hardware specifications.
  • Automatic - Calibrate axes using the specifications of your system. Continue for instructions. Automatic calibration provides the most accurate settings if you have all of your hardware specifications.

Automatic Units Calibration

Automatic calibration requires you to provide all of the details of your motor and axis hardware. If you are unable to find this information, proceed to the Manual Calibration section.

  1. Select the Drive that most closely matches yours. If there is not an exact match, select based on the number of encoder resolution bits.
  2. Select the max motor RPM
  3. Enter 131,072 for the Encoder Resolution. If you have a stepper drive, or the drive is less than 17 bit, then enter the actual resolution per rotation for your motor. To verify the actual encoder resolution of your drive, please use the steps above in Checking Resolution
  4. Enter 1 for the drive ratio.
  5. If this axis uses a pulley, select that box and enter the number of teeth from the load side and the motor side.
  6. If there is a gearbox, select that box and enter the ratio.
  7. This axis will have either a ballscrew or rack and pinion system. Select the type it has and complete the open fields.
  8. Select the axis to calibrate.
  9. Leave Angle at 0 degrees
  10. Press the Calculate button.
  11. Evaluate the current steps value against the proposed values. You may change values and re-calculate.
  12. When you are ready, Accept the new steps per value. The velocity and acceleration are calibrated maximum values based on all of the parameters you entered related to this motor and axis.
    • During operation, the rapid rates can be reduced with on-screen controls.
    • The acceleration should be adjusted to the highest value that will provide smooth motion without over-torque errors, shaking, rigid motion, or jolts. Acceleration that is too slow will increase the cycle types per part.

Repeat for each axis.

Press [OK] and restart MachPro to save the calibration settings.

This is an example of a simple X axis that has been calculated and is ready to be accepted.

Velocity and Acceleration are also calibrated by this process and we recommend that you accept these values. They will be maximum values.

Click the Accept button

Verify that each axis is moving the distance that you command.

Manual Calibration

Use this tool to calibrate an axis. The tool compares the commanded movement with the measured movement and updates the MachPro steps-per-unit value.

For the best accuracy, use the longest distance that you can measure accurately.

  1. Select the axis that you want to calibrate.
  2. Select one of these calibration methods:
    • Jog Distance: Use this method for the initial calibration. You control the movement distance and speed.
    • Commanded Distance: Use this method to verify or fine-tune the calibration.

Calibrate an Axis with Jog Distance

Prepare the Axis

  1. Open the Axis Selection list.
  2. Select the axis that you want to calibrate.
  3. Measure and mark the longest distance that you can measure accurately on the axis.
  4. Click Enable.
  5. Make sure that the indicator turns green.
  6. Jog the axis to the first mark.

Record the Movement

  1. Click Record Jog.
  2. Make sure that the indicator turns green.
  3. Jog the axis to the opposite mark.
  4. Click Record Jog again.
  5. Make sure that the indicator turns red.

Update the Calibration

  1. Measure the actual distance that the axis moved.
  2. Enter the measured distance.
  3. Click Submit.
  4. Click Accept.
  5. Make sure that the lower section of the window clears.
  6. Make sure that the message Steps Per Unit Updated! appears.

Calibrate an Axis with Commanded Distance

Prepare the Axis

  1. Open the Axis Selection list.
  2. Select the axis that you want to calibrate.
  3. Measure and mark the longest distance that you can measure accurately on the axis.
  4. Click Enable.
  5. Make sure that the indicator turns green.
  6. Jog the axis to the first mark.
  7. Enter the distance to the opposite mark.
  8. Enter the correct positive or negative value for the movement direction.

This example uses the Commanded Distance test to verify the Jog Distance calibration of the Y axis.

Run the Test

  1. Click Move.
  2. Wait for the axis to stop.
  3. Compare the axis position with the opposite mark.

If the axis stops at the mark:

  1. Enter the commanded distance.
  2. Click Submit.
  3. Make sure that the status bar shows this message: The distances moved were the same. Steps per unit will not change.

If the axis does not stop at the mark:

  1. Measure the actual distance that the axis moved.

Update the Calibration

  1. Enter the measured distance.
  2. Click Submit.
  3. Click Accept.
  4. Make sure that the lower section of the window clears.
  5. Make sure that the message Steps Per Unit Updated! appears.

Axis calibration is necessary for accurate machine movement. Verify that each axis meets your accuracy requirements before you continue the configuration. The remaining configuration steps depend on correct axis calibration. If you change the calibration later, you must configure the affected settings again.

Configure Velocity and Acceleration

Use this procedure to adjust the maximum velocity and acceleration for each motor.

The Automatic Axis Calibration tool can calculate initial velocity and acceleration values. Use this procedure to adjust those values for your machine.

WARNING: Do not use high velocity or acceleration values until homing and limits are configured. Incorrect values can cause machine damage.

Open the motor settings

  1. Open Configure > Control.
  2. Select the Motors tab.
  3. Click the motor name in the right pane.

Click the word to highlight and select the axis. The checkbox only enables or disables the motor.

Set velocity

Velocity controls the maximum rapid speed for the motor.

  1. Select the motor.
  2. Set Velocity to a conservative value.
  3. Click Apply.
  4. Test the axis with a short jog move.
  5. Increase the velocity in small steps.
  6. Stop increasing the value when motion becomes rough, inaccurate, or unsafe.

The practical maximum velocity depends on:

  • Motor speed
  • Drive capability
  • Counts per unit
  • Axis travel length
  • Machine rigidity
  • Load inertia
  • Required cut quality

Set acceleration

Acceleration controls how quickly the axis reaches the commanded speed. It also controls deceleration.

  1. Select the motor.
  2. Set Acceleration to a conservative value.
  3. Click Apply.
  4. Test the axis with short jog moves.
  5. Increase the acceleration in small steps.
  6. Stop increasing the value if the axis shakes, faults, jolts, or loses position.

Typical starting values:

  • Stepper motors: 15–20
  • Servo motors: 30–40

These values are starting points only. Adjust them for the machine.

Save the settings

  1. Click Apply before selecting another motor.
  2. Repeat the procedure for each motor.
  3. Click OK when all motors are configured.

If you change the counts per unit later, verify the velocity and acceleration values again.

WARNING No limits have been set up. DEATH, INJURY or serious PROPERTY DAMAGE can occur if the system is not operated carefully. Limits and homing setup will be completed in the following sections

Backlash Repair and Compensation

Backlash is caused by the gaps between moving parts such as gears and ballscrews. It is the amount of movement one component can make in one direction without causing motion in the next connected part. Most mechanical systems have some backlash - even when new. If the mechanics are too tight, binding and excessive wear will result. As the gears and ballscrews wear, the backlash will increase, and accuracy will decrease. Ongoing testing and maintenance of your mechanical system is required to minimize backlash.

The M31 provides software backlash compensation as a short-term solution for small, stable amounts of backlash. To calculate the backlash of an axis use How To Test For Backlash

Backlash Value – (Enter in Configure | Plugins > M31). This field sets the backlash amount in inches or millimeters, depending on the setup units. For best performance, backlash should be less than .0015 inches. Start by entering half of the backlash value, test and adjust.

Backlash Speed % – (Enter in Configure | Plugins > M31) This is a factor of the axis acceleration value. The M31 takes the max acceleration of the motor and multiplies it by this percentage. Valid values are 10-400 (0.1 to 4 times max acceleration). A common value is 20%.

Do not leave the backlash speed value at zero. The M31 will not function with a speed of zero.

All of the axes are now calibrated, but MachPro does not know where the limits of travel are on each axis. That will be configured next. Until that setup is completed, be very careful if you are moving axes.

3 Inputs and Homing Setup (J1 & J3)

You will first need to wire the inputs and outputs to the M31. Then you will map the appropriate software signals to those hardware connections.

Inputs 16 (PNP Sourcing)
Voltage 16-24VDC
Input Current Range 3 - 6mA
Isolated Yes

Wiring Inputs

The M31 motion controller has 16 PNP inputs that can be used for the limit and home switches, probes, and other sensors.

Note: For the highest level of safety, wire the limit switches Normally Closed. If a limit is tripped, or a wire or limit is damaged, the system will stop motion.

To wire 24V limit switches, follow the steps outlined below.
  1. Select, or install, two limit switches at the end of each axis' hard limits. 2. Wire the two switches in series, normally closed. If either limit is tripped, the circuit will open and motion will stop. 1. I/O ports are limited, and wiring the limits for a given axis in series conserves those limited ports while maintaining function. 2.

    Note that safety circuits often require each limit to have its own input.

    3. Wire one side of the first switch to +24V from the M31 motion controller. 4. Wire the other side of the limit switch into an input on the M31. Label the wires and document the I/O.

Wire a home switch on each axis to a separate input.

Tip for success: Once you understand how to wire and map inputs and outputs, use the charts in the appendix to plan the physical wiring and software mapping.

Mapping Signals

  1. At the top of the screen, open Configure > Control.
  2. Click the Input Signals tab.
  3. Scroll down the list until you see each motor section: Home, ++, and --.
  4. Note the State column. It shows the current state of that signal, providing immediate confirmation of your I/O configurations. In the first screen below, Z is homed.
  5. For each signal mapping (Home, ++, --), do these steps:
  • Enable mapping: Click the red [X] next to the signal. It will turn into a green [✓]. That turns the mapping on.
  • Device: Choose M31 from the Device list.
  • Input Name: Pick the input you wired to the M31 (for example 1DI.01.08 or 1DI.01.09).
  • Active Low:
    • If your limit switches are normally closed, click the red [X] to change it to a green [✓].
    • This makes the input active when the voltage goes low. Wiring normally closed is the safest method.
  • Description: Type the name for this axis limit (the name operators and designers use).
  1. When you finish all limits and home switches for a motor, click Apply, then click OK.

Short example

  • Motor 0: Home, ++, and -- are enabled (green check).
  • All limits are wired normally closed.
  • We use M31 1DI.01.09 for both ++ and --.
  • We use M31 1DI.01.08 for the Home switch. Using a separate input for Home is more reliable.

Manually trigger each limit switch and make sure they disable Mach before continuing. This verifies both the wiring and signal mapping.

Machine Zero Setup

The M31 supports absolute encoders through the EtherCAT interface. This feature is configured after inputs and homing are complete.

This is also known as the Reference Position, Machine Home, G28 position, Home Switch Position, and Machine Coordinates (0,0,0). This is the position from which the system will measure all movement. You will normally work with fixture, or part, zero. See the operator manual for your machine type.

Danger: If limit switches are wrong or an axis moves the wrong direction, the machine can crash.

Pull down Configure > Plugins > M31 and select the Motor[0] tab.

The **Homing Type** is set in the **Homing** section. There are five options:
  • Home Sensor: This is the simplest to understand, troubleshoot; and it is very reliable. We recommend you install home sensors - even on machines with absolute encoders enabled.
  • Index Pulse: This is set to a particular pulse on the motor rotation. It is the most accurate method, but if anything ever changes in the motor or the mechanics of the machine, this will need to be reset.
  • Sensor + Index: This first touches the home switch, then backs off to a particular index pulse. It is easier to setup, but has the same vulnerability to motor and mechanical changes as an index pulse alone.
  • EtherCAT: This enables advanced EtherCAT communication with the drive and is used to implement EtherCAT homing methods on the drive. Contact support if you need this feature.
  • Mach In-Place: This will define machine zero to be the current location of the axis.

Select the type of homing that your machine will use for each motor, then press Apply and OK to close the window.

Open the settings: From the menu bar click Configure > Control. Then click the Homing/SoftLimits tab.

**Columns**
  • Home Dir: Pick the direction the axis will move to find home positive or negative.
  • Home Order: Set the order of homing using numbers (1 = first, 2 = second, etc.).
    • Tip: Z is often set to 1 so it moves up first and stays out of the way.
  • Home Offset: the machine coordinate value MachPro will assign to the axis when homing finishes
  • Home Speed%: Set how fast the axis homes by choosing a percent.
    • 20% is the usual maximum for best results.
    • Slower speeds help stop over-travel.
    • You can jog the axis quickly close to the home position before homing to save time.
  • Home In Place: Set this based on your hardware in the motion controller config. This is used with absolute encoder systems. The M31 homing value will need to be set to Mach In-Place. If you are not using this method, then deselect it for each axis
  • Soft Enable: Deselect this if you will not be using soft limits on this axis
  • Soft Min: The most negative value you want the machine to move on this axis. Soft Limits will be set in the next section.
  • Soft Max: The most positive value you want the machine to move on this axis
  • Ref On Startup: Used on machines that use G90 and G92 heavily

Save: Press OK to save your changes.

If you have a gantry with a master and slave motor, use MachPro M31 Configuring a Master Slave Axis Gantry

Test Homing

  1. Click the Service tab at the bottom of the screen, then the Maintenance tab at the top left of the screen
  2. You will be working in the upper center portion of the screen
  3. Test: Home each axis one by one to check the settings. Then press Home All to verify everything works.
  4. You should be comfortable with jogging the machine within the soft limits and using the GoTo Positions button to return to Machine Zero.

Close MachPro, power cycle the enclosure, and restart MachPro. This ensures that all M31 and software changes are fully enabled.

Troubleshooting

  • What it means: The home switch used for the master may actually be wired to the slave (they are swapped).

  • What happens: When you touch off switches and home, one side keeps moving and drags the other side. This is a sign the switch assignments are swapped.

  • How to check:

    1. Touch each home switch by hand (one side at a time).
    2. Home the machine and watch each side while you touch the switches.
    3. If one side still travels and pulls the other side, the switch mapping is likely wrong.
  • What to check in software: Look at Input Signals and Axis Mapping to make sure each switch is assigned to the correct axis.

  • Safety: Keep your hand on E-Stop the first time you test after changes.

License Travel Limits

Soft Limits Setup

Soft limits prevent the machine from moving beyond the configured machine travel range.

Soft limits only work correctly after these steps are complete:

  • Axis calibration is complete.
  • Motor direction is correct.
  • Homing is configured.
  • The machine is homed.

WARNING: Soft limits do not replace physical limit switches. Always install and test physical limit switches.

Record the travel limits.

  1. Home the machine.
  2. Select Machine Coordinates on the locked screen view.
  3. Verify that the DRO values are orange.
  4. Jog the axis toward the positive end of travel.
  5. Stop before the physical limit switch.
  6. Record the machine coordinate.
  7. Jog the axis toward the negative end of travel.
  8. Stop before the physical limit switch.
  9. Record the machine coordinate.
  10. Repeat these steps for each axis.

Stay inside the physical limit switches. If the machine moves outside the limit switches, the soft limit values will not protect the machine correctly.

Enter the soft limit values.

  1. Click Configure > Control.
  2. Select the Homing/SoftLimits tab.
  3. Find the axis that you want to configure.
  4. Enable Soft Enable for that axis.
  5. Enter the most positive recorded value in Soft Max.
  6. Enter the most negative recorded value in Soft Min.
  7. Repeat these steps for each axis.
  8. Click OK to save the settings.

Test the soft limits.

  1. Enable soft limits.
  2. Jog each axis slowly toward the positive soft limit.
  3. Verify that motion stops before the physical limit switch.
  4. Jog each axis slowly toward the negative soft limit.
  5. Verify that motion stops before the physical limit switch.
  6. Load a sample G-code file.
  7. Check the toolpath display.

Note: When loading a G-code file, the tool path display will show the soft limits as dashed lines. If any part of the tool path renders outside the soft limits, check your file.

Enable Absolute Encoder

4 Output Setup (J10)

Wiring Outputs

The M31 has 8 logic outputs that can be used for any low current application.

8 Digital Outputs (PNP Sourcing)
Voltage 16 - 24VDC
Max Current 250mA
Pulse Width Modulation (PWM) Not available on this release

Output to a relay

Output to a contactor

Mapping Signals to Outputs

To configure an output, follow the procedure below.

  1. On the menu bar click on Configure > Control and select the Output Signals tab
  2. Scroll down to the desired output (There are 64 output signals available).
  3. Note the State column. It shows the current state of that signal, providing for immediate confirmation of your I/O configurations. In the screen below the Brushes Up signal is active.
  4. Enable the output by setting the Mapping Enabled box to a green check.
  5. Set the Device to your motion controller and the Output Name to the motion controller output port you wired. This example maps the Draw Bar Open to port DO.09.2.
  6. Set the Active Low column to a green check for a normally closed signal (Active Low) or red x for normally open (Active High).
  7. Press Apply and OK to save changes.
**Using Outputs**

Outputs 0-5 can be controlled with M-Codes. One M-Code turns an output on, and the other M-Code turns the output off. Use the table below for a reference.

Custom M-Codes Functions
M200 Output #0 on
M201 Output #0 off
M202 Output #1 on
M203 Output #1 off
M204 Output #2 on
M205 Output #2 off
M206 Output #3 on
M207 Output #3 off
M208 Output #4 on
M209 Output #4 off
M210 Output #5 on
M211 Output #5 off
This pattern continues through M218 and M219 for Output #9

Also see M220 - M222 for extended output control

Mist and Flood Control

  1. On the menu bar click on Configure > Control and select the Output Signals tab.
  2. Select the Motion Control Device and Output Name
  3. Add a User Description, which will show on the Service tab's I/O dashboard.
  4. On the left menu bar, select the Settings tab
  5. Filter for either Mist or Flood and adjust the settings for your system
Feature ON M-Code OFF M-Code
Mist M7 M9
Flood M8 M9

5 Spindle Setup (J5)

Configure the VFD for the spindle motor

A VFD (Variable Frequency Drive) controls the speed of the spindle motor.

Set the VFD to match the motor’s electrical ratings:

  • Rated voltage
  • Rated current
  • Rated speed (RPM range)

You must use the values from:

  • The VFD manual
  • The spindle motor manual

Do not guess these values.


Spindle control options on the M31

The M31 controller will either use 0-10 VDC or EtherCAT to control the spindle. EtherCAT is the recommended option if your hardware supports it. It provides more control, and access to advanced VFD functions. Use your VFD manual to determine the control methods supported.

EtherCat M31 Spindle Configuration

To access this configuration pull down Configuration > Plugins > M31

The feedback index will be the same as the motor number - in this case 3.

Set the Max Following Error very high as this is not meaningful for a spindle

Turning on the Spindle

In addition to the screen controls the spindle can also be controlled using M-codes. Use the table below as a reference.

M-Code Function
M3 Clockwise
M4 CounterClockwise
M5 Stop

Encoder Feedback (J4)

Quadrature Encoder Channel 1
Connection Terminal Blocks, 5 VDC Differential
Max Frequency 1.6 MHz

Please refer to the documentation for your VFD and spindle motor for spindle encoder connections.

0-10 VDC Configuration

  • Forward rotation signal
  • Reverse rotation signal
  • 0–10 V analog speed signal

MachPro Spindle Configure for M31 up to Rev 1.2 These M31 controllers use sinking (forward and reverse collectors) to control the spindle rotation direction.

For M31 Rev 1.3 and later, use the information below. All M31 controllers from Rev 1.3 on use forward and reverse relays to control spindle rotation direction.

The drawings below show 0-10 VDC connections to a Yaskawa GA500. The manual for your VFD should have similar documentation.

Analog Spindle Voltage Adjustment

On the Systems tab of the M31 plugin, the spindle voltage can be adjusted by changing the percentage (10-200%). Most systems will not require this value to be changed. However, if the voltage is not close enough, the percentage adjustment can be calculated with the following formula:

Analog Spindle Scale % = Commanded Voltage/Actual Voltage * 100

MachPro Spindle Calibration

6 Advanced Options and Information

MachPro Settings

A number of advanced features can be configured in the Mach Settings such as periodic oiler control. Begin by going to Configure >Control and got to the Settings tab. Settings contains custom options for the control, including dialog options, lube system, tool measurement/offsets, and tool changer options.

MachPro Lube System Setup

MachPro Tool Setters and Offsets

7 Next Steps

There are Machine Type Setup and Operation manuals for the different machine types,

and there is also an Advanced Configuration Manual for features like modifying the tool table or using the GCAdapter.

8 Reference Information

Signals and ports used

Signal M31 Junction Input Name Use
J1 1DI.01.00
J1 1DI.01.01
J1 1DI.01.02
J1 1DI.01.03
J1 1DI.01.04
J1 1DI.01.05
J1 1DI.01.06
J1 1DI.01.07
J3 1DI.01.08
J3 1DI.01.09
J3 1DI.01.10
J3 1DI.01.11
J3 1DI.01.12
J3 1DI.01.13
J3 1DI.01.14
J3 1DI.01.15
Signal M31 Junction Output Name Use
J10 1DO.01.00
J10 1DO.01.01
J10 1DO.01.02
J10 1DO.01.03
J10 1DO.01.04
J10 1DO.01.05
J10 1DO.01.06
J10 1DO.01.07

9 Troubleshooting

Test Setup

If you want to test motion before installation, or are having trouble getting correct motion:

You can do a test setup with your motors, drives, and cables. This is particularly helpful in setting and verifying 17 bit encoding.

  • This ensures that you have all the cables you need
  • You can verify that the motors all work
  • You can easily verify that your drives are set to 17 bit or less.

Set the motors on a stable work surface. Often the packing materials will work well as temporary pads.

Connect all cables between each drive and motor. You may leave the motors setup like this until the system is ready for axis calibration. At that time you will need to install the motors on the machine.

Testing Axis Motion

This procedure applies to step-and-direction axes and EtherCAT axes.

WARNING: Make sure each axis can move safely in both directions. No software limits are active during this test. If the motor is installed on the machine, the only travel limits are the physical hard stops.

Open the M31 test motion screen

  1. Open Configure > Plugins > M31.
  2. Select the motor that you want to test.
  3. Find the Test Motion section in the lower right corner of the window.

Set the first test move

Use small values for the first test.

  1. Set Position to 0.1.
  2. Set Accel to 10.
  3. Set Velocity to 10.
  4. Select Auto-Reverse.
  5. Click Enable in the Test Motion section.

The motor is now ready for a test move.

Run the test move

  1. Click Execute.
  2. Verify that the axis moves.
  3. Click Execute again.
  4. Verify that the axis moves in the opposite direction.

The second move should reverse direction because Auto-Reverse is enabled.

Increase the test values slowly

After the first test works correctly, increase the values in small steps.

Example:

  1. Increase Position to 0.3.
  2. Increase Accel to 20.
  3. Increase Velocity to 200.
  4. Click Execute.
  5. Verify that the motion is smooth and controlled.

Use short movement distances during this test. The goal is to verify communication between the M31, the drive, and the motor.

Repeat the test

Repeat this procedure for each motor.

Verify these items for each motor:

  • The motor enables correctly.
  • The motor moves when commanded.
  • The motor moves in the expected direction.
  • The motor reverses direction when Auto-Reverse is enabled.
  • The motion is smooth.
  • No drive alarms occur.

EtherCAT Problems

  • The EtherCAT cables must be shielded
  • Very carefully check the In/Out cabling sequence through the entire EtherCAT chain. If one or more of the devices is backwards, the EtherCAT network will power up, but will not enable.
  • All of the drives need to be programmed, and all alarms cleared. With some drives, you can clear the alarm from the face of the drive, but not clear the alarm state internally. Close the MachPro software and power cycle the enclosure. Then restart the MachPro software.
  • Drives connected to the M31 Motion Controller must be configured for 17 bit or less. If they are configured for more than 17 bit, the system may still have motion, but it will be very sluggish.
  • If you see a Not Supported status next to a device in the EtherCAT tab of the M31 Config window, contact support.

Network

Are the M31 motion controller and computer connected and communicating?

  • Ensure that the Motion port on the computer is connected to the Mach J20 port on the M31.
  • From the MachPro software, pull down Diagnostic > M31
  • The value in the GCode Message Cntr should be actively changing
  • If it is a static value or 0:
  • Close MachPro and power cycle your enclosure, then restart MachPro
  • Research and resolve all alerts and warnings that come up during that process.
  • Verify your network settings . If you need to make network changes, close MachPro and power cycle the enclosure.

10 Explanation

EtherCAT State Machine

When enabling or booting up, an EtherCAT slave device moves through a specific sequence of four main communication states managed by the EtherCAT State Machine (ESM):

  1. Init (Initialization) This is the initial state after power-on. No mailbox or process data communication is possible. The master initializes the slave's address and communication settings. The EtherCAT master is answering the question: "What kind of device are you?" for each device in the chain.
  2. Pre-Operational (Pre-Op) - Mailbox communication is enabled, allowing the master to configure SDOs (Service Data Objects), PDO (Process Data Object) mapping, and other parameters. Process data communication is not yet active. The EtherCAT master is answering the question: "How are you configured?" for each device in the chain.
  3. Safe-Operational (Safe-Op) - The master and slave check the configuration. Mailbox and process data communication are active, but the slave only sends input data; outputs are held in a safe state (e.g., switched off). If there are any device alarms, EtherCAT will not move past this state.
  4. Operational (Op) - The slave is fully functional. Both mailbox and process data communication are active, and the master sends output data, which the slave applies.

{{@2016}}