Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: 01sporty on February 21, 2022, 05:54:23 PM

Title: Looking for help with a spindle motor.
Post by: 01sporty on February 21, 2022, 05:54:23 PM
I've been trying to get this motor working to try as a spindle motor on a small lathe.
https://www.omc-stepperonline.com/nema-23-integrated-easy-servo-motor-130w-3000rpm-0-45nm-63-73oz-in-20-50vdc-brushless-dc-servo-motor.html

It's a plain jane Mach3 setup on a Win7 computer.  Parallel port to simple breakout board to the motor.

When I first wired it up, the motor ran really slow.  Mach3 wouldn't let me put in a large enough number in the velocity box in motor tuning.

This morning, I edited the xml file and got part way there.   Line 1383 (see picture) seems to be a percentage.  Changing it to 100 got results.  This changed the velocity in motor tuning to 6000 (see picture).  No clue what the relationship is.

After making this change (here comes the good part) setting the S speed to 200 gave me an actual speed of 200rpm.  Measured frequency was 6.68 KHz - spot on.

At S400 and S600 results were also perfect.  At S800, it all fell apart.  The frequency went to an unstable 23.49 and the rpm a ragged 720.

Any suggestions on how to make this thing work?

Title: Re: Looking for help with a spindle motor.
Post by: joeaverage on February 22, 2022, 02:34:42 PM
Hi,
Mach3's parallel port has by default a kernel frequency of 25kHz. With a well behaved PC you might be able to increase that to 45kHz or maybe 65kHz, or with an extremely
well sorted PC 100kHz.

The kernel frequency is the maximum pulse rate the parallel port can produce. In the case of a default installation that is 25kHz. Lets also guess that your servo requires 10,000
pulses to turn one revolution. At a max pulse rate of 25kHz then the servo could rotate only 2.5 revolutions per second or 150 rpm. As you can see the kernel frequency limits what the servo can do.

What is the encoder resolution of your servo? Is it programmable, ie have 'electronic gearing'. If so you need to set it to about 500 pulse per revolution. The at 25kHz pulse input:
25,000 / 50 =50, so the servo could do 50 revolutions per second or 3000rpm.

According to the manual the lowest resolution you can get with the servo is 1600 pulse/rev. With a pulse rate of 25kHz:
25000 /1600 =15.625 revs/sec or 937 rpm. With a default parallel port installation this is as fast as you could expect  for a Step/Direction driven servo.

You either have to increase the kernel frequency to 65kHz or more, possible but commonly fraught with difficulties, PCs just don't like it OR get an external motion controller like a UC100 (max frequency 100kHz)\
or an ESS (max frequency 4MHz).

Craig

Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 07, 2022, 08:18:53 PM
Hi, I'm back. Thanks for all the great info.  I suspected it was something like that.

So, I went ahead and bought an ESS.

I haven't actually got it to turn the new step/dir motor as of yet but I did find some troubling info on the 'setting up the ESS' page.
https://www.warp9td.com/index.php/gettingstarted/setting-up-the-smoothstepper-and-mach#MachThreeInitialESS

(https://i.imgur.com/LE4U7TM.png)

It appears that the Smoothstepper will indeed produce a kernel frequency of up to 4mhz for the axis motors, it will only do 32khz for the spindle motor.

That leaves me little better off than I was with the parallel port.  The whole deal is beginning to look like an expensive boondoggle.

Walt
Title: Re: Looking for help with a spindle motor.
Post by: joeaverage on April 07, 2022, 08:24:07 PM
Hi,
click the drop down menu, you can use vastly more than 32kHz.

My new servo driven mill runs 416kHz to each of the three axis servos and 466kHz to the C axis....so yes you can use way more than 32kHz.

Craig
Title: Re: Looking for help with a spindle motor.
Post by: joeaverage on April 07, 2022, 08:29:57 PM
Hi,
note also that you have selected PWM as your spindle control mode? Is that what ypou want? I thought you wanted to run Step/Dir, in which case uncheck
the PWM box and check the Step/Dir box.

Craig
Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 07, 2022, 08:36:31 PM
Hi,
click the drop down menu, you can use vastly more than 32kHz.

My new servo driven mill runs 416kHz to each of the three axis servos and 466kHz to the C axis....so yes you can use way more than 32kHz.

Craig

Nope.  Like I said, all of the axis motors will go up to 4mhz.
The spindle only goes to 32mhz.
Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 07, 2022, 08:37:46 PM
Hi,
note also that you have selected PWM as your spindle control mode? Is that what ypou want? I thought you wanted to run Step/Dir, in which case uncheck
the PWM box and check the Step/Dir box.

Craig

I should have clarified that picture.  That's not my setup, that's the example given on the Warp9 site.
Title: Re: Looking for help with a spindle motor.
Post by: joeaverage on April 07, 2022, 08:44:18 PM
Hi,
well what is your set-up then? Have you tried cliking the drop down menu?

Craig
Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 07, 2022, 09:53:43 PM
Well, you're absolutely correct.  I'm not sure how I missed it but the spindle will indeed match the axis frequencies. That should not be an issue.

Now all I need to do is figure out why the motor isn't moving.
Title: Re: Looking for help with a spindle motor.
Post by: joeaverage on April 07, 2022, 10:25:40 PM
Hi,
what I would do is just to prove that I can get the motor to turn....hook up the power and apply a 5V square wave from a signal generator to the Pul+ input with the Pul- input hooked to 0V com.

Craig
Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 08, 2022, 12:54:28 AM
I don't have a signal generator but I do know the motor turns. 
It was working with the printer port up to 600 rpm.  After that the computer just couldn't handle it.  Fell flat on it's face.

You told me that.  Go back and refresh your memory at the initial post and your reply.
Somehow I'm missing one of the basic fundamentals with the ESS.

In my defense, I've been working on this two and three minutes at a time in between the work I'm supposed to be doing.  ::)
Title: Re: Looking for help with a spindle motor.
Post by: JohnHaine on April 08, 2022, 06:52:16 AM
Why use a stepping servo motor to drive a spindle?
Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 08, 2022, 01:02:30 PM
Why use a stepping servo motor to drive a spindle?
It's small (nema23). 
It's very affordable.  Well, it was until it became apparent the ESS would be an essential ingredient.
It has great torque for its size and the torque curve is flat over its entire rpm range.
The rpm will be spot on and stay there if the power demand increases.
It's controllable for soft start and end.
All of this assumes, of course, that I actually get it to work the way its supposed to work.

Right now I'm using a sewing machine motor.  It has good rpm and torque but the rpm is manual and is really vague.  I have to use ipm rather than ipr.  The rpm has to be changed manually between tools so it needs to be constantly tended.
Title: Re: Looking for help with a spindle motor.
Post by: JohnHaine on April 08, 2022, 03:00:31 PM
What lathe is it?
Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 08, 2022, 04:34:58 PM
It's a home built.  Built around a pair of Parker 404XR linear actuators.
(https://i.imgur.com/yqjmK33.jpg?1)
Made for light, precision work.  Jewelers lathe type stuff.
The specs will make you kinda giggly.
8 um (.0003") accuracy over its entire travel.
1.3 um (.000051") repeatability.
Title: Re: Looking for help with a spindle motor.
Post by: joeaverage on April 08, 2022, 04:44:50 PM
Hi,
may I suggest a couple of experiments that will tell you if the ESS and servo are working as expected and also inform you as to how
to set up both to your satisfaction.

Start by assigning your servo to a rotary axis, say A or B , just as an experiment.

Lets say you have set the servo set to 2000 pulse per rev. A rotary axis has units of degrees, so the Steps per Unit value in the
A axis motor tuning page would be 2000 / 360 =5.55 Steps/unit. the max velocity in units would be 3000 (rpm) x 360 =1,080,000
units per minute, and make acceleration 10% of that, say 100,000 unit/s2.

Now try an MDI command of
G0 A360000

This should cause the servo to rotate 1000 turns at max speed and acceleration then stop. Does it do so?

Craig
Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 08, 2022, 04:57:56 PM
Good idea.  I probably won't have time to try it today.  I'll check back and let you know what happens.
Title: Re: Looking for help with a spindle motor.
Post by: JohnHaine on April 08, 2022, 05:24:33 PM
Well those sewing machine motors run up to 5k rpm I think and can generate 3/4 hp, much more suitable than a 130W servo motor IMHO for a lathe.  If precise spindle control is needed for threading then I think Mach4 can process both spindle encoder and index pulses.  Nice looking little machine though.
Title: Re: Looking for help with a spindle motor.
Post by: joeaverage on April 08, 2022, 08:31:04 PM
Hi,

Quote
Well those sewing machine motors run up to 5k rpm I think and can generate 3/4 hp, much more suitable than a 130W servo motor IMHO for a lathe.

On the basis of power output I'd have to agree. There are some countervailing arguments which may prove otherwise.

I've been using servos (Delta B2 series) for a year or more now and they never cease to amaze me how much power they produce, it seems rather more than the
nameplate would suggest. I think the feature that we overlook is a servos overload capacity, commonly three or four times its rated output. It would certainly not
work to design a system that required that overload capacity, but that capacity can and will be exploited and so make you believe that it has much more power
than you guess. On this basis I would suggest that this wee servo could well behave as if its a motor of 260W, so a little over 1/4 hp.

The second area that suggests a servo is better is because it can be position controlled. Things like rigid tapping become possible when you your spindle
has positional capability rather than just  a closed velocity loop.

I have a second hand 1.8kW Allen Bradley servo that I use as a secondary spindle motor. It has so much more torque than my regular 24000 rpm asynchronous
spindle, I use it for steel and stainless. Mostly I use it in velocity mode, ie just a free running spindle with a closed velocity loop, but I can and sometimes do use it
in position mode as a C axis which allows me to do rigid tapping. For instance:

g1 c3600 z-10 f10000
c0 z0

Will result in the C axis, ie the spindle, rotating 10 revolutions at a speed  of 10000 /360 = 27.8 rpm while the Z axis does a coordinated move of -10mm., ie a pitch
of 1mm per revolution. Then the C axis will stop, with deceleration, and coordinated with the Z axis, and then unwind ten revolutions with the Z axis coordinated
to back out of the thread at 1mm per revolution.

Note this does not require any specialised Gcode or any extra motion control support, it just relies on the coordinated movement of two axes which Mach does that and more all the time.

Craig

Title: Re: Looking for help with a spindle motor.
Post by: joeaverage on April 08, 2022, 08:38:42 PM
Hi,
even if the wee 130W servo doesn't have the power then get yourself a 750W Delta B2 series servo ($435USD) and it will 'kick anus all day long'.

Craig
Title: Re: Looking for help with a spindle motor.
Post by: JohnHaine on April 09, 2022, 04:17:03 AM
I agree that using a servo will allow rigid tapping but I'm not sure how useful that is in a lathe.  Ordinary external threading is though.  The sewing machine motors are actually "servo" motors being brushless and allowing fast acceleration/deceleration, though not maybe position control (though I'm not sure about that since basically they are synchronous).  Maybe the ideal is a dual-motor setup with 500W for fast metal removal and all-round flexibility and stepper-servo for rigid tapping?
Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 09, 2022, 10:34:40 AM
You guys are trying to drop a V8 into a go kart.  Good as conversation starter but you're really not gaining anything.  Power plants need to be sized to fit the rest of the machine.

That massive pile of chips you see in the picture is from that equally massive .043 drill.  Face, chamfer, drill to a depth of .260. That's 6D to save you the trouble of getting out your calculator.  No coolant, no pecking, 80 parts.
I could do that all day long with a 30 watt motor.

That sewing machine motor starts so violently it has snapped a 3/8" belt, not to mention what that does to the bearings.  That's why it has that 1/8" belt, it has more stretch.

The servo motor was simply selected because it's sized correctly and is controllable without having to stand around and babysit the machine.
Title: Re: Looking for help with a spindle motor.
Post by: joeaverage on April 09, 2022, 05:33:12 PM
Hi,
well power output is not the big determinant, but smooth acceleration/deceleration is. I'm not at all sure that Mach3 applies an
acceleration/deceleration profile to its Step/Dir spindle.

Two possibilities to gain acceleration control.

If the spindle is a C axis, then it will have an acceleration/max velocity/deceleration profile per the Mach motor tuning page.

The second method relies on the servo itself. Lets say the Mach suddenly accelerates the spindle to max velocity by issuing an abrupt
stream of Step pulses, not ideal but I suspect its what might actually happen. The servo will not accelerate instantly but it will accelerate
at its maximum rate which is likely to be violent, and this is undesirable also.

I cannot speak for the little baby servo you have but the Delta servos I have, 750W's and 400W's, and Delta do 200W's and 100W's servos
in the same series, allow you to program the servo drive for the max acceleration/deceleration IRRESPECTIVE of what Mach tells it to do.
This means that the motor itself has a programmable acceleration/deceleration profile, and if I'm not mistaken the acceleration and deceleration
parameters are separate and so allow you to tailor the profile to your satisfaction.

Can you program such features into your servo?

Craig
Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 09, 2022, 07:08:35 PM
Quote
Can you program such features into your servo?

Yes, but I'm hoping that it works in Mach3 since it's more convenient.

Fortunately, it's one of the parameters that's actually documented.

There are literally dozens of parameters that come with no explanation.
I guess you're supposed to just know this stuff.
(https://i.imgur.com/e1WD64F.png)
Title: Re: Looking for help with a spindle motor.
Post by: joeaverage on April 09, 2022, 07:43:33 PM
Hi,
yes I saw that list, but nothing stood out to me that was going to do as we want. Maybe I just don't understand this manufacturers terminology.

By-and-large all AC servos work the same, and the vast majority of manufacturers have the same features. They may have different names and values but they are all there.

Some of the cheaper Chinese brands have poor documentation, and I'm sorry to say but this looks like an example. Having said that, those parameters which are listed and explained
should give an absolutely superb servo, certainly better than any stepper you've ever encountered, and at a fantastic price. Every once an a while you need to dive deep into the servo
programming and that's where the lack of documentation really hurts.

Delta is a Taiwanese brand but manufactured in China. The documentation is very good indeed, and the set-up and tuning software is better again. Delta are not the cheapest brand,
but they are a lot cheaper than any US, Japanese or European brand, with comparable quality, documentation, set-up and tuning software and support. With Delta servos, with which I am
most familiar, I can certainly program an acceleration/deceleration profile. The other servo for which I have some experience is Allen Bradley, and with that servo too I can program an
acceleration/deceleration profile.

I think you need to work out how to get Mach/ESS/BoB to produce the required Step/Dir signals to get the servo to run. Depending on how Mach3 applies, or does not apply, a profile,
then you may have to dive into servo tuning. You might also want to consider the C axis solution.

I use Mach4 and have done for seven years, its light years ahead of Mach3 IMHO. Mach4 has six OB (Out of Band) axes, which can be jogged, and which still have a motor acceleration/deceleration
profile as part of the motor tuning. A continuous 'Velocity Jog' would give you a smoothly accelerating/decelerating spindle. Whether you can do the same in Mach3 is questionable.

Craig
Title: Re: Looking for help with a spindle motor.
Post by: JohnHaine on April 10, 2022, 04:56:33 AM
Worth looking at this video.
https://www.youtube.com/watch?v=hi09g49JksA
These sewing machine motors are fantastically controllable, they would be great for machine tools with a bit of understanding of how to use them.  They usually have a foot control for the machine operator.  This thread has some interesting information.
https://www.model-engineer.co.uk/forums/postings.asp?th=171903&p=2
The fact that the controller may not be mains isolated isn't a show stopper - lots of DC motor controllers on CNC mills aren't either!
Title: Re: Looking for help with a spindle motor.
Post by: 01sporty on April 10, 2022, 03:00:41 PM
Well, I'm a happy camper.
 
I finally got time to give it some serious attention and it's now running just the way it should. Smooth and silent from 30 to 3000. I didn't try going over the design rpm but I'm sure it would.
Right out of the box the acceleration and deceleration seem quite acceptable.  Once it actually is moving the spindle rather than just sitting on the floor it will be easier to tune it in.

The gory details:  My first problem turned out to be the way I had been checking for a signal. My VOM has a frequency function and I had been using that.  I finally realized the computer doesn't push a signal out, it offers it up.  If the motor isn't accepting the signal, no sinking occurs and there is nothing for the VOM to read.  Once I realized that, I went back and took a much closer look at my setup.  I had plugged the motor into the wrong power supply so it was not getting adequate voltage.  So much for doing things according to memory.  Once it had the proper supply, things got turning and from then on, it was just a matter of sorting out the settings to get it spot on.

Now I finally feel comfortable with ordering the rest of the stuff needed to complete the installation.