Need Recommendations on Advanced Settings

I got everything up and running last weekend. I’ve run two tests. One with a beer constant of 60 degrees and one with a fridge constant of 60. I’ve left all the advanced settings on their default value except the dead time I shortened a bit. Can you please provide recommendations on what to change to get more constant temps?

Graph%202Graph%201

@Elco - Any advice? Here are my settings.

  "kind": "Control",
  "pids": [
    {
      "kind": "Pid",
      "name": "heater1pid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorFallback",
          "onBackupSensor": false,
          "sensor": {
            "kind": "TempSensorDelegate",
            "name": "fridge",
            "delegate": {
              "kind": "OneWireTempSensor",
              "value": 14.9375,
              "connected": true,
              "address": "2801A702090000C2",
              "calibrationOffset": 0
            }
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "fridgeset",
          "value": 15.5547
        }
      },
      "output": {
        "kind": "ActuatorPwm",
        "dutySetting": 30,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 2000000,
            "waitTime": 1677060
          },
          "target": {
            "kind": "ActuatorDigitalDelegate",
            "name": "heater1",
            "delegate": {
              "kind": "ActuatorPin",
              "state": false,
              "pin": 29,
              "invert": false
            }
          }
        }
      },
      "inputError": -0.6914,
      "Kp": 30,
      "Ti": 1800,
      "Td": 60,
      "p": 20.7422,
      "i": 0,
      "d": 9.2578,
      "actuatorIsNegative": false
    },
    {
      "kind": "Pid",
      "name": "heater2pid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorDelegate",
          "name": "beer2",
          "delegate": {
            "kind": "TempSensorDisconnected",
            "value": null,
            "connected": false
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "beer2set",
          "value": null
        }
      },
      "output": {
        "kind": "ActuatorPwm",
        "dutySetting": 0,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 2000000,
            "waitTime": 1677056
          },
          "target": {
            "kind": "ActuatorDigitalDelegate",
            "name": "heater2",
            "delegate": {
              "kind": "ActuatorNop",
              "state": false
            }
          }
        }
      },
      "inputError": null,
      "Kp": 30,
      "Ti": 1800,
      "Td": 60,
      "p": 0,
      "i": 0,
      "d": 0,
      "actuatorIsNegative": false
    },
    {
      "kind": "Pid",
      "name": "coolerpid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorFallback",
          "onBackupSensor": false,
          "sensor": {
            "kind": "TempSensorDelegate",
            "name": "fridge",
            "delegate": {
              "kind": "OneWireTempSensor",
              "value": 14.9375,
              "connected": true,
              "address": "2801A702090000C2",
              "calibrationOffset": 0
            }
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "fridgeset",
          "value": 15.5547
        }
      },
      "output": {
        "kind": "ActuatorPwm",
        "dutySetting": 0,
        "period": 1200,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 2000000,
            "waitTime": 1677052
          },
          "target": {
            "kind": "ActuatorTimeLimited",
            "minOnTime": 120,
            "minOffTime": 180,
            "maxOnTime": 65535,
            "state": false,
            "target": {
              "kind": "ActuatorDigitalDelegate",
              "name": "cooler",
              "delegate": {
                "kind": "ActuatorPin",
                "state": false,
                "pin": 4,
                "invert": false
              }
            }
          }
        }
      },
      "inputError": -0.6914,
      "Kp": 20,
      "Ti": 3600,
      "Td": 300,
      "p": 13.8281,
      "i": -2.8008,
      "d": 30.7031,
      "actuatorIsNegative": true
    },
    {
      "kind": "Pid",
      "name": "beer2fridgepid",
      "enabled": false,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorDelegate",
          "name": "beer1",
          "delegate": {
            "kind": "OneWireTempSensor",
            "value": 14.8125,
            "connected": true,
            "address": "28FE69D509000093",
            "calibrationOffset": 0
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "beer1set",
          "value": null
        }
      },
      "output": {
        "kind": "ActuatorOffset",
        "target": {
          "kind": "SensorSetPointPair",
          "sensor": {
            "kind": "TempSensorFallback",
            "onBackupSensor": false,
            "sensor": {
              "kind": "TempSensorDelegate",
              "name": "fridge",
              "delegate": {
                "kind": "OneWireTempSensor",
                "value": 14.9375,
                "connected": true,
                "address": "2801A702090000C2",
                "calibrationOffset": 0
              }
            }
          },
          "setPoint": {
            "kind": "SetPointSimple",
            "name": "fridgeset",
            "value": 15.5547
          }
        },
        "reference": {
          "kind": "SensorSetPointPair",
          "sensor": {
            "kind": "TempSensorDelegate",
            "name": "beer1",
            "delegate": {
              "kind": "OneWireTempSensor",
              "value": 14.8125,
              "connected": true,
              "address": "28FE69D509000093",
              "calibrationOffset": 0
            }
          },
          "setPoint": {
            "kind": "SetPointSimple",
            "name": "beer1set",
            "value": null
          }
        },
        "useReferenceValue": false,
        "setting": 0,
        "achieved": null,
        "minimum": -6,
        "maximum": 6
      },
      "inputError": null,
      "Kp": 5,
      "Ti": 10800,
      "Td": 600,
      "p": 0,
      "i": 0,
      "d": 0,
      "actuatorIsNegative": false
    }
  ]
}

The beer constant mode assumes that the beer sensor is in a big volume of beer, which responds slowly.

Beer constant mode will not work if the beer sensor is in air. What beer mode does is adjust the fridge setpoint and the actuators respond to that the same way they respond when in fridge constant mode.

What you see in the second chart is that the fridge setpoint often clips to the maximum when it accounts for the steep slope down of the beer temperature.

To reduce the fluctuation in fridge constant mode, you can reduce the minimum cooling time. But you are testing with an empty fridge, which has low thermal mass. So big fluctuations are expected.

These test results should not form the basis for your settings. You should test again with your fermenter inside, filled with water and the beer probe in that water.

Thanks Elco! I will put my fermenter in full of water tonight and test it in beer constant mode. I’ll post my results tomorrow.

@Elco I put fermenter full of water in with temp probe in the water. Any recommended adjustments now?

 pids": [
    {
      "kind": "Pid",
      "name": "heater1pid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorFallback",
          "onBackupSensor": false,
          "sensor": {
            "kind": "TempSensorDelegate",
            "name": "fridge",
            "delegate": {
              "kind": "OneWireTempSensor",
              "value": 16.6875,
              "connected": true,
              "address": "2801A702090000C2",
              "calibrationOffset": 0
            }
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "fridgeset",
          "value": 16.8125
        }
      },
      "output": {
        "kind": "ActuatorPwm",
        "dutySetting": 0,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 2000000,
            "waitTime": 1003332
          },
          "target": {
            "kind": "ActuatorDigitalDelegate",
            "name": "heater1",
            "delegate": {
              "kind": "ActuatorPin",
              "state": false,
              "pin": 29,
              "invert": false
            }
          }
        }
      },
      "inputError": -0.1328,
      "Kp": 30,
      "Ti": 1800,
      "Td": 60,
      "p": 3.9844,
      "i": 0.168,
      "d": -5.7422,
      "actuatorIsNegative": false
    },
    {
      "kind": "Pid",
      "name": "heater2pid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorDelegate",
          "name": "beer2",
          "delegate": {
            "kind": "TempSensorDisconnected",
            "value": null,
            "connected": false
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "beer2set",
          "value": null
        }
      },
      "output": {
        "kind": "ActuatorPwm",
        "dutySetting": 0,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 2000000,
            "waitTime": 1003329
          },
          "target": {
            "kind": "ActuatorDigitalDelegate",
            "name": "heater2",
            "delegate": {
              "kind": "ActuatorNop",
              "state": false
            }
          }
        }
      },
      "inputError": null,
      "Kp": 30,
      "Ti": 1800,
      "Td": 60,
      "p": 0,
      "i": 0,
      "d": 0,
      "actuatorIsNegative": false
    },
    {
      "kind": "Pid",
      "name": "coolerpid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorFallback",
          "onBackupSensor": false,
          "sensor": {
            "kind": "TempSensorDelegate",
            "name": "fridge",
            "delegate": {
              "kind": "OneWireTempSensor",
              "value": 16.6875,
              "connected": true,
              "address": "2801A702090000C2",
              "calibrationOffset": 0
            }
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "fridgeset",
          "value": 16.8125
        }
      },
      "output": {
        "kind": "ActuatorPwm",
        "dutySetting": 16.1016,
        "period": 1200,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 2000000,
            "waitTime": 1003325
          },
          "target": {
            "kind": "ActuatorTimeLimited",
            "minOnTime": 120,
            "minOffTime": 180,
            "maxOnTime": 65535,
            "state": false,
            "target": {
              "kind": "ActuatorDigitalDelegate",
              "name": "cooler",
              "delegate": {
                "kind": "ActuatorPin",
                "state": false,
                "pin": 4,
                "invert": false
              }
            }
          }
        }
      },
      "inputError": -0.1328,
      "Kp": 20,
      "Ti": 3600,
      "Td": 300,
      "p": 2.6563,
      "i": 0.5391,
      "d": -19.2969,
      "actuatorIsNegative": true
    },
    {
      "kind": "Pid",
      "name": "beer2fridgepid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorDelegate",
          "name": "beer1",
          "delegate": {
            "kind": "OneWireTempSensor",
            "value": 15.3125,
            "connected": true,
            "address": "28FE69D509000093",
            "calibrationOffset": 0
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "beer1set",
          "value": 15.5547
        }
      },
      "output": {
        "kind": "ActuatorOffset",
        "target": {
          "kind": "SensorSetPointPair",
          "sensor": {
            "kind": "TempSensorFallback",
            "onBackupSensor": false,
            "sensor": {
              "kind": "TempSensorDelegate",
              "name": "fridge",
              "delegate": {
                "kind": "OneWireTempSensor",
                "value": 16.6875,
                "connected": true,
                "address": "2801A702090000C2",
                "calibrationOffset": 0
              }
            }
          },
          "setPoint": {
            "kind": "SetPointSimple",
            "name": "fridgeset",
            "value": 16.8125
          }
        },
        "reference": {
          "kind": "SensorSetPointPair",
          "sensor": {
            "kind": "TempSensorDelegate",
            "name": "beer1",
            "delegate": {
              "kind": "OneWireTempSensor",
              "value": 15.3125,
              "connected": true,
              "address": "28FE69D509000093",
              "calibrationOffset": 0
            }
          },
          "setPoint": {
            "kind": "SetPointSimple",
            "name": "beer1set",
            "value": 15.5547
          }
        },
        "useReferenceValue": false,
        "setting": 1.2578,
        "achieved": 1.1328,
        "minimum": -6,
        "maximum": 6
      },
      "inputError": -0.2539,
      "Kp": 5,
      "Ti": 10800,
      "Td": 600,
      "p": 1.2695,
      "i": 0.0078,
      "d": -0.0195,
      "actuatorIsNegative": false
    }
  ]
}

Your cooling PID seems to be a tiny bit more aggressive than it should be. ideally the blue line (the actual fridge temp) should be zigzagging around the orange line (the target fridge temp), but in your case it is strictly below the orange line. You could try slightly decreasing cooling PID Kp to start with. You might want to mess with the filter and/or derivative after that, but reducing Kp seems like a good place to start.

I don’t use a fridge for cooling, so I’ll let Elco or others that do suggest specific values to try but, if you want, you can try small changes and then testing again in the meantime (reducing Kp from 20 to 15 would seem like a reasonable experiment to run).

1 Like

adempewolff give you good advice, but I think the biggest issue is the large beer-to-fridge TD, causing the swing in your fridge setting. You have it set to 600. I think 60 would be a better setting. Small fluctuations in the beer temp have a big effect now because the derivative is multiplied by 600 seconds.

You should also set the derivative filtering for beer-to-fridge to maximum.

@Elco ere is the result after making those two changes you recommended. What do you think?

That’s still pretty bad.
The settings for the cooler are too aggressive for your setup. Set Kp to 5, Ti to 7200 and Td to 0 and the minimum on time to 60.

@Elco Here are the results after making those changes. What do you think. Also attaching my settings if needed.

  {
  "kind": "Control",
  "pids": [
    {
      "kind": "Pid",
      "name": "heater1pid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorFallback",
          "onBackupSensor": false,
          "sensor": {
            "kind": "TempSensorDelegate",
            "name": "fridge",
            "delegate": {
              "kind": "OneWireTempSensor",
              "value": 15.625,
              "connected": true,
              "address": "2801A702090000C2",
              "calibrationOffset": 0
            }
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "fridgeset",
          "value": 15.8477
        }
      },
      "output": {
        "kind": "ActuatorPwm",
        "dutySetting": 6.0938,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 2000000,
            "waitTime": 1522409
          },
          "target": {
            "kind": "ActuatorDigitalDelegate",
            "name": "heater1",
            "delegate": {
              "kind": "ActuatorPin",
              "state": false,
              "pin": 29,
              "invert": false
            }
          }
        }
      },
      "inputError": -0.2656,
      "Kp": 30,
      "Ti": 1800,
      "Td": 60,
      "p": 7.9688,
      "i": 0,
      "d": -1.875,
      "actuatorIsNegative": false
    },
    {
      "kind": "Pid",
      "name": "heater2pid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorDelegate",
          "name": "beer2",
          "delegate": {
            "kind": "TempSensorDisconnected",
            "value": null,
            "connected": false
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "beer2set",
          "value": null
        }
      },
      "output": {
        "kind": "ActuatorPwm",
        "dutySetting": 0,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 2000000,
            "waitTime": 1522405
          },
          "target": {
            "kind": "ActuatorDigitalDelegate",
            "name": "heater2",
            "delegate": {
              "kind": "ActuatorNop",
              "state": false
            }
          }
        }
      },
      "inputError": null,
      "Kp": 30,
      "Ti": 1800,
      "Td": 60,
      "p": 0,
      "i": 0,
      "d": 0,
      "actuatorIsNegative": false
    },
    {
      "kind": "Pid",
      "name": "coolerpid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorFallback",
          "onBackupSensor": false,
          "sensor": {
            "kind": "TempSensorDelegate",
            "name": "fridge",
            "delegate": {
              "kind": "OneWireTempSensor",
              "value": 15.625,
              "connected": true,
              "address": "2801A702090000C2",
              "calibrationOffset": 0
            }
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "fridgeset",
          "value": 15.8477
        }
      },
      "output": {
        "kind": "ActuatorPwm",
        "dutySetting": 0.6758,
        "period": 1200,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 2000000,
            "waitTime": 1522401
          },
          "target": {
            "kind": "ActuatorTimeLimited",
            "minOnTime": 60,
            "minOffTime": 180,
            "maxOnTime": 65535,
            "state": false,
            "target": {
              "kind": "ActuatorDigitalDelegate",
              "name": "cooler",
              "delegate": {
                "kind": "ActuatorPin",
                "state": false,
                "pin": 4,
                "invert": false
              }
            }
          }
        }
      },
      "inputError": -0.2656,
      "Kp": 5,
      "Ti": 7200,
      "Td": 0,
      "p": 1.3281,
      "i": -2.0039,
      "d": 0,
      "actuatorIsNegative": true
    },
    {
      "kind": "Pid",
      "name": "beer2fridgepid",
      "enabled": true,
      "input": {
        "kind": "SensorSetPointPair",
        "sensor": {
          "kind": "TempSensorDelegate",
          "name": "beer1",
          "delegate": {
            "kind": "OneWireTempSensor",
            "value": 15.5,
            "connected": true,
            "address": "28FE69D509000093",
            "calibrationOffset": 0
          }
        },
        "setPoint": {
          "kind": "SetPointSimple",
          "name": "beer1set",
          "value": 15.5547
        }
      },
      "output": {
        "kind": "ActuatorOffset",
        "target": {
          "kind": "SensorSetPointPair",
          "sensor": {
            "kind": "TempSensorFallback",
            "onBackupSensor": false,
            "sensor": {
              "kind": "TempSensorDelegate",
              "name": "fridge",
              "delegate": {
                "kind": "OneWireTempSensor",
                "value": 15.625,
                "connected": true,
                "address": "2801A702090000C2",
                "calibrationOffset": 0
              }
            }
          },
          "setPoint": {
            "kind": "SetPointSimple",
            "name": "fridgeset",
            "value": 15.8477
          }
        },
        "reference": {
          "kind": "SensorSetPointPair",
          "sensor": {
            "kind": "TempSensorDelegate",
            "name": "beer1",
            "delegate": {
              "kind": "OneWireTempSensor",
              "value": 15.5,
              "connected": true,
              "address": "28FE69D509000093",
              "calibrationOffset": 0
            }
          },
          "setPoint": {
            "kind": "SetPointSimple",
            "name": "beer1set",
            "value": 15.5547
          }
        },
        "useReferenceValue": false,
        "setting": 0.293,
        "achieved": 0.0703,
        "minimum": -6,
        "maximum": 6
      },
      "inputError": -0.0547,
      "Kp": 5,
      "Ti": 10800,
      "Td": 60,
      "p": 0.2734,
      "i": 0,
      "d": 0.0195,
      "actuatorIsNegative": false
    }
  ]
}

That looks a whole lot better doesn’t it?

Fridge temperature perfectly cycling around the setpoint and beer temp within 0.1 degree!

P.S. if you paste a long block of text/code, surround it with:
<code>
text here
</code>

I have edited your posts each time to do this so far.

Working great. Thanks for all the help Elco! Very pleased with my Spark 3 and support. First batch going in there this weekend.