Manual pneumatic tool changer

More
18 Jun 2023 12:09 #273774 by bbenedikt03
Hello all,

I am new here and I am converting my first machine to Linux cnc. 
It is a Deckel FP1 with servo motors, linear scales, and a 6000RPM spindle with pneumatic manual tool changer. The machine is lubricated with an electronic central lubrication. For operation I have a 22° touch monitor and an old Heidenhain control panel with buttons and emergency stop. 
The whole thing is controlled with a 7i94 / 7i83 / 7i84 / 7i85.
I have already got the axes and the spindle as well as the central lubrication running with lube.py. 
Now I'm currently stuck on the pneumatic tool changer. This is operated by a solenoid valve. This solenoid valve is connected to a 7i84. 
I would like to actuate the tool changer with a button that is also attached to the 7i84. so that this does not happen while the spindle is turning, I would like to lock the whole thing together in the hal. It is already ensured with relays that the solenoid valve does not switch when the spindle is on, but I want to secure it additionally in the Hal.
I have already tried it, but failed. Can someone help me here?
 
This is my input: hm2_7i94.0.7i84.0.0.input-14
And this is my output: hm2_7i94.0.7i84.0.0.output-04

Additionally i have attached my hal and ini file.

Thank you very much in advance.
Attachments:

Please Log in or Create an account to join the conversation.

More
18 Jun 2023 17:29 #273792 by Aciera
One way would be to use the spindle enable signal and run it trough a not component
Then use an AND to connect your panel button to the output

net spindle-enable => not.spindle_enable.in
net spindle-enable_not <= not.spindle_enable.out => and.tool_chng_en.in0
net tool-chng-btn <= hm2_7i94.0.7i84.0.0.input-14 => and.tool_chng_en.in1

net tool-chng-en <= and.tool_chng_en.out => hm2_7i94.0.7i84.0.0.output-04


Additionally you might want to add a off_delay to the spindle_enable signal so that the spindle has time to come to a full stop before the tool change can be enabled.

linuxcnc.org/docs/2.9/html/man/man9/timedelay.9.html

Please Log in or Create an account to join the conversation.

More
18 Jun 2023 17:32 #273793 by Aciera
Also, if you are using a VFD to drive the spindle motor, it might provide a 'zero speed' output that indicates when the spindle is not turning.

Please Log in or Create an account to join the conversation.

More
18 Jun 2023 17:53 #273794 by spumco
[NOTE - I had this mostly typed up before seeing @Aciera's excellent response.  I'll post it in case it helps]

The HAL configuration will depend on what exact behavior you want to happen.

Behavior 1:
If you want the manual button to override the commanded spindle then connect your input pin signal to spindle.N.inhibit as well as the output solenoid.  The manual button will cause the spindle to stop.
net BUTTON-DRAWBAR  <= hm2_7i94.0.7i84.0.0.input-14
net BUTTON-DRAWBAR  => spindle.0.inhibit
net BUTTON-DRAWBAR  => hm2_7i94.0.7i84.0.0.output-04

The above works, but if the spindle is spinning when the manual button is pressed there is a delay during spindle decel when the air solenoid can activate.  Adding a timedelay based on your spindle decel time is one way to avoid a problem, but the timedelay will be active (and maybe annoying) every time you press the button - even if the spindle is stopped:
net DRAWBAR-BUTTON  <= hm2_7i94.0.7i84.0.0.input-14
net DRAWBAR-BUTTON  => spindle.0.inhibit
net DRAWBAR-BUTTON  => timedelay.0.in
net DRAWBAR-DELAY    <= timedelay.0.out
net DRAWBAR-DELAY    => hm2_7i94.0.7i84.0.0.output-04
setp timedelay.0.on-delay  ([i]enter value in seconds here you want to wait for spindle ramp-down[/i])

Behavior 2:
If you want the button to be unavailable while the spindle is rotating AND not permit the spindle to move once it's pressed I'd suggest using the VFD's zero-speed output with an AND2 component.
net DRAWBAR-BUTTON  <= hm2_7i94.0.7i84.0.0.input-14
net DRAWBAR-BUTTON  => and2.0.in0
net VFD-ZERO-IN            <= hm2_7i94.0.7i84.0.0.input-([i]some other input pin connected to VFD zero-speed output[/i])
net VFD-ZERO-IN            => and2.0.in1
net DRAWBAR-ACTIVE   <=  and2.0.out
net DRAWBAR-ACTIVE   => spindle.0.inhibit
net DRAWBAR-ACTIVE   => hm2_7i94.0.7i84.0.0.output-04

Don't forget to 'loadrt' and 'addf' any additional components like and2 or timedelay.
The following user(s) said Thank You: Aciera

Please Log in or Create an account to join the conversation.

More
19 Jun 2023 16:27 - 19 Jun 2023 16:28 #273861 by bbenedikt03
Thanks for your answer @Aciera
This solution looks promising, however I can't get it to work. I pasted your code into my HAL and also did loadrt' and 'addf' as noted by @spumco. Thanks

Now Linux cnc always throws me the following error message:
Debug file information:
Note: Using POSIX realtime
./deckelfp1.hal:336: Pin 'not.spindle-enable.0.in' does not exist
5107
Stopping realtime threads
Unloading hal components
Traceback (most recent call last):
  File "/home/deckelfp1/linuxcnc/lube.py", line 16, in <module>
    time.sleep(10) # run pump for 10s
    ^^^^^^^^^^^^^^
KeyboardInterrupt
Note: Using POSIX realtime


I have already tried with different spindle enable pins, but I can't find a solution. I also tried to omit the not. once in case this function is not loaded somehow, but I get the same error.
My next thought was to find out the exact pin I need for spindle on on my machine, but either I couldn't find the right one, (my question would be where to find it) or the problem is somewhere else.

I use Linux cnc version 2.9.0

I hope you can help me also here so competently. Thanks a lot
 
Last edit: 19 Jun 2023 16:28 by bbenedikt03.

Please Log in or Create an account to join the conversation.

More
19 Jun 2023 16:51 #273863 by Aciera
Please post your current hal so we can see what you are working with.

Please Log in or Create an account to join the conversation.

More
20 Jun 2023 02:12 #273892 by spumco
not.spindle-enable.0.in should probably be not.spindle_enable.in (underscore)

Assuming you did

loadrt not  names= not.spindle_enable
addf not.spindle_enable   servo-thread

I'm betting it's a dash-vs-underscore thing.

Please Log in or Create an account to join the conversation.

More
21 Jun 2023 17:01 #273993 by bbenedikt03
Thanks for the quick feedback. So quickly I do not come to all the proposals around and to answer the questions.
I have tried again, and have now arrived at another error. It does not find the module not.

However, in the described folder I can find the not.so.

I have attached the error report and the current HAL.

Thanks a lot
Attachments:

Please Log in or Create an account to join the conversation.

More
21 Jun 2023 23:06 #274014 by pippin88
loadrt not.0  
loadrt and2

addf not.0                      servo-thread
addf and2.0                     servo-thread

net spindle-enable => not.spindle_enable.in

You load a 'not' called 'not.0', but then you are trying to use a named 'not' called 'not.spindle_enable'

​​​​Either define the 'not' as named

"loadrt not names=not.spindle_enable"

Or work with not.0 (no name)
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

Time to create page: 0.136 seconds
Powered by Kunena Forum