Page 1 of 2

Spindle PID setup

PostPosted: Wed May 13, 2020 2:27 pm
by drumsticksplinter
Hi all,

I'm wondering if anybody would mind sharing their experience or advice with tuning the PID settings in UCCNC please?

I have a Denford Triac mill with a DC spindle motor and sprint 1200 dc drive. I'm using 0-10v analog control, which seems to be working well, but I'm having trouble with the PID values to get the motor to be fast at responding to changes in speed, ie, Id like to use it for rigid tapping.

I am using an incremental encoder with 50ppr, after changing from a 1000ppr encoder because my AXBB-E couldn't handle the pulse rate with the spindle speed. (Ideally I'd have chosen a 200ppr encoder, but I had the other one to hand).

Currently my settings are:

Kp: 0.142
Kd:0
Ki:0.0172
Sample time: 20ms

With these settings the speeds are reached in around 3 seconds, but fluctuate slightly around the desired rpm for a little, then settle close to or at the desired speed.

I have played around with the settings for quite a while, and changing the values in whole numbers too much causes VERY erratic motor behaviour, so these settings are the best I have got so far :?

Any pointers would be appreciated,

Thanks

Re: Spindle PID setup

PostPosted: Wed May 13, 2020 4:09 pm
by eabrust
drumsticksplinter wrote:Hi all,

I'm wondering if anybody would mind sharing their experience or advice with tuning the PID settings in UCCNC please?


Currently my settings are:

Kp: 0.142
Kd:0
Ki:0.0172
Sample time: 20ms


Any pointers would be appreciated,




Hi drumsticksplinter,

I have an older burke kneemill setup with a belt driven encoder, and using a 1/rev index sensor that is separate from the encoder due to pulse width timing issues I had. I've had acceptable results with tapping.

My PID settings are as follows:
kp=1.5
kd=.3
ki=.03
sampling (msec) 10

PID set.JPG



FYI, I'd start over, start by adding kP only until you get oscilations that won't dampen out, then back it off by 50-75%, Then add kD only till you get oscillations, and back that off. You can probably stop there, and only add kI (integral) at the end if you have some small error between commanded and actual speeds that won't go away over time.

I think your biggest issue is you have no damping (kD), and have integral applied (kI) with no damping.

regards
Eric Brust

Re: Spindle PID setup

PostPosted: Wed May 13, 2020 9:32 pm
by cncdrive
Also verify the DC spindle controller. You wrote that it is an analog 0-10V input controller, so I guess it does closed loop PD or PID speed control.
Make sure that the speed loop is tuned fine, because it could also cause slow control loop setlement.

Re: Spindle PID setup

PostPosted: Thu May 14, 2020 8:57 am
by drumsticksplinter
Hello,

Thank you for your replies,

Eric, thanks for the advice on the tuning, I will start over with the pointers you have given, as before I was just changing values until I got somewhere near. Now near isn't close enough and I can't seem to tune any closer...

I have to admit, I really don't understand PID controllers, I have tried to watch videos and read up on basic explanations, but I just can't grasp it. :roll:

cncdrive wrote:Also verify the DC spindle controller. You wrote that it is an analog 0-10V input controller, so I guess it does closed loop PD or PID speed control.
Make sure that the speed loop is tuned fine, because it could also cause slow control loop setlement.


This is a very good point, I did a little tuning with the dc controller as it was a way off before, I will have another look into this, possibly ramp up / down speeds can be sharpened up a bit:

My controller feedback loop looks like the attached image, not sure if its PD or PID? It uses tacho voltage for feedback and is speed controlled rather than torque controlled.

Thanks

Re: Spindle PID setup

PostPosted: Thu May 14, 2020 1:55 pm
by eabrust
drumsticksplinter wrote:Hello,

cncdrive wrote:Also verify the DC spindle controller. You wrote that it is an analog 0-10V input controller, so I guess it does closed loop PD or PID speed control.
Make sure that the speed loop is tuned fine, because it could also cause slow control loop setlement.


This is a very good point, I did a little tuning with the dc controller as it was a way off before, I will have another look into this, possibly ramp up / down speeds can be sharpened up a bit:

My controller feedback loop looks like the attached image, not sure if its PD or PID? It uses tacho voltage for feedback and is speed controlled rather than torque controlled.

Thanks


Hey Drumstick,

I'll admit I glossed over your application initially, now I see what sort of motor drive you're dealing with. I've also dealt with a cousin to your machine, I have a Denford Starturn lathe which is DC motor driven. I currently run it w/ Mach3 via parallel port or via UC100 (and M3). I used PID in M3, with a single index input used for speed feedback. I can do pretty good threads, but I don't do any reversing of the spindle (so I don't do any axis to spindle sync like w/ Rigid tap like you're setting up). This is the sort of PID numbers that my setup works well with:
STurn SPindle Tune.JPG


It's been ~ 10 years since I converted it so details are fuzzy in my brain, but I also had issues with the original motor speed control in the Denford. I don't think my Starturn likely had the exact same speed board as your Triac, as my Starturn used an encoder fed into the DenMint board for spindle position/velocity feedback (no tachometer or speed feedback went direct to the motor speed controller), and the DenMint board fed only 0-10v to the original speed board.

In the end, I replaced the original Denford board with a KB speed controller. I don't believe that KB speed controller does any PID type stuff internally, it is fairly 'dumb' and relies purely on the 0-10v input, so that leaves UCCNC or M3 in full control of the PID. The KB has trim pots to set accel rate and min/max speed output only. I snapped a few pics of the board I'm using for your reference.
IMG_20200514_081303.jpg

IMG_20200514_081342.jpg

IMG_20200514_081349.jpg




Hope it helps, feel free to ask questions. No guarantee I'll be able to answer though :)

Regards,
Eric

Re: Spindle PID setup

PostPosted: Fri May 15, 2020 8:53 am
by drumsticksplinter
Hi Eric,

Thank you for taking the time to get some pics of your setups for me, much appreciated.

I also have another relative of the Denford family, in the form of a Cyclone lathe. That one has been a very long term project, but is now at the stage of dialing in the final setup, similarly with my Triac. I'm hoping both machines combined will support me greatly in my hobby engineering endeavours :D The Cyclone runs on Mach3 Turn using a different brand controller, I haven't messed with the PID settings on that yet. That one uses a 240v Yaskawa VFD in replacement of the the original 415v KEB drive, and seems to be running quite nicely so far.

I have had a small chance to play around with the Triac yesterday evening. I started with just the drive and no PID enabled in UCCNC. I ended up taking the ramp up / down settings out completely, which makes the starting of the motor quite violent, the stopping takes a little while, is it just coasts to a stop (I can's see that the Sprint DC drive has the option of a braking resistor).

Once I knew the drive tuning was sorted, I used the method you advised with the PID settings and I am much happier with the results, some fine tuning to do still, but overall much more responsive. The scope in the PID tuning window shows the motor very sharply following the commanded speed, then a slight curve until it reaches that speed and settles out. I don't have my reverse spindle relay working with UCCNC just yet, as its set up a little strangely, so I might have to change a macro for it to work. The drive uses a spindle enable contact for forward (default), then it requires the spindle enable and reverse contacts for reverse direction. I basically need Fwd and Rev outputs to be active to get the drive to reverse, or possibly wire in the enable contacts through the reverse relay, maybe easier?

I had contemplated using a DG4S-16035 dc servo drive with the motor using step direction as a servo spindle, maybe I'll do this at a later date. My spindle motor is an SEM DC brushed servo, I did a retrofit of a bridgeport some years ago with the same motors as axis servos using the DG3S-16035 (older) drives. They worked out very well indeed!

Thanks,

Adam

Re: Spindle PID setup

PostPosted: Fri May 15, 2020 12:04 pm
by eabrust
Glad to hear you're getting it going the way you want it to behave.

PS, I looked up the Denford Cyclone, that was a mistake.... I want one! Will probably never find one in the US.... now I have lathe envy :lol:


regards
Eric

Re: Spindle PID setup

PostPosted: Fri May 15, 2020 1:25 pm
by drumsticksplinter
Thanks Eric,

Yes the Cyclone is a really nice machine that can just about fit an a 1 car garage... (minus the car). Mine was from a school, it had a servo fault when I bought it and it wasn't feasible to repair it or to buy a replacement to work with the drive and control. I ended up replacing all of the control, servos and drives apart from the small VFD that controls the tool turret. The machine is now single phase and has parts that are still serviceable or reasonably replaceable (fingers crossed). I left behind the Cylone's brother, a Triac VMC at the same school (both were for sale) and always regretted it, so dropped on another Triac to retrofit :) Sadly it doesn't have the ATC, but I'll be fine with manual tool changes for what I want to do anyway...

Harrison also made the same machine, called a TU150, not sure if any of those ended up in the states?

Thanks,

Adam

Re: Spindle PID setup

PostPosted: Sat May 16, 2020 11:41 am
by Battwell
the old dc drives fitted in the triac and boxfords are pretty terrible!
i set mine up as fine as i could originally with just a manual pot. (so i could see exactly how they react by feel), but they still hunt around the set speed etc.
a lot of pot drive tuning before connecting to the controller analog. !
hence on my triac swapping out for a 1kw ac servo and the reliabilty/ controlability it gave. using the encoder pulses out of the drive into uccnc as encoder input.
this got it perfectly under control at the correct speed and pid setting in uccnc virtually spot on.

Re: Spindle PID setup

PostPosted: Mon May 18, 2020 9:37 am
by drumsticksplinter
Battwell wrote:the old dc drives fitted in the triac and boxfords are pretty terrible!
i set mine up as fine as i could originally with just a manual pot. (so i could see exactly how they react by feel), but they still hunt around the set speed etc.
a lot of pot drive tuning before connecting to the controller analog. !
hence on my triac swapping out for a 1kw ac servo and the reliabilty/ controlability it gave. using the encoder pulses out of the drive into uccnc as encoder input.
this got it perfectly under control at the correct speed and pid setting in uccnc virtually spot on.


Your machine looks to work faultlessly, hopefully mine will do too when its complete :)

What servo and drive did you use? That would be the ideal solution in the long term, but I'm not sure I can shell out on a new 1K servo and drive package at the minute. The Sprint 1200 drive in my machine seems to be settling in ok for now, there is some slight hunting at lower RPM, which I'm hoping to tune out eventually.

Somebody may be able to sharped my understanding of how a controller and the software handles something like rigid tapping...

I have AXBB-E running with UCCNC, when using the PID enabled spindle with encoder feedback, if the spindle speed fluctuates, is the z motion completely synchronised with what the software is seeing from the encoder? So if the spindle slows down slightly as the tap starts to cut, the PID loop would try to correct this, but does the Z motion also compensate for this? I'm not totally sure of this and therefore exactly how tightly tuned the spindle has to be to allow for successful rigid tapping?

Thanks,