Brewing with Raspberry

Raspberries by Liz West (Muffet on Flickr)

Raspberries [by Liz West (Muffet on Flickr)]

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.

DS18B20 Temp Sensor

DS18B20 Temp Sensor

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...

Posted in homebrew, raspberry pi
10 comments on “Brewing with Raspberry
  1. Rich Caller says:

    I am part way through building something similar using a RPI to control a herms system. I have three of the same sensors and use a USB relay board to switch the elements.

    • graeme says:

      Good stuff! Have you managed to find a suitable thermowell for the DS18? I decided against the USB relays – I’ll need to switch a higher rated relay anyhow as none I’ve seen are rated high enough on the contact side, so I could equally do the following quite cheaply:

      RPi.GPIO -> Transistor switch -> Optocoupler -> 12V switching circuit -> 20A Power relay

      Of course, I need to make sure I don’t run out of GPIO ports and am trying to use i2c and 1-wire where possible to keep control channels free – I think ultimately 3 heaters, 2 pumps, and some input ports (switches, float switches) will run me close to the limit…

      • Rich Caller says:

        My usb relay is rated at 10A AC so is fine for my element and I happened to have it kicking around from an old project.

        I’ve built thermowells out of 8mm pipe that I was also using to make the HERMS coil.

  2. I too have some Raspi and have been intending on using one to control the brewery. Electronics aren’t really my thing though, so it’s been sat there for a year gathering dust. I shall await further updates with interest!

  3. bjorn says:

    Have you looked at PiFace for expanding IO’s? 2 onboard relays+6 more output and 8 inputs; controlled by SPI. Can use 1-write and other non-spi pins for other stuff. I’m currently using one for my fermentation control, very convenient to have 1 relay for heating and one for cooling + all the sensors. Will probably try to expand to control brewing myself one day.

    Good job documenting this for others to find!

    • graeme says:

      Thanks! There’s a variety of ways of expanding the serial IO capability – PiFace with SPI would work nicely, as would one of the i2c serial expansion chips (i2c gets daisy chained so it can be used for multiple devices with ease). Just need to be sure that the relays are rated for the current to drive whatever load is required – I opted for 16A relays to allow me to switch a fairly hefty immersion heater should I wish – the PiFace alone won’t handle those loads.

  4. Pete says:

    I use SSRs to switch my elements and pump – can be driven directly from 3v / 5v io lines.

    I got my thermowells from

1 Pings/Trackbacks for "Brewing with Raspberry"
  1. […] continuing on from my previous post on starting to use the Raspberry Pi for brewery control, this is a post about the interface aspects of HLT control. There’s a […]

Leave a Reply