603,379 active members*
3,589 visitors online*
Register for free
Login
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2013
    Posts
    5

    Smile 3 spindles on Z axis, activated with relays

    Hello everybody, and greetings from Spain.

    I am trying to set the right macros and postprocesor to run a Chinese (yes) CNC that has 3 spindles on the Z axis.



    There is a probe for Z height that I plan to use to set the tool height of each spindle.

    I am using Mach3 and I either work with Aspire software of with Autodesk Inventor. And here is my logic (I first want help with this and then will see if also with execution).

    I will set for now, three tools: T1, T2 and T3.
    When mach3 readys a M6T()
    it should activate the relay of that spindle
    then go home
    from there go to the probe
    execute Zprobe macro (M930)
    Then set that Height tool. Well, it will be at the bottom of the material, and probably would have to add an increment because we have a MDF sheet over the CNC and we then put the material on top of that).
    Then it can add material height + safety working height and then it can start the spingle and go to the job position.

    We usually use work coordinates rather than machine coordinates, so I have to take that into account when going home and then for the probe. Will work on that, I guess there is plenty of info in the forum.
    I am not sure how to tell which relay to activate according the tool number

    So, if M6Start.m1s
    tool = GetSelectedTool()
    SetCurrentTool( tool)

    Can I then run something like this?
    ActivateSignal (OUTPUT (2+tool))

    What I have is three relays on OUTPUT3, 4 and 5, and what to activate them with tool1, 2 and 3
    How can I tell the number of output related with the spindle number?
    Spindle1=T1=OUTPUT3
    Spindle2=T2=OUTPUT4
    Spindle3=T3=OUTPUT5

    Thanks for the help, and I hope it is clear my explanation
    Attached Thumbnails Attached Thumbnails photo_2025-01-24_14-16-39.jpg  

  2. #2
    Join Date
    Jul 2013
    Posts
    5

    Re: 3 spindles on Z axis, activated with relays

    Ok, some advances so far.
    I have made a script for M6start.m1s that homes the machine and z-probes each of the spindles and records the tool height.
    Will have to work around the work offsets or the spindle offsets and set that into the Tool change macro.

    Here is what I have:
    Sub Main()
    Dim currentTool As Integer
    currentTool = GetOEMDRO(824) ' Get the current tool number

    Select Case currentTool
    Case 1
    Call Tool1Probe()
    Case 2
    Call Tool2Probe()
    Case 3
    Call Tool3Probe()
    Case Else
    MsgBox "Tool not recognized"
    End Select
    End Sub

    Sub Tool1Probe()
    Call SendGCode("G10 L2 P1 X0 Y0 Z0") ' Set work coordinates for Tool 1
    Call SendGCode("G0 X512 Y11 Z5") ' Move to fixed position for Tool 1
    Call SendGCode("M950") ' Perform Z-probe
    Call SendGCode("G0 Z5") ' Retract Z-axis
    End Sub

    Sub Tool2Probe()
    Call SendGCode("G10 L2 P1 X166 Y0 Z0") ' Set work coordinates for Tool 2
    Call SendGCode("G0 X346 Y11 Z5") ' Move to fixed position for Tool 2
    Call SendGCode("M950") ' Perform Z-probe
    Call SendGCode("G0 Z5") ' Retract Z-axis
    End Sub

    Sub Tool3Probe()
    Call SendGCode("G10 L2 P1 X332 Y0 Z0") ' Set work coordinates for Tool 3
    Call SendGCode("G0 X180 Y11 Z5") ' Move to fixed position for Tool 3
    Call SendGCode("M950") ' Perform Z-probe
    Call SendGCode("G0 Z5") ' Retract Z-axis
    End Sub

    Sub SendGCode(gcode As String)
    Code gcode
    WaitForMovementToComplete
    End Sub

    Sub WaitForMovementToComplete()


    and the M950 is my Zprobe script. The probe is at the front of the machine, so the idea is to take the meassure and work with the bottom of the working piece (that is why

    PlateThickness = 33 'Z-plate thickness DRO

    If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
    DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
    Code "G31 Z-200 F500" 'probing move, can set the feed rate here as well as how far to move
    While IsMoving() 'wait while it happens
    Wend
    ZProbePos = GetVar(2002) 'get the axact point the probe was hit
    Code "G0 Z" &Z33 'go back to that point, always a very small amount of overrun
    While IsMoving ()
    Wend
    Call SetDro (2, -PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
    Code "G4 P0.25" 'Pause for Dro to update.
    Code "G0 Z20" 'put the Z retract height you want here
    Code "(Z axis is now zeroed)" 'puts this message in the status bar
    Else
    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
    Exit Sub
    End If

  3. #3
    Join Date
    Jul 2013
    Posts
    5

    Re: 3 spindles on Z axis, activated with relays

    my latest macro:
    I will try it today


    Sub Main()
    ' Declare variables
    Dim NewTool As Integer, OldTool As Integer
    Dim XProbe As Double, YProbe As Double
    Dim XShift As Double
    Dim PlateThickness As Double
    Dim ZProbePos As Double
    Dim StoredX0 As Double, StoredY0 As Double

    ' Set plate thickness
    PlateThickness = -33

    ' 1?? Deactivate all spindle outputs
    DeactivateSignal(OUTPUT3)
    DeactivateSignal(OUTPUT4)
    DeactivateSignal(OUTPUT5)

    ' 2?? Detect current tool
    OldTool = GetCurrentTool()

    ' 3?? Detect new tool from M6 command
    NewTool = GetSelectedTool()
    If NewTool = OldTool Then
    Exit Sub ' No tool change needed
    End If

    ' 4?? Store the current WORK coordinates of X0 Y0
    StoredX0 = GetOEMDRO(800) ' Work X coordinate
    StoredY0 = GetOEMDRO(801) ' Work Y coordinate

    ' 5?? Set X shift based on tool change
    Select Case OldTool
    Case 1
    If NewTool = 2 Then XShift = -166
    If NewTool = 3 Then XShift = -332
    Case 2
    If NewTool = 1 Then XShift = 166
    If NewTool = 3 Then XShift = -166
    Case 3
    If NewTool = 1 Then XShift = 332
    If NewTool = 2 Then XShift = 166
    Case Else
    XShift = 0
    End Select

    ' 6?? Move X axis to adjust for the new spindle
    If XShift <> 0 Then
    StoredX0 = StoredX0 + XShift ' Apply shift to stored WORK coordinate
    Code "G90 G0 X" & StoredX0 ' Move in work coordinates
    While IsMoving()
    Sleep(100)
    Wend
    Code "G92 X0" ' Set new X zero in work coordinates
    End If

    ' 7?? Activate output signal for new tool
    Select Case NewTool
    Case 1
    ActivateSignal(OUTPUT3)
    XProbe = 512
    YProbe = 11
    Case 2
    ActivateSignal(OUTPUT4)
    XProbe = 346
    YProbe = 11
    Case 3
    ActivateSignal(OUTPUT5)
    XProbe = 180
    YProbe = 11
    Case Else
    Message "Invalid Tool Selected!"
    Exit Sub
    End Select

    ' 8?? Move to probe position in machine coordinates
    Code "G90 G53 G0 X" & XProbe & " Y" & YProbe
    While IsMoving()
    Sleep(100)
    Wend

    ' Wait 3 seconds before probing
    Code "G4 P3"

    ' 9?? Cancel offsets & Start Z-probing (ONLY MOVES Z)
    If GetOemLed(825) = 0 Then ' Check if probe is not already triggered
    Code "G49 G40 G92.1 G90" ' Cancel tool, cutter, fixture offsets
    Code "G91 G31 Z-200 F100" ' Probing move (incremental mode)
    While IsMoving()
    Sleep(100)
    Wend

    ' Get exact probe hit position
    ZProbePos = GetVar(2002)

    ' Set Z-axis DRO to plate thickness
    Call SetDro(2, PlateThickness)
    Code "G4 P0.25" ' Pause for DRO update
    Code "(Z axis is now zeroed)"
    Else
    Code "(Z-Plate is grounded, check connection and try again)"
    Exit Sub
    End If

    ' ???? Move to Z50 (SAFE HEIGHT)
    Code "G53 G90 G0 Z50"
    While IsMoving()
    Sleep(100)
    Wend

    ' ???? Move back to the UPDATED stored work coordinate
    Code "G90 G0 X" & StoredX0 & " Y" & StoredY0 ' Now in work coordinates
    While IsMoving()
    Sleep(100)
    Wend

    ' Set the new tool as the current tool
    SetCurrentTool(NewTool)
    End Sub

  4. #4
    Join Date
    Jul 2013
    Posts
    5

    Re: 3 spindles on Z axis, activated with relays

    I finally made it work.
    With a slight different approach.
    Still needs refinement.
    Now I set WCS for G54 with tool1.
    Then machine zprobes all the tools and creates G55, 56 and 57.
    When the gcode calls an M6 command, the tool is loaded and the WCS is set accordingly.
    Super happy with the results, and I already adapted my postprocessor for this.

    NOW: THE PROBLEM.
    The Z is not consistent. It is loosing steps or something. I run the same job twice in a row and the Z has changed.
    Should I change driver steps? Current? both?

Similar Threads

  1. Why are keling ATC spindles so much more expensive than er11 spindles?
    By sburck in forum Automation Technology Products
    Replies: 2
    Last Post: 12-20-2019, 02:32 PM
  2. 4-Axis Rotary machine with 10 spindles
    By Roctech-Cathy in forum Roctech CNC Routers
    Replies: 0
    Last Post: 09-17-2015, 07:30 AM
  3. Y-Axis motor on Tormach 770 just keeps whining when activated!
    By Smokey911 in forum Tormach Personal CNC Mill
    Replies: 10
    Last Post: 03-18-2012, 01:23 AM
  4. Spindles de alta qualidade.High quality spindles.
    By Newtron in forum News Announcements
    Replies: 0
    Last Post: 09-21-2009, 08:33 PM
  5. slim-size spindles on Z-axis ??
    By capnl in forum Mechanical Calculations/Engineering Design
    Replies: 12
    Last Post: 10-26-2005, 08:56 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •