Originally Posted by rpierce
Some friends and I have done something very similar at a local hackerspace (Pumping Station: One) in Chicago.
We chilled the fermenting chamber with a window air conditioner. The Pi can only provide 50 mA on its GPIO pins, so a solid state relay powered a much larger relay which powered the air conditioner. We used a 5 minute duty cycle with a minimum 2 minute off time time protect the compressor. Because the air temperature swings wildly, we averaged it every second over the five minute period, and used that to determine the error for the next 5 minutes. The resulting average at the end of each period was pretty tightly regulated by PID.
Your control system approach seems a bit twisted. You might try controlling the liquid temperature by placing a sensor on the outside of the fermenting vessel with some insulation over the side exposed to ambient. There is a bit of ambient temp influence on the sensor, which is beneficial when using on/off contollers and fridges/freezers because it minimizes overshoot, though you might have to retune/rewrite your PID loop (which isn't really necessary, since the thermal mass of the vessel is so much greater than the air). This will much more accurately control the temp of the actual stuff fermenting, instead of the cabinet ambient temp. Also, it will greatly prolong the life of the AC unit.
Cycling freq should be kept to a minimum, and controlling to an air temp will do the opposite. Your duty cycle should be governed by the temp diff value. A good cycle freq is 1-2/hour. You should be able to get this with .5 or 1 F as a temp diff, which is plenty tight for beer. There should be a guaranteed 'off time', as you mentioned, to protect the compressor. In practice, this limit shouldn't be in play in normal operation, so setting to 10-15 min is a much safer bet, and might save your AC unit if something starts causing rapid cooling calls. Also, if you don't have it already, some averaging/delay before triggering will prevent jitter of the sensor causing a false 'on'.
If you read the previous posts about using heat wraps for each vessel to control multiple vessels, you could easily build a system ORing all the cooling calls (in SW or HW). This would allow for only calling for cooling when needed, as opposed to a maintaining a worse case temp much colder than needed for the majority of the time. The wraps could be PID controlled, if you really want to, but the time constant is so large, the tuning essentially reverts to on/off with maybe a tiny bit of D.