What to expect from a PID controller?

I have a simple hot air Popcorn popper that I plan to use as a coffee roasting apparatus.

The popper consists of a fan propelled by a DC motor put below a heater wire. The produced hot air is channeled through some vents into a cylinder:

      |     |
      |     |
     _|     |_
    | :_____: <--- Vents
     \ %%%%% /  <- Heater wire
      |vvvvv|   <- Fan

The heater and the wire are connected so that it was only possible to turn the system on or off as a whole.
To gain the needed control I already split the circuit. The heater wire is now controlled via a SSR connected to an Arduino. The fan is powered separately and is always on.
I put a Type K thermocouple in one of the vents to measure the temperature that is entering the cylinder.

I already have a working Arduino sketch that heats the “roasting chamber” according to a time based temperature profile. The PID library is used to control the relay as in the PID_RelayOutput.ino example.

Basically everything works.

The thing I’m having trouble with is tuning the PID parameters. I’ve already spent several hours tuning. I even tried the Arduino PID Autotune Library.
I get a somewhat stable system. But no matter what I try, I can’t get rid of temperature deviations of ~ 5° C to ~ 10° C.

Here’s what I tried so far:

Now I’m wondering: What can I expect from a PID controller in the above use case? How accurate will I be able to set the temperature? Am I not tuning correctly or does it just not get any better?

For reference, here are plots of two of the more accurate test runs:

It looks like the issue is windowsize, not your PID parameters, try reducing it. On the cooling side though, unless you can find a way to run the fan by itself, it doesn't look as though the system will be able to follow the setpoint, at least in your first graph.

So, the awkward thing with using PID loops in temperature based systems is that it is expected to be a relatively linear system. However, heating is usually not a linear process, mainly as the time it takes to cool stuff down is not the same as the time it takes to heat it back up. This means that the value to increase the temperature 5 degrees does not have the same magnitude as one to decrease it 5 degrees from the same value. Basically, without a way to actively cool it in a relatively similar way than you actively heat it, you'll end up with all kinds of problems. Especially if you are trying for a temperature profile and not just a particular temperature.

Long story short: PID loops don't work well for temperature controls without some form of active cooling.

mirith:
Long story short: PID loops don't work well for temperature controls without some form of active cooling.

You can accommodate the non-linear or asymmetric nature of the system by applying a transform between the (linear) PID and the actual system. For example, if the system has much more authority heating than cooling, you can scale the output differently depending whether it is heating or cooling.