AXYZ 4008 ATC CNC router control retrofit

More
12 years 6 months ago #45677 by tsmutz5
@ papaours:
Thanks for the advice!

That’s some heavy looking iron you’ve got there! What kind of machine is it?

My plan is to keep the existing control system in place as it is functional but not great at 3d work. The wiring I’ve done so far plugs into the OEM connectors so I just un-plug the cables from the OEM controller board and plug my cables into them when I want to develop my Linuxcnc settings. During the day I am still using the OEM controller.

I’ve got pretty decent documentation for accel, decal, max linear, max angular, centripetal accel, steps per unit, etc. But my weakness is Linux!
Good advice on E-stop importance. I’ve operated and maintained some 30+ axis automated systems with close human interaction and man oh man is safety important. A runaway axis (something I’ve experienced with MACH on smaller machines) is a very scary thing. My hardware E-stop Chain is working (disconnects the drives and stops the spindle as fast as possible. I’ve still got to get Linuxcnc disconnecting the relays powering the drives/spindle.

Gmoccapy looks like a great GUI! I’ll have to look into it more once I get up and running. Thanks for bringing it to my attention.

The Cslab products look nice, and presents an “easier” path, kind of like “going to the darkside”  :cheer: It’s temping sometimes.

What I really like about Linuxcnc is how adaptable it is, but that edge cuts both ways as my programming knowledge is not developed enough yet to make it sing.

When I get my ATC working well I'll definitely let you know how I did it.

Talk soon.

Tyler

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

More
12 years 6 months ago #45691 by andypugh

tsmutz5 wrote: The machine only has one proximity switch for homing/limit on the X-axis. The signal for the X and Y proximity switches goes over the same conductor in the E-chain to the OEM control. So for Linuxcnc I think I’ll need the homing procedure to home Z then Y then X. This is done in the .ini with HOME_SEQUENCE correct?


Yes. You can basically use the original procedure and simply run two stepgens from the same axis position commands. You might want to add auto-squaring later, but lets leave that for now.

. The ATC detects the home stud by the distance from one pulse to the next is closer together than all others (around 1250 steps between tool studs). Once homed the ATC goes to the required number of steps to tool “?” hits the sensor, and then backs off till the sensor goes off then the tool change routine continues.

I think that you can do this using the normal homing routines and HAL logic. If you choose a homing direction such that the sensor sees the tool pin first then a oneshot in HAL set to run for about 75% of the time between studs during the homing procedure triggered from the falling edge of the sensor, then combined with an and2 component so that the homing signal is actually "Stud now AND stud recently passed" becomes the home signal.
www.linuxcnc.org/docs/html/man/man9/oneshot.9.html
www.linuxcnc.org/docs/html/man/man9/and2.9.html

So your first job is probably to sort out homing for the axes and toolholder. I think in this case, as you need axis movements to perform a tool change, it makes sense to do tool-change with a G-code routine.
The tool carousel can be any unused axis, but a rotary one (possibly C if you plan to use A and/or B later) might be easier.
It is also possible to consider using an non-axis stepgen for the toolholder. The stepgen doesn't care where the position commands come from.

I’m not sure about how to handle the homing/latching system.
The reasoning for the latching procedure for every tool is as the Y-axis slides the tool out of the holder the stepper could be pushed out of position by a burr or wood chip.


Assuming that the C-axis is the toolchanger, and the stepgen scale is set so that one-tool = one-unit I think my simplistic approach would be:

G0 C #<tool>
M66 P0 L0 (check that there is a stud at the sensor)
O100 IF [#5399 EQ 0] (no stud)
M64 P0 (trigger a HAL pin to re-home the C-axis, halui.joint.5.home)
M66 P1 L1 Q20 (wait for halui.joint.5.is-homed)
O200 IF [#5399 EQ -1] (homing timed out)
(message, PANIC)
O200 ENDIF
O100 ENDIF

{Rest of sequence}

There is quite a lot to configure, but it should be OK in bite-size chunks.

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

More
12 years 6 months ago #45692 by andypugh
As a tweak, after verifying that there is a tool at the sensor, a small move backwards ( G0 C[#<tool> - 0.01>] ) could be checked to ensure that the sensor goes off again, to verify that the carusel is near the correct stud edge.

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

More
12 years 6 months ago - 12 years 6 months ago #45716 by papaours
here is a nice ATC macro from Mach3 and CsLab for a commercial router.
it is not a carousel but it could be done whit a C axis in place of the Yaxis move

THat could not be easily translate to Linuxcnc but the frame and the message are good
the soft-limit override and the cone cleaning option are interesting.




Code:
'------------------------------------------------------------------------------ '----------------------------- '------------------------------------------------------------------------------ ' CS-Lab s.c. ' Toolchanger VB macro (MILL - Flat ATC with toolholders on the work table) ' v1.3 '------------------------------------------------------------------------------ '----------------------------- '------------------------------------------------------------------------------ '------------------------------------------------------------------------------ ' Digital outputs CONFIG '------------------------------------------------------------------------------ Const OUT_OPENCOLLET = 10 ' open collet CSMIO output Const OUT_CLEANCONE = 11 ' cone cleaning CSMIO output Const OUT_CURTAIN = 12 ' raise curtain CSMIO output '------------------------------------------------------------------------------ ' Digital inputs CONFIG '------------------------------------------------------------------------------ Const IN_COLLETCLOSED = 20 ' collet locked sensor CSMIO input Const IN_COLLETOPENED = 21 ' collet open sensor CSMIO input Const IN_TOOLINSIDE = 22 ' tool locked sensor CSMIO input '------------------------------------------------------------------------------ ' variables declaration - don't modify '------------------------------------------------------------------------------ Dim Z_TOOLGET, Z_LIFT, Z_SAFE, X_FORSLIDE, X_LOCK, Y_BASE, Y_TOOLOFFSET, TOOLCOUNT Dim ToolNew, ToolOld Dim SoftLimitsState As Boolean '------------------------------------------------------------------------------ ' CONFIG data '------------------------------------------------------------------------------ Y_TOOLOFFSET = 170.00 ' distance between tools Y_BASE = 42.93 ' Y position of first tool Z_TOOLGET = -311.3 ' Z position (abs) of tool get/relase Z_SAFE = -220 ' Safe Z for safe moving above tool holders Z_LIFT = 10 ' rise distance for cone cleaning X_FORSLIDE = -50 ' X position before slide tool into the holder X_LOCK = -100 ' X position for lock tool into the holder TOOLCOUNT = 6 ' Max. tool number '------------------------------------------------------------------------------ '------------------------------------------------------------------------------ ' ------------------------ ' Macro start ' ------------------------ '------------------------------------------------------------------------------ SetUserLED(1001, 1) ' UserLED 1001 - private info, toolchange is in progress ' Get the current tool # and new tool # ToolOld = GetCurrentTool() ToolNew = GetSelectedTool() ' save softlimits state If(GetOEMLED(23)) Then SoftLimitsState = true Else SoftLimitsState = false End If ' turn off softlimits - toolholders can be outside normal work area SoftLimitsOff ' raise the curtain Call SetCsmioOut (OUT_CURTAIN, true) ' check are the axes referenced If GetOEMLed(807) Then SetCurrentTool( ToolOld ) SetUserLED(1001, 0) DoOEMButton(1003) DoOEMButton(1002) Sleep(150) Message( "Machine is not referenced" ) Sleep(150) ' restore softlimit SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If If GetOEMLed(808) Then SetCurrentTool( ToolOld ) SetUserLED(1001, 0) DoOEMButton(1003) DoOEMButton(1002) Sleep(150) Message( "Machine is not referenced" ) Sleep(150) ' restore softlimit SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If If GetOEMLed(809) Then SetCurrentTool( ToolOld ) SetUserLED(1001, 0) DoOEMButton(1003) DoOEMButton(1002) Sleep(150) Message( "Machine is not referenced" ) Sleep(150) ' restore softlimit SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If If GetOEMLed(11) Then SetCurrentTool( ToolOld ) SetUserLED(1001, 0) DoOEMButton(1003) DoOEMButton(1002) Sleep(150) Message( "Spidnle is running. Toolchange failed." ) Sleep(150) ' restore softlimit SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If ' Spindle must be turned off for toolchange If (ToolNew = ToolOld) Then If (IsToolInside()) Then SetCurrentTool( ToolOld ) SetUserLED(1001, 0) Sleep(150) Message("Tool is already in spindle.") Sleep(150) ' restore softlimit SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If End If ' New tool # must be <= TOOLCOUNT If (ToolNew > TOOLCOUNT) Then SetCurrentTool( ToolOld ) SetUserLED(1001, 0) DoOEMButton(1003) DoOEMButton(1002) Sleep(150) Message("There is no such a tool.") Sleep(150) ' restore softlimit SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If Code("G0G53 Z0.0") ' Z up to machine '0' WaitForMove ' if current tool > 0 put it first into the holder If (ToolOld > 0) Then ' if there is no tool in spindle, skip this part If (IsToolInside()) Then ' move to the toolholder Code("G0G53 X"& X_FORSLIDE &" Y" & (Y_BASE + (Y_TOOLOFFSET * (ToolOld-1)))) WaitForMove Code("G0G53 Z" & Z_TOOLGET) WaitForMove Code("G0G53 X" & X_LOCK) WaitForMove ColletOpen CleanConeOn Sleep(1000) ' is collet opened? If (Not IsColletOpened()) Then ColletClose CleanConeOff Sleep(1000) Code("G0G53 X"& X_FORSLIDE) WaitForMove Code("G0G53 Z0") Code("G0G53 X0Y0") WaitForMove SetCurrentTool( ToolOld ) SetUserLED(1001, 0) DoOEMButton(1021) DoOEMButton(1002) Sleep(150) Message("Can't open collet! Toolchange failed.") Sleep(150) ' restore softlimit SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If Code("G0G53 Z" & Z_SAFE) WaitForMove CleanConeOff ColletClose End If End If ' If newtool = 0, there is no need to get new tool If (ToolNew = 0) Then Code("G0G53 Z0") WaitForMove Code("G0G53 X0Y0") WaitForMove SetCurrentTool( ToolNew ) Message("Tool loaded : " & ToolNew) Code("G43T" & ToolNew) ' G43 to sync tool length in system Code("G43H" & ToolNew) ' G43 to sync tool length in system WaitForMove SetUserLED(1001, 0) ' restore softlimits SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If ' Is there no tool in the spindle? If (IsToolInside()) Then Code("G0G53 Z0") Code("G0G53 X0Y0") WaitForMove SetCurrentTool( ToolOld ) SetUserLED(1001, 0) WaitForMove DoOEMButton(1021) DoOEMButton(1002) Sleep(150) Message("Can't get new tool, because other tool is already in spindle!") Sleep(150) ' restore softlimits SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If ' move to the new tool position Code("G0G53 X" & X_LOCK &" Y" & (Y_BASE + (Y_TOOLOFFSET * (ToolNew-1)))) WaitForMove ColletOpen Sleep(1000) ' check is the collet opened If (Not IsColletOpened) Then CleanConeOff ColletClose Sleep(1000) Code("G0G53 X"& X_FORSLIDE) WaitForMove Code("G0G53 Z0") Code("G0G53 X0Y0") WaitForMove SetCurrentTool( 0 ) SetUserLED(1001, 0) DoOEMButton(1021) DoOEMButton(1002) Sleep(150) Message("Can't open collet! Toolchange failed!") Sleep(150) ' restore softlimits SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If ' cone cleaning CleanConeOn Code("G0G53 Z" & (Z_TOOLGET + Z_LIFT)) Code("G1G53 Z" & Z_TOOLGET & " F3000") Code("G1G53 Z" & (Z_TOOLGET + Z_LIFT) & " F3000") Code("G1G53 Z" & Z_TOOLGET & " F1500") WaitForMove ' colled close CleanConeOff Sleep(500) ColletClose Sleep(1000) ' check is tool locked? If (Not IsToolInside()) Then Code("G0G53 X"& X_FORSLIDE) WaitForMove Code("G0G53 Z0") Code("G0G53 X0Y0") WaitForMove SetCurrentTool( 0 ) SetUserLED(1001, 0) DoOEMButton(1021) DoOEMButton(1002) Sleep(150) Message("Toolchange failed. Tool should be locked!") Sleep(150) ' restore softlimits SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End End If ' slide out from toolholder position Code("G0G53 X" & X_FORSLIDE) WaitForMove Code("G0G53 Z0") WaitForMove ' Go to absolute 0,0 Code("G0G53 X0 Y0") WaitForMove SetCurrentTool( ToolNew ) Message("Tool Loaded: " & ToolNew) Code("G43T" & ToolNew) ' G43 to sync tool length in system Code("G43H" & ToolNew) ' G43 to sync tool length in system WaitForMove SetUserLED(1001, 0) ' restore softlimit SetSoftLimits(SoftLimitsState) ' curtain down Call SetCsmioOut (OUT_CURTAIN, false) End ' ----------------------------------------------------------------------------- Public Function IsToolInside () As Boolean If(GetCsmioIn(IN_TOOLINSIDE)) Then IsToolInside = true Else IsToolInside = false End If Exit Function End Function ' ----------------------------------------------------------------------------- Public Function IsColletOpened () As Boolean If(GetCsmioIn(IN_COLLETOPENED)) Then IsColletOpened = true Else IsColletOpened = false End If Exit Function End Function ' ----------------------------------------------------------------------------- Public Function IsColletClosed () As Boolean If(GetCsmioIn(IN_COLLETCLOSED)) Then IsColletClosed = true Else IsColletClosed = false End If Exit Function End Function ' ----------------------------------------------------------------------------- Sub ColletClose () Call SetCsmioOut(OUT_OPENCOLLET, false) End Sub ' ----------------------------------------------------------------------------- Sub ColletOpen () Call SetCsmioOut(OUT_OPENCOLLET, true) End Sub ' ----------------------------------------------------------------------------- Sub CleanConeOn () Call SetCsmioOut(OUT_CLEANCONE, true) End Sub ' ----------------------------------------------------------------------------- Sub CleanConeOff () Call SetCsmioOut(OUT_CLEANCONE, false) End Sub ' ----------------------------------------------------------------------------- Sub SoftLimitsOff () If(GetOEMLED(23)) Then DoOEMButton(1029) End If End Sub ' ----------------------------------------------------------------------------- Sub SetSoftLimits (state As Boolean) If(state) Then If(GetOEMLED(23) = 0) Then DoOEMButton(1029) End If Else If(GetOEMLED(23)) Then DoOEMButton(1029) End If End If End Sub ' ----------------------------------------------------------------------------- Sub WaitForMove () While IsMoving() Sleep(15) Wend End Sub ' ----------------------------------------------------------------------------- Public Function GetCsmioIn (n As Integer) As Boolean Dim reg As Integer If(n < 16) Then reg = 90 Else reg = 91 n = n - 16 End If If(GetInBit(reg, n)) Then GetCsmioIn = true Else GetCsmioIn = false End If Exit Function End Function ' ----------------------------------------------------------------------------- Public Sub SetCsmioOut (ByVal n As Integer, ByVal state As Boolean) If(state) Then SetOutBit(90, n) Else ResetOutBit(90, n) End If End Sub ' -----------------------------------------------------------------------------
Last edit: 12 years 6 months ago by BigJohnT. Reason: insert code tags

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

More
12 years 6 months ago #46226 by papaours
Atc is working

This afternoon i have tryed the sub routine code i found on the net and it worked!

I must ad the tool ejected, tool locked input and soleinod to moove up the spindle....


To open and close the drawbar i have use m64 and m65 instead of m101/m102

The subroutine, check if there is a tool in the spindle, and drop it before to load one.

I hop it could help you.

Mael.


( ;Pick tool subroutines )
O<PickTool1> SUB
g53 G0z0 (safe height)
g53 g0 x0 y5.2 ( over slot )
g53 g0 z-65
m64p2
g53 g0 z-67.5
g4p3
g53 g0 z-70.5
m65p2
g53 g0 z0
#1000 = 1 (; toolchange success )
#1001 = [#5400]

O<PickTool1> endsub

O<PickTool2> Sub ( PickTool2 )
g53 G0z0 (safe height)
g53 g0 x0 y27.2 ( over slot )
g53 g0 z-65
m64p2
g53 g0 z-67.5
g4p3
g53 g0 z-70.5
m65p2
g53 g0 z0
#1000 = 1 (; Tool change success )
#1001 = [#5400]

O<PickTool2> endsub

O<PickTool3> Sub ( PickTool3 )
g53 G0z0 (safe height)
g53 g0 x0 y49.2 ( over slot )
g53 g0 z-65
m64p2
g53 g0 z-67.5
g4p3
g53 g0 z-70.5
m65p2
g53 g0 z0
#1000 = 1 (; Tool change success )
#1001 = [#5400]

O<PickTool3> endsub

O<PickTool4> Sub ( PickTool4 )
g53 G0z0 (safe height)
g53 g0 x0 y71.2 ( over slot )
g53 g0 z-65
m64p2
g53 g0 z-67.5
g4p3
g53 g0 z-70.5
m65p2
g53 g0 z0
#1000 = 1 (; Tool change success )
#1001 = [#5400]

O<PickTool4> endsub

( ;Drop tool subroutines )

O<DropTool1> Sub ( DropTool1 )
g53 G0z0 (safe height)
g53 g0 x0 y5.2 ( over slot )
g53 g0 z-65
m64p2
g4p3
m65p2
g53 g0 z0
O<DropTool1> endsub

O<DropTool2> Sub ( DropTool2 )
g53 G0z0 (safe height)
g53 g0 x0 y27.2 ( over slot )
g53 g0 z-65
m64p2
g4p3
m65p2
g53 g0 z0
O<DropTool2> endsub

O<DropTool3> Sub ( DropTool3 )
g53 G0z0 (safe height)
g53 g0 x0 y49.2 ( over slot )
g53 g0 z-65
m64p2
g4p3
m65p2
g53 g0 z0
O<DropTool3> endsub

O<DropTool4> Sub ( DropTool4 )
g53 G0z0 (safe height)
g53 g0 x0 y71.2 ( over slot )
g53 g0 z-65
m64p2
g4p3
m65p2
g53 g0 z0
O<DropTool4> endsub

O<Change_Tool> sub (change_tool)

( ;Use #1000 to indicate successful toolchange )
( Use #1001 to indicate old tool )
#1000 = 0 ( ; Tool change not performed )
O100 if [ [#5400] eq [#1001] ]
(msg,Tool already in spindle)
o100 endif
( ; check tool in spindle and exit sub )
o101 If [ [#5400] ne [#1001] ]
o102 if [[#5400] ge 5 ]
(msg,Please select a tool from 1 to 4.)
m0 ; stop
o102 else
( ;Drop current tool )
o103 If [[#1001] eq 1]
O<DropTool1> call
o103 endif
o104 If [[#1001] eq 2]
O<DropTool2> call
o104 endif
o105 If [[#1001] eq 3]
O<DropTool3> call
o105 endif
o106 If [[#1001] eq 4]
O<DropTool4> call
o106 endif
( ;Pick new tool )
o107 if [[#5400] eq 1]
O<PickTool1> call
o107 endif
o108 if [[#5400] eq 2]
O<PickTool2> call
o108 endif
o109 if [[#5400] eq 3]
O<PickTool3> call
o109 endif
o110 if [[#5400] eq 4]
O<PickTool4> call
o110 endif
o102 endif
o101 endif
o111 If [[#1000] eq 1]
o111 endif

O<Change_Tool> EndSub




m6 t1
o<Change_Tool> call
g0 x0 y0
g0 z50
m6 t2
o<Change_Tool> call
g0 x0 y0
g0 z50
m6 t3
o<Change_Tool> call
g0 x0 y0
g0 z50
m6 t4
o<Change_Tool> call
g0 x0 y0
g0 z50
m6 t0
o<Change_Tool> call
g0 x0 y0
g0z50
m2
The following user(s) said Thank You: tsmutz5

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

More
12 years 6 months ago #46228 by tsmutz5
Wow Mael !

This is great news.

I'm looking forward to implementing this sub routine.

This is a huge help, thank you.

Tyler

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

Time to create page: 0.375 seconds
Powered by Kunena Forum