Lathe Collet Closer M Code

More
18 May 2018 14:20 - 18 May 2018 14:21 #110843 by OT-CNC
Replied by OT-CNC on topic Lathe Collet Closer M Code
You guys are great! Thanks so much. This was a bit of a mile stone for me today to get a bar pull operation to work on my lathe. I was previously the bar puller. :)

I just ditched the hal line containing the or2.1.in1

Here is a video. Disregard the ghetto way covers and slow rapids. Still need to tune down my acceleration as the rapids will shake the whole machine when turned up to full.


<iframe width="560" height="315" src="
" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
Last edit: 18 May 2018 14:21 by OT-CNC.

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

More
19 Jul 2019 09:34 #139860 by Erikcnc
Replied by Erikcnc on topic Lathe Collet Closer M Code
Hi,

I was trying to get this also to work on my lathe. I don't have a pedal, but i will use two buttons or also a footpedal.

I aint getting it to work though.

How does the code look like now? as in the M1** scripts as in the Hal file?

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

More
20 Jul 2019 16:48 - 20 Jul 2019 16:49 #139978 by OT-CNC
Replied by OT-CNC on topic Lathe Collet Closer M Code
I use a momentary switch on the foot pedal but could be a physical push button on your interface. I just kept it simple to get it going. Meaning in my case,there is no safety in place in case the spindle is running, you could open the collet while its running so keep that in mind. Maybe follow what Andy outlined earlier if you want it to not open at a certain rpm.
Here is what I have in the hal: (I can check later on what's on the machine, this is what I found on a backup)
Also, in the ini you need to set the user m_path. See Todds post:
forum.linuxcnc.org/38-general-linuxcnc-q...m-code?start=0#65476


########### ######## #########
# --- Collet Closer Foot Pedal Switch ---
# Collet Closer
addf or2.1 servo-thread

net collet-closer-pedal hm2_5i25.0.7i84.0.0.input-14 => or2.1.in0
net user_m100m101code => or2.1.in1

# --- COLLET-OPEN/CLOSE ---
net collet-open-close or2.1.out => hm2_5i25.0.7i84.0.0.output-09





In the executable files I have:

In the executable M100
#!/bin/sh
# open the collet closer
eval halcmd setp or2.1.in1 1
sleep 0.5
exit 0

In the executable M101
#!/bin/sh
# close the collet closer
eval halcmd setp or2.1.in1 0
sleep 0.5
exit 0

If any of this isn't right, I can double check the machine next time I power it up....
Last edit: 20 Jul 2019 16:49 by OT-CNC. Reason: clarification
The following user(s) said Thank You: Erikcnc

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

More
29 May 2021 03:12 #210581 by jacky
Replied by jacky on topic Lathe Collet Closer M Code
Hello Friend, good day. We are Chinese Manufacturer for Lathe Collet more than 15 years experience. We produce 140E, 145E, 173E Collet etc. Please check my link www.cncnctools.com/Lathe-Collet.html

Any question, please fell free to contact me below:

Mail: This email address is being protected from spambots. You need JavaScript enabled to view it..

Whatsapp/ Wechat: +86 14714816052.

Web: www.cncnctools.com

Catalog and other details will be sent on next mail. Hope to hear from you soon.

Thanks & regards,

Jacky

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

More
18 Jan 2024 13:15 #291023 by xenon-alien

Here is what I want to implement. I have a collet closer hooked up to a pneumatic solenoid that is nc, output pin on mesa goes high, opens the closer. M101/M102 open/close. Somehow there has to be a safety implemented that the closer can not open when the spindle is turning. So this needs to be linked to a motion component in hal? A button to add to the axis gui like open/close and error message when open M code is sent while spindle is turning would be nice. Where do I start?

Start with a HAL pin that goes high when the spindle is safe

I assume you have a spindle encoder and that the encoder velocity is already part of the spindle-speed-fb net.
Add this to your hal file:
loadrt near count=1
addf near.0 servo-thread
setp near.0.difference 0.5
setp near.0.in1 0
net spindle-speed-fb near.0.in2

http://linuxcnc.org/docs/2.7/html/man/man9/near.9.html
Now the pin near.0.out will go true when the spindle is doing less than 0.5 rps. You may want to decrease that further.
Now we need a truth table. bit0 is the spindle-speed pin, bit 1 is the manual release, bit 2 is the G-code input.



[table]
[tr]
[td]G-code[/td]
[td]manual[/td]
[td]spindle[/td]
[td]output[/td]
[/tr]
[tr]
[td]0[/td]
[td]0[/td]
[td]0[/td]
[td]0[/td]
[/tr]
[tr]
[td]0[/td]
[td]0[/td]
[td]1[/td]
[td]0[/td]
[/tr]
[tr]
[td]0[/td]
[td]1[/td]
[td]0[/td]
[td]0[/td]
[/tr]
[tr]
[td]0[/td]
[td]1[/td]
[td]1[/td]
[td]1[/td]
[/tr]
[tr]
[td]1[/td]
[td]0[/td]
[td]0[/td]
[td]0[/td]
[/tr]
[tr]
[td]1[/td]
[td]0[/td]
[td]1[/td]
[td]1[/td]
[/tr]
[tr]
[td]1[/td]
[td]1[/td]
[td]0[/td]
[td]0[/td]
[/tr]
[tr]
[td]1[/td]
[td]1[/td]
[td]1[/td]
[td]1[/td]
[/tr]
[/table]

This truth-table can be encoded in a LUT 5 HAL component.
http://linuxcnc.org/docs/html/man/man9/lut5.9.html

There is a tool here to calculate LUT5 codes:
https://docs.google.com/spreadsheets/d/1_VlL39jUOPpS8Tt9mpRK-eaSTS6C6PHBDoE3JitvLzs/

You want 168 or 0xA8 (in hex) to have the required function
[code]loadrt lut5 names=collet-interlock
addf collet-interlock servo-thread
setp collet-interlock.parameter 0xA8
net spindle-stopped near.0.out collet-interlock.in-0
net collet-manual collet-interlock.in-1
# in the postgui halfile you then need net collet-manual pyvcp.collet-button
net collet-release collet-interlock.out hm2_5i25.0.gpio.10.out

Then M101 needs to contain[code]halcmd setp collet-interlock.in-2 1 and M102 needs [code]halcmd setp collet-interlock.in-2 1
[/code][/code][/code]

Hello.

Can you help me out?
I have used your example in a strange mode and it's working. (the output disabling when the spindle is running, or turning by hand)
Is it possible disabling the spindle/program running (enable) until a collet sensor is inactive/active in manual mode? (PNP NC - so I'm getting 24v to the input, when it's OK, also added it to din-00, so it's checks, when will push out the rod)
I thought to use and2  spindle-anable + collet sensor, but it looks incorrect.
What will happen, when the sensor will has some issues..? The program will running without the spindle, or will turning on/off the spindle? 

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

Time to create page: 0.072 seconds
Powered by Kunena Forum