- Posts: 617
- Thank you received: 0
Lathe Collet Closer M Code
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></iframe>
Please Log in to join the conversation.
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 to join the conversation.
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....
Please Log in to join the conversation.
Any question, please fell free to contact me below:
Mail: jacky@cncnctools.com.
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 to join the conversation.
- xenon-alien
- Offline
- Premium Member
-
- Posts: 157
- Thank you received: 0
Hello.
OT-CNC wrote: 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:[/code][/code][/code]Code: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
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 to join the conversation.
