Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: DMBGO on March 15, 2016, 07:43:26 AM

Title: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 07:43:26 AM
Hello everyone
I had a great idea the other day, and that was generated by my recent acquisition of a little Myford lathe from a deceased estate.
I want to convert it to Mach, but leave it in a condition that can easily be put back as original.
Anyway the problem I have atm is a follows:
I set up a servo as the X axis, then decided to use it as a spindle. I checked the box in the Ess plugin to say that the spindle was step and direction. 

This servo works well and revolves at maximum speed (2500rpm) when it is connected to the smoothstepper and configured in Mach as the x axis. 

Using the same servo controller and cable etc, in fact all I  did was change the configuration in Mach,  I can't get the motor to turn at over 700 rpm. 

The servo does support step and direction  and as i have already said it works well when it is X.

I'm sure if will be an easy fix. It could be caused by the smoothstepper,  or the the Mach configuration. 
Anyway I'd better mention my configuration.
Mach3 an Ess, a GSK Servo and controller.
I think that's it.
Any help would be appreciated.
Dave

Title: Re: Using servo for spindle on lathe
Post by: Hood on March 15, 2016, 08:15:41 AM
What is the encoder count?
What is the Max RPM of the motor via that drive?
Hood
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 04:00:00 PM
Hi Hood
I'm not sure about the encoder count, but I will check the manual when I get out there this morning and let you know.
The max RPM is 3000 and the nominal is 2500. It spins ay any speed you like when it is set up as an X axis.
I haven't connected the encoder output to Mach.
Title: Re: Using servo for spindle on lathe
Post by: Hood on March 15, 2016, 04:08:21 PM
The encoder counts are needed so that you can work out the steps per unit.
If however it was correct for the X I can work back if you can tell me the steps per unit you had set for that, also the pitch of the ballscrew and what, if any, gearing you had between motor and screw.
Hood
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 05:30:06 PM
See the attached file for the X settings that work, the servo isn't on the lathe yet, and I haven't had delivery of the ball screws, so atm the steps per unit are a guess. I thought I could just disable the X axis in Mach, and use the same settings for a spindle. This is where my theory has a hole!
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 05:30:48 PM
Attachment
Title: Re: Using servo for spindle on lathe
Post by: Hood on March 15, 2016, 05:46:23 PM
Ah ok, well for a spindle you need to set things up a bit differently, Greg did it one way in a description he had on here but I did it another way and it works fine.
Basically as it is a spindle you would set the RPM as the Velocity, so you would set 2500 as that, you would then have to set the Steps per unit as the encoder count, so for example if it was a 2500 line per rev encoder you would set 10,000 steps per unit. The Accel would be revs per second per second so 20 would mean it would reach 2500rpm in a bit over 2 seconds.

One other important thing you have to do for the spindle is go to Config menu then Spindle Pulleys and set the Max RPM up the same as you have in Motor tuning, ie 2500rpm.

Hood
Title: Re: Using servo for spindle on lathe
Post by: Hood on March 15, 2016, 05:49:13 PM
Oh one other thing, you will have to set the ESS up for the frequency, so it can output the steps per unit required.
Hood
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 06:10:04 PM
Thanks a milion Hood. I don't think I would have ever worked that out on my own!
I'll give it a try in a couple of hours.

Thanks again

Davel
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 07:09:35 PM
Well, some areas were successful, but others not. I set the servo back up, and configured the motor in motor tuning as shown in the attachment.
I tested from 200rpm up to 700rpm and the servo controller displayed the speed that I commanded in Mach. Ie: M3S400 made the servo controller display 400rpm and I assume the servo was turning at that speed.
However, once I went past 700rpm, the servo would just stop turning with no errors on the controller or Mach. When I used an M5 command after it had stopped the motor would start to spin once it decelerated to 700rpm down to 0rpm.

This is the issue that I was trying (not very well) to describe before.

Cheers

Dave
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 07:11:55 PM
Attachment
Title: Re: Using servo for spindle on lathe
Post by: Hood on March 15, 2016, 07:26:48 PM
20,000 for Steps per unit will almost certainly be too much unless your encoder is 5,000 lines per rev which is unusual, try setting it to 10,000 and see if that helps.

With it set at 10,000 and Velocity at 2,500 you would require a frequency of  41.666KHz, so make sure you have the ESS plugin set to the next above that (sorry can't look as I don't have an ESS here)

One other thing to look at in the ESS plugin is the pulse for spindle, try setting it at 1 or 2. The ESS and SS do not handle the pulse width the same for a spindle as they do for an axis and this can cause issues if set too high.

One last thing is make sure you have no electronic gearing set in the servo drive.

Hood
Title: Re: Using servo for spindle on lathe
Post by: Hood on March 15, 2016, 07:27:54 PM
Sorry should have been 416KHz

Hood
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 07:30:31 PM
Thanks Hood
Was just wondering if the Ess treated a step & Dir spindle the same as an axis, or differently, as you say. I'll play with the Ess settings now. Wont be long.
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 07:34:17 PM
Here are the Ess settings before I start.
Title: Re: Using servo for spindle on lathe
Post by: Hood on March 15, 2016, 07:37:42 PM
I would set the KHz to whatever the next above 416KHz is and set the pulse width to 2.
Hood
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 07:46:22 PM
I don't know how to thank you enough Hood. I knew it would be a simple solution, but it helps incredibly to talk with someone who knows all about these things.
The problem was caused by the spindle pulse width, I hadn't changed it before, because I though that what was Ok as an axis, should also be Ok for the spindle.
I'll just have a fiddle and see what is the maximum pulse width I can have. At the moment it is working with a pulse width of 1.
Should I use whatever pulse width it works with, or should I be conservative and set it one unit below whatever works?
Title: Re: Using servo for spindle on lathe
Post by: Hood on March 15, 2016, 07:52:03 PM
If it is working at 1 then I would just leave it. It won't work much higher, as said maybe 2 max.

With the axis the ESS spreads the pulses evenly no matter the output frequency,  with the spindle it just bunches them together, if you have the width too high then it can not output the pulses correctly above a certain RPM (depends on steps per unit and RPM) and you get problems. You can see this very clearly if you scope the output.

Ok sleep time.

Hood
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 07:55:20 PM
Well I've experimented and cannot get 2500rpm with a pulse width above 1. Unless you can have decimal points in pulses, Ie: 1.5, but I think I'll leave that for another day. I can get on with my fitting now
Thanks again
Dave
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 07:58:04 PM
Well I did think about putting the scope on the output, but I thought I'd ask first.I'm glad I did.

Seems funny going to bed at 11:00am.

Sleep well

Dave
Title: Re: Using servo for spindle on lathe
Post by: Hood on March 15, 2016, 07:59:26 PM
BTW that is one of the annoyances I have about the SS and ESS. My spindle motors have Sine/Cosine encoders and work best when I have the encoder count interpolated and set high, the servo drive can really handle the motor smoothly but the ESS can not handle it as the pulse width is too great for the frequency so I have to lower the encoders resolution.

I thought I could get round it by using electronic gearing in the drive but that just caused other issues, whether ESS or Servo I am not sure but I would guess ESS. What would happen is when I commanded M5 it would sometimes run on for a few seconds and then all of a sudden stop without decelleration. A 250mm dia chuck stopping instantly is not good for the heart or the machine ;)

Hood
Title: Re: Using servo for spindle on lathe
Post by: Hood on March 15, 2016, 08:00:13 PM
Aye 11AM in Oz, 12PM is Scotland :D

Hood
Title: Re: Using servo for spindle on lathe
Post by: DMBGO on March 15, 2016, 08:03:34 PM
Yes
I didn't have this issue with the CSMIO
Here are the working Ess settings for posterity.