Hello Guest it is May 21, 2019, 01:31:13 PM

Author Topic: Strange occurence in Mach 4  (Read 1894 times)

0 Members and 1 Guest are viewing this topic.

Re: Strange occurence in Mach 4
« Reply #10 on: October 06, 2017, 10:05:12 PM »
the servos and drivers you've got will work an absolute treat once you get them 100% sorted. Many a hobbyist CNCer would give their eye teeth for
that set up, me included.

To understand PID settings and stability in depth requires University level mathematics and many an Electrical Engineer will regale you with stories of
trying to understand pages of seeming incomprehensible mathematics for the purposes of passing exams.

In absence of that detailed understanding you have to rely on heuristic methods.

The essential feature of any servo loop is that the servos actual position is compared with its ideal programmed position. This is called the error term.
If for instance your servo is at 100.5 degrees when the programmed position is 102 degrees then the error will be -1.5 degrees, minus because its lagging
behind. The amplifier in the drive will increase its output voltage a little bit to encourage the servo to catch up. How much it increases its voltage
for a given amount of error is where PID comes in. The higher the gain of the amplifier will cause the voltage to increase markedly, the servo accelerate
and catch up. This is called the Proportional gain. In general you wish the proportional gain to be high so that the servo quickly responds to an error
and so minimise the error.

Imagine this servo is on the Z axis and the weight of the spindle causes the servo to want to drift clockwise as the Z axis slumps under gravity. The servo
drive would recognise this as an error and produce a voltage that causes the servo to drive counter clockwise. Ideally they would cancel out, but they don't,
not quite. Just to hold the axis against gravity requires a little voltage to try to spin counter clockwise even though it doesn't spin at all, its balanced.
This will mean there will be a small amount of error, say 1 degree. This is an example, contrived to be sure, but still an example of following error.
The solution to this error is to have an integrator in the error loop as well as the proportional term. The integrator will cause the amplifier to up its output
just enuf to cancel the following error. The aim here is to have enuf Integral gain to quickly and reliably reduce the following error to zero.
The downside is that excess integral term can cause oscillations.

The solution to the instability often introduced by the integral term is Differential. It is analogous to frictional damping, sometimes called viscous damping.
The aim is to add enuf differential term to cause the loop to be stable without adding so much as it becomes lethargic.

Your servo setup is very close to correct. A very small reduction in integral gain will reduce its tendency to oscillate quite a bit when the reduction
of performance in reducing following error will be hardly noticeable. You could increase the differential term to increase the damping but you'd probably
have to up it quite a bit to get the same result. If all else fails you may have to reduce the proportional gain, really the whole business with integral and
differential terms is just a means of increasing the proportional gain AND keep it stable. If you push the proportional gain too high then you have to do
pretty radical things to keep it stable and if circumstances or the load changes it could go back to oscillating.

My wife left with my best friend...
     and I miss him!
Re: Strange occurence in Mach 4
« Reply #11 on: October 07, 2017, 12:05:18 PM »
Thanks Craig, I will have to check out the PID loop and try to lower my Integral gain and see what performance that yields.
Re: Strange occurence in Mach 4
« Reply #12 on: October 11, 2017, 03:47:58 AM »
Hi native34,
have you had a chance to experiment?

My wife left with my best friend...
     and I miss him!
Re: Strange occurence in Mach 4
« Reply #13 on: October 11, 2017, 01:46:50 PM »
No not yet. I have a couple of jobs to finish before I can take my machine down. Hopefully I will be able to get to it this weekend. I will keep you posted.
Re: Strange occurence in Mach 4
« Reply #14 on: November 05, 2017, 08:32:04 AM »

I just found this thread in our forum in which you state that you could not get support for us for tuning the servo.  I am not sure you reached to us, but we have a ticket system and you can open a ticket with this and we will give you a hand:


The problem you are having is a tuning issue and the advice you have been given here is right on.
Here are other resources that may help you:

Tuning guide: http://cnc4pc.com/Tech_Docs/PID_tuning_eng.pdf

Sample Configuration file for that motor: http://cnc4pc.com/Files/DG4S08020-34-180-72.PID

Arturo Duncan