6i25 7i76 closed loop spindle

More
12 May 2020 18:41 #167540 by Bob654321
Hello,

I have a been running a late 80’s kitamura mycenter cnc mill with linuxcnc for about 4 years now in open loop as a hobby in my barn. With 20 years experience as a cnc machinist I am beyond impressed with linuxcnc!!!

My goal is to move forward and restore the full functionality of my machine starting with closing the loop on the spindle with synchronized motion to orient the spindle for the tool changer and allow for rigid tapping. The computer is a dell 7020 with mesa 6i25 7i76 plug and go kit. I am using the original brushless permanent magnet spindle motor and the original 1000 count differential encoder with an Invertek drive. The motor is belted to spindle at 2:1 where max speed of motor is 4000 and the spindle is 8000.

On the 7i76 W4,W5,W6 are to the right.

The encoder connections on TB3 are a+ to pin7, a- to pin8, G to pin9, b+ to 10, b- to 11, +5v to pin 12, z+ 13, and z- to 14.
The drive connections to Tb4 seem to be correct, m3 forward m4 reverse and m5 spindle is free to spin by hand. Attached are some hal scope images for a b and index.

When I mess with the spindle PID some interesting things happen. The first is when I make P higher than 1 the spindle runs faster than M3Sxx and when less than 1 spindle runs slower than M3Sxx. I can increase P slowly to a large number and the only thing that happens is spindle speed scaling. Speed oscillates slightly then settles within 5rpm no matter what value of P I use (same as if I unhook the 7i76 and hook a potentiometer to drive). If I is increased spindle speed starts about where you tell it than drifts to the maximum spindle speed. With a low I this happens slowly and with a higher I it happens faster…

I am not sure if my problem is the hal/ini file that was created using pncconf, signal problem, PID values and or something else. Please advise on where to start.

Thanks,
Bob
Attachments:

Please Log in or Create an account to join the conversation.

More
12 May 2020 19:02 #167541 by PCW
Replied by PCW on topic 6i25 7i76 closed loop spindle
For spindle velocity control, feed forward (FF0=1) is the most important PID control term
This should be verified to see if the scaling is correct before worrying about feedback
That is test first with P,I,D = 0 and FF0 = 1. only after this is correct should you add P and I

When doing this you can also verify that the encoder velocity (spindle-vel-fb-rpm-abs) reflects the commanded RPM

Please Log in or Create an account to join the conversation.

More
12 May 2020 20:37 #167546 by Bob654321
With FF0=1, FF1=0, FF2=0, and P,I,D=0 spindle speed is roughly +-30rpm for s1000, s2000, and s3000. In the spindle speed display. I am sure the spindle speed display is using the encoder because I can see speed change if I spin the spindle by hand.

Please Log in or Create an account to join the conversation.

More
12 May 2020 21:08 - 12 May 2020 21:09 #167556 by PCW
Replied by PCW on topic 6i25 7i76 closed loop spindle
OK that means that the scale is about right so FF0 should stay at 1.0
Now the work that the P term needs to do is much less so P and then I
can be added
Last edit: 12 May 2020 21:09 by PCW.

Please Log in or Create an account to join the conversation.

More
13 May 2020 12:58 #167644 by Bob654321
Is there something missing in the hal file that needs to be added or should I modify the P and I term in the ini file and test? Should i start with Ziegler-Nichols tuning method?

Please Log in or Create an account to join the conversation.

More
13 May 2020 13:13 #167645 by PCW
Replied by PCW on topic 6i25 7i76 closed loop spindle
You can use the calibrate menu to tune the spindle "live"
Not sure Ziegler Nichols is much use with zeroth order plants
like velocity command velocity feedback spindles

Please Log in or Create an account to join the conversation.

More
13 May 2020 19:09 #167674 by Bob654321
When open Machine then calibrate with linuxcnc open I only see 3 tabs labeled Tune0, Tune1, Tune 2. They appear to be for the XYZ axis and not the spindle. How do I get the spindle to show up in calibrate?

Please Log in or Create an account to join the conversation.

More
13 May 2020 19:44 - 13 May 2020 20:27 #167675 by PCW
Replied by PCW on topic 6i25 7i76 closed loop spindle
I think the magic is the "SPINDLE_9" in the ini file

This adds the spindle to the calibrate tabs on my test config:
[SPINDLE_9]

# PID tuning params
DEADBAND =        0
P =              50
I =             200
D =               0
FF0 =             0
FF1 =             0
FF2 =             0
BIAS =            0
MAX_OUTPUT =      0
MAX_ERROR =	 50
SCALE =        6000
MINLIM =          0
MAXLIM =       6000

But this is LinuxCNC master, What version of LinuxCNC are you running?
Last edit: 13 May 2020 20:27 by PCW.

Please Log in or Create an account to join the conversation.

More
14 May 2020 01:13 - 14 May 2020 01:17 #167692 by gmouer
I had lots of problems getting closed loop spindle to function properly until recently. Because the spindle is calibrated reasonably close in open loop, the I term is what "grabs" the small error and pulls it in. The BIG problem I always had was I windup, the spindle would severly overshoot on starting and then come back to the commanded RPM. What was needed was pid.N.maxerrorI to limit that windup. Using the maxerrorI parameter gave me a very well behaved spindle that settles very fast and is dead on commanded RPM.

The PID component has a lot more pins and parameters than we see normally used. Most of the time they are not needed BUT sometimes they make all the difference. The docs on the PID component detail ALL the pins and parameters available for use. Limiting the windup of I prevents severe RPM overshoot on spindle starting.

All the docs on closed loop spindle control I read never mentioned limiting the I max output to prevent overshoot. All the examples I seen implemented exhibited overshoot.
Last edit: 14 May 2020 01:17 by gmouer.

Please Log in or Create an account to join the conversation.

More
14 May 2020 12:40 #167730 by Bob654321
This is what my ini looks like with no calibrate tab.

[SPINDLE_9]
P = 0.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 8000.0
ENCODER_SCALE = 2000.0
OUTPUT_SCALE = 8000
OUTPUT_MIN_LIMIT = 0
OUTPUT_MAX_LIMIT = 8000

Please Log in or Create an account to join the conversation.

Time to create page: 0.249 seconds
Powered by Kunena Forum