Trouble brewing

Generic topic to prevent spamming the forums :smile:

Currently the brewing system I made works a bit. The heater goes on etc but sadly the system overshoots the temperature with simple thermostat like control.

Hence I was looking into PID controlling it. After having issues determining the P, I and D values I looked into autotune. Luckily, particle ported the arduino PID autotune lib. But somehow, I can’t get it to work.

First I tried editing my code to fit in the autotune example. After that failed I edited the example to add in my SSR and temp sensor. Sadly that works only a little bit. It starts heating a bit (output will become 130, about half of the 255 max of the PWM) but drops to a mere 30 after a few minutes. I don’t know if this is the expected behavior of this tuning but in my case it will pretty much never reach the setpoint.
The code I tested with.

I’m guessing I missed a parameter for the tuning or wrongly set a parameter but I can’t pinpoint it. Randomly adjusting some values didn’t quite work either nor copying the autotune values of a sous-vide project.

It seems you are still in tuning mode (tuning = true).
If this does’t solve your problem, what is the output on the serial during the few minutes it drops to 30? Specially to compare the input and output values

1 Like

I was mistaken, the code I linked above has output 70 or 130 (via serial).

Even when the setpoint is much higher than the value (65C vs 25C) the output never goes above 130 briefly and drops to 70 shortly after.

Seems to be connected to the “aTuneStep” value which is default 30 and the “aTuneStartValue” which is default 100. Why this results in maximum 130 and 70 is something I don’t understand. Perhaps the autotune tries to use the Ziegler-Nichols Open-Loop Tuning to determine P, I and D. But because my system is so slow to react it doesn’t quite work like it should. Perhaps.

Above tuning method is not equal to what the author of the PID autotune library writes on his blog so it is still confusing.

Anyway, I’m going to give the Ziegler-Nichols open-loop tuning a shot and see where that leaves me. All I need are some reasonable starting values, finetuning is easily done by hand.