Tuning my PID controller 2

by Ivan Hamilton 5/10/2008 10:44:00 PM

I've mentioned previously that I think it's beyond me to visually judge the performance of the PID tuning values in use in my servo controller.

I had created a simple program to test the response, but wasn't happy with the point to point style test it was carrying out. It's more important for a CNC machine to follow curves closely, than have outright movement speed.

To fix this, I've added a feature to the microcontroller, a sine wave test. The test was added to the controller, because for a good test, a position update needs to be present every time the PID loop recalculates. By placing the sine wave path generation in the controller, a new movement value is present every single PID update. I couldn't achieve this sort of high performance timing by sending updates down a serial line.

Also, the standard point to point test produces massive errors when the set-point jumps, masking the fine detail of an "error" plot. I've added it now (on it's own axis), and it's very helpful in seeing exact levels of error (the large scale of the movement would otherwise hide this relatively small error). 

Rotate 1 revolution forward and back in 1 second

Rotate 1 revolution forward and back in 5 seconds

In the above images you can see the reduction in error during a slower test (from +/-10 to +/-3). On the slower test, that's within 0.9 degrees.

I've also included a "steady state" option. This doesn't instruct the controller to make any movement, but it does record and display it. This lets you see the response to an external disturbance on the servo (the handy shifter!).

Armed with this new information... I still haven't gone back and re-tuned the PID values.

Currently rated 3.0 by 2 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


.NET | CNC | Electronics

Related posts


4/19/2009 9:30:26 PM

you can give more infomation

Hai Linh

8/14/2009 2:56:27 PM

There are certainly a lot more details to take into consideration, but thanks for sharing.

Goose Hunting Canada

8/31/2009 1:57:35 AM

I like your blog theme btw, actually i love this design. :)

buy salvia divinorum

9/1/2009 6:03:33 PM

Very Interesting article will make sure I check your posts more often! :)


Dental Implants

9/2/2009 6:22:13 AM

Very cool, thanks for the heads up! :)

where to buy salvia in nc

9/9/2009 2:24:36 AM

Hey, this blogengine thing looks pretty decent i must say. :)

jon gabriel diet

10/27/2009 5:33:15 AM

You make us look like we�re smarter than we really are :o).

ATV San Diego

10/27/2009 10:01:58 AM

One doesn't need to be an analytic thinker to love this idea...

Computer Repair San Marcos CA

10/28/2009 2:50:22 AM

One doesn't need to be an analytic thinker to love this idea...


12/22/2009 11:58:37 AM

Hmmrh You have a not too shabby post. Pretty good posts also. Thanks!

Maria Goods

Add comment



Powered by BlogEngine.NET
Original theme by Mads Kristensen

About the author

Name of author Ivan Hamilton
"My inner nerd can beat up your inner nerd."

E-mail me Send mail



<<  April 2018  >>

View posts in large calendar

Recent comments





    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2018

    Sign in