AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Explainer

Why a CNC axis needs an external interlock with a cylinder

Servo and stepper motion Published 8 min read By AutomateDirectUSA engineering team

Short answer

A check inside the G-code file cannot protect a pneumatic cylinder from a CNC axis, because a wrong or edited file simply skips it. Supervise the physical forward sensor together with the axis actual velocity in a high-priority task and raise an axis error when both are true; if the risk assessment calls it a safety function, use a safe operating stop per IEC 61800-5-2.

On this page
  1. Why can't the M-code in the part program protect the cylinder?
  2. What is the exact error condition the interlock must catch?
  3. How does the controller stop the axis when the condition is true?
  4. When must the interlock become a safety function instead of application logic?
  5. Example: what stopped-axis threshold catches a 50 deg/min A-axis move?
  6. How do you verify the interlock before releasing the machine?
  7. Which interlock architecture do you choose for your machine?
  8. Questions asked

The fault that destroys the cylinder is one condition: the cylinder is forward while the protected axis is turning. A check written into the G-code file cannot prevent it, because the protection then lives inside the very file that can be wrong: an edited or hand-written program skips the check and the axis drives into the unit. The fix is a CNC axis pneumatic cylinder interlock outside the program, a high-priority task that reads the cylinder's physical forward-state sensor together with the axis actual velocity and raises an axis error when both are true. Where the risk assessment demands a safety function, the same condition goes to a safe operating stop on a safety-rated drive per IEC 61800-5-2.

Why can't the M-code in the part program protect the cylinder? #

A part-program check cannot protect the cylinder because the protection then depends on every G-code file being correct: an edited, hand-written or wrong file can command the axis with the cylinder still forward, and nothing outside the file will notice. An M-code is a command, not a supervisor. A blocking variant of the M-function can hold program execution while the forbidden state exists, but that protection is present only in files where the check was written, in the right place, every time.

The dangerous scenario is precisely the incorrect file: an operator edit at the machine, a hand-written program, the wrong file loaded, or a restart that picks up execution past the check. The program then commands the move with the unit still forward, and no program-level logic objects. Because the failure you are guarding against is a bad program, the guard cannot live inside the program. The condition has to be evaluated by something that sees the machine itself.

What is the exact error condition the interlock must catch? #

The condition is cylinder forward AND axis moving: the physical forward-state sensor is true at the same moment the protected axis's absolute actual velocity exceeds a small stopped-axis threshold, evaluated by the controller continuously, independent of any M-code. The forward state comes from the cylinder's position sensor, the switch at the forward end of stroke, never from the commanded M-code. The two disagree more often than you expect: a stuck spool, a burst hose, a held manual override or a failed solenoid can leave the cylinder forward with no command active, and a cylinder that never reached its switch leaves the command active with no forward state. Supervise what the machine is, not what the program last asked for.

The motion state comes from the axis actual velocity, read from the drive feedback through the standard MC_ReadActualVelocity function block of a PLCopen-style motion library and taken as an absolute value so rotation in either direction counts. Compare it against a small stopped-axis threshold: small enough to catch the slowest guarded feed, large enough to ignore the velocity noise of an axis merely standing still. The example below derives both bounds from numbers. The condition is a plain AND of two measured states and needs no knowledge of the program, which is exactly why it survives any program.

How does the controller stop the axis when the condition is true? #

A high-priority cyclic task evaluates the condition every cycle and raises an error on the protected axis through the motion library's axis-error function block, which stops that axis and reports the error to the CNC kernel. Run the evaluation in the highest-priority cyclic task the application has, so a busy program interpreter, an HMI update or a logging job cannot delay it; the task cycle time is what bounds your reaction time. Clear the execute input once the function block reports busy, following the call pattern your motion library documents.

Supervise the single axis, not only the axes group. A group-level error sees motion commanded through the group's interpreter and nothing else; a jog, a direct single-axis move or a second task commanding the axis sits outside its view. Axis-level supervision covers both, and it costs the same two signals.

After a trip the axis stands in an error state it shares with genuine drive faults; if the axis faults without your interlock firing, work the isolation sequence in troubleshooting a servo axis that faults mid move before blaming the interlock.

When must the interlock become a safety function instead of application logic? #

When the machine's risk assessment rates the axis-into-cylinder collision as a hazard needing risk reduction, the interlock must be a safety function: a safe operating stop (SOS) on a safety-rated drive per IEC 61800-5-2, fed by the cylinder sensor through a safety controller. Application supervision is a process interlock: standard controller code that protects the machine from a wrong file, with no rated performance behind it. That is the right tool while the consequence is a damaged cylinder and scrap. IEC 61800-5-2 is the standard that defines safety functions for drives, sorting them into stop functions and the rest, which includes the safe motion and safe brake functions.

Safe operating stop is the one that fits here: the drive stays closed-loop and monitors the standstill position, so while the cylinder is forward any attempt to move the axis raises a safe fault instead of motion. Implementing it takes a safety-rated drive with the safe motion functions and a safety controller that feeds the cylinder's forward sensor in through rated input channels, hardware decided at purchase rather than a parameter. The rated channels also close the hole a plain digital input leaves: a sensor stuck or unplugged reads as a fault, not as cylinder retracted.

The air side of the cell needs its own, separate protection: stopping a vertical air cylinder on a light curtain trip handles the pneumatic half, while this interlock handles the axis half. Which half needs a rated function is decided in the machine's risk assessment under ISO 13849-1; this page fixes the architecture, not the validation.

Example: what stopped-axis threshold catches a 50 deg/min A-axis move? #

For an A axis whose slowest guarded move feeds at 50 deg/min and whose standstill velocity noise measures 0.1 deg/s, the threshold is 0.35 deg/s, which is 0.001 rev/s when the controller reports velocity in revolutions per second. Take a rotary A axis whose guarded program line is G90 A50 F50, a move to an absolute 50 deg at a feed of 50 deg/min, with these illustrative inputs:

  • Measured standstill velocity noise, adjacent axes running: 0.1 deg/s. Measure it on your machine; it is the number that moves most.
  • Supervision task cycle time: 2 ms.
  • Axis scaling: one revolution per 360 deg, velocity reported in rev/s.

The arithmetic, a calculated example for these inputs and not a measurement:

  1. Slowest move that must be caught: 50 deg/min ÷ 60 s/min = 0.83 deg/s. A threshold above this misses the programmed move entirely, and the interlock protects nothing.
  2. Upper bound, half the slowest feed as margin (rule of thumb): 0.83 ÷ 2 = 0.42 deg/s.
  3. Lower bound, three times the noise (rule of thumb): 3 × 0.1 = 0.3 deg/s. Below it, the axis chatters the error at every idle.
  4. The window is 0.30 to 0.42 deg/s. Set the threshold at 0.35 deg/s, clear of both edges.
  5. Convert once into the controller's units: 0.35 deg/s ÷ 360 deg/rev = 0.00097 rev/s, so enter 0.001 rev/s.
  6. Reaction check: at the full guarded feed the axis covers 0.83 deg/s × 0.002 s = 0.0017 deg per task cycle, so the error fires with the axis barely off standstill, long before the cylinder sees load.

The window is the reusable result: derive the two bounds from your own noise and your own slowest guarded feed, in the units your controller actually reports, and pick the middle.

How do you verify the interlock before releasing the machine? #

Verify it in four checks: confirm the forward sensor reads true with the cylinder physically extended, command the guarded axis and see the error fire, repeat with a move commanded outside the CNC axes group, then walk the written recovery sequence.

  1. Sensor chain: extend the cylinder by its normal command and confirm the forward-state input reads true at the controller, in the task that runs the supervision.
  2. Axis stop: with the cylinder forward, command the guarded axis at the slowest guarded feed. The error must fire, the axis must stop under its error stop, and the CNC system must report the axis error.
  3. Coverage: command the same axis from outside the axes group, as a jog or a direct single-axis move, and confirm the same error. If you chose group-level protection instead, record that outside motion is uncovered, and reconsider, because the single-axis version costs the same.
  4. False trips: run a normal production cycle with the cylinder cycling and the axis idling between moves. Any nuisance error at standstill means the threshold sits inside the noise: remeasure and re-derive.
  5. Recovery: retract the cylinder, confirm the sensor reads false, acknowledge the error, re-enable the axis, and restart from a defined safe block, then write that sequence into the machine documentation.

That list proves a process interlock. A safe operating stop is validated under the safety function's own validation plan, not by a production trial.

Which interlock architecture do you choose for your machine? #

Choose independent supervision whenever a wrong or edited file can reach the machine, which is always worth assuming, and add a safe operating stop on a safety-rated drive only when the risk assessment rates the collision as a hazard requiring risk reduction.

  • Programs come only from a trusted post processor and are never edited at the machine: install the supervision anyway. It costs one task and two signals, and it is the only guard that sees a sensor or a valve disagreeing with the program.
  • Operators edit, hand-write or restart programs at the machine: the supervision is mandatory. A blocking M-code sequence alone is not an interlock here; it is the failure mode you are guarding against.
  • The risk assessment rates the collision as a hazard requiring risk reduction: add the safe operating stop on a safety-rated drive with the cylinder sensor on rated channels, and keep the supervision beneath it for ordinary error handling and restart.

In every case the core decision is the same: the condition that protects the cylinder is cylinder forward AND axis moving, evaluated outside the part program, on the physical sensor and the measured velocity. The M-code sequence remains what it always was, a command, and the machine stops trusting it.

Questions asked

Does CNC workspace monitoring cover this fault?

No. Workspace monitoring watches tool and axis positions against programmed working-envelope limits; it does not read pneumatic states, so it cannot relate a forward cylinder to axis motion. Only a dedicated supervision task or a safety function that reads the cylinder sensor will catch the condition.

Is safe torque off an alternative to a safe operating stop?

Safe torque off removes motor torque immediately, a stop category 0 under EN 60204-1. On a gravity-loaded axis that means a drop unless a holding brake catches it, while a safe operating stop keeps the drive closed-loop holding the standstill position. For a horizontal rotary axis either can hold; for a vertical axis choose the operating stop.

Can the interlock use the group feed override instead?

You can force a group feed override to zero or interrupt the axes group, but those functions are shared: an operator feed-override control or another program task can write them back, and they are not reserved for faults. The axis-error function block is reserved for error handling, which is why the supervision task calls that one.

What if the axis velocity is reported in mm/s instead of rev/s?

Then the constant 0.001 mm/s would sit inside standstill noise for most linear axes, and the interlock would nuisance-trip at every idle. Derive the threshold from your measured noise floor and your slowest guarded feed, in the units the controller actually reports, and convert once at the end.

Does the supervision protect the cylinder if the forward sensor fails?

Not by itself: a sensor stuck or reading false leaves the condition invisible while the cylinder is forward. Wire the forward detection so a broken wire or lost supply reads as cylinder forward, using a contact that opens in the forward position; the machine then refuses the move instead of running blind, and the failure shows up as a trip you can diagnose.

Keep reading

  • How-to

    Homing a Servo Axis to a Hard Stop With Torque Limit

    Approach the stop in torque control at a torque below the actuator's allowable end-stop load and low speed, accept contact only as sustained torque with near-zero velocity inside the permitted travel window, stop, then execute MC_Home with the Zero position preset method. The preset only writes the coordinate; sequence logic must qualify the stop first.

    Servo and stepper motion

  • Selection guide

    Pneumatic valve setup for double-acting robot grippers

    One 5/3 double-solenoid valve with a chosen center runs a single double-acting gripper cylinder: coil A closes, coil B opens, both off gives the idle state you ordered. Two spring-return valves on one manifold usually feed two functions — equalization, safety lock, cascaded exhaust — not one cylinder. Size the valve on peak flow: the worked example needs about 264 L/min at close.

    Pneumatics and hydraulics

  • Selection guide

    Why a Pneumatic Cylinder Will Not Sustain 5 m/s Motion

    No mainstream pneumatic cylinder is rated for continuous 5 m/s travel: documented high-speed lines top out near 2.5 m/s, and at 5 m/s the load carries 12.5 J per kilogram, 2.78 times the energy at 3 m/s. Commit to a belt-driven servo axis or a linear motor for that speed, and keep pneumatics for end-to-end transfers within the rated speed, cushion energy and cycle frequency of the exact cylinder.

    Pneumatics and hydraulics