Hello Guest it is March 29, 2024, 06:32:15 AM

Author Topic: Step/Dir control of spindle?  (Read 8983 times)

0 Members and 1 Guest are viewing this topic.

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Step/Dir control of spindle?
« on: March 17, 2018, 06:38:23 AM »
Mach3 gives three relay control options: Relay, PWM or Step/Dir.
However, I have yet to read of anyone actually using the Step/Dir option to control a spindle. Anyone?

The problem, as I see it, comes when you compare what Mach3 does when running an axis motor vs a spindle.
For an axis drive Mach3 will issue a number of step pules to move the axis from A to B. Fine.
But for a spindle, Mach3 would have to be sending out a fast and continuous stream of step pulses with no further limits. And if you are asking for S24000, then Mach3 would have to be issuing 24000 Step pulses per minute. That's 400 Hz. I am not sure it can do this. Or can it?

Cheers
Roger
Re: Step/Dir control of spindle?
« Reply #1 on: March 17, 2018, 08:11:59 AM »
Hi Roger,
I use Mach4 and my high torque spindle is a 1.8kW servo. It has an 8000 count per rev encoder and rated speed of 3500rpm.
with electronic gearing of 10 the required pulse rate is (3500/60)*8000/10=46.66kHz. My ESS/BoB signals that no trouble
single ended. According to the manualif I used differentia signaling I wouldn't have to use gearing ie a pulse rate of 466.6kHz.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: Step/Dir control of spindle?
« Reply #2 on: March 17, 2018, 05:25:55 PM »
Hi Craig

So your spindle drive can accept Step/Dir? OK, that works. Not that many spindle drivers can do that afaik.

I wonder: is Mach4 actually outputting the pulses at 46 kHz, or is it just telling the ESS to do that?

Cheers
Roger
Re: Step/Dir control of spindle?
« Reply #3 on: March 17, 2018, 05:49:00 PM »
Hi Roger,
its not a spindle drive its a servo drive and accepts pulse inputs.

Mach4 provides trajectory data, its the ESS that generates the pulses. An ESS can generate pulse streams up to 4MHz, which is academic because my servo drive
can accept up to 500kHz with differential signaling.

As I don't require fine angular resolution on my spindle I elected to use electronic gearing to reduce the pulse rate so I could use a standard BoB and single
ended signaling to the servo drive. Even with the loss of resolution the electronic gearing implies its still capable of 27 arc min resolution, very adequate!

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: Step/Dir control of spindle?
« Reply #4 on: March 17, 2018, 07:12:31 PM »
Hi Craig

I am confused. It may be that Mach4 is sufficiently different from Mach3 that the difference is the problem, but I am not convinced about that.

Mach4 provides trajectory data, its the ESS that generates the pulses.
Well, that's fine for an axis drive, but a spindle does not have a trajectory, does it? So I am not understanding how Mach4 can drive a spindle.

Can Mach4+ESS be told to run a spindle at some speed with no destination, but with Step/Dir signals? For hours on end. There is NO destination.

Help!

Cheers
Roger
Re: Step/Dir control of spindle?
« Reply #5 on: March 17, 2018, 07:36:53 PM »
Hi Roger,
Mach4Hobby allows one out-of-band axis and it is always a spindle. As the attached pic shows it can be driven step/direction.

Given it is an out-of-band axis it is not constrained to motion end points like coordinated axes.

Hobby allows for one OB axis whereas Industrial allows six. At this stage I can't find a means of having Hobby drive my spindle as an indexing axis.
That is to say that the API doesn't apparently allow position commands only speed commands. Exactly how rigid tapping works I don't know.

I can make my spindle index by switching its pulse inputs to the A Axis. Of course the A axis is coordinated but if all I require is an indexed move
I can do so in one move provided there are no other axis moves on the same Gcode line. There might be some overlap due to  CV at the end of the index move.

I consider it a shame that NFS have limited Hobby to one OB axis and also that it has only speed control. I'd love to be able to play with Industrial to see
how those extra OB axes are handled.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Step/Dir control of spindle?
« Reply #6 on: March 17, 2018, 07:53:04 PM »
But for a spindle, Mach3 would have to be sending out a fast and continuous stream of step pulses with no further limits. And if you are asking for S24000, then Mach3 would have to be issuing 24000 Step pulses per minute. That's 400 Hz. I am not sure it can do this. Or can it?


How are you determining that number?
Mach3 at it's lowest kernel speed, 25Khz, can output 25,000 steps/second.
The frequency of steps required depends on what you are doing with them.
Here's board that converts step/dir to 0-10V analog.
https://cnc4pc.com/catalog/product/view/id/7/s/c6-variable-speed-control-board/category/155/

It outputs 10V with a 25Khz pulse stream.


As Craig said, Mach3 (or 4) can output up to 4Mhz pulse streams. 4 million steps/second.




Quote
So I am not understanding how Mach4 can drive a spindle.

Just like in Mach3. Mach tells the ESS what to do, and the ESS generates the required pulses.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: Step/Dir control of spindle?
« Reply #7 on: March 17, 2018, 08:08:22 PM »
Hi Craig

OK, I see.

Crawling through Mach3, it seems that this should also be possible. Curious that I have not heard of anyone doing it with Mach3, but then, who would comment if they were doing it that way? And where would they get a suitable low-cost driver anyhow?

Now, I know Greg and Andy at Warp9 are trying to get a PID controller for a spindle encoder into the FPGA they are using, but I suspect they may be having some problems squeezing it into the remaining space. They would be limited to using a PWM output signal which would need to be optically buffered and then DC-filtered.

So I am left to wonder just how hard it would be to set up a small black box between the ESS and the slightly crude DC driver/PS I have on my DC spindle. Basically, it would just need to be a phase-lock loop with an analog output. The Index pulse would still go through to Mach3 for threading sync, but the spindle speed would now be rock-solid.

Hi Gerry

You are right of course. My numbers were for syncing the Index pulse to the Step pulses. But that was written late at night after a very hot day and a lot of work :)
I would want something like 256*24,000 pulses/minute to drive an encoder rather than an Index pulse (as it were) at 24,000 RPM. That's over 100 kHz. I *knew* my figures were far to slow somehow! In my case I cannot get anywhere near that spin: 30 kHz would be enough. A little fast for mach3, but peanuts for an ESS.

The C6 board - Step/Dir to analog, but no option for phase locking on feedback. I want that feedback.

Interesting thoughts.


Cheers
Roger
« Last Edit: March 17, 2018, 08:12:07 PM by rcaffin »
Re: Step/Dir control of spindle?
« Reply #8 on: March 17, 2018, 08:37:08 PM »
Hi Roger,
a modern AC servo leaves the ESS PID solution in the dust.

Of course you know that at this time it is limited to one pulse per rev. Andy has expressed interest in extending that to multiple pulses per rev. As you also probably
know many ENTRY level servos are shipping with 17 bit encoders, A Delta servo I've been giving a hand with in the forum has a potential encoder count of
160,000 per rev. Will Andy be able to squeeze that in?

My servo is about 10 years old, Allen Bradley and is equipped with a 8000 count per rev encoder.....very ho hum by todays standards but has proven to really REALLY
spin my wheels! I had to buy the software to program the EMPROM, I would have had it gratis had I bought new, but this is second hand.

Anyway the software has a database of all Allen Bradley servos, mine included and many of the basic parameters are set just by virtue of selecting your servo from
the list. The basic parameters include such things as rated speed, rated current, encoder count etc, all the usual stuff. What may not be apparent is the detail about each
servo, the resistance and inductance of the windings, a table of flux density verses current....yes that's a quasi linear approximation of hysteresis, thermal mass and
temperature rise. In short the database has more information that you could expect to find or measure yourself.

There is the opportunity to adjust the PID parameters if you wish however the database entries have proven to be better than me fiddling with them for hours.
Amongst the facilities of the software is an Oscilloscope where you can plot loop error verses time, just brill....I can see at a glance the damping factor a damn near
0.7071, just what I'd try to achieve if I were fiddling with it...and to have it displayed as a live oscilloscope trace!

In short modern AC servos and their drives with the software support from the manufacturer make old school PID loops look like crap. I bought my servo and drive
including shipping for $800 NZD or about $600 USD. Quite frankly for that sort of money why would you bother with a DC servo?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Step/Dir control of spindle?
« Reply #9 on: March 17, 2018, 09:03:37 PM »
Hi Roger,
sorry about my rant, as you can tell I'm enthusiastic about AC servos, you might say I've had my eyes opened.

Quote
Basically, it would just need to be a phase-lock loop with an analog output. The Index pulse would still go through to Mach3 for threading sync, but the spindle speed would now be rock-solid.

I think that would work. Essentially the step pulse from an ESS is proportional to required speed as reflected by the encoder. If you feed the step pulse and the
encoder feedback into a frequency discrimination circuit you would end up with an error term which could be applied to your drive.

I personally would approach the problem slightly differently. I would have the step/dir pulses cause an accumulator count up/down to reflect position.
An identical accumulator would count up/down with encoder position and the difference between the two accumulators would be the required error term.
Obviously I am anticipating doing this on a micro. As a result of another project I bought a development board of Texas Instruments with a TMS320F28069
32 bit microcontroller with on board everything, single cycle 32 bit floating point.....and the list goes on. $47NZD +15%GST free shipping. It might be like
using a sledgehammer to crack an egg but POWER to burn!

Given my new found enthusiasm for AC servos and the realization that servo manufacturers are very VERY good at getting the best from their products
all the effort involved in making my own feedback loop would be undertaken for interests sake/bragging rights only.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'