So I'm in the process to learn PID and how to work with it, I run thru tutorials understood some parts
we get a Input and thru the PID formula get a stable output for our task/robot..etc
So I start searching PID for arduino and I found this:
http://playground.arduino.cc/Code/PIDLibrary
and run thru the basic example:
/********************************************************
* PID Basic Example
* Reading analog input 0 to control analog PWM output 3
********************************************************/
#include <PID_v1.h>
#define PIN_INPUT 0
#define PIN_OUTPUT 3
//Define Variables we'll be connecting to
double Setpoint, Input, Output;
//Specify the links and initial tuning parameters
double Kp=2, Ki=5, Kd=1;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
void setup()
{
//initialize the variables we're linked to
Input = analogRead(PIN_INPUT);
Setpoint = 100;
//turn the PID on
myPID.SetMode(AUTOMATIC);
}
void loop()
{
Input = analogRead(PIN_INPUT);
myPID.Compute();
analogWrite(PIN_OUTPUT, Output);
}
and we got input data the Kp,Ki and Kd but there is no any explaining how to run it use it..etc
thru this lib, what is the setpoint, direct, automatic, why we need setpoint how in general to use
this lib.
I'm a PID beginner so pls if you get any other examples easier to learn that would be nice or please
explain me how this lib works.
I will try to setup a simple example to run thru the PID process, a IR sensor, a motor and H-Bridge
to keep the motor spinning constantly the same speed no mater what so ever if there is friction
or me trying to stop it.
If you are not patient giving few min or hours from your time in the next days pls
don't comment. I try to learn some useful stuff and rage will not be helpful.
D.60