Fridge Setpoint Fluctuating in Beer Constant Mode

I’m running Brewpi Spark in a mini fridge (no fan or heater yet, 30C here in Brazil now) which doubles as a kegerator.

As soon as I got everything set up I tested the fridge constant mode with the one sensor through the fridge door:

Then I wired everything following the fridge hack guide and then decided to test the beer constant mode with 20L of water in a carboy (thermowell included):

That’s when I noticed I had a overshoot problem and after reading a couple of threads decided do incr
ease Kp from 2 (default) to 12.

The overshoot problem was beautifully resolved but now I think I have two problems:

  1. Wildly oscillating fridge set point, and;
  2. Big lag between frige temp and set point.

Right now I have a 5 gal corny keg which I’m holding at 16C for one more day before I crash it to lagering temps:

When holding at 16C I tried to decrease the ‘Maximum difference between fridge and beer set point’ from 10C to 5C but the beer temp started to deviate from the set point.

I’ve seen a suggestion to increase both the ‘Beer-to-Fridge filter delay time’ and that’s what I just did.

Other suggestions are increasing Ti or trying a Kp less aggressive. I’d really appreciate some directions.

Here’s my settings:

{
  "kind": "Control",
  "pids": [
    {
      "kind": "Pid",
      "name": "heater1",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "fridgeset",
        "value": -8
      },
      "inputSensor": {
        "kind": "TempSensorFallback",
        "onBackupSensor": false,
        "sensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 1.1875,
            "connected": true,
            "address": "28822DC2070000CA",
            "calibrationOffset": 0
          }
        }
      },
      "inputError": 9.1563,
      "Kp": 10,
      "Ti": 600,
      "Td": 60,
      "p": -91.5625,
      "i": 0,
      "d": 0.3125,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 0,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "waitTime": 1799929
          },
          "target": {
            "kind": "ActuatorNop",
            "state": false
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "heater2",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "beer2set",
        "value": null
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "beer2",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 27.5625,
          "connected": true,
          "address": "28C6A5C007000091",
          "calibrationOffset": 0
        }
      },
      "inputError": null,
      "Kp": 10,
      "Ti": 600,
      "Td": 60,
      "p": 0,
      "i": 0,
      "d": 0,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 0,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "waitTime": 1799860
          },
          "target": {
            "kind": "ActuatorNop",
            "state": false
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "cooler",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "fridgeset",
        "value": -8
      },
      "inputSensor": {
        "kind": "TempSensorFallback",
        "onBackupSensor": false,
        "sensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 1.1875,
            "connected": true,
            "address": "28822DC2070000CA",
            "calibrationOffset": 0
          }
        }
      },
      "inputError": 9.1563,
      "Kp": 10,
      "Ti": 1800,
      "Td": 200,
      "p": -91.5625,
      "i": -26.2539,
      "d": 0.9766,
      "actuatorIsNegative": true,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 100,
        "period": 1200,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "waitTime": 1799784
          },
          "target": {
            "kind": "ActuatorTimeLimited",
            "minOnTime": 120,
            "minOffTime": 180,
            "maxOnTime": 65535,
            "state": true,
            "target": {
              "kind": "ActuatorPin",
              "state": true,
              "pin": 17,
              "invert": false
            }
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "beer2fridge",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "beer1set",
        "value": 2
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "beer1",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 8.375,
          "connected": true,
          "address": "286BE2C00700003F",
          "calibrationOffset": 0
        }
      },
      "inputError": 6.4141,
      "Kp": 12,
      "Ti": 7200,
      "Td": 1200,
      "p": -76.9688,
      "i": 0,
      "d": 3.75,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorSetPoint",
        "targetSetPoint": {
          "kind": "SetPointSimple",
          "name": "fridgeset",
          "value": -8
        },
        "targetSensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 1.1875,
            "connected": true,
            "address": "28822DC2070000CA",
            "calibrationOffset": 0
          }
        },
        "referenceSetPoint": {
          "kind": "SetPointSimple",
          "name": "beer1set",
          "value": 2
        },
        "output": -10,
        "achieved": -0.8125,
        "minimum": -10,
        "maximum": 10
      }
    }
  ]
}

It seems like the filtering change really did the trick (now it sounds pretty obvious):

I hope the ramps maintain this accuracy.

Although I’m satisfied, if you guys think there’s any room for improvement please let me know.