Beta releases now available

Just an FYI that the script thinks the 0.4.3b release is a newer version than 0.4.3 stable:

Current firmware version on controller: 0.4.3b

Checking GitHub for available release…

Available releases:

[0] 0.4.3
[1] 0.4.3beta3
[2] 0.4.2
[3] 0.4.1
[4] 0.4.0
[5] 0.3.0a
[6] 0.2.11
[7] 0.2.10
[8] 0.2.9
[9] 0.2.8
[10] 0.2.7
[11] Cancel firmware update
Enter the number [0-11] of the version you want to program [default = 0 (0.4.3)]: 0
Your current version is newer than 0.4.3.
If you are encountering problems, you can reprogram anyway. Would you like to do this?
Type yes to reprogram or just press enter to keep your current firmware:

I noticed that too.

It’s how LooseVersion compares versions, apparently it does not recognize 0.4.3b as beta.
However, if it compares 0.4.3beta3 with 0.4.3 it does think 0.4.3 is newer. So if I name things properly in the future, the current code works fine.

So I am not going to change the code, just for the next beta name it differently in the firmware version string.

Thank you for looking at it, Elco.
If by log files you mean the stderr log under the “View logs” button, it reports

Apr 09 2016 00:00:00 Notification: New day, creating new JSON file.
BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.254 failed (Sat Apr 9 00:20:11 CEST 2016)
Apr 09 2016 11:21:10 Notification: Restarted logging for beer ‘Big%20Vessel’.
BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.254 failed (Sat Apr 9 14:20:11 CEST 2016)
Apr 09 2016 15:42:22 Opening serial port
Apr 09 2016 15:42:22 Notification: Script started for beer 'Big Vessel’
Apr 09 2016 15:42:32 Checking software version on controller…

Apr 09 2016 15:42:32 Found BrewPi v0.4.3b build 0.4.3b2-0-g3de44b0,
running on a Particle Photon with a V2 shield on port /dev/ttyACM0

BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.254 failed (Sat Apr 9 23:50:11 CEST 2016)
Apr 10 2016 00:00:00 Notification: New day, creating new JSON file.

The logging restart at 11:21 should be due to me, changing active beer to “Big Vessel”.
However you are right, there is something that looks like a system restart at 15:42.
Not sure about the reason, but it is there.

I’m running the release Beta and everything was going well for 1 week. On April 10th I noticed by temps were not varying at all on the web server. When I checked on my fridge, my conical was drenched in condensation and the fridge temp was in the 30s F. I was able to log on to the web server without any issue, script was running, but it was still reporting fridge and beer temp in the 60s. The web server allowed me to open the maintenance panel and look through the settings, but it could not populate a device list. I had no internet issues or power outages during this time. I’m trying to understand how the web server continued to work (frozen but working) and the Spark went into freezer mode… It worked out for me as a cold crash, but would have been scary if it happened any earlier. I reset the Pi and Spark and it’s been working fine every since, no issues with SSR either.

Hi Jesse,

Are you using DS2413 based actuators (the SSR expansion boards)?

Elco

No, I’m using the Spark outputs.

Hi Jesse,

This is the first time I have heard of this happening. Do you have any more details?
Anything in the log files?
Anything that might help me figure out where in the code it seemed to have deadlocked?

Elco

This is what I got from the log files.

Found BrewPi v0.4.3b build 0.4.3b2-0-g3de44b0, running $

BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.1 failed (Thu Apr 7 22:00:11$
Apr 08 2016 00:00:00 Notification: New day, creating new JSON file.
BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.1 failed (Fri Apr 8 01:40:12$
BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.1 failed (Fri Apr 8 19:30:11$
Apr 09 2016 00:00:00 Notification: New day, creating new JSON file.
BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.1 failed (Sat Apr 9 02:30:12$
BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.1 failed (Sat Apr 9 04:40:12$
BrewPi: wifiChecker: Attempt 1 to reach 192.168.1.1 failed (Sat Apr 9 19:00:11$
Apr 10 2016 00:00:00 Notification: New day, creating new JSON file.
Apr 10 2016 02:28:48 Serial Error: Write timeout)
Apr 10 2016 02:29:23 Serial Error: Write timeout)
Apr 10 2016 02:29:57 Serial Error: Write timeout)

This continues on every 2-3 minutes with Serial Error…
Apr 10 2016 23:17:07 Serial Error: Write timeout)
Apr 10 2016 23:17:22 Cannot process line from controller: Beer Const. ",$
Apr 10 2016 23:17:28 Serial Error: Write timeout)

Apr 10 2016 23:59:28 Serial Error: Write timeout)
Apr 11 2016 00:00:00 Notification: New day, creating new JSON file.
Apr 11 2016 00:00:02 Serial Error: Write timeout)

And restarted on the 12thApr 12 2016 14:29:08 Serial Error: Write timeout)
Apr 12 2016 14:31:24 Opening serial port
Apr 12 2016 14:31:24 Notification: Script started for beer 'IPA Ferment’
Apr 12 2016 14:31:34 Checking software version on controller…
Apr 12 2016 14:31:34 Found BrewPi v0.4.3b build 0.4.3b2-0-g3de44b0, running $

During this time BrewPi Wifi Checker attempted once and failed to connect, however I continued to have a web server presence on the 11th and 12th before I restarted the Pi on the 12th.

This still happens in the latest beta: Communication between browser and pi fails intermittently on Safari

But this is no problem since it can easily be fixed as described in the link.

Btw, runs just fine on the raspberry 3 and the script start-up time is impressive :wink:

Hi Elco,

I am running 4.3 and have noticed that although the beer temp is being maintained spot on, the way in which it is doing it seems a little untidy. I am noticing cycling between cooling and heating which was not there before. I have a Brewtech 1/2bbl fermenter in a fridge with 11gals of beer, heating is supplied by a 1200w hairdryer. The settings of the Brewpi are factory, are there any changes you would recommend to tidy the control?

Cheers,

Dave.

Please zoom in on a smaller portion of that, like 3 alternations.

Also give my your current settings (you can copy the control algorithm page). It is probably just a matter of reducing the heater Kp, so it heats more gently.

Thanks Elco,

 "kind": "Control",
  "pids": [
    {
      "kind": "Pid",
      "name": "heater1",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "fridgeset",
        "value": 19.9766
      },
      "inputSensor": {
        "kind": "TempSensorFallback",
        "onBackupSensor": false,
        "sensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 20,
            "connected": true,
            "address": "28FF510CA515018C",
            "calibrationOffset": 0
          }
        }
      },
      "inputError": 0.0234,
      "Kp": 10,
      "Ti": 600,
      "Td": 60,
      "p": -0.2344,
      "i": 0.1875,
      "d": -0.1563,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 0,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "waitTime": 1721324
          },
          "target": {
            "kind": "ActuatorOneWire",
            "state": false,
            "pio": 0,
            "invert": false
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "heater2",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "beer2set",
        "value": null
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "beer2",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 23.3125,
          "connected": true,
          "address": "2869863607000027",
          "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": 1721253
          },
          "target": {
            "kind": "ActuatorNop",
            "state": false
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "cooler",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "fridgeset",
        "value": 19.9766
      },
      "inputSensor": {
        "kind": "TempSensorFallback",
        "onBackupSensor": false,
        "sensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 20,
            "connected": true,
            "address": "28FF510CA515018C",
            "calibrationOffset": 0
          }
        }
      },
      "inputError": 0.0234,
      "Kp": 10,
      "Ti": 1800,
      "Td": 200,
      "p": -0.2344,
      "i": 0,
      "d": -0.625,
      "actuatorIsNegative": true,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 0.8594,
        "period": 1200,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "waitTime": 1721178
          },
          "target": {
            "kind": "ActuatorTimeLimited",
            "minOnTime": 120,
            "minOffTime": 180,
            "maxOnTime": 65535,
            "state": false,
            "target": {
              "kind": "ActuatorOneWire",
              "state": false,
              "pio": 1,
              "invert": false
            }
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "beer2fridge",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "beer1set",
        "value": 20
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "beer1",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 20,
          "connected": true,
          "address": "28FFF0F3A4150132",
          "calibrationOffset": 0
        }
      },
      "inputError": 0,
      "Kp": 2,
      "Ti": 7200,
      "Td": 1200,
      "p": 0,
      "i": 0,
      "d": -0.0234,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorSetPoint",
        "targetSetPoint": {
          "kind": "SetPointSimple",
          "name": "fridgeset",
          "value": 19.9766
        },
        "targetSensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 20,
            "connected": true,
            "address": "28FF510CA515018C",
            "calibrationOffset": 0
          }
        },
        "referenceSetPoint": {
          "kind": "SetPointSimple",
          "name": "beer1set",
          "value": 20
        },
        "output": -0.0234,
        "achieved": 0,
        "minimum": -10,
        "maximum": 10
      }
    }
  ]
}

After heating, your fridge temperature seems to overshoot a lot, like 10 minutes.
Combat that by setting heater1 Td to 5 or even 10 minutes (try 300s first).

Also maybe reduce the intensity of the heater, by reducing Kp from 10 to 2.

Finally, you can set the dead time to 2 hours: so if it wants to switch from heating to cooling, it will have to wait 2 hours.

Thanks Elco,

I have applied those settings.

Dave.

Hi Elco,

Sorry to be a thorn but I would appreciate some feedback if you can…
I applied the settings as you suggested,

  "kind": "Control",
  "pids": [
    {
      "kind": "Pid",
      "name": "heater1",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "fridgeset",
        "value": 20.582
      },
      "inputSensor": {
        "kind": "TempSensorFallback",
        "onBackupSensor": false,
        "sensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 20.5625,
            "connected": true,
            "address": "28FF510CA515018C",
            "calibrationOffset": 0
          }
        }
      },
      "inputError": -0.0195,
      "Kp": 2,
      "Ti": 600,
      "Td": 600,
      "p": 0.0391,
      "i": -0.0195,
      "d": 1.2344,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 1.2539,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 3600000,
            "waitTime": 1816240
          },
          "target": {
            "kind": "ActuatorOneWire",
            "state": false,
            "pio": 0,
            "invert": false
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "heater2",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "beer2set",
        "value": null
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "beer2",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 20.125,
          "connected": true,
          "address": "2869863607000027",
          "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": 3600000,
            "waitTime": 1816169
          },
          "target": {
            "kind": "ActuatorNop",
            "state": false
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "cooler",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "fridgeset",
        "value": 20.582
      },
      "inputSensor": {
        "kind": "TempSensorFallback",
        "onBackupSensor": false,
        "sensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 20.5625,
            "connected": true,
            "address": "28FF510CA515018C",
            "calibrationOffset": 0
          }
        }
      },
      "inputError": -0.0195,
      "Kp": 10,
      "Ti": 1800,
      "Td": 200,
      "p": 0.1953,
      "i": -4.875,
      "d": 2.0703,
      "actuatorIsNegative": true,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 2.6094,
        "period": 1200,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 3600000,
            "waitTime": 1816093
          },
          "target": {
            "kind": "ActuatorTimeLimited",
            "minOnTime": 120,
            "minOffTime": 180,
            "maxOnTime": 65535,
            "state": false,
            "target": {
              "kind": "ActuatorOneWire",
              "state": false,
              "pio": 1,
              "invert": false
            }
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "beer2fridge",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "beer1set",
        "value": 21
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "beer1",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 20.9375,
          "connected": true,
          "address": "28FFF0F3A4150132",
          "calibrationOffset": 0
        }
      },
      "inputError": -0.1094,
      "Kp": 2,
      "Ti": 7200,
      "Td": 1200,
      "p": 0.2188,
      "i": -0.8945,
      "d": 0.2578,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorSetPoint",
        "targetSetPoint": {
          "kind": "SetPointSimple",
          "name": "fridgeset",
          "value": 20.582
        },
        "targetSensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 20.5625,
            "connected": true,
            "address": "28FF510CA515018C",
            "calibrationOffset": 0
          }
        },
        "referenceSetPoint": {
          "kind": "SetPointSimple",
          "name": "beer1set",
          "value": 21
        },
        "output": -0.418,
        "achieved": -0.4375,
        "minimum": -10,
        "maximum": 10
      }
    }

But there is a bit of an overshoot and undershoot when adjusting the “beer” temperature.
It also appears to want to still heat during the overshoot and vice versa.




I have attached the overall graph to date with three enlarged periods.

Cheers
Dave.

Hi Dave,

Now your fridge temperature follows the setpoint very nicely. Great.
Now to adjust the beer-to-fridge PID:

The beer responds very slow to the fridge temp, so this should be reflected by long time constants.
But let’s start with Kp, which is 2. This means that when the beer temp is 1 degree to high, the fridge setpoin will be 2 degrees below the beer setpoint. Judging from your graphs, that should be fine. You could make it a bit more aggressive by setting it to 8. That way it create a much larger difference between fridge and beer temp.

Your overshoot comes from integrator windup. The integrator time constant is 7200. This means that if the beer is not reaching the setpoint, the integral can increase with the proportional part every 7200 seconds.That is too fast for you. Your beer takes about 5-6 hours to respond to the change in fridge temp. So please increase Ti to 30000 at least.

Now finally, to take into account that if your beer temp is already dropping, take into account about 2 hours into the future that it will stay dropping when you stop cooling: Set Td to 7200.

You probably also want to increase the filtering on your beer temperature, so the setpoint is smoother.
You can set the filter safely delays to 318 seconds, because the beer is temp slow anyway.

Thanks again Elco for the prompt feedback.

I have applied the suggestions.
I have just one concern, the fridge is also used to house a 5gal fermenter, which will obviously have very different thermal characteristics to the 1/2bb/ with 10gals of beer. Will the modified settings be a problem for the smaller volume? There is no way of switching between default settings…yet?:wink:

Thanks
Dave.

I think the settings will work okay for your smaller volume as well, but you’ll just have to try.

My home automation system is surveilencing my BrewPi, basically data is imported by a lua script and the home-automation-base then checks for temperatures and sends me messages if anything is wrong. I recently got a message it was unable to compare date since the compared value is “–.-” and not a number. Due to this the system automatically power-cycled the BrewPi.

When I came home I saw this on BrewPi:


So basically BrewPi has no been logging data during a few days. The actual regulation was running, I am sure since I took some beers out every single of these days and they were cold. Sometime during the last 24 hours of not logging any data the cooling stopped and the beer started warming up. It looked like BrewPi had lost the connection to the beer sensor since this was showing “–.-”. After power-cycling everything seems to be up and running again.

What information is usefull for you the help figure out this behaviour? The logs might be gone, but if it happens again I would like to know what you need.

The stderr log is not overwritten, so that would be helpful.

Can you check the voltage going to the BrewPi Spark? If you are powering it over USB, depending on the quality of the USB cable and Rpi power supply, it might not be getting enough voltage.

Best measurement would be on the 5V pin of the RJ12 connector, or if you have the enclosure open, just the VIN pin on the photon.