Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: DMBGO on April 11, 2018, 06:43:25 PM

Title: Spindle servo on lathe is 10% fast
Post by: DMBGO on April 11, 2018, 06:43:25 PM
Hi, while I was on a roll, I thought I might ask if there are any suggestions as to why M3 reports my spindle as travelling at 10% faster than the commanded speed. I use a hall element from a car distributor as the spindle rpm sensor (index). A steel plate with a single slot attached to the spindle supplies the pulse. When I command S1000 M3, I get a readout of 1100. If I command S500 M3, I get 550 on the readout. I am using an ESS, with the spindle servo driver configured in Step / Dir mode.
Thanks in advance
Dave
Title: Re: Spindle servo on lathe is 10% fast
Post by: joeaverage on April 11, 2018, 07:02:10 PM
Hi,
Mach does not have feedback control of spindle speed. If you program a speed its does its best to go the right
speed but if it misses it has no way to correct itself.

There are ways around it, almost all of them quite involved. Does it really matter, I mean really really matter?

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: DMBGO on April 11, 2018, 11:50:39 PM
Is not critical, I just have to remember to subtract 10%. I was under the impression that it adjusted the speed of its pulse stream to match the commanded speed.
Title: Re: Spindle servo on lathe is 10% fast
Post by: joeaverage on April 12, 2018, 12:09:41 AM
Hi,
no Mach is not closed loop. The ESS is being developed to enact closed loop control, my understanding
is that its not ready yet and that is with Mach4, I don't know whether it will be extended to Mach3.

If I understand your situation you are using a servo drive? What type of drive/servo?
I would have thought that a step/dir drive would be as accurate as Mach, within fractions of 1%, not 10%

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: DMBGO on April 12, 2018, 11:44:34 PM
That's what I would have thought Craig. I realise that "closed loop" is adjusting things on the fly based on the index sensor's output.. That, however isn't really what I was asking. My spindle speed is consistently 10% above the commanded speed, so it should be possible to slow the pulse rate, either within Mach, or in the smoothstepper driver, to make the commanded speed be equal to the actual speed.
The spindle servo motor is a GSK 110SJT and the AC driver is a GSK DA98B. Probably a little bit underpowered for the job, but seems to work Ok.
Title: Re: Spindle servo on lathe is 10% fast
Post by: joeaverage on April 13, 2018, 12:23:00 AM
Hi,
well that should mean that the speed is spot on, that is to say that every time the ESS pulses the servo should advance
one encoder count. The ESS should be producing pulses at exactly (within 0.1%) of what is commanded by Mach.

Do you have an oscilloscope or a frequency counter? I would be prepared to guess that Mach an the ESS are working
correctly but your index pulse generator is somehow wrong.

I would issue a speed command in Mach such that the step pulse to the driver was 5kHz and measure it as accurately as you
can.

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: joeaverage on April 13, 2018, 12:40:18 AM
Hi,
another thought is that maybe the 'electronic gearing' of the servo is not 1:1.

What is the current value of parameters PA12 and PA13?

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: DMBGO on April 13, 2018, 12:44:08 AM
Fixed now. Here are the steps to solve it.

Control Mode: Step and Dir
Pulse width in Ess driver:  3.0 ms
Commanded speed: 1000
Displayed speed on M3: 1113
Displayed RPM on DA98B Servo controller: 1335 (This difference to Mach3 is due to the Spindle pulley having more teeth than the servo motor pulley)
Measured speed with digital tacho:  1113
Pulse width in Ess driver:  2.0ms and 4.0ms are the same as above.


Changed spindle velocity in motor tuning setting for M3 from 4001 to 3600 (10%)

Commanded speed: 1000
Displayed speed on M3: 1001
Displayed RPM on DA98B: 1202 (This difference is due to the Spindle pulley having more teeth than the servo motor pulley)
Measured speed with digital tacho:  1001


Divided 3600 (Velocity setting) by 1001 (actual speed displayed in M3) 3600/1001=3.5964
Set velocity to 3596 and M3 changed it as below.

  
Commanded speed: 1000
Displayed speed on M3: 1000
Displayed RPM on DA98B: 1200 (This difference is due to the Spindle pulley having more teeth than the servo motor pulley)
Measured speed with digital tacho:  1000

Thanks for the help, the speed is now, as you said, spot on.
Title: Re: Spindle servo on lathe is 10% fast
Post by: joeaverage on April 13, 2018, 12:48:40 AM
Hi,
kool. Next question is why you pissed around fitting an index pulse generator when you could use a digital ouput based on the inbuilt
encoder?

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: DMBGO on April 13, 2018, 01:58:38 AM
 :) When I first converted this lathe to Mach control, the year was 2003. I had a single phase AC drive motor for the spindle with no speed control and steppers for the axis. I needed an index pulse in order to thread. The next incarnation was about 2007 and I was using a 3 phase motor and VFD for the spindle, I used a converter to make 0v to 10v for the VFDs speed control. I  still needed an index pulse though. About this time, or a bit after, the USB smoothstepper became available, I had a lot of issues with electrical noise from the VFD, but soldiered on.
In late 2010 I decided to upgrade my lathe to servo motors, after much to ing and fro ing I ordered servos and controllers for the lathe, I also ordered a new KRV3000 milling machine, and GSK servos intended for the mill . Business was doing well, the kids were starting to leave home and the world was my oyster so to speak.
The first thing to arrive was the mill on the 30th Mar 2011 I picked it up from the carrier, unloaded it in my shed and then received a phone call asking me to come on an overnight camping trip. Reluctantly I agreed.
Then I had a severe car accident in the early hours of the morning on the 31st of Mar 2011. I was rushed to hospital, despite the policeman in attendance trying to cancel the ambulance, saying there was no need of an ambulance, just a hearse. Luckily the ambulance was already dispatched, and being mistrustful of the diagnosis provided by members of the constabulary, came anyway.
I was airlifted to Melbourne and spent the next 6 weeks in a coma, with the prognosis that even if I did live, I would be in a wheelchair and on dialysis for the rest of my life. After 7 weeks, the staff at the Royal Melbourne hospital started to call me the "miracle man". By the following September, after a period in rehab hospital, I was back at home, albeit, still a bit the worse for wear.
Then followed a period of slowly regaining my mobility, finding out and guessing what I was doing before the accident, and continuing with some of the projects that I had started. I fitted the GSK servos to the mill, and used the Adtech motor that I had earmarked for the spindle on the lathe, for the knee on the mill instead, since the GSK servo that I had bought wasn't powerful enough.
I fitted the Adtech servos to the X and Y axis of the lathe, and used the GSK servo for the spindle on the same. This was in 2017, a bit later than I had initially planned :).
Anyway, to answer your question, now that you have a bit of background, I already had an index pulse, prior to fitting the servos, I did give brief thought to using the encoder on the spindle servo motor to provide information about RPM, but decided that I didn't need to, and that I'd only be making extra work for myself, since I am still a long way behind where I imagined I'd be. Oh and did I mention that I ran for the first time since 2011 the other month?
Title: Re: Spindle servo on lathe is 10% fast
Post by: joeaverage on April 13, 2018, 03:07:22 AM
Hi,
that story rather puts CNCing as a hobby or a job into perspective. I hope your recovery progresses, it sounds that while you have come a long way it is still a long road.

I play Bridge recreationally and its a competetive game and I have a phrase, 'Bridge, its only a game...its not life or death....its more important than that!' While the humour is fun
its not in fact 'life or death'.

Using a modern AC servo as a spindle  puts you at the leading edge performance. You will, once you get it sorted and provided you remain within the torque limits of the servo
have a spindle with speed/position stability the envy of many.

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: DMBGO on April 14, 2018, 08:56:01 PM
Yes, it is only a hobby, but at times one gets caught up in the moment and it seems more important in the grand scheme of things than it really is. I am interested however when you say:

"Using a modern AC servo as a spindle  puts you at the leading edge performance. You will, once you get it sorted and provided you remain within the torque limits of the servo have a spindle with speed/position stability the envy of many."

This implies that once you do have a accurate, controllable, spindle that more can be done with it than previously. I have seen a YouTube video of someone using parametric G Code to turn a hexagonal shape on a lathe, do you have any idea of this?
Title: Re: Spindle servo on lathe is 10% fast
Post by: DMBGO on April 14, 2018, 09:06:10 PM
Here is an example of what I was talking about:
https://www.youtube.com/watch?v=DajrTlI8IWA
Title: Re: Spindle servo on lathe is 10% fast
Post by: joeaverage on April 14, 2018, 09:27:15 PM
Hi,
yes I have seen it, very impressive.  More of a party trick than a production technique.

Your spindle should do that.  Writing the Gcode for it would be a challenge.
Do you use Mach3 or Mach4?

I think the way to go about it is to call your spindle an A axis so that you can have coordinated rotation and cutting depth with the X axis. Success will depend heavily on the acceleration
of the X axis, if it can't accelerate quickly the hexagon will get rounded.

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: DMBGO on April 14, 2018, 09:40:30 PM
Yes, a combination of both the acceleration of the "A" axis and the X axis, may not have to be extremely fast acceleration though, just V well coordinated.

I am using M3, but I have an M4 license. I was initially V keen at converting to M4, but I use an ESS, which for a long time did not support threading on the lathe. The impetus to change to M4 has became a bit cooler over the intervening years.

I am still happy to M4 a try, but I need a reason to. :)
Title: Re: Spindle servo on lathe is 10% fast
Post by: joeaverage on April 14, 2018, 09:52:59 PM
Hi,
the Mach4 ESS plugin still does not support lathe threading but it is still progressing. Warp9 have decided that they wish to have multi-pulse per rev encoder capability and that has put them back
a bit. It may be a case of one step forwards but two backwards. It is happening though.

This hexagonal machining problem does not require Mach4.

The reason I ask is because if I have to write code I will not be writing VB, I will be writing Lua.

I will come back with some ideas about the Gcode necessary for the hexagonal machining trick.

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: joeaverage on April 14, 2018, 10:53:41 PM
Hi Dave,
got some ideas....

The attached pi shows a segment of the required hexagon, the longest dimension R. As it rotates about the center by angle theta the resulting triangle has longest side of R still but a somewhat shorter side Rprime.
The sine rule allows us to define a relation between the angle theta and Rprime, and of course Pprime is the X coordinate of your lathe.


A table of results might make it clearer:

theta         Rprime
0               R
5               0.955 X R
10             0.927 X R
15             0.896 X R
20             0.879 X R
25             0.869 X R
30             0.866 X R
35             0.869 X R
40             0.879 X R
45             0.896 X R
50             0.927 X R
55             0.955 X R
60             R

Clearly this works only for theta on the range 0 to 60 degrees, but all the rest of the hexagonal sectors are identical.

We could just write Gcode as a series of moves between the A axis and X axis, much like in the table or could do the calculation in a macro. The macro would be more fun but I'm
writing in Lua which is not going to make much sense to you.

You know you bloody Aussies ought to try to keep up!

What do you think?

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: joeaverage on April 21, 2018, 07:37:41 PM
Hi Dave,
I have a little bit of code here, its just a table of moves between A and X axes over a 60 degree segment of the A axis.
Its R dimension is 25mm, so your hexagon would be 50mm across the points.

Code: [Select]
G1 A0.0  X24.9975
G1 A0.5  X24.875
G1 A1.0  X24.7525
G1 A1.5  X24.635
G1 A2.0  X24.52
G1 A2.5  X24.4075
G1 A3.0  X24.2975
G1 A3.5  X24.19
G1 A4.0  X24.0875
G1 A4.5  X23.985
G1 A5.0  X23.8875
G1 A5.5  X23.7925
G1 A6.0  X23.6975
G1 A6.5  X23.6075
G1 A7.0  X23.52
G1 A7.5  X23.4325
G1 A8.0  X23.35
G1 A8.5  X23.2675
G1 A9.0  X23.19
G1 A9.5  X23.1125
G1 A10.0 X23.04
G1 A10.5 X22.9675
G1 A11.0 X22.8975
G1 A11.5 X22.83
G1 A12.0 X22.7625
G1 A12.5 X22.7
G1 A13.0 X22.64
G1 A13.5 X22.58
G1 A14.0 X22.5225
G1 A14.5 X22.4675
G1 A15.0 X22.4125
G1 A15.5 X22.3625
G1 A16.0 X22.3125
G1 A16.5 X22.265
G1 A17.0 X22.22
G1 A17.5 X22.175
G1 A18.0 X22.1325
G1 A18.5 X22.0925
G1 A19.0 X22.055
G1 A19.5 X22.0175
G1 A20.0 X21.985
G1 A20.5 X21.95
G1 A21.0 X21.92
G1 A21.5 X21.89
G1 A22.0 X21.8625
G1 A22.5 X21.8375
G1 A23.0 X21.8125
G1 A23.5 X21.79
G1 A24.0 X21.77
G1 A24.5 X21.75
G1 A25.0 X21.7325
G1 A25.5 X21.7175
G1 A26.0 X21.7025
G1 A26.5 X21.69
G1 A27.0 X21.68
G1 A27.5 X21.67
G1 A28.0 X21.6625
G1 A28.5 X21.6575
G1 A29.0 X21.6525
G1 A29.5 X21.65
G1 A30.0 X21.65
G1 A30.5 X21.65
G1 A31.0 X21.6525
G1 A31.5 X21.6575
G1 A32.0 X21.6625
G1 A32.5 X21.67
G1 A33.0 X21.68
G1 A33.5 X21.69
G1 A34.0 X21.7025
G1 A34.5 X21.7175
G1 A35.0 X21.7325
G1 A35.5 X21.75
G1 A36.0 X21.77
G1 A36.5 X21.79
G1 A37.0 X21.8125
G1 A37.5 X21.8375
G1 A38.0 X21.8625
G1 A38.5 X21.89
G1 A39.0 X21.92
G1 A39.5 X21.95
G1 A40.0 X21.985
G1 A40.5 X22.02
G1 A41.0 X22.055
G1 A41.5 X22.0925
G1 A42.0 X22.135
G1 A42.5 X22.175
G1 A43.0 X22.22
G1 A43.5 X22.265
G1 A44.0 X22.3125
G1 A44.5 X22.3625
G1 A45.0 X22.415
G1 A45.5 X22.4675
G1 A46.0 X22.5225
G1 A46.5 X22.58
G1 A47.0 X22.64
G1 A47.5 X22.7
G1 A48.0 X22.765
G1 A48.5 X22.83
G1 A49.0 X22.8975
G1 A49.5 X22.9675
G1 A50.0 X23.04
G1 A50.5 X23.115
G1 A51.0 X23.19
G1 A51.5 X23.27
G1 A52.0 X23.35
G1 A52.5 X23.435
G1 A53.0 X23.52
G1 A53.5 X23.6075
G1 A54.0 X23.7
G1 A54.5 X23.7925
G1 A55.0 X23.8875
G1 A55.5 X23.9875
G1 A56.0 X24.0875
G1 A56.5 X24.1925
G1 A57.0 X24.3
G1 A57.5 X24.4075
G1 A58.0 X24.52
G1 A58.5 X24.635
G1 A59.0 X24.755
G1 A59.5 X24.875
G1 A60.0 X25

It doesn't have any Feed word or any Z moves. Study it at see what you think.

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: DMBGO on April 30, 2019, 05:05:26 AM
Craig I'm very sorry, but your posts somehow slipped through tho the keeper. I had stopped thinking about the hexagon turning and moved onto my 3d printer, but I can always come back :). I'll have a read tomorrow and reply.
Cheers
Dave


Hi Dave,
I have a little bit of code here, its just a table of moves between A and X axes over a 60 degree segment of the A axis.
Its R dimension is 25mm, so your hexagon would be 50mm across the points.

Code: [Select]
G1 A0.0  X24.9975
G1 A0.5  X24.875
G1 A1.0  X24.7525
G1 A1.5  X24.635
G1 A2.0  X24.52
G1 A2.5  X24.4075
G1 A3.0  X24.2975
G1 A3.5  X24.19
G1 A4.0  X24.0875
G1 A4.5  X23.985
G1 A5.0  X23.8875
G1 A5.5  X23.7925
G1 A6.0  X23.6975
G1 A6.5  X23.6075
G1 A7.0  X23.52
G1 A7.5  X23.4325
G1 A8.0  X23.35
G1 A8.5  X23.2675
G1 A9.0  X23.19
G1 A9.5  X23.1125
G1 A10.0 X23.04
G1 A10.5 X22.9675
G1 A11.0 X22.8975
G1 A11.5 X22.83
G1 A12.0 X22.7625
G1 A12.5 X22.7
G1 A13.0 X22.64
G1 A13.5 X22.58
G1 A14.0 X22.5225
G1 A14.5 X22.4675
G1 A15.0 X22.4125
G1 A15.5 X22.3625
G1 A16.0 X22.3125
G1 A16.5 X22.265
G1 A17.0 X22.22
G1 A17.5 X22.175
G1 A18.0 X22.1325
G1 A18.5 X22.0925
G1 A19.0 X22.055
G1 A19.5 X22.0175
G1 A20.0 X21.985
G1 A20.5 X21.95
G1 A21.0 X21.92
G1 A21.5 X21.89
G1 A22.0 X21.8625
G1 A22.5 X21.8375
G1 A23.0 X21.8125
G1 A23.5 X21.79
G1 A24.0 X21.77
G1 A24.5 X21.75
G1 A25.0 X21.7325
G1 A25.5 X21.7175
G1 A26.0 X21.7025
G1 A26.5 X21.69
G1 A27.0 X21.68
G1 A27.5 X21.67
G1 A28.0 X21.6625
G1 A28.5 X21.6575
G1 A29.0 X21.6525
G1 A29.5 X21.65
G1 A30.0 X21.65
G1 A30.5 X21.65
G1 A31.0 X21.6525
G1 A31.5 X21.6575
G1 A32.0 X21.6625
G1 A32.5 X21.67
G1 A33.0 X21.68
G1 A33.5 X21.69
G1 A34.0 X21.7025
G1 A34.5 X21.7175
G1 A35.0 X21.7325
G1 A35.5 X21.75
G1 A36.0 X21.77
G1 A36.5 X21.79
G1 A37.0 X21.8125
G1 A37.5 X21.8375
G1 A38.0 X21.8625
G1 A38.5 X21.89
G1 A39.0 X21.92
G1 A39.5 X21.95
G1 A40.0 X21.985
G1 A40.5 X22.02
G1 A41.0 X22.055
G1 A41.5 X22.0925
G1 A42.0 X22.135
G1 A42.5 X22.175
G1 A43.0 X22.22
G1 A43.5 X22.265
G1 A44.0 X22.3125
G1 A44.5 X22.3625
G1 A45.0 X22.415
G1 A45.5 X22.4675
G1 A46.0 X22.5225
G1 A46.5 X22.58
G1 A47.0 X22.64
G1 A47.5 X22.7
G1 A48.0 X22.765
G1 A48.5 X22.83
G1 A49.0 X22.8975
G1 A49.5 X22.9675
G1 A50.0 X23.04
G1 A50.5 X23.115
G1 A51.0 X23.19
G1 A51.5 X23.27
G1 A52.0 X23.35
G1 A52.5 X23.435
G1 A53.0 X23.52
G1 A53.5 X23.6075
G1 A54.0 X23.7
G1 A54.5 X23.7925
G1 A55.0 X23.8875
G1 A55.5 X23.9875
G1 A56.0 X24.0875
G1 A56.5 X24.1925
G1 A57.0 X24.3
G1 A57.5 X24.4075
G1 A58.0 X24.52
G1 A58.5 X24.635
G1 A59.0 X24.755
G1 A59.5 X24.875
G1 A60.0 X25

It doesn't have any Feed word or any Z moves. Study it at see what you think.

Craig
Title: Re: Spindle servo on lathe is 10% fast
Post by: Hood on May 02, 2019, 03:41:57 AM
Spindle pulleys in Mach is where you set the max velocity and any gear ratio.