Brewable

Raspberry Pi based programmable temperature controller

Download tarball

What is brewable?

Brewable is software for the Raspberry Pi (including Pi Zero), enabling it to read temperature information from directly connected sensors; then programmatically activate relays to control heating and/or cooling equipment. A main point of difference to other similar software is that direct keyboard, mouse and screen access to the Raspberry Pi is not required to run the software; it is run remotely via a browser. This enables the Raspberry Pi and associated hardware (relays etc.) to be packaged into a box and tucked away somewhere safe without further need for physical access to it.

The hardware involved is connected directly to the Raspberry Pi's GPIO connectors, via which it is controlled using the brewable software. The brewable controller software is normally run as a daemon process which is started whenever the Raspberry Pi is booted up. A small web server is used to provide a user interface to the controller so that a normal web browser on any machine in the local network can access and manipulate the controller, thus control the hardware. In this way, a user can create temperature/time profiles, any of which can be used as the basis of a job template. Any number of job templates can be created and any of these templates can be run as active job instances. The brewable software is capable of running multiple job instances simultaneously, limited only by the connected hardware available.

Hardware

The purpose of the brewable software is to switch cooling (or heating) equipment on or off in response to changes in temperature and time. The temperature sensors used in this project are the very common DS18B20 devices. By default, the Raspberry Pi system itself limits the number of these sensors that can be used to 10, however that limit can be increased (see the Notes section). The multiple sensors can be connected via a terminal block which can also house the required 4.7kΩ pull-up resistor. Jumper cables connect the terminal block to the Raspberry Pi's GPIO pins. If you use jumper cables with colours to match the sensor cable wires, the red jumper is attached to physical pin number 1 (3.3V Power), the yellow jumper to physical pin 7 (BCM 4) while the black (or blue) cable is connected to physical pin 6 (Ground). Please check the GPIO Pinout Guide to see the GPIO connector's pin arrangements.

In addition to the DS18B20 temperature sensors, Brewable now also supports iSpindel hydrometer devices to monitor temperature and specific gravity. Basic iSpindel setup & usage hints are provided here.

Any external equipment to be switched is connected to the Raspberry Pi via relays. Brewable supports multiple SainSmart 5V relay modules. Previous versions of the software (earlier than 0.3) also supported the four channel Seeed Relay Board. While that board is somewhat more expensive, an advantage of the Seeed Relay Board is that it fits directly onto the Raspberry Pi GPIO strip and no further relay interconnection is required. The Seeed Relay Board is mounted onto the Raspberry Pi's first 26 GPIO pins but nevertheless extends them so that the DS18B20 sensors can be attached using the same pins mentioned above. Support for the Seeed Relay Board will be reinstated in a future version of the software.

Apart from their lower cost, a possible advantage of the SainSmart board modules is that they may be combined to provide up to twenty individual relays. The SainSmart relay boards are connected via jumper cables as follows:
    Relay pin VCC connects to GPIO pin 5V
    Relay pin GND connects to GPIO pin GND
(the GPIO connector has a number of GND & 5V pins; take your pick)
    Relay pins IN1, IN2, IN3 etc. connect to any of the GPIO's following BCM connectors: BCM 18, BCM 17, BCM 27, BCM 22, BCM 23, BCM 24, BCM 10, BCM 9, BCM 11, BCM 25, BCM 8, BCM 7, BCM 5, BCM 6, BCM 13, BCM 19, BCM 26, BCM 16, BCM 20 or BCM 21, using the GPIO Pinout Guide to identify pin locations.

As an example, suppose a 4x relay module has IN1 connected to BCM 17, IN2 connected to BCM 27, IN3 connected to BCM 22 and IN4 connected to BCM 10 i.e. physical pins 11, 13, 15 & 19 respectively. The browser interface will then show the IN1 relay as "Relay 01", IN2 as "Relay 02", IN3 as "Relay 03" and IN4 as "Relay 04".

The software does not currently support using a mix of Seeed and SainSmart relays in the same system.

Software Installation

These instructions are based on a standard Raspbian based system, although other systems should work without great effort since nothing esoteric is required to install and run the software. It is assumed you have a Raspberry Pi up and running, including wired or wireless networking. It is highly recommended that the Raspberry Pi uses a static IP address or that its DHCP server (probably your modem/router) is configured to always allocate the same IP address to the Raspberry Pi. Make a note of the IP address.

Since Raspbian enables the ssh server by default, the installation itself can be performed either remotely, using any ssh client program (e.g. 'ssh' on Linux & Mac, Putty on Windows), or directly on the Raspberry Pi using keyboard, mouse & display if they're still connected. If installing remotely, connect with ssh or putty to the Raspberry Pi at its previously noted IP address. If installing directly, open a Terminal window. In either case, run the following commands:
    
    
    
    sudo make install
Now reboot the Raspberry Pi (sudo reboot). This is necessary to enable the GPIO pins, as well as to start the brewable server. The software is started automatically whenever the Raspberry Pi boots up so there's generally no need to start it manually.
If you need to stop the brewable software while the Raspberry Pi stays running, run the command:
    sudo /etc/init.d/brewable stop
or to restart, run the command:
    sudo /etc/init.d/brewable restart

See also:

  • Usage & General Notes
  • iSpindel