Go Down

### Topic: Help with PID (Read 815 times)previous topic - next topic

#### SMM2

##### Oct 01, 2016, 01:22 amLast Edit: Oct 01, 2016, 01:39 am by SMM2
Hi, I am planning on creating a line follower robot, and I ran across something called PID, and I am trying to understand this concept and how it can be implemented in a line follower robot.

What I do understand is that this is a control method used to set the current position of something, or current value, to a set point in a short amount of time. Is this correct? Also, I'm assuming this can be used with a line follower robot to move the robot back to it's set point, which would be it centered right above the line.

So, I guess my question(s) is how would you use this control method in your sketch? What code do you need to write to do this? How exactly does it work? What does it do? Do I need a library?(Example code would be awesome)

I really would like to understand this so I could implement it in a line follower robot, and possibly a self-balancing robot.

Any help would be great.
"Success is not built on success. It's built on failure. It's built on frustration. Sometimes its built on catastrophe."

#### jremington

#1
##### Oct 01, 2016, 01:52 am
Good place to start reading here.

Arduino PID library

#### SMM2

#2
##### Oct 03, 2016, 10:34 pm
First off thanks for the response jremington

Ok, so I looked at the links you gave me and I also did a lot of looking around on YouTube, and I had found some helpful videos. I'm somewhat understanding what this control method is all about, but I am still confused...

What I'm confused about currently is basically how the Kp, Ki, and Kd get the values. Like I have seen where people set them to an integer like for example 9, 7, & 6. But what confuses me is how these values make the input equal to the setpoint through an output. So, basically what do these values do and how do they work.

Also, some example code would be great!
"Success is not built on success. It's built on failure. It's built on frustration. Sometimes its built on catastrophe."

#### jremington

#3
##### Oct 04, 2016, 02:28 amLast Edit: Oct 04, 2016, 02:32 am by jremington
You have to choose Kp, Ki and Kd.  Google "PID tuning" for some tutorials on how to go about it systematically.

It is very important that you put print statements into your test code, so that you can see whether the values make sense.

If you want help with a line following robot, you will need to post details about the robot and post the code that you are using with it. If you don't have a robot, then it is too early to worry about PID details, as those depend on the robot.

Go Up