Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: triag on May 07, 2009, 03:15:17 AM

Title: Stepper motor as spindle
Post by: triag on May 07, 2009, 03:15:17 AM

Hello,

I'm thinking of application where spindle motor is also stepper motor.

How can I configure Mach3 so that it can control this stepper motor as well using M3/M4 Sxx commands.

Title: Re: Stepper motor as spindle
Post by: Hood on May 07, 2009, 04:08:13 AM
If you are meaning just using a stepper as a spindle then its easy, just set up the ports and pins for the spindle then tune as you would an axis.
Problem will be that steppers loose torque the faster they turn so as long as your speed/torque requirements arent too big you will be fine.
Hood
Title: Re: Stepper motor as spindle
Post by: triag on May 07, 2009, 05:44:37 AM


Hi,

After look more carefylly I understand already a bit more. But still unclear what is relation for S xx to how many steps / s.

Can you please clarify which menu I have to use to define how many steps / s means example S200?


Title: Re: Stepper motor as spindle
Post by: Hood on May 07, 2009, 05:53:04 AM
If you have a stepper motor that has 200 steps per rev and your drive has 10 microsteps then you will put 2000 steps per unit as one unit is one revolution as far as the spindle is concerned.
Hood
Title: Re: Stepper motor as spindle
Post by: simpson36 on May 09, 2009, 07:18:21 AM
You will be very limited in what you can do with a stepper as a spindle.

Consider using a servo. It is basically the same kind of motor as a typical DC spindle, just has an encoder so it knows where it is.

The caveat is that the only reason (that I can think of) to want a stepper for the spindle is to get positional accuracy and in Mach, there is no facility for that on the spindle, so you are really no better off thatn using a regular motor and an indexer.

You can set up the spindle as an axis, which gives you the positional accuracy, but then you cannot run the motor continuously without some tricks. For an example of this  see the recent post entitled 'Success - Mini machining center . . '. (sorry I don't know how to link to other posts here).

There is a development effort going on right now for threading that may change the landscape on this issue.


Title: Re: Stepper motor as spindle
Post by: Hood on May 09, 2009, 08:00:19 AM
As has been said before if positioning  is required then it is a simple mater of swapaxis until the positioning is done then when normal operation is required then swap them back, can all be done within code with a simple macro.
 As for being better or worse, the servo or stepper will give you an exact speed very easily where using an induction motor it will normally not be such an easy process.

Hood
Title: Re: Stepper motor as spindle
Post by: simpson36 on May 09, 2009, 09:51:48 AM
The problem with swap axis . .  as has also been said before . . . is that once you go into 'spindle mode' you loose all reference to azimuth.

If there is some way to get that back, within code or simple macro, no one has yet posted it that I have seen.


The comment on motor speed is simply inaccurate.
Title: Re: Stepper motor as spindle
Post by: Hood on May 09, 2009, 10:15:07 AM
The problem with swap axis . .  as has also been said before . . . is that once you go into 'spindle mode' you loose all reference to azimuth.

If there is some way to get that back, within code or simple macro, no one has yet posted it that I have seen.

What is your definition of azimuth?

Quote
The comment on motor speed is simply inaccurate.
In what way?


Hood
Title: Re: Stepper motor as spindle
Post by: simpson36 on May 09, 2009, 12:28:06 PM
The problem with swap axis . .  as has also been said before . . . is that once you go into 'spindle mode' you loose all reference to azimuth.

If there is some way to get that back, within code or simple macro, no one has yet posted it that I have seen.

What is your definition of azimuth?

Azimuth = location by degrees around a circle.

I think you are a practical hands on kind of guy so I'll put theory aside and go practical example.

Suppose I deliver the following design to you for fabrication:  A keyway to cut in a shaft end that will also be threaded for a retention nut. The shaft has a shoulder on it with wrench flats and a second flat that is on a precise angle from the keyway, and on the opposite side from the flat is a threaded hole.
This ia an actual for a packaging line, incidentally. The keyway locates a cam and the flat locates a trigger arm. Once the cams and trigger are installed the wrench flats can only be accesses from one angle as there is an access panel, so even the wrench flats have to be on a certain azimuth relative to the cam angle.

To avoid an interrupted cut, you turn down the nose first and cut the threads.  OK so far swap axis to 'spindle mode' is working.

Now you swap axis to 'indexer mode' and machine keyway.

Swap axis back to 'spindle mode' and face the shoulder for the trigger arm, and cut a concentric locating bevel for the cam, and  . . oh yeah . . . almost  forgot . . a grove for a circlip . . . and what the heck, throw in an o-ring groove too.


Swap back to 'indexer mode' . . . cut the flat in the trigger shoulder 36.5 degrees away from the keyway  . . .  problem  . . where is the keyway? We have lost azimuth . . i.e. the machine no longer knows where it cut the keyway.

This problem will be repeated with the wrench flats and the threaded retention hole . . if any 'spindle mode' operations are done in between.

Don't argue this p[articular part could be sequenced to do all indexed operations together becuase that's neither always the case, nor efficient.

If there is something I am missing about how swap axis works and Mach can indeed retain or regain it's orientation after a swap axis, please feel welcome to correct me.



Quote
The comment on motor speed is simply inaccurate.
In what way?

Induction motors with a tachometer (including Mach's use of an index pulse) can be closely controlled relative to speed.

The only possible reason to cosider using a stepped would be to gain full azimuth control for the purpose of doing hard tapping of some other operation requiring agular accuracy. So in that respect only, steppers and servos are 'equivalent'.

However, that is where the equivalence ends. Even putting the torque loss aside, there is no stepper I am aware of that can run 25,000 or 7,500 or even 5,000 RPM. Making a comparison between a stepper and a servo motor relative to spindle speed is not reasonable . . just my opinion. Your mileage may vary. ood
Title: Re: Stepper motor as spindle
Post by: Hood on May 09, 2009, 01:11:21 PM
Being a fisherman I knew what was meant by azimuth in my trade  but was thinking your definition may be different, they however seem to be the same :).
 Ok so what I would do is use the index pulse for the spindle mode  but also set it up as a home switch for the A Axis, should therefore be a simple matter of homing the A Axis each time you swap from spindle to A. The homing could easily be written into the swap axis macro or am I still not following?


As for the motors then I mostly agree, especially with the stepper not being the most suitable motor for a spindle but then that would depend on the aplication, it is certainly excellent for my coil winderbut then again that is used mainly as an A Axis ;D
 I have never used Mach to control a spindle via a VFD but I have certainly seen lots of very experienced people that have problems with linearity and even when one is set up correctly the commanded speed is unlikely to be exactly what the spindle will actually do.
 This probably isnt an issue in reality as long as it is close but a servo (or stepper) commanded to do a certain speed will do that speed.
 The problem I have with VFD is loss of torque at low speeds and that is why I have gone different routes but maybe that is just because the VFD or motors I have used are not up to snuff.
 AC Servo in my thinking is the best for a spindle, constant rated  torque  from 0 to constant  rated speed.

Hood


Title: Re: Stepper motor as spindle
Post by: MechanoMan on May 09, 2009, 04:02:30 PM
I know about this and have dealt with it quite a bit.  In my case I needed to direct-drive a stepper as a lathe axis for very light stock and wanted to move around while keeping the A-axis moving constantly.  And call the A-unit a "rotation".

One, the format of G-code will have some problems with the concept.
Two, Mach3's brain will trash itself because of a numerical integrity bug in the acceleration rules.  It will corrupt its numbers and create software-originated stalls.  At least, I ran into it and dissected the problem to no end.

Allow me to explain.
Say you do tune one rotation= 2000 pulses on a 10-microstep G540.

The G-code problems:
Say you want to rotate at 800 RPM for 1 sec.  You can simply type G1 A[800] F800, but that's not interesting, it goes nowhere.
OK so I want to move to X=1 at 5 ipm.  BTW, Motor Tuning has X-jog limited to 50ipm.
G1 X1 A800 F800
Oh wait.  How many rotations did I really want?  How far did I go?  The line doesn't say.  Let's say I just know that I started at X=0.  So the travel should take 1/5th a min and 1/5th of 800 rotations in a minute is 160.  Uhhh... ok, so G1 X1 A160 F800?
But the Feedrate is not exactly correct.  In fact how does Feedrate work?  How would I get 5ipm?  Well, I know it limits XYZ on the basis on sqrt(X^2+Y^2+Z^2).  But rotational axis is something totally different.  As best I can tell it squares and sums it as well, even though this is a meaningless folly in reality.  That's not a Mach3 thing it's a G-code shortcoming.  So you'd have to calculate out a feedrate=sqrt(5^2+800^2)=F800.0156 wait, that basically means the X-axis speed can't be controlled with Feedrate because it has no effect.  RIGHT, the idea doesn't work for combining numerically small XYZ feedrates with numerically high rotational rates.  You want to say G1 X1 A160 F800 and adjust the number of spindle rotations it takes to get from point A to point B.  This becomes less accurate if high linear travel rates come into play and you may have to write in the Feedrate= sqrt(x-movement^2+y-movement^2+z-movement^2+800^2) equation AND adjust the number of revolutions it takes to get there.

The number of revolutions will build without limit.  Say the first move is:
G0 X0 Y0
G1 X1 A160 F800 and the second move is
G1 Y1 A160 F800
This is wrong because the A is absolute, not incremental (unless you put the whole darn thing in inc mode, the structure of G-code does not allow you to make only one axis incremental).   So next 1in move is A320,  next is A480, etc.
You can periodically reset it with G92 A0.  BUT, G92 takes all axes to a full stop and like a 1 sec pause due to a Mach3 implementation limitation.  So you can't use it between successive instructions.  The finish would be bad and it will take forever.

The Mach3 problem:
I found that when G-code gives lines with a very high ratio of delta-A to XYZ motion, there is about a 2% chance of an super-stall on any given line in Constant Velocity mode, even if the RPM is supposed to be constant and there is not even a big change in speed and direction on the XYZ axes.  It will not only stall the A-axis but potentially can stall any of the XYZ axes at the same time, despite being at low speed.  And it doesn't happen because A grew really really large.  I had it happen when A was near 0.  The problem likely originates from the obscenely high Feedrate needed to set the RPM creating an error in its internal velocity number and it somehow passes along an erroneous change in XYZA velocities that completely ignores the Motor Tuning acceleration.  Exactly where it happens in the code is completely random but will always happen at the same point in the code unless you change something.  It really surprised me though that the corruption did not always involve only the A-axis but sometimes the X-axis which was barely even moving before or after, and had a modest acceleration limit.

This is a bear to workaround.  But there IS a workaround.  The A-numbers in all the G-code lines have to be made numerically smaller.  Basically you gotta make the number of pulses per A-unit 10x or 100x larger in the Motor Tuning, and change max speed and acceleration as well.  Then you use numbers in the A-field 10x or 100x smaller.  Funny because this asks for the exact same movement in the end, but it puts delta-A on the same order of magnitude as delta-XYZ fields more sensible and the stalls will stop.  Downside here is that when the magnitude of A travel approaches the magnitude of XYZ travel then "the Feedrate (F-field)=rpm alone, and set the XYZ feedrate by changing the number of A-rots in that line" may not cut it.

Yeah, as you can see, I've "been there".
Title: Re: Stepper motor as spindle
Post by: simpson36 on May 10, 2009, 05:41:19 AM
Mechaniman; thanks for the contribution.

I've run into some of the same issues. My approach was to calc the number or rotations needed for the feed rate and movement and always used G0 since the A axis was the limit and it never was turning as fast as I wanted anyway.

example - 1" long cut @ .005 per rev. needs 1/.005*360 degrees of A axis movement, so G0  A72000 X1 got the job done.

For threading, I wrote a little macro to do the calculations and generate the G-code for Mach. Learning how to zero machine coords was a critical piece of the programming pie.

I have also run into the stalling issue, but it my case, it appeared as though Mach was not honoring the acceleration on the X axis. One thing is clear. Anything we do to get this working is going to be a work around, so there is no 'correct way'.


Hood: as usual, your comments are thought provoking (this is a good thing). I was immediately impaled upon this comment:

"Ok so what I would do is use the index pulse for the spindle mode  but also set it up as a home switch for the A Axis, should therefore be a simple matter of homing the A Axis each time you swap from spindle to A. The homing could easily be written into the swap axis macro or am I still not following?"



The only homing I have seen thus far is the arduous multi axis process, and stopping for that with every swap axis is not reasonable, but your comment indicates (I hope) that there is a way to home a single axis?

Would you post your proposed macro to accomplish a swap axis with the A axis homing?


Title: Re: Stepper motor as spindle
Post by: Hood on May 10, 2009, 05:59:34 AM
I am not the best at VB and I am sure you said you have done programing beforeĀ  so I will leave  the detailsĀ  up to you, but as far as homing goes then
DoOemButton(1025) will home the A axis. You will probably need to check first that it is not active, ie the axis is at such a position that the slot is in the sensor, easy enough I would think by looking at LED 39 (A axis home) and if it is active then move the axis before you start the home with a Code("G0A10") or whatever.

Obviously in your setup you couldnt have the A Axis with an index as I was referiing to the OP's setup but it would not be impossible to have the actual spindle index and an A Axis index connected to the index input but have a relay switch them depending on the state of the swap axis.
 Your next problem may lie in that you are using Mill and not turn, I dont know if G76 works in Mill, you may have to go back to your old method for threading. If so then the index issue wouldnt need addressed.

Hood
Title: Re: Stepper motor as spindle
Post by: simpson36 on May 10, 2009, 07:31:26 AM
Based on your previous comments, I tried the homing on the A axis yesterday and it works fine (I cheated and told mach the spindle index was on the A axis and then turned it by hand to see if it would stop the A axis homing rotation). I have a spare CNC4PC index setup that I can easily mount on my 4th axis so that's a non-problem.

I can dig into the scrpiting, no problemo. The scripting is easy enough, the only frustration is finding all of the Mach specific info as it seems there is no comprehensive manual. The info is spread around hear and there and is incomplete. I have collected all I could find on the Mach VB scripting and your clue about the 4th axis home command is probably enough to point me in the right direction, and so it just a treaure hunt at this point.

And your tip about checking the index state is an excellent one. I don't think I need G76, but I'll cross that bridge when I come to it.

Question: What is the command to swap axis?


Thanks for the  help. I'll see what I can come up with.




Incidentally, don't know if I mentioned it, but Simpson is part of clan Frasier from the Loch Ness region. We have a coat of arms, a Tartar I think it is called (hideous one, unfortunately) etc.




Title: Re: Stepper motor as spindle
Post by: Hood on May 10, 2009, 07:59:23 AM
Afraid as I have a SmoothStepper on all on my machines and none of them have parallel ports so I am unable to test (SmoothStepper does not support swap axis yet)
 Having said that I am almost certain either
SwapAxis(3,6)
or
SwapAxis(A,Spindle)

will work.


Hood
Title: Re: Stepper motor as spindle
Post by: simpson36 on May 10, 2009, 01:24:23 PM
Hood,

Thanks for the help and ideas and tips. Rehoming the A axis separately was the missing piece of the puzzle. I have it all working now!

There are some details to work out  . . swapped axis must be on the same BOB, etc. but it's all functioning.

My macro tests LED39 and if it is active, just rotates the axis 10 degrees before homing. Great idea . . that would have been one of those things that drives you crazy trying to track down.

I have to mount the index sensor on the 4th axis and a few other odds and ends, and then we'll see if the setup works, and if the re-homing is accurate enough.










Title: Re: Stepper motor as spindle
Post by: Hood on May 10, 2009, 01:27:17 PM
Homing should be accurate if using an opto, certainly is on my coil winder.
Hood
Title: Re: Stepper motor as spindle
Post by: MechanoMan on May 10, 2009, 01:32:12 PM
I misspoke.  I meant "zero", not "homing".  I am not sending the machine off to find home in a mechanical sense.  In fact since my stock is round, it does not matter at all what angle the A-axis starts at, they're all the same.  Later in the code I do start cutting flat sides into it and need to maintain the actual angle. 

For example, say you are lathing a cylinder into a profile:
G0 ...  A20
G0 ...  A50
G0 ...  A150
G0  ... A168

This is getting problematic.  The numbers get larger and larger indefinitely because I never turn back and rotate the other direction.  Now if I want to add ONE operation in there requiring an extra 20 turns, I may have to add 20 to like 100 other lines following it.

We can't say "G0 A0".  Well, you could, but it could mean hundreds of turns in the opposite direction as motion.  You could be there for a long time.
Instead I can just back off the work, say G92 A0 and the current location is considered zero so we have a divider in the code where it won't matter if you need to add rots before this line, we won't have to fix lines after the G92 A0.  All those lines rotate off the new zero so it'd be A20, A40, A60....   G92 does involve a 1 sec software-based pause which stops all axes.  This may create a mark in the work's finish so you may have to back the cutter off the work, G92, and reapproach.

This is especially good if you already separate code into sections based on different features.

Now if A1 is one rotation, as long as A is already a whole number before G92 A0, then it IS homed at 0 deg as well.  Mechanically, it was already home since it's at zero deg, but now it's software-home as well.
Title: Re: Stepper motor as spindle
Post by: MechanoMan on May 10, 2009, 01:33:40 PM
I was hoping that the SmoothStepper might fix the software-initiated stalls when using the A-axis like this.  No, it doesn't.  It will stall with the parallel port or with the SmoothStepper the same way.

BTW, long moves are NOT required.  In fact so far the problem seems to come up when there is very little XYZ motion.  I was profiling by doing 4 turns and 0.1" X-steps and Y being a variable radius (using side cutting).  Y changes slowly.  It's set up to be one continuous profiling cut.  But after the first 5 it would bomb on the 6th and stall out the A and X axes until the profile was done and it came to a stop. 

Boggled my mind that it's crawling the X-axis along at what equates to under 5 ipm, at what should be a fixed speed, and stalls it.
Title: Re: Stepper motor as spindle
Post by: sixmile on May 10, 2009, 02:34:59 PM
Hey Triag, why did you want to use a stepper for a spindle? Just curious.
Title: Re: Stepper motor as spindle
Post by: simpson36 on May 10, 2009, 06:56:39 PM
Mechanoman

Im a bit confused about your A axis rotation. In my setup A20 rotates the axis 20 degrees, not 20 rotations.

Just FYI, I ran the machine A coords up into the 10's of millions so there is a lot of room there before you need to worry about zeroing it out.


Someting I sould recommend to anyone having stalling problems os to open the task manager in windoes and watch the perfomance monitor. If you get too close to 100% CPU utilization, you are going to stall. An interesting test is to grab the Task manager itself and just drag it quickly around the screen while your g-code is running. If you are marginal on processing power, that will put it over the edge and the motors will stall.

Another general tip: don't assume that because your computer can pass a driver test at 60,000 that it can run Mach successfully at that speed.
 

Title: Re: Stepper motor as spindle
Post by: MechanoMan on May 10, 2009, 07:19:59 PM
Im a bit confused about your A axis rotation. In my setup A20 rotates the axis 20 degrees, not 20 rotations.
You can configure it any way you want by changing the number of steps in a "unit".  For a direct-drive stepper with a 10x microstep driver, that would be 2000 steps per "inch" in the Motor Tuning.  In fact, IIRC it wasn'teven possible to accurately use degrees at all because that would be 5.55555555555555(repeating) steps per "inch" to get A1=1 deg. 
The 360 rollover will not work correctly unless A1=1deg.  But we have to disable that for lathing purposes because otherwise it is limited to one turn per line, and IIRC some problem existed even with the direction it was going to turn.

Just FYI, I ran the machine A coords up into the 10's of millions so there is a lot of room there before you need to worry about zeroing it out.
The bug will occur without the A-axis going into high values.  The zeroing is necessary to make the code readable and maintainable.

Someting I sould recommend to anyone having stalling problems os to open the task manager in windoes and watch the perfomance monitor. If you get too close to 100% CPU utilization, you are going to stall. An interesting test is to grab the Task manager itself and just drag it quickly around the screen while your g-code is running. If you are marginal on processing power, that will put it over the edge and the motors will stall. 

Another general tip: don't assume that because your computer can pass a driver test at 60,000 that it can run Mach successfully at that speed.
The A-motion-induced stall bug has NOTHING to do with processing power.  It can happen running at 25khz on the parallel.  It will happen at the same time on a SmoothStepper which has no processing limits.  In fact, if you DO exceed the processing limits with a SmoothStepper, the buffer underrun will be recognized and it will halt on that.

What it's clearly doing is having a math error and sending out a completely off-the-wall number for speed between two normal speeds.  The speeds requested were well within capability AND the difference in speed- acceleration- on the commands is very minimal.  There's nothing exceptional in the code.  The only way it could stall with a SmoothStepper is asking for pulses to create 5ipm one moment, then like -999ipm, them 5ipm: a glitch.  If I could snoop and record the bus or brain traffic I'd know better what it actually did.
 
Title: Re: Stepper motor as spindle
Post by: simpson36 on May 10, 2009, 07:31:26 PM
It just seems to me that if you have A1 being a complete revolution, there is not much accuracy in your axis, but then I don't know what your objective is.

If I understand your comments correctly, you are saying that you are limited to one revolution per line of code? Why would that be?

Title: Re: Stepper motor as spindle
Post by: MechanoMan on May 10, 2009, 08:35:25 PM
If you're writing code for lathing with a lot of rotations, it is more readable to have A27= 27 rotations.  I guess I could write A[27*360] everywhere, but you can't even enter 5.5555555(repeating) into the pulses-per-inch field anyways because it's an irrational number.

Oh wait, NOW I remember.  I seem to recall that when fractions were entered into the Pulses-Per-Inch field, something about Mach3 broke badly.  5 would work.  6 would work.  5.55555... caused something horrible.  But I don't recall what.  Boogey Man reaches out and grabs your face?  No, I don't recall, but it did something totally erratic and inexplicable.

you are saying that you are limited to one revolution per line of code? Why would that be?

Because IIRC, if you DO use the Rot 360 Rollover in General Config, all entries into the A-field are interpreted as modulo 360.  So if you start at 0 deg, A3600  deg doesn't do 10 turns- it does zero.  Actually if you do A270 deg, it doesn't do 3/4 turn, it goes backwards 1/4 turn.  So I was wrong, it actually it limits each line to 1/2 turn.  This is not practical for lathing operations, a single move with 100 turns would have to be expanded into 200 lines.  Actually it's even worse because IIRC it wasn't clearly specified if a 180 deg turn was guaranteed to be performed going forward or backwards, so it might have to be expanded into 60 deg steps- 3 lines per turn- to clearly guarantee the turn direction.

I wish it would be that it rolled over the CURRENT position only, so A3600 is 10 turns in one direction and A-3600 is 10 turns in the other direction BUT at the end it would turn the A-DRO to 0 since 3600=0.  THAT makes sense.  Maintaining a DRO >+360 or <-360 on a rotary axis is nonsensical.  But wanting to rotate +3600 deg on a G1 move makes perfect sense.  Modding the end A-DRO value makes perfect sense. 
Title: Re: Stepper motor as spindle
Post by: Hood on May 11, 2009, 02:24:27 AM
MechanoMan
 I have never had that stalling problem on my coil winder but then I only have one other axis other than the A. I have mine set as 1 rev being one unit.
With the other axis I had a step per unit being a repeating decimal, .33333333 or .66666666  if I remember correctly and still didnt have an issue.

Hood
Title: Re: Stepper motor as spindle
Post by: MechanoMan on May 12, 2009, 03:04:38 PM
Well it's not a solid problem where it never works.  Something like 1 out of 100 moves fail.  Your coil winder probably only has one big move, doesn't it?  It'd be unlikely to see.  A more significant profiling job with lots of little moves makes it likely.
Title: Re: Stepper motor as spindle
Post by: Hood on May 12, 2009, 03:19:25 PM
One of the coils I do has 20,000 turns and that equates to 45 layers so the X axis is back and forth, have done over 50 of these particular ones. Also lots of others some with only 20 layers, some 10 and some only 4. Coils range from 45mm long to 500mm long.
Maybe it needs movement in more than two axis for the problem to show.
Hood
Title: Re: Stepper motor as spindle
Post by: MechanoMan on May 12, 2009, 04:11:05 PM
It doesn't require long movement, and long movement seems to be no more likely.  In fact, the problems I hit often seemed to be where there was a big A-rotation followed by a small one, such as where it backs the cutting head off the material but keeps turning.  And there were like 2 times when it happened specifically at the end of the code immediately before M5 (stop spindle), which was quite suspicious, but it also happened mid-code with no remarkable circumstances.

My theory is on a numeric integrity problem, where the acceleration or velocity is so low at one point in the calculation that a divisor got rounded to zero or simply got rounded to a point where it has harmful effects.  If any one axis runs into an acceleration or velocity limit from MT, then it has to scale all the steps on all axes to guarantee the specified move is followed.  And the feedrate is funky when we blend high A-rates with low XYZ rates.

Or it's having glitches due to, AFAIK, it's trying to make a vector sum out of X Y Z and A to compare to the Feedrate.  That's actually complete nonsense in reality.  When you specify F10 in an XY move, that limits the lateral cutting rate which directly sets the chip load and controls the bit stresses and degree of finish on the resulting cut.  On an X Y A move with A being a rotary axis, there's no telling what tool-vs-work velocity results from this command.  If the tool is far from the center of the A axis it is a high physical surface "feedrate" and if it's close then it's low.  So there's no way the code can actually generate a real surface feedrate off of this.  I think somewhere in the code it's confused as to what it's doing to implement this confused concept.


Title: Re: Stepper motor as spindle
Post by: simpson36 on May 13, 2009, 06:56:06 AM
Hood,

It took a bit of dinking around with the macros and the A has to home pretty slowly in order to be repeatable, but I got everything working and ran a workout program in an endless loop for about an hour. So far, so good.

FWIW, Mach has a bug in it where it will occationally refuse to run a macro . .  or maybe it just does not like MY macros . . . :)    I used M950 for my 'unswap and home' macro. Sometimes Mach will just get stubborn and it goes past the macro but does not execute the code. Close Mach and reopen it and it's fine again. That's not good from a reliability standpoint, however, so far if I just start Mach and load and run a program with the macro in it, everything goes well.

MechanoMan,

I'm having a hard time seeing the purpose of using the 360 rollover if the objective is to have continuous rotation. It's your call, but in my opinion, you are just making a lot more work for yourself using a mode that seems unsuitable for your application. It seems to me that I saw a 'radius compensation' or similar parameter associated with rotary axis, but I haven't had time to go back and research it. The software obviously needs to know how big your part is in order to calculate meaningful feed rates on the A axis circumference. I had no trouble using repeating decimals for steps. Lastly, I do know there are math problems within Mach evidence by a rather severe sidestep at arc tangents when using tool comp. In my example .008 caused a significant side step, yet .009 was perfect.

My comment on computers was general and not directed at your particular issue. I will add, however, that if you are doing all of your trouble shooting on the same computer, assumming your stalls have nothing to do with the computer, you are mistaken. There are numerous examples on this forum of people changing computers and starting to have trouble or of changing computers and their problem disappears. I recently changed from an old dual 850mhz P3 server running Win2k to a Pentuim 1.6ghz running XP. The 'better' computer had constant lock-ups with Mach and all of the motors were stalling like crazy. That computer runs everythig else fine and has for years. It just doesn't like Mach AT ALL!  I'm back now on the old server, but I can't use the XBox controller unless I have XP, so  . . .






 


Title: Re: Stepper motor as spindle
Post by: MechanoMan on May 13, 2009, 01:14:22 PM
I'm having a hard time seeing the purpose of using the 360 rollover if the objective is to have continuous rotation. It's your call, but in my opinion, you are just making a lot more work for yourself using a mode that seems unsuitable for your application.

I had no trouble using repeating decimals for steps. Lastly, I do know there are math problems within Mach evidence by a rather severe sidestep at arc tangents when using tool comp. In my example .008 caused a significant side step, yet .009 was perfect.

I never said I really wanted to use Rot360Rollover, nor have I ever tried to use it.  I only said it had to be disabled because it's incompatible with the one-rot-per-A concept.  I only said it would be very useful IF it were coded completely differently than it currently is, to avoid the serious code writing and maintenance problems when using ever-increasing-A.  I cannot add a feature that uses 50 rots mid-code without having to manually add 50 to say all 100 code lines after that.  That's not very practical to code.

Actually ideally I wish I could put A alone in "Incremental" mode.  That would be nice!  But Incremental would affect all axes and it's even less practical to write the XYZ moves as Incremental.

A "repeating decimal" is an irrational number.  It's a fine point, but any number with a finite length you enter in that field is rational and thus not quite exactly the correct number.  It actually is possible for this to cause an accuracy problem, although specific circumstances have to be met.
Title: Re: Stepper motor as spindle
Post by: simpson36 on May 13, 2009, 02:18:03 PM
I grant you the theory on killing an irrational number by rouding the last digit, but in practical terms, if one was to take the decimal out say 10 or even 20 places, the error would be insignificant in terms of a machine tool, so the argument is moot. The point correctly made was that Mach will take a decimal number and has no problem with it, at least not that I have encountered. There are errors in the math internaly as evidenced by certain behaviors, but I am not convinced it is the cause of stalling. I doubt this is knowable unless one were privy to the source code and had a LOT of time to study it.

I've been thru a couple of iterations now on setting up a 'universal' 4th axis.

The epiphany for me was that Mach is essentially a WIP and there are some interesting things it can do that are not documented, or have only recently been published in a somewhat obscure manner. So my assumption was incorrect that if I did not read about it in a  manual, it was not available.

Useful info I gathered was first that an axis can be zeroed anywhere in the G-code.

         Using that function, you can make any axis act 'incrementally' independent of the others, in effect.

The next magic trick was that machine coord can be set to zero at any point via VB.

        That eliminates the accumulation of mach coord until some overflow . . which would be at some rediculously high number anyway, but . . . )

The final piece of the puzzle was that any axis can be re-homed again via VB.

       That function makes the swap axis solution viable, which would otherwise be completely unworkable (for my purpose).

As I mentioned, you can't just sit and RTFM to get your answers . It requires some digging and asking questions. But ultimately I *think* I have evolved a solution for my needs . .  AKA workaround. Hopefully you will also. 







Title: Re: Stepper motor as spindle
Post by: MechanoMan on May 17, 2009, 03:59:55 PM
I recently went back to RTFM on this.

10.1.6 Says "Feedrate" for rotational axeswithout XYZ moves becomes degrees (or rotations) per minute.
HOWEVER- IF you include any XYZ motion, then the interpretation is completely different.  It tries to become a surface speed based on "Rotational Axis Diameter" setting.

6.2.12 Shows how you set rotational axis.  It looks fairly useless the way it's implemented, unfortunately.  It's a fixed number.  If you have a profile, the number will be screwed up.  It's not included in the System #parameters so you can't change it as you go either.
I will have to check what mine is.  It might have a rotational offset of zero, which could indeed screw up a calculation. 
Title: Re: Stepper motor as spindle
Post by: MechanoMan on May 18, 2009, 02:07:15 AM
Huh.  TFM appears to be wrong.  Well, that's not to say I know what Mach3's doing, but whatever it is doing, it's not doing what it's supposed to be doing.

I went into Settings and found the A-axis "diameter" was indeed 0.00in.  Hmm.  So how could it in any way calculate feedrate for any rotational movement combined with XYZ motion as per 10.1.6?  Good question right there.  Maybe it reverts to "feedrate" meaning RPM like it means when you're doing A-moves for an axis and integrates it with XYZ speed... how?  Checked in General Config, yes it does have "A-axis is Angular" checked.

Well, next experiment was to change the A-axis diameter to 2.5in, which is close to what a lot of the workpiece will be.  OK, but how do we even know what effect that had?  There is no way to get Mach3 to read out what it chose for an A-rotation-rate.  It gives a Feedrate but since it's unclear what that is even supposed to mean then that's useless.  Well, since this code is like 90% rotational milling, my best shot was to go to ToolPath and Simulate Program Run to see how long the code takes.

And... it takes the exact same amount of time.  Hmm, well maybe that's not strange, since the code normally provides a very large Feedrate (6000) in its rotational moves with the idea that the Motor Tuning on the A-axis would limit it to a fixed RPM.  So, let's give it an absurdly large 1000 in diameter!  That would mean 6000ipm surface speed would limit it 1.829 rpm. 

But, it had NO effect.  Again, exact same 3:31 runtime.  So it's not using the A-diameter field at all (and the whole A-diameter concept was wrong from the start anyways!) I officially have no idea what Mach3 thinks it's using for a Feedrate for a rotational axis.  It's not what's in the manual, that's for sure.