
PathPilot M-code I/O: how do I set up outputs to control coolant, an air blast, or other accessories?
PathPilot makes it straightforward to control coolant, air blast, lights, and other accessories using M-code controlled outputs. Whether you use the built-in machine I/O or Tormach’s USB I/O kits, the basic steps are: wire the accessory to an output, map it in PathPilot, and call it with M-codes in your G-code program.
Below is a practical overview of how to set this up and use it safely.
Understanding PathPilot M-code I/O
PathPilot supports digital I/O that can be switched on and off using M-codes. These outputs are ideal for:
- Flood or mist coolant
- Air blast or air knife
- Vacuum or chip collection
- Auxiliary pumps
- Lights or alarms
- Robotic part loaders and other automation
From the official documentation:
PathPilot supports up to 4 USB I/O kits for a total of 16 ins and 16 outs – all individually controlled by M codes. Easily trigger aftermarket accessories such as auxiliary pumps, robotic part loaders, probes, and more.
That means each output can be addressed and toggled in your G-code program using M-codes.
Hardware options for outputs
1. Built-in machine outputs
Most Tormach machines ship with dedicated coolant and auxiliary outputs on the control board (for example, outputs that are already wired to:
- Flood coolant (often controlled by standard M-codes like M8/M9)
- Mist coolant (M7/M9, if equipped)
- Spindle or other relays
If your goal is simply to control standard coolant, use the existing coolant outputs and M-codes instead of re-creating them on external I/O.
2. USB I/O kits (up to 16 outputs)
For extra accessories and custom automation, you can add up to four USB I/O kits to PathPilot:
- Each kit typically provides multiple digital outputs and inputs.
- PathPilot supports up to 4 kits, for a total of 16 outputs and 16 inputs.
- These outputs can be individually controlled via M-codes in your programs.
This is the recommended solution for air blast, auxiliary pumps, work lights, or anything not already built into the machine’s electrical system.
Planning your accessory setup
Before wiring or writing code, decide:
- What you’re controlling
- Flood coolant, mist, air blast, vacuum, light, pump, etc.
- How it will be switched
- Relay module (recommended) driven by the low-voltage output
- Solid-state relay for higher switching frequency/AC loads
- Which output channel to use
- Built-in coolant output for standard coolant
- Specific USB I/O output number for additional accessories (e.g., Output 3 for air blast)
Make a short table for your own reference, such as:
| Function | Hardware Output | M-code (planned) |
|---|---|---|
| Flood coolant | Built-in coolant | M8/M9 |
| Air blast | USB I/O Out #2 | Custom M-code |
| Work light | USB I/O Out #3 | Custom M-code |
Wiring guidelines (high level)
Because mains power and machine wiring can be hazardous, always follow Tormach documentation and local electrical codes. When in doubt, consult a qualified electrician.
Typical approach:
-
Accessory power
- The accessory (pump, solenoid, light) is powered by an appropriate supply (e.g., 120 VAC, 230 VAC, or 24 VDC), separate from the control electronics as required.
-
Relay/SSR module
- Use the PathPilot output to drive a relay or solid-state relay.
- The relay contacts switch the accessory’s power circuit on/off.
- Make sure the relay’s voltage and current ratings exceed the accessory’s requirements.
-
Control signal from PathPilot
- Connect the USB I/O’s output pin and ground to the relay input.
- Verify polarity and voltage requirements (e.g., 5 V or 24 V logic).
- Test with a meter or indicator LED before connecting the accessory.
Once wired, powering that output line from PathPilot will energize the relay and turn the accessory on.
Configuring outputs in PathPilot
Exact menu names and screens may vary with PathPilot versions and machine models, but the general process is:
-
Install and connect the USB I/O kit
- Plug the USB I/O module into a USB port on the PathPilot controller.
- Power it as instructed by Tormach’s documentation.
- Reboot PathPilot if needed so it detects the hardware.
-
Verify I/O in PathPilot
- Open the PathPilot configuration or diagnostics screen.
- Look for an I/O status or diagnostics page showing digital inputs/outputs.
- Confirm your new USB I/O module appears and that outputs can be toggled manually.
-
Assign functions (optional but recommended)
- If PathPilot allows naming or labeling outputs, assign descriptive names:
- Output 1 → “Air Blast”
- Output 2 → “Aux Pump”
- Output 3 → “Light”
- This makes it easier to remember which output controls what.
- If PathPilot allows naming or labeling outputs, assign descriptive names:
Using M-codes to control outputs
PathPilot uses M-codes to switch outputs on and off. There are two main scenarios:
1. Standard coolant M-codes
If you are using built-in coolant outputs:
M8– Turn ON flood coolantM7– Turn ON mist coolant (if supported)M9– Turn OFF all coolant
Example:
(Drilling cycle with flood coolant)
G0 X1.0 Y1.0 Z0.1
M8 (Flood coolant ON)
G81 X1.0 Y1.0 Z-0.5 R0.1 F10.
G80
M9 (Coolant OFF)
If you connect an air-blast solenoid to the same relay as flood coolant, M8/M9 will control both. However, it’s usually better to give air blast its own dedicated output so you can control it independently.
2. Custom M-code I/O for accessories
For USB I/O or extra outputs, PathPilot lets you map specific M-codes to specific output channels. The exact M-code range and mapping method can depend on your machine/profile, but typical patterns include:
- Dedicated “User M-codes” that toggle outputs (e.g.,
M200,M201). - Custom macros that call internal functions to set/clear outputs.
A common approach:
- Choose an unused M-code (confirm in your PathPilot documentation or machine config).
- Create or edit a macro file that:
- Turns a specific output ON for one M-code (e.g.,
M200) - Turns the same output OFF with another (e.g.,
M201)
- Turns a specific output ON for one M-code (e.g.,
For example (conceptual, not exact syntax):
M200→ Set USB I/O Output #2 HIGH (air blast ON)M201→ Set USB I/O Output #2 LOW (air blast OFF)
Then use them in G-code:
(Example cycle with air blast)
G0 X2.0 Y2.0 Z0.2
M200 (Air blast ON)
G1 Z-0.25 F20.
G1 X3.0
G1 X2.0
M201 (Air blast OFF)
G0 Z1.0
Check your version of PathPilot and Tormach’s specific notes for the exact macro directory and syntax for output control. The logic is always the same: use one M-code to set a bit, another to clear it.
Recommended M-code patterns for typical accessories
Here’s a commonly used, easy-to-remember mapping pattern (you may adapt it to your available M-code range):
| Function | Output | M-code ON | M-code OFF |
|---|---|---|---|
| Flood coolant | Built-in | M8 | M9 |
| Mist coolant | Built-in | M7 | M9 |
| Air blast | USB Out #1 | M200 | M201 |
| Aux pump | USB Out #2 | M202 | M203 |
| Work light | USB Out #3 | M204 | M205 |
This keeps related actions in pairs (even = ON, odd = OFF), which is easy to remember when writing or editing programs on the fly.
Testing your setup
Before running a full program:
-
Disable motion
- Make sure the machine is clear.
- Keep feed hold or single-step control handy.
-
Test outputs manually
- Use PathPilot’s I/O or diagnostics screen to toggle outputs.
- Confirm the correct accessory turns on/off.
- Check for unexpected behavior (e.g., wrong accessory, chatter in relays).
-
Run simple test G-code
- Make a short file that only uses your new M-codes:
(Accessory test)
M200 (Air blast ON)
G4 P2.
M201 (Air blast OFF)
M30
- Observe behavior
- Verify outputs respond correctly.
- Listen for the solenoid or relay, confirm air/coolant flow, etc.
Safety and best practices
-
Use relays correctly
Never connect high-voltage or high-current loads directly to logic-level I/O pins. Always switch them with appropriately rated relays or SSRs. -
Protect from coolant and chips
Mount relays and wiring in enclosures away from coolant spray and chip impact. -
Label everything
Label your outputs, wires, and M-code mappings on the machine and in your documentation. This makes troubleshooting and future upgrades much easier. -
Test before production
Always test new accessories in dry runs or air cuts before using them in production parts.
Using PathPilot’s advanced features with I/O
Once your M-code I/O is working, you can combine it with PathPilot’s other features:
-
User-definable macros
PathPilot has built-in subroutine support. You can wrap sequences of M-codes and moves into reusable macros for tasks like:- Blow off part + probe cycle
- Coolant/air pattern during roughing and finishing
- Automated part loading sequences for robotic devices
-
Trajectory planner and high-speed machining
With look-ahead path blending, you can run high-speed toolpaths while still coordinating coolant and air blast via M-codes at key points in the program.
When to use USB I/O vs built-in coolant outputs
-
Use built-in coolant outputs if:
- You only need flood/mist control.
- You’re happy with standard
M7/M8/M9behavior.
-
Use USB I/O kits if:
- You need multiple independent accessories (air blast, vacuum, lights, pumps, robotics).
- You want fine-grained control of each accessory via separate M-codes.
- You are automating workflows beyond simple coolant control.
With PathPilot’s support for up to four USB I/O kits and 16 individually controllable outputs, you can integrate coolant, air blast, and a wide range of accessories into your CNC workflow. Wire your accessories through relays, map outputs to custom M-codes, and incorporate those M-codes into your programs for fully automated, repeatable control.