
PathPilot M-code I/O: how do I set up outputs to control coolant, an air blast, or other accessories?
Controlling coolant, an air blast, or other accessories with PathPilot M-codes is straightforward once your outputs are wired and mapped correctly. This guide walks through hardware options, configuration steps, and example M-code usage so you can reliably switch peripherals on and off from your CNC programs.
1. How PathPilot M-code I/O Works
PathPilot supports digital inputs and outputs that can be turned on or off with M-codes. These outputs can drive:
- Coolant pumps (flood or mist)
- Air blast solenoids
- Chip conveyors or augers
- Workholding (pneumatic or hydraulic)
- Probes and other accessories
Key concepts:
- Outputs: On/off signals from PathPilot to your hardware (via motion controller I/O or USB I/O kits).
- M-codes: G-code commands that toggle or pulse those outputs.
- Indexing / Mapping: Assigning PathPilot’s logical output numbers to physical I/O hardware pins.
Once configured, your G-code might include lines like:
M8 (coolant on)
M64 P2 (turn accessory on via Output 2)
M9 (coolant off)
M65 P2 (turn accessory off via Output 2)
2. Hardware Options for Outputs in PathPilot
Depending on your Tormach machine and setup, you may use:
2.1 Built-in Machine I/O
Many Tormach mills and lathes include built-in outputs on the motion controller or I/O board:
- Pre-assigned outputs for flood coolant, mist coolant, and sometimes spindle brake or aux outputs
- Often exposed as terminal blocks inside the control cabinet
You can piggyback off existing coolant outputs (e.g., M8/M9) or use spare outputs if available.
2.2 USB I/O Kits
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.
Highlights:
- Each USB I/O kit adds configurable inputs and outputs
- Ideal for adding air blast, chip conveyor, robot interface, or lights
- Outputs are controlled via M64/M65 or user-defined M-codes/subroutines
This is often the cleanest path if you’re adding multiple accessories and want flexible M-code control.
3. Electrical Basics: Connecting Your Accessory
Before changing anything in PathPilot, ensure the physical wiring is correct and safe.
3.1 Understand Your Output Type
Most CNC outputs are one of:
- Dry contacts / relays: The output acts like a switch, and you provide your own power (often best for pumps/solenoids).
- Transistor outputs (open collector): The output sinks or sources current; you must stay within voltage and current ratings.
Check your machine’s electrical documentation or the USB I/O kit manual for:
- Maximum voltage
- Maximum current
- Whether the output is sinking or sourcing
3.2 Connect Coolant, Air Blast, or Accessory
Typical wiring pattern:
- Power supply: Provide appropriate voltage (e.g., 24 VDC) for the pump or solenoid.
- Load: Wire the pump/solenoid in series with the output device.
- Output terminals: Connect the accessory in accordance with the I/O board or relay terminals.
For example, for a 24 VDC air blast solenoid:
- 24 V+ → solenoid (+)
- Solenoid (–) → I/O output (switching to ground)
- I/O common ground tied to 24 V supply ground
Always:
- Use proper fusing or circuit protection
- Respect any polarity markings on solenoids
- Follow Tormach’s and the accessory manufacturer’s wiring recommendations
4. Standard M-codes for Coolant in PathPilot
PathPilot uses standard coolant M-codes that may already be wired on many Tormach systems:
M7– Mist coolant ON (if available)M8– Flood coolant ONM9– All coolant OFF
If your machine’s flood coolant is wired to a built-in relay, you can use M8/M9 directly in your G-code. To repurpose or supplement this:
- You can drive a second relay off the same terminals as the coolant relay if electrical load allows.
- Or use USB I/O for independent control of flood, air blast, etc.
Example:
(Use flood coolant for this operation)
M8
G1 X0 Y0 Z-0.500 F20.0
...
M9 (coolant off at end of operation)
If you want air blast to mimic coolant behavior, you can wire the air solenoid to the same relay as the flood pump—but you lose independent control. For independent control, use a separate output (see M64/M65 below).
5. General-Purpose Outputs with M64 and M65
For user-configurable outputs (including USB I/O), PathPilot uses:
M64 Pn– Turn output n ONM65 Pn– Turn output n OFF
Where n is the output index PathPilot associates with a physical I/O pin.
Basic example for air blast:
M64 P2 (turn on air blast on Output 2)
G1 X1.0 Y1.0 Z-0.250 F20.0
...
M65 P2 (turn off air blast)
5.1 Confirming Output Numbers
Depending on your configuration:
- PathPilot may document I/O mapping in the machine configuration screen or control documentation.
- USB I/O kits typically provide a mapping table (e.g., Output 0–3 on Kit 1, 4–7 on Kit 2, etc.).
Once you know “which P number is which physical pin,” you can create standard usage:
- P0: Light tower, green
- P1: Light tower, red
- P2: Air blast
- P3: Chip conveyor
Maintain a simple internal “I/O map” reference for your shop.
6. Assigning Outputs to Accessories: Practical Examples
6.1 Example: Dedicated Air Blast Output
- Hardware:
- Connect your air solenoid to USB I/O Output 2 (or a free built-in output).
- Documentation:
- Note:
Output 2 = Air blast solenoid.
- Note:
- Program:
(Spot drilling with air blast)
T1 M6
G0 G90 G54 X0 Y0
M3 S3000
M64 P2 (air blast ON)
G81 R0.1 Z-0.250 F10.0
X1.0
X2.0
G80
M65 P2 (air blast OFF)
M5
M30
6.2 Example: Controlling Two Coolant Modes
If you want flood and air blast separate:
- Use
M8/M9for flood - Use
M64 P2/M65 P2for air
(Turn on flood coolant and air blast for heavy roughing)
M8 (flood coolant on)
M64 P2 (air blast on)
...
M65 P2 (air blast off for finishing)
...
M9 (coolant off at end)
7. Using Subroutines or Macros for Cleaner Code
PathPilot has user-definable macros and subroutine support built in. This is ideal for standardizing I/O control.
From the documentation:
PathPilot comes with subroutine support baked in. Operators can build and customize G-code subroutines for fast programming of specific application needs.
You can define accessory control subroutines like:
(--- O1000: Air blast ON ---)
O1000
M64 P2
M99
%
(--- O1001: Air blast OFF ---)
O1001
M65 P2
M99
%
Then call them in programs:
M98 P1000 (air blast on)
...
M98 P1001 (air blast off)
Benefits:
- Consistent accessory behavior
- Easy to update mapping in one place if you change wiring or P numbers
8. Verifying and Testing Your Setup
Before running a production program:
-
No tools, no workpiece:
Test with the machine clear and doors closed. -
Manual M-code tests:
Run simple snippets from the MDI:M64 P2 (does air blast come on?) M65 P2 (does it turn off?) M8 (does coolant behave correctly?) M9 -
Watch for incorrect wiring:
- Unexpected accessories activating
- No response from the intended accessory
- Overcurrent tripping fuses or breakers
-
Label everything:
Inside the cabinet and at the machine, label:- I/O terminals
- Relays
- Accessories and associated M-codes / P numbers
9. Best Practices for Reliable M-code I/O Control
-
Use separate outputs for independent accessories
Don’t chain multiple unrelated devices to the same relay unless they must always run together. -
Document your I/O map
Keep a simple chart near the PathPilot console so programmers know how to call each accessory. -
Use macros
Wrapping M64/M65 and M7/M8/M9 in subroutines makes code cleaner and easier to maintain. -
Plan for growth
PathPilot can support up to 4 USB I/O kits (16 ins / 16 outs). Reserve some outputs for future devices like probes, robots, or status lights. -
Stay within electrical specs
Use external relays/contactors if your pumps or solenoids draw more current than the on-board outputs can handle.
10. When to Use USB I/O Kits vs. Built-in I/O
Use built-in I/O when:
- You only need basic coolant control (M8/M9, M7/M9).
- The machine’s default outputs already match your needs.
Use USB I/O kits when:
- You need multiple independent outputs for automation (air blast, conveyors, robots, lights).
- You want explicit, individually addressable outputs controlled by M-codes.
- You’re customizing a cell or integrating external equipment into your PathPilot-controlled machine.
With up to 4 USB I/O kits supported, you can scale to many accessories while keeping control simple via M64/M65 and macros.
If you share which Tormach model you’re using and what accessory you’re wiring (e.g., 24 VDC solenoid, AC pump), I can outline a specific wiring and M-code mapping example tailored to your setup.