Spindle Control
Spindle Control
The spindle control logic in the provided iCube Engineer project for use with Compass includes simple reference M-Code commands, both as an example of M-Code integration and as a starter for integrating specific spindle control into the Compass solution.
- Spindle control is performed in 2 distinct steps:
- Spindle Start / Stop commands (M-codes) is included in the base starter project
- Connections to specific hardware of the machine's controls can be made using these M-Codes as the base
- This is dependent on the actual hardware used for controlling the spindle
- Spindle Start / Stop commands by default are utilized using M-codes.
- M3 - Start Spindle clockwise direction
- S argument used with M3 / M4 sets spindle RPM
- P argument sets a delay (ms) for the spindle to reach the target velocity before acknowledging the M-code.
- M4 - Start Spindle counterclockwise direction
- S argument used with M3 / M4 sets spindle RPM
- P argument sets a delay (ms) for the spindle to reach the target velocity before acknowledging the M-code.
- M5 - Stop Spindle.
- No arguments are generally needed for the command
- Machine specific desired behaviors and logic must be considered alongside this
- E.g., If it is desired for the spindle to stop at the end of files automatically, during a feed hold, and other machinery related stop conditions
- Note:
- Control logic to start and stop the spindle hardware is not provided, and is dependent on the interface used for the spindle drive (e.g., analog, EtherCAT, Modbus, etc.)
- These M-Codes are generally expected by G-Code files to be closed loop commands, where they wait till the target speed is reached from the feedback
- This accounts for variations in tooling, variation over time, and specific spindle options on a machine
- M3 - Start Spindle clockwise direction
Example
Below shows an example integration of the spindle M-Code commands into a project that controls a spindle for a CNC router.
- M-code command samples:
- M3 S2500 P2000 - Spindle start CW, 2500 rpm, 2000 ms delay.
- M4 S18000 - Spindle start CCW, acknowledge immediately
- M5 P1000 - Spindle stop, 1000 ms delay.
- M-code logic samples:
- The logic executing M3 / M4 / M5 commands is setting and resetting appropriate VFD_Start, spindleStartCW, spindleStartCCW, spindleSpeed variables to be used in an actual spindle drive control logic.
- The logic below is a sample logic and is intended to be modified by the customer to match their specific application and machinery requirements
- Spindle hardware control using Yaskawa GA series drives:
- The drive is controlled directly using CiA402 communication standard.
- A minimum necessary data needed for this control is:
- Status word input
- Control word output
- Target velocity output
- Example of interlocking with other parts of the machine's control system
- Drive direction control is performed by negating the Target velocity value:
- The communication with the Yaskawa GA series drive is utilizing YaskawaVfdInterface function block which uses a state machine to directly enable CiA402 standard control word bits and monitor the status word: