Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Hellfire on September 08, 2012, 06:29:56 PM

Title: Mach3 turn atc
Post by: Hellfire on September 08, 2012, 06:29:56 PM
Hi and help lol
I have just done a conversion on a boxford mt2, the machine has a 8 position atc on it. I think the way it operates the stepper motor  rotates it  one way then reverses it to lock it in. There is only one proxy on it.
Do I need a macro to run it, lol I don't even know what a macro is or how to go about writing one. I have searched and seen a few macro's and to be honest it's just complete jibberish to me.
I think I need help

Thanks in advance
Title: Re: Mach3 turn atc
Post by: Dan13 on September 09, 2012, 03:25:52 AM
Are you sure it's a stepper and not an ordinary DC motor? Having a proximity sensor I would assume it's a DC motor.

A macro is needed, but first you need to figure the exact setup you have.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 09, 2012, 04:49:08 AM
Thanks for the reply, I am fairly sure it's a stepper motor and have it wired as such. It works fine, the proxy is on the turret.
I assume it's there to tell the system to reverse to lock it
Title: Re: Mach3 turn atc
Post by: Dan13 on September 09, 2012, 05:49:06 AM
Ok. Then you can use the switch for homing the turret. Since it's a stepper you will have to treat it as an axis and set it up in ports and pins and define the steps/per in motor tuning. For instance you could assign the A axis for the turret. Then you need to figure how many steps per one index of the turret the stepper has to make and enter this in the motor tuning. Once you know this you can write a simple macro to control the turret.

I suggest you doing a search on the forum for a macro and changing it to work for you. There are many here and I think you should be able to find something close to what you need. Anyway, see if you can find someting.

Dan
Title: Re: Mach3 turn atc
Post by: Hood on September 09, 2012, 06:07:24 AM
See if this thread may help
http://www.machsupport.com/forum/index.php/topic,17567.0.html

Hood
Title: Re: Mach3 turn atc
Post by: angel tech on September 09, 2012, 08:07:10 AM
unlike the smaller denford lathe atc, boxford use a stepper for rotation. If you have a datum you can tell the motor to go 45 degrees plus a small amount to clear the pawl, then reverse a few degrees until it locks again. If you do this move in incremental mode you don't have to worry about missed steps when it locks on the pawl when you reverse the stepper..
Title: Re: Mach3 turn atc
Post by: Dan13 on September 09, 2012, 10:26:00 AM
Here is a real quick one I made. Seems to work here in simulation.

numtools = 99                                              'The number of valid tools
newtool = GetSelectedTool( )                                         'read the new requested tool

currenttool = GetOEMDRO(1000)                                     'user DRO 1000 is used to store the current tool. In this line assign whatever is in this DRO to the variable
While(currenttool< 1 Or currenttool > numtools)                'Check that currenttool contains a legal tool number.
currenttool = question("Please enter the current tool")       ' If not ask to enter the current tool in position.
Wend
SetOEMDRO 1000,newtool                                               ' Set user DRO 1000 to the new tool number

dist = (newtool Mod 8 ) - (currenttool Mod 8 )                    ' the number of turret positions to move to the requested tool.

If (dist < 0) Then                                                            'Check if rollover needed
dist = 8 - Abs(dist)
End If

Code " G91 G0 A" & dist                                                  ' Move to the new turret position.
While IsMoving()
Wend
Code " G91 G0 A" & (-dist/5)                                           ' Reverse move to lock - set to 1/5th of one position and can be changed
While IsMoving()
Wend

Code "G90"                                                                  ' Set back to absolute mode.  

SetCurrentTool(newtool)


Set the A axis as above and although not mandatory check the rotational axis rollover in general config.

You can then use the proximity switch to home the A axis and set reset OEMDRO 1000.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 09, 2012, 03:37:59 PM
Thank you very much, do I just copy and paste that into the vscript.
As I said I am completely useless at this part of it.
Title: Re: Mach3 turn atc
Post by: Dan13 on September 10, 2012, 03:47:10 AM
You have to put the code into the M6Start.m1s file located under Mach3\macros and the name of your turn profile (if you haven't changed it, it would be Mach3Turn).

Oh.. just noted there was a small mistake in the code. On the reverse move line it should be:

Code " G91 G0 A" & (-1/5)

Dan
Title: Re: Mach3 turn atc
Post by: jasminder on September 10, 2012, 10:26:18 AM
hello dan13,
My god, you gave him a really good idea. (thanks for that because i am gonna copy that too)
I am making a similar turret but i was considering a dc motor and 8 switches to index the turret and that means a lot of wires and input/outputs to mach3. Now i will also use a stepper motor for the indexing and locking of the turret. (you are very right that using the incremental mode for the stepper will not care for the missed steps that are surely  going to be there when the ratchet and pawl will meet.
maybe i will need some help from you on the macro's part later.

thanks,
jasminder singh
Title: Re: Mach3 turn atc
Post by: Hellfire on September 10, 2012, 11:22:34 AM
lol almost scared to ask anything now as all you guys are clued into this.
ok copied and pasted it v scribt and saved as above file name.
typed t0202 in the mdi bar and nothing, how does mach turn know a axis is my turret.
ducks for cover
Title: Re: Mach3 turn atc
Post by: Dan13 on September 10, 2012, 11:35:52 AM
Hi Jasminder,

You could still use a DC motor and only need one switch running on a cam or an optical switch with a slotted disk.

Dan
Title: Re: Mach3 turn atc
Post by: Dan13 on September 10, 2012, 11:41:25 AM
You have to enable the A axis in Ports and Pins and then in Motor Tuning set the number of steps per one turret index. Actually just a bit more than one index so that it overshoots a bit and then reverses to lock.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 10, 2012, 11:44:12 AM
i have done that and set the steps also. will mach3 know i am using that as the turret then
Title: Re: Mach3 turn atc
Post by: Dan13 on September 10, 2012, 11:46:36 AM
Yes. The macro tells it to move the A axis. Go to General Config and under Tool Change select Automatic Tool Change.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 10, 2012, 11:50:54 AM
the macro you posted for me, do i just copy and paste the hole thing, is there anything i need to do with it.
i have tool change set to auto
Title: Re: Mach3 turn atc
Post by: Dan13 on September 10, 2012, 11:52:06 AM
Yes. Copy and paste it in the M6Start.m1s macro file.

Dan
Title: Re: Mach3 turn atc
Post by: jasminder on September 10, 2012, 01:01:22 PM
Hi Jasminder,

You could still use a DC motor and only need one switch running on a cam or an optical switch with a slotted disk.

Dan
I am sorry to say but then how mach3 will get a datum point for let's say tool no. 1.?

jasminder singh
Title: Re: Mach3 turn atc
Post by: jasminder on September 10, 2012, 01:05:38 PM
one thing about the hellfire's turret i would like to know is that "does it has a worm and gear"? or just a stepper attached by some sort of reduction pulleys + timing belts?

regards,
Jasminder
Title: Re: Mach3 turn atc
Post by: Dan13 on September 10, 2012, 01:11:58 PM
You set it manually to the current tool and then you can check Persistent Tool Selection in General Config and Mach will remember the last tool on a restart. You can add a second switch for homing when you power up the machine.

Of course 4 switches on an 8 position turret would be better as Mach would always know the tool in position, but it's more complex too and requires 4 inputs, although you could even do it with only 3 switches.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 10, 2012, 01:21:10 PM
jasminder, its a worm drive.
do i need to keep vb script running in the back ground or just close it.
when i push the play button on the vb script it asks me for current tool and the turret will move a bit.
but when i type t0202 into the mdi bar nothing happens
Title: Re: Mach3 turn atc
Post by: jasminder on September 10, 2012, 01:27:52 PM
you gotta type t0202 M6

jasminder
Title: Re: Mach3 turn atc
Post by: jasminder on September 10, 2012, 01:28:34 PM
remember that the m6 calls for the start and stop macros for the tool change

regards,
Jasminder
Title: Re: Mach3 turn atc
Post by: jasminder on September 10, 2012, 01:29:35 PM
I need some drawings/design idea of your turret .
Do you have any links or PDF of the machine or turret?

regards,
Jasminder singh
Title: Re: Mach3 turn atc
Post by: Hellfire on September 10, 2012, 01:37:16 PM
i will see what i can find.
still not working sorry
Title: Re: Mach3 turn atc
Post by: Dan13 on September 10, 2012, 01:38:58 PM
M6 is not required in Mach Turn. The correct way to call a tool change in Mach Turn is T0202. This will automatically call the M6Start macro.

You do not need the VB script editor be open in the background. Save it and close the window. Make sure you are saving the M6Start for the correct profile as I mentioned earlier. Also could be Mach is already at tool #2 when you issue T0202 so nothing happens. Check the Tool DRO in Mach.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 10, 2012, 01:42:27 PM
dont have a dro for the a axis, but i am alternating between tools. according to the tool no on mach
Title: Re: Mach3 turn atc
Post by: Dan13 on September 10, 2012, 01:44:00 PM
Please attach you XML file.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 10, 2012, 01:48:59 PM
thanks
Title: Re: Mach3 turn atc
Post by: Dan13 on September 10, 2012, 01:56:32 PM
Looks good here. Is you profile name "cnclathe"? If so, do you have the M6Start macro under C:\Mach3\macros\cnclathe ?

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 10, 2012, 02:05:28 PM
unbelievable ,thank you so much.
well that just proves how useless i am at this sort of thing.
i will go and stand in the corner now
Title: Re: Mach3 turn atc
Post by: Dan13 on September 10, 2012, 02:11:59 PM
Glad it worked.

Although a T0 call is illegal, but just to prevent the turret from moving if a T0 gets issued somehow I would add an If conditional like this:

numtools = 99                                              'The number of valid tools
newtool = GetSelectedTool( )                                         'read the new requested tool

currenttool = GetOEMDRO(1000)                                     'user DRO 1000 is used to store the current tool. In this line assign whatever is in this DRO to the variable
While(currenttool< 1 Or currenttool > numtools)                'Check that currenttool contains a legal tool number.
currenttool = question("Please enter the current tool")       ' If not ask to enter the current tool in position.
Wend
SetOEMDRO 1000,newtool                                               ' Set user DRO 1000 to the new tool number

If (newtool > 0) Then                                                     'Added this

dist = (newtool Mod 8 ) - (currenttool Mod 8 )                    ' the number of turret positions to move to the requested tool.

If (dist < 0) Then                                                            'Check if rollover needed
dist = 8 - Abs(dist)
End If

Code " G91 G0 A" & dist                                                  ' Move to the new turret position.
While IsMoving()
Wend
Code " G91 G0 A" & (-dist/5)                                           ' Reverse move to lock - set to 1/5th of one position and can be changed
While IsMoving()
Wend

Code "G90"                                                                  ' Set back to absolute mode. 

SetCurrentTool(newtool)

End If
Title: Re: Mach3 turn atc
Post by: Hellfire on September 10, 2012, 02:13:16 PM
your a true gentleman
Title: Re: Mach3 turn atc
Post by: Hellfire on September 11, 2012, 11:55:00 AM
numtools = 99                                              'The number of valid tools
newtool = GetSelectedTool( )                                         'read the new requested tool

currenttool = GetOEMDRO(1000)                                     'user DRO 1000 is used to store the current tool. In this line assign whatever is in this DRO to the variable
While(currenttool< 1 Or currenttool > numtools)                'Check that currenttool contains a legal tool number.
currenttool = question("Please enter the current tool")       ' If not ask to enter the current tool in position.
Wend
SetOEMDRO 1000,newtool                                               ' Set user DRO 1000 to the new tool number

If (newtool > 0) Then                                                     'Added this

dist = (newtool Mod 8 ) - (currenttool Mod 8 )                    ' the number of turret positions to move to the requested tool.

If (dist < 0) Then                                                            'Check if rollover needed
dist = 8 - Abs(dist)
End If

Code " G91 G0 A" & dist                                                  ' Move to the new turret position.
While IsMoving()
Wend
Code " G91 G0 A" & (-dist/5)                                           ' Reverse move to lock - set to 1/5th of one position and can be changed
While IsMoving()
Wend

Code "G90"                                                                  ' Set back to absolute mode. 

SetCurrentTool(newtool)

End If

hi all
ok i have the turret moving but not the correct amount. it takes 266 steps to get one full revolution in motor tuning.
in tool table i have setup some tools and asigned a degree in turret deg.
dose the turret deg relate to the position of the tool in the turret in degrees and if so why does the turret not move to this degree setting.
thanks in advance
Title: Re: Mach3 turn atc
Post by: Dan13 on September 11, 2012, 01:33:39 PM
Do not use the turret angle under Tool Table. You have to play with the Steps/Per in motor tuning till you get one index per one unit of A axis move. Enter in the MDI the following line:

G91 G0 A1

And play with the motor tuning till the above line advances the turret just the right amount. Also, change the reverse move line as I mentioned earlier.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 12, 2012, 07:22:38 AM
thanks Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 13, 2012, 11:17:40 AM
quick question, after the macro moves to the tool position and reverses does it reset the dro. what appears to be happining is when it reverses to lock i loose steps. then when i ask it to get the next tool it dosent quite make it.
cheers
Title: Re: Mach3 turn atc
Post by: Dan13 on September 13, 2012, 12:04:54 PM
Movement is incremental so lost steps should have no effect. May be you Steps per Unit setting is marginal. Try increasing it a bit.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 13, 2012, 12:39:29 PM
I have tried that, the problem is if i go to far it over shoots if choosing a tool more than 6 ahead.
It deffo seems to be loosing steps
Title: Re: Mach3 turn atc
Post by: Dan13 on September 13, 2012, 01:00:16 PM
I don't quite understand. Can you please be more specific and give more details about what is happening.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 13, 2012, 01:09:41 PM
i will try.
if i dont keep it marginal and i am on tool 1 and choose tool 8 it will over shoot tool 8 index and end up in tool 1.
if i choose a closer tool then its fine.
now if i keep it tight and move from tool 1 till tool 2, when it reverses its effectively driving against a dead stop for milliseconds. then when i select tool 3 it dosent quite make it.
Title: Re: Mach3 turn atc
Post by: Dan13 on September 13, 2012, 01:13:39 PM
What happens if you keep it tight and index from tool 1 to 8?

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 13, 2012, 01:16:44 PM
its fine. but if the reverse stage stalls the motor at all it wont make the next change.
Title: Re: Mach3 turn atc
Post by: Dan13 on September 13, 2012, 01:36:14 PM
Only reason I can think of is mechanical. Could be that the motor locks the turret so tight that when you command the next tool it loses steps trying to accelerate. Try decreasing the speed and acceleration of the A axis in motor tuning to some real low values ( I would say at least 1/10 of the current values) and see what happens.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 13, 2012, 02:00:12 PM
no not mechanical, tried that. sorry
Title: Re: Mach3 turn atc
Post by: Hellfire on September 13, 2012, 02:27:04 PM
ok managed to find a screen with an a axis for turn. when changing tools the a axis doesnt seem to reset.
Title: Re: Mach3 turn atc
Post by: Dan13 on September 14, 2012, 02:13:51 AM
It shouldn't. The moves are incremental.

If you want to reset the A axis after a tool change, just add this line to the end of the macro:

SetOEMDRO 803,0


Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 14, 2012, 11:01:10 AM
Dan you where right, it is mechanical.
i stripped the thing down and what did i discover, alternating ratchet distances. the tool turret holds 4 external tools and 4 internal.
is there any thing i can do.
Title: Re: Mach3 turn atc
Post by: Dan13 on September 14, 2012, 11:59:38 AM
That's bad news. That macro won't work then. You have to move in absolute then. Consider the macro that Hood suggested you at the beginning.

Dan
Title: Re: Mach3 turn atc
Post by: Hellfire on September 14, 2012, 01:36:19 PM
Oh no, i seen Hoods one but it activates a solenoid
Title: Re: Mach3 turn atc
Post by: Dan13 on September 14, 2012, 03:17:52 PM
Yes. Just remove that part.

Dan