Hello Guest it is December 21, 2024, 11:15:28 AM

Author Topic: Arrggghhh!! Mach3, Win XP, ESS, and MB3 Spindle RPMs erratic  (Read 2393 times)

0 Members and 1 Guest are viewing this topic.

Arrggghhh!! Mach3, Win XP, ESS, and MB3 Spindle RPMs erratic
« on: February 01, 2020, 05:38:21 PM »
Hey guys - I'm stumped with my CNC mill / lathe setup.  I'm starting to lean towards a stick of dynamite to fix it.

I started out with a functioning machine using stepper motors with a Gecko, and a Nowforever VFD for spindle control.  The VFD was stable and worked just fine, but the steppers were small, cheap, and constantly lost steps unless I ran the machine *really* slow.
So I upgraded to servo motors on X, Y, and Z - and bought a cheap chinese cnc controller.  Hooked everything up, and got the servos running great!  But the spindle speed fluctuated all over the place.  I did some research and found that a lot of the cheap controllers couldn't read the index pulse fast enough - so I decided to go a little further and I just bought an ESS and an MB3 board.  Now I've got that setup running the servos just fine .... and .... you guessed it!!  My spindle speeds are all over the place still.

A.) I've tried a bunch of different settings in Mach, including the original settings that worked with the Gecko, but nothing ever stabilizes the spindle speed.

B.) I've got the 0-10v analog output from the MB3 running to the VFD, and when I connect everything and set a speed of 2,500rpm in Mach (max is 5,000), the voltage output varies constantly, causing the speed "hunting".
If I connect 5v from another source to the VFD, I get a nearly perfect and constant 2,500 rpm out of the spindle.  So I feel that the VFD is fine.

C.) Strange thing is that if I disconnect the VFD and measure the output of the MB3 open-circuit, I get damn near 5v and it's steady.  So it seems that the ESS/MB3 is fine as well.

But when I connect them together, voltage output from the ESS/MB3 immediately starts varying, and spindle speed jumps around from say 500 rpm all the way to nearly 5,000rpm.
My commons are all connected between the MB3 and the VFD and ohm out as good connections.

I'm running my index sensors at 24v, which the MB3 board is designed for (and they are on the high-speed inputs, supposedly capable of up to 1,710,000 rpm!!!).  I get a pretty clean signal on my oscilloscope all the way through max rpm.  If I run the VFD manually and vary the speed, I can see the LED on the MB3 board lighting extremely consistently (at slower speeds at least, lol.  My eyes can't see the flashing at higher speeds!)  But in Mach3, the rpm display isn't always steady.  It'll read pretty constant, then jump way up, then read constant, then jump around again.  Shouldn't the ESS be interpreting the RPM and simply sending a value to Mach?  Or is the ESS somehow sending irregular pulses to Mach for the index?  Or is Mach just glitching?

I'm running an older Dell desktop with Windows XP on it.  The only thing installed are the factory drivers and Mach3.
I thought maybe the software was corrupted, so I formatted the PC yesterday, reloaded Windows, and reinstalled the latest version of Mach.  Went through all the setup, and it still acts exactly the same way.

There has to be some simple thing I'm just not thinking of, right? 

Please enlighten me as to what I am doing wrong!!!

-Darren
Re: Arrggghhh!! Mach3, Win XP, ESS, and MB3 Spindle RPMs erratic
« Reply #1 on: February 01, 2020, 07:04:06 PM »
Hi,
it seems like you have a few things going on and creating a lot of confusion.

May I suggest strip the problem down to its component parts and diagnose each individually.

In the first instance use a separate DC supply to provide a constant voltage to the VFD and therefore a constant
spindle speed. You have already established that with constant voltage the rpm is stable, ie the VFD is OK.
You have also established with a scope that the 24V index signal going INTO the MB3 is good.
Now probe the index output of the MB3 TO the ESS, it should be a clean square wave but now 0-5V.

This would prove that the index input circuit of the MB3 is correctly wired and operating and that the index signal is
being correctly translated to the ESS input. You should be able to sweep the DC input to the VFD and therefore sweep
the index pulse rate through its full range. The full range of pulse frequency should be displayed in Machs spindle speed DRO.
If the spindle speed is correctly displayed you have established that the ESS is correctly reading the 0-5V index signal
input from the MB3 and signalling Mach the actual (measured) speed.

In ESS plugin DISABLE the spindle PID. Now with MDI test the PWM output of the ESS (0-5V) and then the PWM DC
oputput of the MB3. Given that the spindle PID has been disabled the speed should be close to the Snnn command given in
the MDI line.
You might expect:
M3 S1000 result in a approximately 1/5 PWM output of 2V, assuming 0-10V full-scale.
You might expect:
M3 S2500 result in 1/2 PWM output of 5V assuming 0-10V full-scale.
You might expect:
M3 S5000 result in 100% PWM output of 10V assuming 0-10 full-scale.

Assuming a positive outcome of this test you have proved that Mach3 can signal the ESS to produce a given percentage PWM output
and that the MB3 can convert that duty cycle to a varying DC voltage necessary to drive the VFD.

If both these experiments have conclude successfully THEN try spindle PID. I suspect from your description that this is the fault.
That is, I would anticipate that the two experimental procedures to be successful and that the PID loop is unstable. GET USED TO IT,
PID loops are HARD TO TUNE, especially loops like this that have very restricted input bandwidth. By input bandwidth I mean the rate at
which the ESS signals to Mach the actual (measured) speed. Mach compares the actual speed with the commanded speed and produces an
error signal with which to alter its PWM output to reduce the error. The number of times per second Mach gets updated about actual speed
is quite low, approx. 40 updates per second. Consequently the rate at which it can correct an rpm error is also quite low, and if Mach
attempts a too greater correction the loop becomes unstable. This fits your description.

If the PID loop is unstable....what to do about it?

First question to be answered is ….do you need spindle PID at all? My experience is that if you command a spindle speed in Mach, either
MDI or Gcode, a good motion controller and breakout board will provide a DC voltage within a few percent accuracy WITHOUT a closed loop.
If the rpm is within a few percent and it does not drop to badly under load....who cares about spindle PID?. For years and years
I've used manual lathes and mills WITHOUT spindle PID, in fact only discrete (gear/pulley) spindle speed settings....and work turns out fine
on manual machines. Is it strictly necessary to have precise speed control just because its a CNC machine? I don't think so.
One area where a closer control of spindle speed is required is single point lathe threading. Is this your purpose/requirement?

If you  require spindle PID then you'll have to tune it. Tuning PID loops is a whole subject on its own. As a starting point increase the P(proportional)
component of gain and set the I(integral) and D(differential) to zero. Once you have established a maximum P gain back off by 25% and try a smidgen of
I gain. If you keep the I gain low you may not need any D gain. Increase I gain until you achieve your steady state error specification and then tweak
the D gain for best dynamic performance.

One of the limitations of Spindle PID in Mach3 is that the input signal refresh rate is determined by the index signal which is by definition one
pulse per rev. In Mach4 you can use an encoder and therefore have multiple inputs per rev thereby increasing the bandwidth by a factor of ten
to one hundred. The increased bandwidth allows a MUCH easier to tune and stable PID loop.This is a quantum leap forward in spindle PID, and
should be considered VERY favourably by anyone wanting to do single point lathe threading, ESPECIALLY with a marginally powered/inertia spindle.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Arrggghhh!! Mach3, Win XP, ESS, and MB3 Spindle RPMs erratic
« Reply #2 on: February 02, 2020, 11:26:27 AM »
Hi Craig, thanks for the detailed response!  That's exactly what I was looking for.  Even though I thought I was being very logical in how I was testing things, you brought up even further, more detailed ways of testing each component.  I will try to test further in the next couple days.

And I think you are 100% spot on in that PID isn't needed for 99% of what is going to be done.  The only thing that I would like it for is for threading when using the lathe part of the machine - but I don't have an immediate need for that anyways.

- Darren