How the terms Kp ; Ki ; Kd are known for a heater pid controller? using arduino PID library

can you give me some ideas here?

can you give me some ideas here?

Study up on how PIC controllers work. There are many tutorials on line.

have an idea about PID controllers but dont know how to process these terms

Kp ; Ki ; Kd

You can try out the Tuning example

```
/********************************************************
* PID Adaptive Tuning Example
* One of the benefits of the PID library is that you can
* change the tuning parameters at any time. this can be
* helpful if we want the controller to be agressive at some
* times, and conservative at others. in the example below
* we set the controller to use Conservative Tuning Parameters
* when we're near setpoint and more agressive Tuning
* Parameters when we're farther away.
********************************************************/
#include <PID_v1.h>
//Define Variables we'll be connecting to
double Setpoint, Input, Output;
//Define the aggressive and conservative Tuning Parameters
double aggKp=4, aggKi=0.2, aggKd=1;
double consKp=1, consKi=0.05, consKd=0.25;
//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint, consKp, consKi, consKd, DIRECT);
void setup()
{
//initialize the variables we're linked to
Input = analogRead(0);
Setpoint = 100;
//turn the PID on
myPID.SetMode(AUTOMATIC);
}
void loop()
{
Input = analogRead(0);
double gap = abs(Setpoint-Input); //distance away from setpoint
if(gap<10)
{ //we're close to setpoint, use conservative tuning parameters
myPID.SetTunings(consKp, consKi, consKd);
}
else
{
//we're far from setpoint, use aggressive tuning parameters
myPID.SetTunings(aggKp, aggKi, aggKd);
}
myPID.Compute();
analogWrite(3,Output);
}
```

So these parameters can be altered anytime to make the system smooth?

is there any way to get smooth values for these parameters?

If you want to know how to choose PID parameters for optimum performance you need to catch up on control theory. Specifically, you need to study differential equations, Laplace transforms, and feedback control. Without this background and jumping straight to Arduino you are shooting in the dark.

I have studied the equations associated with the PID library

But dont get an idea about the Kp ; Ki ; Kd terms in the equations,

How can we take the Kp ; Ki ; Kd terms, for a temperature controller?

For heating element

For the start you can use a proportional value of 45% (meaning that a 1 degree error will increase the power by 45 percentage points) and an integral value of 0.05, meaning 0.05 percentage points per degree error per second, or 3 per minute. you can initially ignore differential component.

This approach keeps the room temperature with 0.1 degree of the setpoint most of the time, and adjusts well to changes in conditions.

```
// PID tuning
double KP=45; // 2.2 degrees out = 100% heating
double KI=0.05; // 3% per degree per minute
double KD=0; // Not yet used
```