Brewing with Raspberry
First up, this is not a post about framboise, lambic fruit or any other style beer with fruit – though I have some good ideas to work on homebrew-wise, including a gooseberry witbier and a sloe porter. More of that later.
This is instead about first steps towards some brewery automation, and I’m looking to use the opportunity to start to use and learn about the Raspberry Pi. I have some control already later in the brewing process with using an ATC to control the fermenting fridge, but this is about introducing some control earlier in the brewing process.
My first set of high-level requirements – <professional hat on>always start with requirements</hat off> – look something like:
- Whole solution to be driven by one RPi
- Long term, look to web based control
- Manual overrides (with feedback on state where practical)
- Panel output of states, temperature display, etc.
- Feedback for safety cutouts – eg float switches to ensure no dry running of elements, etc.
- Initial control aspects:
- HLT heating (eg for strike/sparge)
- HLT recirc pump to avoid stratification/non-equilibrium
- Later aspects may include (though some include hardware changes):
- Solenoid valves to control transfers
- Mash recirc, mash temp readouts
- HERMS control
- Kettle temp readouts
- Fermentation control (temp readout, heating, cooling, etc)
The driver here is saving time – the ability to remotely control or schedule things like heating of strike water, and the control of the system to keep sparge water at the right temperature should speed up the brewday in terms of my actual need to be there doing stuff.
Temperature readouts are relatively simple. I’ve chosen to use the DS18B20 1-wire sensors as these have kernel modules already built, and they can be daisy chained to read many from a single port as each sensor has a unique id (thus saving precious GPIO pins).
The output from these sensors is obtained by reading from /sys/bus/w1/devices/28-nnnnnnnnnnnn/w1_slave (replace “nnnnnnnnnnnn” with the unique ID for the sensor). Reading this file gives something like the following:
0b 00 4b 46 7f ff 05 10 95 : crc=95 YES 0b 00 4b 46 7f ff 05 10 95 t=21687
The temperature is given (in “milli-celsius”) by the
t= portion – in this case 21.687C. A simple class to run a thread to monitor this file is sufficient to read the temperature here – a check needs to be in place to ensure that the CRC checks out in the previous line (“YES”). I’ll include code in a later post.
Next steps will be in building a circuit to interface with a pair of relays for the control of the two elements in my current HLT – there’s a few steps to this since the GPIO out is only at 3.3V and with a very low current, and there needs to be sufficient isolation between this, a switching circuit and the mains driven elements. A transistor switch and optocoupler to a 12V switching circuit look like the solution. Also, I need to mount the sensor in some kind of thermowell and mount that in the HLT.
More to follow...