# Control system for a temperature controller

I have adapted a refrigerator to create a temperature controlled environment for brewing beer. I have mounted an electric heater coil inside the fridge and configured a basic controller to maintain a constant temperature inside the fridge. When the temperature at the temperature probe, $$T_p$$, is below the target temperature, $$T$$, the heater is turned on. When $$T_p$$ is above $$T$$, the fridge compressor is turned on. The target temperature, $$T$$, is in fact a small range to stabilise the system.

$$T_p \lt T-c \ \ \rightarrow \ \ Heat$$ $$T_p \gt T+c \ \ \rightarrow \ \ Cool$$

My question is this: I am trying to decide, more for interest than anything else, whether it is more effective to probe the temperature of the air inside the fridge, or the liquid (beer) inside the plastic vessel inside the fridge?

My instinct says that I should probe the air temperature, because the temperature of the beer will follow the temperature of the air, subject to a time delay, and by probing the temperature of the beer I could get unstable feedback due to this delay? Would the answer change if I were to put the fridge outside, where the air temperature is subject to much more variation? I suspect in this case it might be better to probe the beer so that the controller can over-compensate with air temperature and limit temperature variation of the beer.

For the purposes of this application, the control system is fixed as I'm using a fixed controller ie. heating and cooling are binary on/off functions. However I'd be interested to learn of any control techniques that could be implemented with a raspberry pi, if they were suggested!

• The thermal capacity of the air will small compared with the beer (unless you are brewing a very small amount of beer in a huge fridge) but the thermal capacity of the heater itself might be bigger, especially if it operates at a high temperature. You might also want to think about how much heat is being radiated direct from your heater to the beer container rather than being transferred by convection through the air. Nov 29, 2018 at 12:23
• You have a strongly nonlinear exothermic process subject to damaging runaway depending on the size of the carboy. You definitely want to measure the wort. The air temps needed to regulate the fermentation will very by quite a lot, like 15 degrees F. But you also need to limit the air temp excursion to prevent the carboy walls from reacting differently and producing off flavors. The air temps need to stay within the healthy range for your yeast pitch. I'd put high and low level cutouts in the airspace and monitor the wort. Dec 29, 2018 at 15:54
• Depending on the temperature range, heating/cooling power, and relative sizes of the air and liquid, monitoring the liquid could create an unstable situation.. Say the liquid is too cool, so the system heats the air until the liquid becomes warm enough, but by then the air is very hot and even though the heater is off the liquid continues to heat until the cooling is triggered. Then the whole thing happens over again in the other direction. The liquid will continually cycle between too warm and too cool. To avoid this, monitor the air as well, with a larger, but not too large, range. Apr 28, 2019 at 13:56

I would probe the liquid and control it with a PID + SSR relay, it'll take an initial time to stabilize, but once it figures out its equation, your good to go. You probe the liquid simply because that's what you really care about. The liquid's container will have some effect on heat transfer from the environment to the liquid, so unless the liquid is to be in the refrigerator for a very long time, you can guarantee the two temperatures will be the same. Symmetry is important here, unless everything is geometrically/ volumetrically center, temperatures will vary inside until time takes over ( may not even be possible to create complete uniform temperature in the environment, insulation,sealing,etc) So it may be possible to have temperature fluctuations throughout the liquid.

May I suggest... Use the fridge as is, always on, and control the heaters, submerged in the liquid, inside its container, inside the fridge, with a PID/SSR,probe in the liquid. Stirring the liquid would ensure proper temp throughout, or multiple heater/PID/SSR/probe would help without stirring. And depending on the set point temp, you might not even need the fridge. Cold is the absence of heat, if your set temp is always above ambient, all you need to control is heat input.

• Wouldn‘t using a ssr relay effectively be a 2point control system controlled via pid with beyond excessive switching? (Since one is effectively continuous and the other discrete?) Sep 18, 2021 at 12:34

Two things to consider:

1. Your sensor has some hysteresis and some finite accuracy.
2. The whole system has some complex frequency response (or transient behavior).

If the sensor is in the air, the air temperature will alternate between the hysteresis points. The reaction vessel temperature will somewhat average the external temperature, an effect you may or may not need.

If the sensor is in the beer, you will get more accurate feedback. It is the beer temperature you want to maintain, after all. On the other hand, it will react somewhat slower and the temperature may start to overshot.

The whole different can of worms is the temperature at different places. The temperature is not a value, it is a whole scalar field. Everyone who tried to estimate the amount of hot water in the water heater knows that the task is surprisingly complex.

You can stir the air with a fan (or at least allow for convection) and get more or less uniform temperature in the air. AFAIK most beers don't tolerate stirring.

This is why my intuition is to put the sensor in the air, UNLESS your control system needs to react quickly to particular fermentation events that release a lot of heat.

But your mileage may vary. Such "homebrew" equipment is usually made with a great deal of engineering generosity (10% higher or lower overall cost is not an issue for an 1-off project).

You can always ignore extra sensors but they help establish your model, although in this case it is unnecessary.

Your objective of keeping a fluid at a temperature can be broken down into two: driving the fluid to the desired temperature, and preventing the temperature from changing. Both of these can be most directly observed in the temperature of the fluid- as the temperature and as the rate of temperature change. You could use air, but that puts more states between your sensor and your target, all of which take time.

I suggest that even if you are in temperature limits, you operate to adjust the rate of temperature change. If it is falling too fast after you enter the range, turn on the heater to sap the cold from the air a bit and slow the temperature change. Doing so will cost you in energy, but you could also just add more thermal mass to slow down all temperature changes.

This will require you to do some testing to figure out how quickly your heater and chiller affect your fluid temperature. I expect the heater will respond quickly while the chiller's response will only be quick if it was not off for a long period of time. Electric heaters can be pretty easy to fine tune with pretty cheap electronics (such as solid state relays)- they're just running current through a coil. Periods of on and periods of off fast enough, stabilized through the thermal mass of the coil itself, give you finer temperature commands than simple on/off. If you are approaching the target too fast, slow down with a period of off, maybe even cool if it's ridiculously fast.