Hello Guest it is May 21, 2019, 09:20:25 PM

Author Topic: Servo axis switchable between spindle and angular position modes?  (Read 5300 times)

0 Members and 1 Guest are viewing this topic.

Offline nicad

*
  •  40 40
    • View Profile
I have an application that is very much like a lathe, where I have a servo motor with a 500 count encoder driving the spindle, powered by a G320.
I would like to know if I can switch Mach modes from "velocity" mode to "position" mode from my Gcode, so that I can also use the spindle as a "C" axis for indexing the stock in the spindle for live tool machining, from within my program.

IE- 
For normal spindle mode, I know Mach can run a "spindle" with steps or PWM. I would use steps, since it is going to a G320 servo amp.
Then for angular control, I know Mach can output step and direction, and is a normal rotary "C" axis.

I need to know if I can switch between these two modes dynamically from my Gcode program? I understand that absolute position would be lost while in spindle mode, but that would be OK..

Thanks-
Colin

Offline jimpinder

*
  •  1,233 1,233
  • Wakefield, West Yorks, UK
    • View Profile
Re: Servo axis switchable between spindle and angular position modes?
« Reply #1 on: March 25, 2008, 05:57:47 AM »
When you say dynamically, do you mean while everything is actually in motion, or can the machine stop until it changes.

As far as I know, there is no method of changing the configuration of Mach 3 from G Code - except through the known commands e.g. absolute and incremental positioning, or constant velocity mode, or other things.

Unless someone else can tell us, it would seem to me that what you are wanting to do is change the configuration of the spindle from a "spindle" to an axis. I am sure this could be done by writing a Vis Basic Macro, although where I peek and poke the relative information, I do not know.

I did, however, just think of a simpler way (perhaps). Have you tried controlling the spindle as though it were an axis yet.

Assuming that you can - and assuming the spindle stays in the correct position when you have done it, then why not resort to a relay system - a two pole change-over should do - controlled by an output from Mach3 - there are several available.
The machine stops - having been in "spindle" mode. The relay switches from the control wires for the spindle, to the control wires for the C axis - and you then control the c axis for your machining.

At the end, the relay disengages and you are back to a spindle again.

If you can drive your spindle from both types of output then that would seem the simplest way to me -


Not me driving the engine - I'm better looking.

Offline nicad

*
  •  40 40
    • View Profile
Re: Servo axis switchable between spindle and angular position modes?
« Reply #2 on: March 25, 2008, 02:44:30 PM »
Yes the axis would come to a stop first before switching.. not "while in motion". :)
It is what any lathe with a "C" axis (or "spindle indexing") can do. Or a mill that can ridged tap.

The hardware solution you mentioned could work, but I would think should be a last resort. Would require an added DC motor controller to run the spindle apart from the G320. Also, switching the encoder lines on and off from the G320 might make it upset. If you did not disconnect the encoder, the G320 would error out as soon a the "spindle" started spinning.

I know Mach can perform both functions. I just need to find out how, if possible, to switch between the two functions programmatically from Gcode. A VB macro might do the job, but someone with much more knowledge in that would have to say how to do it.

Art? Brian? :)

Offline jimpinder

*
  •  1,233 1,233
  • Wakefield, West Yorks, UK
    • View Profile
Re: Servo axis switchable between spindle and angular position modes?
« Reply #3 on: March 26, 2008, 06:04:41 AM »
I wasn't thinking of changing the drive wires to the motor - I was thinking of changing the control wires to the driver - as you are saying, principally the "step" wire.

This, in essence, is what you will do anyway - switch from spindle control to axis control - I was just thinking of a way I know Mach 3 could handle as I understand it.

I don't even know if something as simple as configuring Mach so that the step output on both the spindle and the drive appeared on the same pin all the time, and you just used the one you wanted, would work - would one interfere with the other ???

I think the first question is - have you tried driving your spindle from an axis output - we can work out how to change the configuration after that.
Not me driving the engine - I'm better looking.

vmax549

*
Re: Servo axis switchable between spindle and angular position modes?
« Reply #4 on: March 26, 2008, 09:13:19 AM »
Yes NICAD you can do the axisswap() inside of a program filevia an Mcode. Art also put in place some safeguard to keep from reswapping in the event you had to estop and the program lost control over the swap(;-)

If your Spindle servo drive has velocity/postion modes you can also swap between the modes via the Mcode at the same time.

(;-) TP

Offline nicad

*
  •  40 40
    • View Profile
Re: Servo axis switchable between spindle and angular position modes?
« Reply #5 on: March 26, 2008, 03:05:09 PM »
Jim- ah yes I think I see what you are getting at now... Yes that would be cleaner than the other hardware method I thought you were talking about.

Vmax- Thank you! I will look into the axisswap(). It sounds like it will do what I need.

vmax549

*
Re: Servo axis switchable between spindle and angular position modes?
« Reply #6 on: March 26, 2008, 03:21:57 PM »
Actually I think it should be SwapAxis(x,x)

(;-) TP

Offline nicad

*
  •  40 40
    • View Profile
Re: Servo axis switchable between spindle and angular position modes?
« Reply #7 on: March 26, 2008, 05:05:12 PM »
Yes looked into on the Yahoo group, where it was described in a bit more detail.
Any ideas if this will work with a SmoothStepper? I have a G100 and I am 99.9% sure it wont work with that.. even if it did, the G100 has no "spindle" output. And if it did, the ABS encoder counter register for it would overflow after a few minutes of use, and everything would go wacky. :) :)

How to find out the Axis # designation? What "axis" is the spindle output in Mach? I guess trial and error might have to take it from here. :)

Offline jimpinder

*
  •  1,233 1,233
  • Wakefield, West Yorks, UK
    • View Profile
Re: Servo axis switchable between spindle and angular position modes?
« Reply #8 on: March 27, 2008, 07:49:25 AM »
If you read the PDF file - Using3Mill - details of how to set up Spindle motor control are shown there - section 5.5.6.3 You connect your spindle driver to two of the normal output pins - step and dir, as you would an axis. I haven't seen anything on changing them in software.
Not me driving the engine - I'm better looking.