Hello Guest it is April 19, 2021, 01:46:16 AM

Author Topic: Tool Turret setup  (Read 4479 times)

0 Members and 1 Guest are viewing this topic.

Tool Turret setup
« on: June 24, 2014, 03:23:16 PM »
Hello all,
            Previously I completed a cnc conversion on BVB25L lathe and now I'm adding a 8 station tool turret to this cnc lathe:


I know I need a macro code for this, I did a search on Machsupport forum, found some code but not sure if that's the suitable one, here's the link:
http://www.machsupport.com/forum/index.php/topic,15569.0.html

can I use the code below for my tool turret?

'Macro Tool Changer

Sub Main()

Dim Tool As Integer
Dim OldTool As Integer
Dim NewTool As Integer
Dim MaxToolNum As Integer

NewTool = 10
MaxToolNum = 8 'Maximum positions on Automatic Tool Changer
Tool = GetSelectedTool() 'Get the toolnumber from the command e.g T0101 M6 Tool number 1
OldTool = GetCurrentTool() 'Get current tool number



If Tool > MaxtoolNum Then GoTo 6
If TOOL = OldTool Then GoTo 7
 
ActivateSignal(Output3) 'Turn on output signal to turn off spindle and turn on the atc
sleep(10)
ActivateSignal(Output4) 'Turn atc forward
sleep (3000) 'Needed to start atc otherwise it plays up

While  NewTool <> Tool
   ' CheckPins
If IsActive(Input3) And Not IsActive(Input2) And Not IsActive(Input1) Then
NewTool = 1
GoTo 5       'StopTool
End If
If Not IsActive(Input3) And Not IsActive(Input2) And Not IsActive(Input1) Then
NewTool = 8
GoTo 5       'StopTool
End If
If Not IsActive(Input3) And Not IsActive(Input2) And IsActive(Input1) Then
NewTool = 4
GoTo 5       'StopTool
End If
If IsActive(Input3) And Not IsActive(Input2) And IsActive(Input1)Then
NewTool = 5
GoTo 5       'StopTool
End If
If IsActive(Input3) And IsActive(Input2) And IsActive(Input1) Then
NewTool = 7
GoTo 5       'StopTool
End If
If Not IsActive(Input3) And IsActive(Input2) And IsActive(Input1)Then
NewTool = 6
GoTo 5       'StopTool
End If
If Not IsActive(Input3) And IsActive(Input2) And Not IsActive(Input1) Then
NewTool = 2
GoTo 5       'StopTool
End If
If IsActive(Input3) And IsActive(Input2) And Not IsActive(Input1) Then
NewTool = 3
GoTo 5       'StopTool
End If

Wend

5:
' Stoptool
DeActivateSignal(Output4) 'StopATC
sleep(10)
ActivateSignal(Output5) 'Run ATC in reverse
Sleep (3000) 'Wait 3 seconds to allow the toolpost to lock in
DeActivateSignal(Output5) 'Stop running ATC in reverse
Sleep (1000)
SetCurrentTool(NewTool)
DeActivateSignal(Output3) 'Turn off output to turn spindle back on
sleep(10)
GoTo 7

6:
MsgBox ("Tool out of RANGE")
Goto 7
 
7:

 End Sub


Thanks,

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Tool Turret setup
« Reply #1 on: June 24, 2014, 05:59:12 PM »
How does your turret operate? what signals does it require?

Hood
Re: Tool Turret setup
« Reply #2 on: June 24, 2014, 09:35:47 PM »
Hello Hood,
                The turret tool changer use a double acting cylinder ( http://en.wikipedia.org/wiki/Pneumatic_cylinder#mediaviewer/File:Doppelwirkender_Zylinder_Funktionsprinziep.gif)
attached at the back of the tool changer box so to change tool air applies to one of the tube to dis-engage then turn the the plate via a stepper motor to the desire position then applies air to the other tube to engage.

http://s1204.photobucket.com/user/cncfreakcncfreak/media/BVB25L%20cnc%20conversion/Tool%20turret%20ATC/M4V05238_zps5e2bf69a.mp4.html

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Tool Turret setup
« Reply #3 on: June 25, 2014, 06:03:56 AM »
Ok then what you will want is something like this.

First you will ideally have a Home switch fitted so that you can home the turret.
You also need 2 outputs for your cylinder.
You want to set up the motor tuning so that the A axis is per degree (assuming you are using A) and set the Vel and Accel according to your needs.
On general config page you want A is Angular, you also want Ang Short Rot on G0 and 360 rollover chosen and Rotary soft limits off.

When you do as above what should happen is when you command a tool position Mach will look to see the shortest route and go whichever direction it is.

The macro will be fairly easy and although I am not the best at VB I will give it a shot later on when I get a chance.

Hood
Re: Tool Turret setup
« Reply #4 on: June 25, 2014, 06:08:14 AM »
Thanks for the info.
Home Switch for Turret, where should this be placed? any related links?

thanks,

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Tool Turret setup
« Reply #5 on: June 25, 2014, 06:29:48 AM »
You dont need the home switch but it would be easier to set up as you could home the turret at each staart of Mach. If you dont have a home switch then you will have to ensure that the turret is in the correct position each time you start Mach.

If you do fit a home switch then an optical or a prox would be best and exactly how you fit would depend on the setup inside, you can maybe  fit a slotted disc in there for an opto or maybe have a magnet for a prox fitted.


Hood
Re: Tool Turret setup
« Reply #6 on: June 25, 2014, 09:44:18 AM »
I'll add a home switch inside the turret. If I use an incremental encoder would this work using the I (index pin)?

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Tool Turret setup
« Reply #7 on: June 25, 2014, 10:26:00 AM »
It will depend on what you are using, ie if it is the parallel port then the index from an encoder will be too short a duration. If it is an external controller then it may or may not be ok, all depends on the speed of the inputs on that controller.
Hood
Re: Tool Turret setup
« Reply #8 on: June 25, 2014, 10:43:22 AM »
This reminded me the slot disk behind the lathe chuck to read spindle speed, slot disk it is.

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Tool Turret setup
« Reply #9 on: June 25, 2014, 03:08:37 PM »
I thought about it and likely you will only be requiring 1 output for the air solenoid as the default position will be air clamping and you will only have one signal to change the solenoid valve.

Anyway here is a macro, it seems to work here, so hopefully it will do. Paste the following into notepad and save as M6Start.m1s  in the macro folder of the profile you are using.

OldTool = GetCurrentTool()
 
NewTool = GetSelectedTool() Mod 8
 If NewTool = 0 Then
  NewTool = 8
  End If

Tool = ((NewTool * 45) - 45)
 

 
If NewTool = OldTool Then
End
Else
ActivateSignal (OutPut1)
sleep 100
Code "G53 G0 A" & Tool
While IsMoving()
Wend
DeActivateSignal(OutPut1)
End If 

Hood
« Last Edit: June 25, 2014, 03:12:32 PM by Hood »