Hello Guest it is April 18, 2024, 09:35:03 PM

Author Topic: Servo Spindle Question  (Read 2027 times)

0 Members and 1 Guest are viewing this topic.

Servo Spindle Question
« on: November 22, 2019, 02:13:08 PM »
My CNC has a Step/Dir servo spindle motor which holds position of the spindle very tightly. I currently have it set up as OB1 and control it with M03/M04/M05.

I would like, in a small set of use cases, to be able to command incremental positions of this spindle (position control). Say use a G code command C1.0000 to command 1 revolution forward of the spindle.

What is the "proper" way to configure a spindle in Mach 4 such that I can use both M03/M04/M05 *and* C#.####?

Are there any gotchas when doing this?
Re: Servo Spindle Question
« Reply #1 on: November 22, 2019, 02:43:16 PM »
Hi,
yes that can be done, I'm not sure that you would call it the 'proper way' though.

Because Mach can reassign motors to axes on-the-fly programmatically what I suggest is that you have two
axes defined, one your regular OB1 axis and the other a C axis.

Using:
Quote
rc = mc.mcAxisMapMotor(
      number mInst,
      number axisId,
      number motorId)

I believe you can assign your motor to each axis as required.
I would suggest you write two macros, m666,and m999 say.
m666 would assign your spindle motor to your OB1 axis, the normal operating condition. Thus m666 would need to be
included in all your Gcode jobs.
m999 would assign your spindle to the Caxis.

There may well be some complications that need to be worked through. For example the simple scheme I have sketched out would
require that the servo be step/direction in both modes with the same steps per rev in each mode. That data is stored in the ESS
and cannot, to my knowledge, be changed on the fly. I would suspect that the ESS would need to be power cycled to pick up
the fresh data.

What I did was to use two axes (OB and C) but with two permanently assigned motors. My OB axis is PWM and my C axis
is step/direction. When I wish to change mode I would have the ESS change a two pole relay and set an output for the
drive. I too use an AB3000 drive and I take advantage of the dual mode feature. In one mode (primary) its step/direction
and suitable as a C axis and the second mode its analogue velocity mode, all that is required is one digital input to the drive.
You've got to absolutely love modern AC servos!

You may recall I have just bought three 750W Delta B2 series servos for a new project and they have essentially the same
feature, namely dual mode operation with the application of just one input......so simple. I would guess that all new or recent
design servos would have the same feature or version of it. The competitive market requires that if one manufacturer does something
the others all do it too, just to keep up.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Servo Spindle Question
« Reply #2 on: November 22, 2019, 02:53:46 PM »
That's brilliant! Thanks.

I guess I will have to home the spindle whenever I switch to the C axis since I won't know where it is at that time. I'm starting to think about getting rigid tapping working on this machine.

I will have the spindle assigned to OB1 at startup and only switch to C axis when needed.

Do I need to do a profile save or anything silly to get the changes to apply after I call that mc.mcAxisMapMotor()?

Quote
For example the simple scheme I have sketched out would
require that the servo be step/direction in both modes with the same steps per rev in each mode. That data is stored in the ESS
and cannot, to my knowledge, be changed on the fly. I would suspect that the ESS would need to be power cycled to pick up
the fresh data.

Good news is that I am already using the spindle in step/dir mode. I would have no need to change this or the steps per rev.

Quote
You've got to absolutely love modern AC servos!

They are absolutely the coolest engineering marvel in my book :)

Thanks for the help, will likely follow up with more questions down the road.
Re: Servo Spindle Question
« Reply #3 on: November 22, 2019, 03:21:01 PM »
Hi,

Quote
Do I need to do a profile save or anything silly to get the changes to apply after I call that mc.mcAxisMapMotor()?

Yes, if you want the change to stick.

I imagine that in most circumstances that you will run in free running mode ie OB1 and only occasionally run in C axis mode.
Thus you are likely to switch mode during a session, rigid tap those holes, and then switch back to free running mode.
Thus there is no need to flush the change to the profile.

The only fly-in-the-ointment is if you change mode to C axis mode and then finish your session or Mach crashes and effectively
ends your session, Mach will detect the mode change and flush that change to the profile when it executes the screen un-load script.
This may well have destructive consequences when you next fire up Mach without realizing that the C axis mode was 'left over'
from last time.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Servo Spindle Question
« Reply #4 on: November 22, 2019, 03:26:41 PM »
I have a "Start-Up script" which sets everything to my default values and configures my servo drive parameters over serial when Mach loads. I will make sure to include a command to set the motor to OB1 every time Mach loads. I think this would get me around the issue?

I wish I had your depth of knowledge on Mach 4. I am working hard to get there, but there is a lot to learn.
Re: Servo Spindle Question
« Reply #5 on: November 22, 2019, 03:39:31 PM »
Hi,

Quote
I will make sure to include a command to set the motor to OB1 every time Mach loads. I think this would get me around the issue?

Yes, that is exactly the sort of precaution that you need to adopt.

Quote
I wish I had your depth of knowledge on Mach 4. I am working hard to get there, but there is a lot to learn.

I assure that my apparent 'depth of knowledge' is not nearly as deep as it might appear.

I have observed the progression of your posts over the year, or so, time that you have been using Mach4 and your knowledge has
increased vastly and in certain areas far exceeds my own.

In this particular case I have some experience of my own but the foundation of what I know about programmatically changing
motor/axis assignments came from a thread where I was trying to help some other bloke do something not dissimilar. The thread
is over a year old, I'll try to find it. Smurph weighed in at one stage of it....and he clears up misunderstandings quicker than my
mother used to tidy my room! (with a continual diatribe re my personal habits!!) ;D

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Servo Spindle Question
« Reply #6 on: November 22, 2019, 09:52:43 PM »
Craig,

Quote
I have observed the progression of your posts over the year, or so, time that you have been using Mach4 and your knowledge has
increased vastly and in certain areas far exceeds my own.

Coming from you this means a lot. I appreciate it. I have a long way to go but I am having a blast.

Will update this thread a bit later once I start some testing of the code.

Mike