Hello Guest it is March 19, 2024, 01:48:44 AM

Author Topic: Lathe turret Tool Changer, PLC, VB Scripts  (Read 10188 times)

0 Members and 1 Guest are viewing this topic.

Lathe turret Tool Changer, PLC, VB Scripts
« on: October 28, 2009, 12:22:58 PM »
Hi All,

I am working on a Takisawa DTX-1 Turret lathe and am using Mach3 for the retrofit.  I have used Mach on 2 other machines, a small 9X24 lathe and a Bridgeport sized Gorton 1-22 knee mill, but have not needed extra IO.

On this machine there is an 8-position turret (see photo) that I need to get going.  There are at least 9 inputs (8 tool positions and lock/unlock state) and at least 4 outputs (lock/unlock, motor on/off, motor brake on/off, and forward/reverse), just for the turret and things need to happen at specific times.  For instance, the direction cannot change with the motor on, among other things...

I have talked with Peter Homann and he has graciously volunteered to write some custom software for his ModIO card, but I am considering using an Automation Direct PLC instead, mainly so all of the outputs are relay controlled and all of the logic is a nice robust 24V.

So, what I am looking for are some general guidelines on doing this.  I have watched the videos on VB scripting and the modbus, and that all seems fairly straightforward.  Here are specific questions:

1-Would one program all of the timing functions in VB, or would that be done in the PLC "ladder logic" and the VB would just do "something" via Modbus after the M6start?
2-Is Modbus a robust enough interface for a serious machine like this?  With a 15 HP spindle and 2KW servo motors I want this thing under control at all times :-)

Thanks for any help or suggestions!
Dustin
www.protoplant.com

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Lathe turret Tool Changer, PLC, VB Scripts
« Reply #1 on: October 28, 2009, 01:27:03 PM »
I have the turret on my lathe controlled via the PLC and all the VB does is tell the PLC to do its stuff and then report back when its complete so the VB can then tell Mach to carry on.
 My Lathe has a 12.5KW AC servo Spindle and 3KW  AC servo Axis.
Hood

Offline jve

*
  •  128 128
    • View Profile
Re: Lathe turret Tool Changer, PLC, VB Scripts
« Reply #2 on: October 28, 2009, 02:44:57 PM »
I'm doing the same on my mill as hood did
Re: Lathe turret Tool Changer, PLC, VB Scripts
« Reply #3 on: October 28, 2009, 04:49:33 PM »
Hi All,


1-Would one program all of the timing functions in VB, or would that be done in the PLC "ladder logic" and the VB would just do "something" via Modbus after the M6start?
2-Is Modbus a robust enough interface for a serious machine like this?  With a 15 HP spindle and 2KW servo motors I want this thing under control at all times :-)

Thanks for any help or suggestions!
Dustin
www.protoplant.com



Hi Dustin,


2. Modbus was designed specifically for industrial control. It is robust enough.


1. There are 2 parts to the story.  Basically, the M6 toolchange Macro tells the ModIO or PLC to 'go to tool X'. The PLC does it's stuff and reports back "Now at tool X, or reports an error".

For example, below is the M6Start Macro I use for all the ModIO based toolchangers.


Code: [Select]
' Macro To interface To ModIO/TC
'
' The Mach3 Modbus interface should be configured:
' ModIO Checkbox NOT checked
' First line of AutoPolling Input not checked - No inputs can go to Ports
' and Pins
' Second line of Inputs Checked, Slave = x, Start Regs = 1200, # Regs = 3
' First line of Autopolling Output not checked - no output Ports & Pins
' Second line of Output Slave = x, Start Regs = 1100, # Regs = 2

' This macro should be used with M990 in the Mach3 Init string. This is needed
' to synchronisethe Initiation flag values in ModIO and Mach3.
' M999 must be called after a ModIO reset too.

Option Explicit ' requires declarations

Dim tool As Integer
Dim ChangesCalled As Integer
Dim Dummy As Integer

Dim ChangesWere  As Integer ' value before this request
Dim ChangerCount As Integer ' value returned from the ModIO
 

Dim ErrNo as Integer

Const ChangerCurrPos  = 64 ' Inputs  1200 Current tool
Const ChangerCountReg = 65 ' 1201 Change done indicator - this is the
' same as 1101 when done
Const ChangerErrCode  = 66 ' 1202 Error code reply if problems

Const ChangerReqPos   = 64 ' Outputs 1100
Const ChangerInitReg  = 65 ' 1101 initiates a change when made different
' to 1201

Const CallDRONo = 1080


' This just keeps count of the number of changes done
ChangesCalled = GetUserDRO (CallDRONo) ' what we think is current
ChangesCalled = ChangesCalled + 1
SetUserDRO CallDRONo, ChangesCalled ' remember new value in Mach3



' Now lets kick the ModIO/TC
tool = GetSelectedTool() ' what tool does user want

SetModOutput ChangerCurrPos, tool ' output requested tool number

ChangesWere = GetInput (ChangerCountReg) ' read current ChangerCountReg

SetModOutput ChangerInitReg, ChangesWere+1 ' initiate the turret change

ChangerCount = ChangesWere ' How many does it think is has done so far

While (ChangesWere = ChangerCount) And (GetInput (ChangerErrCode) = 0)
' not failed or finished
Sleep(50)
ChangerCount = GetInput (ChangerCountReg)
Wend ' loop until changer tells is it done something

If GetInput (ChangerErrCode) <> 0 Then
ErrNo = GetInput (ChangerErrCode)
Message "Toolchanger raised error " & ErrNo
Code "M0" ' chuck it all in.
' *** Must be a better solution here
Else
Message "Tool changed " & ChangesCalled & " times"
End If

     SetCurrentTool GetInput (ChangerCurrPos)

SetModOutput ChangerCurrPos, 0 ' Clear tool number incase the Mach3 and
' ModIO initiate counters get out of step
' when we might get a spurious change

   
' end of Toolchanger macro
 
' *** Note M6End.M1S should be empty     
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: Lathe turret Tool Changer, PLC, VB Scripts
« Reply #4 on: October 29, 2009, 12:06:59 AM »
Thank you for the input, I appreciate it.  I think I might go with the PLC for now, partly just because I want to get more familiar with their operation, etc.  Also, I am concerned that I would not be able to modify the program if I go with the ModIO, is that right Peter?  It is flashed into a PIC and I would not be able to change it?

Hood, you say that you have an AC servo for your spindle, how do you have that setup in Mach?  I was going to go into that here, but it turned into a new topic, called "spindle encoder, VFD, rigid tap, lathe"

Thanks again all,
Dustin

Re: Lathe turret Tool Changer, PLC, VB Scripts
« Reply #5 on: October 29, 2009, 01:14:01 AM »
Hi Dustin,

That's OK I understand.  The new ModIP I'm working on will allow you to write your own basic scripts in it. But it is some months away.

A PLC is also a good way to go.

Cheers,


Peter.
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com
Re: Lathe turret Tool Changer, PLC, VB Scripts
« Reply #6 on: February 04, 2010, 10:48:36 AM »
George,

Attached is the ladder program for my PLC.

Dustin

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Lathe turret Tool Changer, PLC, VB Scripts
« Reply #7 on: February 04, 2010, 02:18:45 PM »
Hood, you say that you have an AC servo for your spindle, how do you have that setup in Mach?  I was going to go into that here, but it turned into a new topic, called "spindle encoder, VFD, rigid tap, lathe"

Thanks again all,
Dustin



Sorry Dustin, I must have missed you posting that. Setting up a servo as a spindle is easy enough, its just like setting up any other axis, you just need your drive to be able to accept Step/Dir signals.
Hood