Pages: [1]   Go Down
Author Topic: Arduino PID Library: Out of Beta  (Read 4032 times)
0 Members and 1 Guest are viewing this topic.
Boston
Offline Offline
Full Member
***
Karma: 0
Posts: 101
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

After being in Beta for way too long, the Arduino PID Library is ready (I think) for prime time. The new and improved PID_v1 can be downloaded here.

I made some major changes to the internal code, but what I hope the end-user notices most is that I tried to simplify things.  The two biggest examples of this:
  
  • I switched to the Kp, Ki, Kd form of the PID.  I still like the other version better, but this is what everyone is expecting, and it isn't really about what I want.
  • There are significantly fewer functions.  All that's left is what's absolutely necessary to make the pid work well.

The biggest improvement this time around, and by far the most difficult, is that I've explained myself.  In excruciating detail.  If you want to know how and why I did things in the code, it's all there.

As always, questions and comments are greatly appreciated.

-Brett

Update: the previous PID thread became a rather unwieldy place for Q&A.  In an attempt to have things be a little more organized, I've created a google group.   
« Last Edit: April 26, 2011, 07:01:09 am by br3ttb » Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 209
Posts: 13028
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


First, thank you!  I appreciate the work you've done.

Second, are you interested in specific technical comments?  If "yes", would you prefer them posted here, on your blog, or something else?
Logged

Boston
Offline Offline
Full Member
***
Karma: 0
Posts: 101
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
are you interested in specific technical comments?
Yeah absolutely.  If it pertains to something addressed in one the blog posts, it probably makes the most sense to post there, so I can respond in context.  For more general stuff, here probably makes more sense.  But no huge deal. I'm more interested in the feedback than where it's delivered.
« Last Edit: April 15, 2011, 09:08:44 pm by br3ttb » Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8596
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks br3ttb, I skimmed your tute and already know 10x what I used to about PID, I'll have a better read later.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 209
Posts: 13028
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Done.  On the blog.
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Neat - I was just implementing the beta version - looks like I'll switch to this now smiley

Nice writeup - I'm learning a lot too.
Logged

Boston
Offline Offline
Full Member
***
Karma: 0
Posts: 101
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@Coding Badly.  Excellent, thank you.  responded.
@mowcius, @Graynomad  I'm not the biggest fan of the work involved in doing a writeup.  The fact that it's useful to you makes all the difference.  thanks.
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh that writeup really makes the difference - To most people using the arduino platform, code without a writeup is as useful as no code - they wouldn't know how to use it and therefore wouldn't be able to.

Your writeup obviously goes into a lot more than just how to use it but that's much appreciated - educates us all smiley
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think DIRECT implies other things but i can't think of anything to change it to. Obviously FORWARD would be no better.

Perhaps you want to mention the point that double is acting with the same precision as a float but presumably is there in case double is added with full precision in the future.
Logged

Boston
Offline Offline
Full Member
***
Karma: 0
Posts: 101
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I think DIRECT implies other things but i can't think of anything to change it to
  agreed.  when there's a question about naming I fall back to industrial standards.  I did the same thing with "sample time"

Quote
Perhaps you want to mention the point that double is acting with the same precision as a float but presumably is there in case double is added with full precision in the future.
  yes!  can't believe I forgot to do that.  True double-precision is WAY overkill for PID.  Now I just need to figure out where to put it...
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's almost as bad as things like 'proper time'... but I can live with DIRECT - makes sure people read your documentation smiley

I'll let you know if I find any actual issues with it rather than me nitpicking smiley-wink
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's almost as bad as things like 'proper time'... but I can live with DIRECT - makes sure people read your documentation smiley

I'll let you know if I find any actual issues with it rather than me nitpicking smiley-wink

Having worked in the process control industry I can state that the concept of direct/reverse acting controller can be hard for newcomers to grasp at first. An example might be a simple level controller for a vessel where there is a pump forcing liquid into a vessel and a PID controller reading the level and manipulating a control valve to keep the vessel level at a fixed level. Now depending on if the valve is on the inlet side to the vessel or on the outlet of the vessel will dictate with control action one requires, direct or reverse.

 Also control valves come in direct and reverse acting versions and that can also require a flipping of the controller action. In the 'old days' it could be quite confusing to see one valve that would move to full open with 100% output and another valve that would move to fully closed with 100% controller output. Most control valves in industrial service have a 'fail safe' requirement defined by the process engineers for each specific control valve in the plant that would determine which way a pnumatic valve would move with a loss of all control power via internal spring force. Modern computer process control systems have kind of eleminated the confusion for the control operators such that it's always clear on the computer screen what the position of a control valve is regardless of it's control action. But of course the complexity is still where, just transfeered to the control system engineers to configure each controller properly.

Lefty
Logged

Leighton Buzzard, UK
Offline Offline
Edison Member
*
Karma: 21
Posts: 1339
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

just skimmer through the explanations
stunning bit of reading
have marked for in-depth study!

thanks
Logged

there are only 10 types of people
them that understands binary
and them that doesn't

Pages: [1]   Go Up
Jump to: