Switch relay in a defined x position
- Benb
-
- Offline
- Elite Member
-
Less
More
- Posts: 175
- Thank you received: 58
04 Aug 2025 16:01 #332824
by Benb
Replied by Benb on topic Switch relay in a defined x position
I misunderstood your previous inquiry.
Right, you are satisfied with the performance of your existing system and would like to add a switch to monitor whether the cylinder support is extended before allowing the machine to start. If this statement is correct than you have two choices:
The switch will act as permissive, ie when switch is active the machine should not be able to start.
Or the switch will act as an interlock, ie anytime the switch is active the machine shuts down?
Right, you are satisfied with the performance of your existing system and would like to add a switch to monitor whether the cylinder support is extended before allowing the machine to start. If this statement is correct than you have two choices:
The switch will act as permissive, ie when switch is active the machine should not be able to start.
Or the switch will act as an interlock, ie anytime the switch is active the machine shuts down?
Please Log in or Create an account to join the conversation.
- mgm
-
Topic Author
- Offline
- Elite Member
-
Less
More
- Posts: 206
- Thank you received: 13
04 Aug 2025 18:49 #332838
by mgm
Replied by mgm on topic Switch relay in a defined x position
Correct as interlock
If the cylinder is not retracted, the switch should stop all axles.
The axle needs about 2 seconds from the activation of the cylinder until it reaches the position of the cylinder!
If the cylinder is not retracted, the switch should stop all axles.
The axle needs about 2 seconds from the activation of the cylinder until it reaches the position of the cylinder!
Please Log in or Create an account to join the conversation.
- Benb
-
- Offline
- Elite Member
-
Less
More
- Posts: 175
- Thank you received: 58
04 Aug 2025 22:16 #332850
by Benb
Replied by Benb on topic Switch relay in a defined x position
If you just want to stop all axes when the cylinder support is extended then you can use “motion.enable” pin.
From doc, motion.enable:
If this pin is driven FALSE, motion stops, the machine is placed in the "machine off" state, and a message is displayed for the operator. For normal motion, drive this pin TRUE.
Practically: you need a limit switch wired to your hardware input. And you would need to add the following hal line to your existing hal file:
net cylndr.extnd hm2.your-input motion.enable
(Replace hm2.your-input with the correct address)
What the above hal code does: when hm2.your-input pin goes true the motion.enable pin will be true normal operation resume, when the cylinder is extended the switch opens and stop all axes motion. Assuming that the limit switch is normally open and your hardware input is sinking (positive logic).
From doc, motion.enable:
If this pin is driven FALSE, motion stops, the machine is placed in the "machine off" state, and a message is displayed for the operator. For normal motion, drive this pin TRUE.
Practically: you need a limit switch wired to your hardware input. And you would need to add the following hal line to your existing hal file:
net cylndr.extnd hm2.your-input motion.enable
(Replace hm2.your-input with the correct address)
What the above hal code does: when hm2.your-input pin goes true the motion.enable pin will be true normal operation resume, when the cylinder is extended the switch opens and stop all axes motion. Assuming that the limit switch is normally open and your hardware input is sinking (positive logic).
Please Log in or Create an account to join the conversation.
- mgm
-
Topic Author
- Offline
- Elite Member
-
Less
More
- Posts: 206
- Thank you received: 13
05 Aug 2025 19:42 #332914
by mgm
Replied by mgm on topic Switch relay in a defined x position
Thanks for the answer
The PIN for HAL is what I'm looking for.
The whole thing should be monitored by my comp. file mentioned above.
The spindle support is only retracted when the axle passes, and this is exactly when I want to monitor whether the cylinder is retracted.
I have no idea how to implement this in the comp. file.
I think it should be an abreage which checks whether the cylinder is really in the end bearing after the command to retract the cylinder.
The PIN for HAL is what I'm looking for.
The whole thing should be monitored by my comp. file mentioned above.
The spindle support is only retracted when the axle passes, and this is exactly when I want to monitor whether the cylinder is retracted.
I have no idea how to implement this in the comp. file.
I think it should be an abreage which checks whether the cylinder is really in the end bearing after the command to retract the cylinder.
Please Log in or Create an account to join the conversation.
- Benb
-
- Offline
- Elite Member
-
Less
More
- Posts: 175
- Thank you received: 58
05 Aug 2025 21:56 - 05 Aug 2025 21:57 #332928
by Benb
Replied by Benb on topic Switch relay in a defined x position
Did you add new limit switch to monitor the cylinder extended position?
if not, right now you are activating a relay when the cylinder position is in between
(cylinder-position < 900) and (cylinder-position > 1600)
And you would like to stop any axis movement when the above statement is true AND the cylinder-position < 1600?
please upload you hal file and I will add for you some hal code that you can test.
if not, right now you are activating a relay when the cylinder position is in between
(cylinder-position < 900) and (cylinder-position > 1600)
And you would like to stop any axis movement when the above statement is true AND the cylinder-position < 1600?
please upload you hal file and I will add for you some hal code that you can test.
Last edit: 05 Aug 2025 21:57 by Benb.
Please Log in or Create an account to join the conversation.
- rodw
-
- Offline
- Platinum Member
-
Less
More
- Posts: 11324
- Thank you received: 3801
06 Aug 2025 08:40 #332944
by rodw
Replied by rodw on topic Switch relay in a defined x position
Attachments:
Please Log in or Create an account to join the conversation.
- mgm
-
Topic Author
- Offline
- Elite Member
-
Less
More
- Posts: 206
- Thank you received: 13
06 Aug 2025 12:49 #332960
by mgm
Replied by mgm on topic Switch relay in a defined x position
Thanks for the suggestion, but I have already installed a pressure monitor with an e-stop, which is set at 4.5 bar.
Unfortunately, this did not prevent the support from breaking off, for whatever reason, I don't know.
Therefore, I would like to install an additional safety device.
Unfortunately, this did not prevent the support from breaking off, for whatever reason, I don't know.
Therefore, I would like to install an additional safety device.
Please Log in or Create an account to join the conversation.
- mgm
-
Topic Author
- Offline
- Elite Member
-
Less
More
- Posts: 206
- Thank you received: 13
06 Aug 2025 13:30 #332962
by mgm
Replied by mgm on topic Switch relay in a defined x position
Hello Benny,
I'm not sure if I expressed myself correctly,the file spinport.comp causes the cylinder to retract when the y-axis reaches position 900 (while processing a program or jogging), allowing the axis to pass through the support.
When the y-axis reaches position 1600, the cylinder is extended again.
I haven't changed anything on the machine yet because I'm on vacation. But after my vacation, I want to install the new spindle support quickly. I tore down the support shortly before my vacation!
I'm not sure if I expressed myself correctly,the file spinport.comp causes the cylinder to retract when the y-axis reaches position 900 (while processing a program or jogging), allowing the axis to pass through the support.
When the y-axis reaches position 1600, the cylinder is extended again.
I haven't changed anything on the machine yet because I'm on vacation. But after my vacation, I want to install the new spindle support quickly. I tore down the support shortly before my vacation!
component spinport "LinuxCNC HAL component that switches the spindle support";
description
"""
Component to trigger the spindle support
\\fBEXAMPLE:\\fR
.br
.br
loadrt spinport names=spport
.br
addf spport servo-thread
.br
net position axis.y.pos-cmd => spport.position
.br
setp spport.on 900
.br
setp spport.off 1600
.br
net spport-trigger spport.trigger
""";
author "Rod Webster"; [attachment=71242]spinport.comp[/attachment]
pin in float position "Motion signal for Axis position";
pin out bit trigger "True if spinport segment should be triggered";
param rw float on "Absolute axis coordinate from which the support is retracted";
param rw float off "Absolute axis coordinate from which the support is extended";
function _;
license "GPL";
;;
#include <rtapi_math.h>
FUNCTION(_) {
if((position > on)&&(position < off))
trigger = 0;
else
trigger = 1;
Attachments:
Please Log in or Create an account to join the conversation.
Time to create page: 0.134 seconds