Skip to content

Setting up fermentation control with a Blynk user interface

Hrafnkell Eiríksson edited this page Aug 11, 2018 · 7 revisions

Overview

Many strains of yeast benefit from fermentation at a lower than indoors ambient temperature. For lagers, fermenting at a low temperature is required.

Here we describe how TFBrew can be used to control a fridge used as a fermentation chamber. We describe what hardware is needed, how to configure TFBrew and how to set up a Blynk user interface.

Hardware needed

  • Fridge you can fit your fermenter into.
  • Raspberry Pi to run the software (version 3 or Zero W if you want to monitor the changes in gravity with a Tilt or iSpindel Hydrometer)
  • A DS18b20 one-wire temperature probe to measure the fermentation temperature
  • To turn the fridge on and off, either of:
    • A WiFi controlled TPLink socket such as HS-100 or HS-110. This is the easy option, no wiring required.
    • A relay (preferably Solid State Relay that you can connect directly to a GPIO output on the Raspberry Pi).

Optional hardware

  • Tilt Hydrometer to measure gravity as the fermentation progresses
  • iSpindel Hydrometer to measure gravity as the fermentation progresses
  • A second DS18b20 one-wire temperature probe to measure ambient temperature

Hardware setup

Sensor

Connect your one-wire sensor to the GPIO pins of the Raspberry Pi. The Linux driver assumes that the sensor data line is connected to GPIO pin 4. Make sure you have set up your Raspberry Pi as described in Plugins#w1sensor.

sensors:
  - FridgeTemp:
      plugin: W1Sensor
      id: 10-000123456
      offset: 0.0

Actor

Option 1: TPLink WiFi socket

Using the TPLink WiFi socket is the easier option. You just plug your fridge into the socket and then have the TFBrew software control it over the network. No wiring needed. The risk is that if your WiFi isn't stable, the TFBrew will loose connection to the socket and can't controll your fridge.

Set up your TPLink socket using the Kasa app. You then need to find the IP address of your HS-100/HS-110 socket. This is probably easiest to do by logging into your WiFi router and seeing which IP address has been given to it.

You can configure this in the config.yaml file like this

actors:
  - Compressor:
      plugin: TPLinkActor
      ip: 192.168.1.72

Option 2: Use a relay

Wire the control terminal of a relay (preferably SSR) to a GPIO pin on the Raspberry Pi. Then wire the power to the fridge thorugh the contact on the relay.

actors:
  - Compressor:
      plugin: GPIOActor
      gpio: 18
      pwmFrequency: 1

Controller

The TFBrew software comes with a logic plugin called Hysteresis. This is suitable for controlling the temperature of a fridge. You can set a desired temperature and an allowed deviation from it before the fridge is turned on or off.

Note that temperatures change slowly and that the temperature will continue to change after you have turned the fridge on or off. Your over and undershoot will be more than you set it too. Experiment with water in your fermenter to find good settings.

controllers:
  - FermentationFridge:
      plugin: HysteresisLogic
      logicCoeffs:
        allowedOvershoot: 0.1
        allowedUndershoot: 0.1
      actor:  Compressor
      sensor: FridgeTemp
      initialSetpoint: 23
      initialState: on

Setting up a Blynk user interface

You can clone my user interface by installing the Blynk app on your phone/tablet and then visiting this link [http://tinyurl.com/yadlr6zo]

Configuration file

The setup described above is colleced here in a single file.

sensors:
  - FridgeTemp:
      plugin: W1Sensor
      id: 10-000123456
      offset: 0.0
# AmbientTemp is optional
  - AmbientTemp:
      plugin: W1Sensor
      id: 10-000803628fd8
      offset: 0.0
# Tilt is optional
  - Tilt:
      plugin: TiltSensor

actors:
# If using the TPLink wifi socket, use the second compressor setup
  - Compressor:
      plugin: GPIOActor
      gpio: 18
      pwmFrequency: 1
#  - Compressor:
#      plugin: TPLinkActor
#      ip: 192.168.1.65

controllers:
  - FermentationFridge:
      plugin: HysteresisLogic
      logicCoeffs:
        allowedOvershoot: 0.1
        allowedUndershoot: 0.0
      actor:  Compressor
      sensor: FridgeTemp
      initialSetpoint: 23
      initialState: on

extensions:
  - blynk:
      plugin: BlynkLib
      server: blynk-cloud.com
      port: 8442
      token: 123456645459866e233984d00sdf

connections:
  - Compressor.power=>blynk.v2
  - Tilt.temperature=>blynk.v3
  - Tilt.gravity=>blynk.v5
  - FridgeTemp.temperature=>blynk.v9
  - AmbientTemp.temperature=>blynk.v10
  - blynk.v6=>FermentationFridge.setpoint
  - blynk.v7=>FermentationFridge.undershoot
  - blynk.v8=>FermentationFridge.overshoot