FOSH-following-demand / thermostatic-water-bath

Made by tecsci
GNU General Public License v3.0
2 stars 0 forks source link

PID Control #4

Open gcorthey opened 5 years ago

gcorthey commented 5 years ago

@juanstdio please, go back to version 0.02 of the code an work on the proper implementation of the PID control.

Your code looks good, I would remove the condition loop and leave the calculation of PID_iout of it.:

  if(-3 < PID_error <3) //Calculate the I value in a range on +-3, 
  {
    PID_i = PID_i + (ki * PID_error);
  }

Have you followed the explanation of the PID library here? You can also use the PID library directly.

Also there is nice explanation here with a interactive IPhython Notebook that you can download and execute here

For tuning the parameteres, first you can just use PI control and see how it works and then add D also.

Cheers

Gaston

juanstdio commented 5 years ago

I would remove the condition loop and leave the calculation of PID_i out of it.:

Solved in commit #6593f4aff6ff25d2b05d3076212be09fb5a14ec0

For tuning the parameteres, first you can just use PI control and see how it works and then add D also.

Tunning only using PI was impossible because the overshoot was too high.

gcorthey commented 5 years ago

I would remove the condition loop and leave the calculation of PID_i out of it.:

Solved in commit #6593f4aff6ff25d2b05d3076212be09fb5a14ec0

I don't see that, it was completely removed and only p and d left... We need to work on that...it must be possible to have a PI or PID control....please read throughly the guides I sent you to completely understand the details of the process.

For tuning the parameteres, first you can just use PI control and see how it works and then add D also.

Tunning only using PI was impossible because the overshoot was too high.

Why is that? have you tried different parameters for P and I? there might be a problem there. It is necessary to follow a PID tuning protocol to achieve the correct parameters. You should follow this procedure for example.

amchagas commented 5 years ago

Hi folks,

I don't know if this is useful, but someone wrote and documented a PID library for arduino: https://github.com/br3ttb/Arduino-PID-Library/

amchagas commented 5 years ago

Also this might be useful http://ospid.com/blog/

juanstdio commented 4 years ago

Hi, Check the version 0.0.4, might be the solution of the PID Control