Spark stuck idling after tens of minutes

Looked around in the forums, etc, but nothing to resolve this.

I have the spark setup and reading 2x two-wire sensors (BeerTemp and RoomTemp). I set up Device 2, 3, 4, 5 as Chamber1 Chamber device, [cooler, heater, light, fan]

Doesn’t matter if I am fridge constant or beer constant modes or if the temp is above or below the current temp by a good margin. The script simply does not leave “Idling”. Been an hour now.

What am I missing?

You should set up a fridge temp /chamber temp sensor. The actuators work with the fridge temperature, if that is unknown, the controller stays in idle.

‘Room temp’ is the temperature outside the fridge, just for logging.

Thanks, Elco.
By switching my Beer Temp thermistor over to a Chamber Temp, the controller show’s “Heating” now when in Fridge Constant

###Here’s what I would like to do**

  • Temp sensor 0: Beer temp. Measuring fermentor.
  • Temp sensor 1: Room temp…for reference.
  • Control Output 0: Heater strapped to outside of fermentor.
  • Control Output 1: Chiller strapped to outside of fermentor (*)

As you can see, I have no “chamber” per se.

###To clarify:
In fridge constant, one of the thermistors must be assigned to Chamber Device:ChamberTemp. However this setup doesn’t seem to work for Beer Constant.

What is the “Beer Constant” setup then?

The only options I have for temps are: [None, Chamber, Room, Beer], and t he only options I have for chamber device functions are [ None, Heater, Cooler, Light, Fan]

(*) In reality, I’m using a high power motor H-bridge and am driving a TEC array that is strapped to the outside of the fermentor. The control outputs go to either side of the H-bridge.

Beer constant/profile mode works by modifying the fridge setpoint, for example the beer is 1 degree too warm, so the fridge temperature is set to beer setpoint - 5.

So fridge temperature is in between your actuator and your beer temp.

Your options with the current firmware are:

  • Use fridge constant mode and put the fridge sensor in the beer
  • Add a fridge sensor in between the beer and the cooler/heater.

Next major release with PWM will support binding actuators to the beer temp directly.

Elco,

Oh – on further thought, I might have to buy another sensor.
Sensor 1: Room temp
Sensor 2: The TEC block itself (equiv to the chamber temp)
Sensor 3: The beer.

Again – thanks! Not sure how much time you guys put into this, but having looked at the code base, it’s extensive! I saw that in a future release you’ll be allowing increased flexibility (renaming of sensors/control points), which will make your web interface extremely powerful for controlling all sorts of object.

I’ll go for fridge constant mode then and stick the “chamber temp” in the thermowell. Can’t wait to see how it all puts together. I’ll try to post a picture of my setup once I clean up the hack wiring.

Red

I have a problem happening similar to the OP. But I updated the firmware, software, and RPi firmware 24 hours ago, which seems to have caused the problem rather than fixed it (the system behaved as expected prior to updating), I have not changed any actuators, sensors, relays, etc. But now I have long periods of idle instead of actuator activity.

Shown is a screenshot my device info. Notice that LCD output says “Idling for 2h41m38”, but the heater should be on because the target beer temp is about 4 degrees higher than current temp. Notice how Device 4 has a value of “100” which I take to mean max PWM power. In other words the heater seems to be on but BrewPi doesn’t record this fact in LCD output or actuator log.

In the Advanced Settings the values are all default, so the Dead Time = 1800. But I notice in the Control Algorithm output this value says 1800000. I take it this is in milliseconds.

Below is my Control Algorithm output:

{
  "kind": "Control",
  "pids": [
    {
      "kind": "Pid",
      "name": "heater1",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "value": 23.1719
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "fridge",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 18,
          "connected": false,
          "address": "28A6A273060000B1",
          "calibrationOffset": 0
        }
      },
      "inputError": -5.1289,
      "Kp": 10,
      "Ti": 600,
      "Td": 60,
      "p": 51.2891,
      "i": 76.6563,
      "d": 0.0391,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 100,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "lastActiveTime": 32760999
          },
          "target": {
            "kind": "ActuatorNop",
            "state": false
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "heater2",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "value": null
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "beer2",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 19.625,
          "connected": false,
          "address": "28B3FC3507000074",
          "calibrationOffset": 0
        }
      },
      "inputError": 0,
      "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,
            "lastActiveTime": 32760999
          },
          "target": {
            "kind": "ActuatorNop",
            "state": false
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "cooler",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "value": 23.1719
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "fridge",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 18,
          "connected": false,
          "address": "28A6A273060000B1",
          "calibrationOffset": 0
        }
      },
      "inputError": -5.1289,
      "Kp": 10,
      "Ti": 1800,
      "Td": 200,
      "p": 51.2891,
      "i": 0,
      "d": 0.0781,
      "actuatorIsNegative": true,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 0,
        "period": 1200,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "lastActiveTime": 32760999
          },
          "target": {
            "kind": "ActuatorTimeLimited",
            "minOnTime": 120,
            "minOffTime": 180,
            "maxOnTime": 65535,
            "active": false,
            "target": {
              "kind": "ActuatorNop",
              "state": false
            }
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "beer2fridge",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "value": 18.8906
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "beer1",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 16.75,
          "connected": false,
          "address": "28D8C67306000034",
          "calibrationOffset": 0
        }
      },
      "inputError": -2.1406,
      "Kp": 2,
      "Ti": 7200,
      "Td": 1200,
      "p": 4.2813,
      "i": 0,
      "d": 0,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorSetPoint",
        "targetSetPoint": {
          "kind": "SetPointSimple",
          "value": 23.1719
        },
        "targetSensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 18,
            "connected": false,
            "address": "28A6A273060000B1",
            "calibrationOffset": 0
          }
        },
        "referenceSetPoint": {
          "kind": "SetPointSimple",
          "value": 18.8906
        },
        "output": 4.2813,
        "achieved": -0.8906,
        "minimum": -10,
        "maximum": 10
      }
    }
  ],
  "sensors": [
    {
      "kind": "TempSensor",
      "name": "fridge",
      "sensor": {
        "kind": "OneWireTempSensor",
        "value": 18,
        "connected": false,
        "address": "28A6A273060000B1",
        "calibrationOffset": 0
      }
    },
    {
      "kind": "TempSensor",
      "name": "beer1",
      "sensor": {
        "kind": "OneWireTempSensor",
        "value": 16.75,
        "connected": false,
        "address": "28D8C67306000034",
        "calibrationOffset": 0
      }
    },
    {
      "kind": "TempSensor",
      "name": "beer2",
      "sensor": {
        "kind": "OneWireTempSensor",
        "value": 19.625,
        "connected": false,
        "address": "28B3FC3507000074",
        "calibrationOffset": 0
      }
    }
  ],
  "actuators": [
    {
      "kind": "ActuatorPwm",
      "value": 0,
      "period": 1200,
      "minVal": 0,
      "maxVal": 100,
      "target": {
        "kind": "ActuatorMutexDriver",
        "mutexGroup": {
          "kind": "ActuatorMutexGroup",
          "deadTime": 1800000,
          "lastActiveTime": 32760999
        },
        "target": {
          "kind": "ActuatorTimeLimited",
          "minOnTime": 120,
          "minOffTime": 180,
          "maxOnTime": 65535,
          "active": false,
          "target": {
            "kind": "ActuatorNop",
            "state": false
          }
        }
      }
    },
    {
      "kind": "ActuatorPwm",
      "value": 100,
      "period": 4,
      "minVal": 0,
      "maxVal": 100,
      "target": {
        "kind": "ActuatorMutexDriver",
        "mutexGroup": {
          "kind": "ActuatorMutexGroup",
          "deadTime": 1800000,
          "lastActiveTime": 32760999
        },
        "target": {
          "kind": "ActuatorNop",
          "state": false
        }
      }
    },
    {
      "kind": "ActuatorPwm",
      "value": 0,
      "period": 4,
      "minVal": 0,
      "maxVal": 100,
      "target": {
        "kind": "ActuatorMutexDriver",
        "mutexGroup": {
          "kind": "ActuatorMutexGroup",
          "deadTime": 1800000,
          "lastActiveTime": 32760999
        },
        "target": {
          "kind": "ActuatorNop",
          "state": false
        }
      }
    }
  ],
  "setpoints": [
    {
      "kind": "SetPointNamed",
      "name": "beer1set",
      "setPoint": {
        "kind": "SetPointSimple",
        "value": 18.8906
      }
    },
    {
      "kind": "SetPointNamed",
      "name": "beer2set",
      "setPoint": {
        "kind": "SetPointSimple",
        "value": null
      }
    },
    {
      "kind": "SetPointNamed",
      "name": "fridgeset",
      "setPoint": {
        "kind": "SetPointSimple",
        "value": 23.1719
      }
    }
  ]
}

If there is a wiring issue with the PowerSwitch relay that I use for the heating element, such that the circuit is not complete between the BrewPi Spark unit and the relay, would this cause BrewPi to report that the system is idling when ideally it should be heating? I may have to crack open the project box where the PowerSwitch Tails are housed to see if the little LED glows at the relevant time. As of now my only feedback is an audible click when I manually force the relay on and off when the BrewPi is set in Test mode. But the fact that I hear a click at all seems to imply the relay is working. I know the cool-side relay is working as expected.

That should read:

"target": {
            "kind": "ActuatorPin",
            "state": false,
            "pin": 16,
            "invert": false
          }

There doesn’t seem to be a heater (or cooler) installed to be driven by the PWM module.
Can you refresh the device list, then from the log files, copy this:

Jan 19 2016 23:17:47 Installed devices received: [{"a": "2833017406000010", "c": 1, "b": 0, "d": 0, "f": 5, "i": 0, "h": 2, "j": 0.0, "p": 0, "t": 1}, {"c": 1, "b": 0, "d": 0, "f": 3, "i": 1, "h": 1, "p": 17, "t": 4, "x": 0}, {"a": "2873A562070000D3", "c": 1, "b": 1, "d": 0, "f": 9, "i": 2, "h": 2, "j": 0.0, "p": 0, "t": 1}, {"c": 1, "b": 0, "d": 0, "f": 2, "i": 3, "h": 1, "p": 16, "t": 4, "x": 0}]
Jan 19 2016 23:17:48 Available devices received: [{"c": 1, "b": 0, "d": 0, "f": 0, "i": -1, "h": 1, "p": 11, "t": 0, "x": 0}, {"c": 1, "b": 0, "d": 0, "f": 0, "i": -1, "h": 1, "p": 10, "t": 0, "x": 0}]

After you have done that, see if a restart of the Spark (just unplug) helps. If it doesnt, uninstall the device by setting the function to none and clicking apply. Then re-assign.

Below is the output from the log after refreshing the device list, if you can make anything of it. I have 3 OneWire sensors to your 2, and we both have actuators, but I can’t decipher the rest of it. I also have fewer available devices (on line #2), presumably because you have an expansion board.

Jan 19 2016 14:37:25 Installed devices received: [{"a": "28D8C67306000034", "c": 1, "b": 1, "d": 0, "f": 9, "i": 0, "h": 2, "j": 0.0, "p": 0, "t": 1, "v": 70.25}, {"a": "28A6A273060000B1", "c": 1, "b": 0, "d": 0, "f": 5, "i": 1, "h": 2, "j": 0.0, "p": 0, "t": 1, "v": 72.836}, {"a": "28B3FC3507000074", "c": 1, "b": 0, "d": 0, "f": 6, "i": 2, "h": 2, "j": 0.0, "p": 0, "t": 1, "v": 65.977}, {"c": 1, "b": 0, "d": 0, "f": 3, "i": 3, "h": 1, "p": 16, "t": 4, "v": 100.0, "x": 0}, {"c": 1, "b": 0, "d": 0, "f": 2, "i": 4, "h": 1, "p": 11, "t": 4, "v": 0.0, "x": 0}]
Jan 19 2016 14:37:26 Available devices received: [{"c": 1, "b": 0, "d": 0, "f": 0, "i": -1, "h": 1, "p": 10, "t": 0, "x": 0}]

The device list looks fine. Exactly the same as mine, expect for the slot (i). You have one available less, because you have a first generation BrewPi Spark with 3 outputs, instead of 4.

After a reset, are the devices not loaded correctly? Check the algorithm tab for that.

Given that I am at my office and the BrewPi is about 20 miles away while I type, I am happy to report that a “Reset Core to factory defaults” button exists in Advanced Settings (and thank goodness for port forwarding):

After using that button I was able to re-add all my devices, and now my Control Algorithm includes two sections like here. When I physically get back to the BrewPi I will check further.

      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 0,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "lastActiveTime": 102861046
          },
          "target": {
            "kind": "ActuatorPin",
            "state": false,
            "pin": 11,
            "invert": false
          }
        }
      }
    },