Continue to Site

# [SOLVED]Arduino pid autotune taking too long

Status
Not open for further replies.

#### bmandl

##### Full Member level 4
Hello,
I am implementing pid autotuner in my project with Arduino. I am using This library.
My aplication works like this:
When external interrupt from zero cross detector occurs, Timer is started with interval, which is calculated with PID algorithm. Input data is temperature from DHT22 sensor. When interval expires, triac is fired. So, longer the interval, less power is transfered to light bulb (which is turned on with TRIAC). That leads me to, that my PID controller is reversed (if I want more power-more heat, I must decrease interval before triac is fired).
Now, the autotuner. First problem is, that tuning takes forever. I managed to get it complete one time, but output parameters were negative, so there was definetly an error.
On this page it says, that output step for autotuner must be positive. But if I set it positive, input never reaches trigger line, so output never changes direction. If I set it to negative, then relay method works. But I don't know if this is ok.
Has anyone experience with this autotuner library and how it works? Does it really have to take so long? In description, author says that number of intervals is between 3 and 10. I counted them 30 already and it is not finished yet.

#### bmandl

##### Full Member level 4
Code:
//oscillate the output base on the input's relation to the setpoint

if(refVal>setpoint+noiseBand) *output = outputStart-oStep;
else if (refVal<setpoint-noiseBand) *output = outputStart+oStep;

This part of code in autotuner library is made just for DIRECT type controllers (If we want input to raise, we have to raise the output). But I need REVERSE type controller, so I changed the + and - and now is stepping ok.

Status
Not open for further replies.